Function sodiumoxide::crypto::aead::chacha20poly1305::open
[−]
[src]
pub fn open(
c: &[u8],
ad: Option<&[u8]>,
n: &Nonce,
k: &Key
) -> Result<Vec<u8>, ()>
open()
verifies and decrypts a ciphertext c
together with optional plaintext data ad
using a secret key k
and a nonce n
.
It returns a plaintext Ok(m)
.
If the ciphertext fails verification, open()
returns Err(())
.