This crate provides authenticated encryption with additional data (AEAD) functionality, as described in the upstream Tink documentation.
```Rust
fn main() -> Result<(), Box
let pt = b"this data needs to be encrypted";
let aad = b"this data needs to be authenticated, but not encrypted";
let ct = a.encrypt(pt, aad)?;
println!("'{}' => {}", String::from_utf8_lossy(pt), hex::encode(&ct));
let pt2 = a.decrypt(&ct, aad)?;
assert_eq!(&pt[..], pt2);
Ok(())
} ```
subtle::EncryptThenAuthenticate
implementation may be vulnerable to chosen-ciphertext attacks. An attacker can generate ciphertexts that bypass the
HMAC verification if and only if all of the following conditions are true:
usize
is a 32-bit integer. This is usually the case on 32-bit machines.This is not an officially supported Google product.