pub enum AeadImpl {
AesGcm(Aes256Gcm),
ChaCha(ChaCha20Poly1305),
}Expand description
Unified AEAD cipher implementation selected by header.cipher.
Variants§
AesGcm(Aes256Gcm)
ChaCha(ChaCha20Poly1305)
Implementations§
Source§impl AeadImpl
impl AeadImpl
Sourcepub fn from_header_and_key(
header: &HeaderV1,
session_key: &[u8],
) -> Result<Self, CryptoError>
pub fn from_header_and_key( header: &HeaderV1, session_key: &[u8], ) -> Result<Self, CryptoError>
Construct AEAD implementation from header.cipher and derived session key.
Sourcepub fn seal(
&self,
nonce_12: &[u8],
aad: &[u8],
plaintext: &[u8],
) -> Result<Vec<u8>, CryptoError>
pub fn seal( &self, nonce_12: &[u8], aad: &[u8], plaintext: &[u8], ) -> Result<Vec<u8>, CryptoError>
AEAD seal (encrypt) plaintext with nonce and AAD.
Sourcepub fn open(
&self,
nonce_12: &[u8],
aad: &[u8],
ciphertext_and_tag: &[u8],
) -> Result<Vec<u8>, CryptoError>
pub fn open( &self, nonce_12: &[u8], aad: &[u8], ciphertext_and_tag: &[u8], ) -> Result<Vec<u8>, CryptoError>
AEAD open (decrypt) ciphertext with nonce and AAD.
Sourcepub fn seal_in_place(
&self,
nonce_12: &[u8],
aad: &[u8],
buf: &mut (dyn Buffer + 'static),
) -> Result<(), CryptoError>
pub fn seal_in_place( &self, nonce_12: &[u8], aad: &[u8], buf: &mut (dyn Buffer + 'static), ) -> Result<(), CryptoError>
AEAD seal (encrypt) plaintext in place with nonce and AAD. The buffer must have enough capacity for plaintext + tag.
Sourcepub fn open_in_place(
&self,
nonce_12: &[u8],
aad: &[u8],
buf: &mut (dyn Buffer + 'static),
) -> Result<(), CryptoError>
pub fn open_in_place( &self, nonce_12: &[u8], aad: &[u8], buf: &mut (dyn Buffer + 'static), ) -> Result<(), CryptoError>
AEAD open (decrypt) ciphertext in place with nonce and AAD. The buffer must contain ciphertext+tag, will be replaced with plaintext.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AeadImpl
impl RefUnwindSafe for AeadImpl
impl Send for AeadImpl
impl Sync for AeadImpl
impl Unpin for AeadImpl
impl UnsafeUnpin for AeadImpl
impl UnwindSafe for AeadImpl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more