decrypt

Function decrypt 

Source
pub fn decrypt(
    key: &SessionKey,
    nonce: &[u8; 24],
    aad: &[u8],
    ciphertext: &[u8],
) -> Result<Vec<u8>, CryptoError>
Available on crate feature crypto only.
Expand description

Decrypt ciphertext using XChaCha20-Poly1305.

§Arguments

  • key - 32-byte session key
  • nonce - 24-byte nonce (constructed from epoch, direction, counter)
  • aad - Additional authenticated data
  • ciphertext - Ciphertext with appended 16-byte Poly1305 tag

§Returns

Decrypted plaintext, or error if authentication fails