Skip to content

Commit

Permalink
Test for bad AAD input
Browse files Browse the repository at this point in the history
  • Loading branch information
cygnusv committed Aug 1, 2023
1 parent e662e17 commit e51e6ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tpke/src/ciphertext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@ mod tests {
let plaintext =
decrypt_symmetric(&ciphertext, aad, &privkey, g_inv).unwrap();

assert_eq!(msg, plaintext)
assert_eq!(msg, plaintext);

let bad: &[u8] = "bad-aad".as_bytes();

assert!(decrypt_symmetric(&ciphertext, bad, &privkey, g_inv).is_err());
}

#[test]
Expand Down

0 comments on commit e51e6ec

Please sign in to comment.