pub fn decrypt(
key_slice: &[u8],
nonce_slice: &[u8],
ciphertext: Vec<u8>,
) -> Option<Vec<u8>>
Expand description
Decrypts the given ciphertext with the given key and nonce. The key must be 32 bytes long and the nonce must be 12 bytes long. The plaintext is returned as an option vector of bytes.
ยงExamples
use nutek_cipher_lib::aes_gcm_siv::decrypt;
use nutek_cipher_lib::aes_gcm_siv::encrypt;
fn main() {
let ciphertext = encrypt(b"hello world", b"123456123456", b"12345678123456781234567812345678");
let plaintext = decrypt( b"12345678123456781234567812345678", b"123456123456", ciphertext).unwrap();
assert_eq!(plaintext, b"hello world");
}