MCPcopy
hub / github.com/pyca/cryptography / test_wrong_aad_fails

Method test_wrong_aad_fails

tests/hazmat/primitives/test_hpke.py:384–397  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

382 suite.decrypt(ciphertext, secp384r1_sk)
383
384 def test_wrong_aad_fails(self):
385 suite = Suite(KEM.X25519, KDF.HKDF_SHA256, AEAD.AES_128_GCM)
386
387 sk_r = x25519.X25519PrivateKey.generate()
388 pk_r = sk_r.public_key()
389
390 ciphertext = rust_openssl.hpke._encrypt_with_aad(
391 suite, b"Secret message", pk_r, aad=b"correct aad"
392 )
393
394 with pytest.raises(InvalidTag):
395 rust_openssl.hpke._decrypt_with_aad(
396 suite, ciphertext, sk_r, aad=b"wrong aad"
397 )
398
399 def test_info_mismatch_fails(self):
400 suite = Suite(KEM.X25519, KDF.HKDF_SHA256, AEAD.AES_128_GCM)

Callers

nothing calls this directly

Calls 2

generateMethod · 0.45
public_keyMethod · 0.45

Tested by

no test coverage detected