Skip to main content

DryocAead

Type Alias DryocAead 

Source
pub type DryocAead<Mac, Data> = AeadBox<XChaCha20Poly1305Ietf, Mac, Data>;
Expand description

XChaCha20-Poly1305-IETF AEAD box.

Aliased Type§

pub struct DryocAead<Mac, Data> { /* private fields */ }

Implementations§

Source§

impl DryocAead<Mac, Vec<u8>>

Source

pub fn encrypt_to_vecbox<Message: Bytes + ?Sized, SecretKey: ByteArray<CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES>>( message: &Message, associated_data: Option<&[u8]>, nonce: &Nonce, key: &SecretKey, ) -> Result<Self, Error>

Encrypts a message and returns a VecBox.

§Errors

Returns an error if the message exceeds the construction’s maximum length.

Source

pub fn decrypt_to_vec<SecretKey: ByteArray<CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES>>( &self, associated_data: Option<&[u8]>, nonce: &Nonce, key: &SecretKey, ) -> Result<Vec<u8>, Error>

Decrypts this box and returns the plaintext as a Vec.

§Errors

Returns an error if the ciphertext exceeds the construction’s maximum length or authentication fails because the key, nonce, associated data, ciphertext, or tag does not match.

Source

pub fn into_vec(self) -> Vec<u8>

Consumes this box and returns it as ciphertext || tag.