We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 74c6769 commit 6798400Copy full SHA for 6798400
aead/src/lib.rs
@@ -232,6 +232,18 @@ pub trait Aead: AeadCore {
232
Ok(out)
233
}
234
235
+ /// Encrypt with a random nonce generated by the specified RNG, explicitly
236
+ /// prepended to the message.
237
+ #[cfg(feature = "rand_core")]
238
+ fn encrypt_with_nonce_from_rng<'msg, 'aad, R: CryptoRng + ?Sized>(
239
+ &self,
240
+ rng: &mut R,
241
+ plaintext: impl Into<Payload<'msg, 'aad>>,
242
+ ) -> Result<Vec<u8>> {
243
+ let nonce = Self::generate_nonce_with_rng(rng);
244
+ self.encrypt_with_explicit_nonce(&nonce, plaintext)
245
+ }
246
+
247
/// Decrypt an AEAD message which has an explicit nonce prepended to the
248
/// AEAD message.
249
fn decrypt_with_explicit_nonce<'msg, 'aad>(
0 commit comments