(self, ciphertext, aad, iv, key)
| 41 | self.hash_alg = getattr(hashlib, f"sha{hash_type}") |
| 42 | |
| 43 | def _hmac(self, ciphertext, aad, iv, key): |
| 44 | al = encode_int(len(aad) * 8, 64) |
| 45 | msg = aad + iv + ciphertext + al |
| 46 | d = hmac.new(key, msg, self.hash_alg).digest() |
| 47 | return d[: self.key_len] |
| 48 | |
| 49 | def encrypt(self, msg, aad, iv, key): |
| 50 | """Key Encryption with AES_CBC_HMAC_SHA2. |
no test coverage detected