Skip to main content

decrypt_payload

Function decrypt_payload 

Source
pub fn decrypt_payload(
    ciphertext: &[u8],
    key: &[u8; 32],
    nonce: &[u8; 24],
) -> Result<Vec<u8>, VCLError>
Expand description

Decrypt ciphertext with XChaCha20-Poly1305 using the given key and nonce.

ยงErrors

Returns VCLError::InvalidKey if key is not 32 bytes. Returns VCLError::CryptoError if decryption or authentication fails (e.g. wrong key, tampered ciphertext).