MCPcopy Create free account
hub / github.com/Nariod/RustPacker / test_aes_encrypt_decrypt_roundtrip

Function test_aes_encrypt_decrypt_roundtrip

src/aes.rs:55–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53
54 #[test]
55 fn test_aes_encrypt_decrypt_roundtrip() {
56 let original: Vec<u8> = vec![0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00,
57 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52, 0x51];
58 let key: [u8; 32] = [0x01; 32];
59 let iv: [u8; 16] = [0x02; 16];
60
61 let encrypted = aes_256_encrypt(&original, &key, &iv);
62 assert_ne!(encrypted, original);
63
64 let cipher = Cipher::new_256(&key);
65 let decrypted = cipher.cbc_decrypt(&iv, &encrypted);
66 assert_eq!(decrypted, original);
67 }
68
69 #[test]
70 fn test_encrypt_aes_returns_expected_fields() {

Callers

nothing calls this directly

Calls 1

aes_256_encryptFunction · 0.85

Tested by

no test coverage detected