crypto: Test that we correctly check the hash when decrypting attachments.

master
Damir Jelić 2020-09-18 17:49:44 +02:00
parent 562bb5aee3
commit a183584541
1 changed files with 11 additions and 0 deletions

View File

@ -333,4 +333,15 @@ mod test {
assert_eq!("It's a secret to everybody", decrypted);
}
#[test]
fn decrypt_invalid_hash() {
let mut cursor = Cursor::new("fake message");
let key = example_key();
let mut decryptor = AttachmentDecryptor::new(&mut cursor, key).unwrap();
let mut decrypted_data = Vec::new();
assert!(decryptor.read_to_end(&mut decrypted_data).is_err())
}
}