Error Handling: Implicit Rejection
If you pass a malformed ciphertext to decapsulate(), aws-lc-rs returns
a consistent-time garbage value (not an error) — this is the FO transform's
implicit rejection in action.
let mut bad_ct = ciphertext.as_ref().to_vec();
bad_ct[0] ^= 0xFF;
let bad_secret = recipient_dk.decapsulate(Ciphertext::from(bad_ct.as_ref()))?;
assert_ne!(sender_secret.as_ref(), bad_secret.as_ref());
println!("Implicit rejection: different secrets for bad ciphertext (as expected)");
This is by design — timing-safe rejection of invalid ciphertexts.