Skip to content

Commit

Permalink
Try increasing test coverage (decrypt Aes256Gcm)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeevab committed Oct 6, 2023
1 parent 17acf78 commit 6a3e7e8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,25 @@ mod test {
assert_eq!(b"my secret data", &data);
}

#[test]
fn cocoon_decrypt_aes() {
let detached_prefix = [
127, 192, 10, 1, 2, 1, 2, 0, 155, 244, 154, 106, 7, 85, 249, 83, 129, 31, 206, 18, 95,
38, 131, 213, 4, 41, 195, 187, 73, 224, 116, 20, 126, 0, 137, 165, 0, 0, 0, 0, 0, 0, 0,
14, 103, 127, 175, 154, 15, 80, 248, 145, 128, 241, 138, 15, 154, 128, 201, 157,
];
let mut data = [
88, 183, 11, 7, 192, 224, 203, 107, 144, 162, 48, 78, 61, 223,
];
let cocoon = Cocoon::parse_only(b"password");

cocoon
.decrypt(&mut data, &detached_prefix)
.expect("Decrypted data");

assert_eq!(b"my secret data", &data);
}

#[test]
fn cocoon_wrap() {
let cocoon = Cocoon::from_seed(b"password", [0; 32]);
Expand Down

0 comments on commit 6a3e7e8

Please sign in to comment.