def check_vector
qasim-bend-kit@0.1.0.2 · usage/AES_NistTest.bend:17
import qasim-bend-kit@0.1.0.2/usage/AES_NistTest.bend as AESNistTest
import Base
import qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend as AES
17def check_vector(+key: AES.SecretKey, +nonce: AES.Nonce,
18 +aad: List<&2, U32>, +plaintext: List<&2, U32>,
19 +expected: AES.Envelope) -> Bool:
20 encryption_ok = result_matches(AES.encrypt(key, nonce, aad, plaintext),
21 expected)
22 decryption_ok = plaintext_matches(AES.decrypt(key, aad, expected),
23 plaintext)
24 parsing_ok = result_matches(AES.parse(AES.encode(expected)), expected)
25 Bool.and(encryption_ok, Bool.and(decryption_ok, parsing_ok))