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

Method test_info_mismatch_fails

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

Source from the content-addressed store, hash-verified

397 )
398
399 def test_info_mismatch_fails(self):
400 suite = Suite(KEM.X25519, KDF.HKDF_SHA256, AEAD.AES_128_GCM)
401
402 sk_r = x25519.X25519PrivateKey.generate()
403 pk_r = sk_r.public_key()
404
405 ciphertext = suite.encrypt(b"Secret", pk_r, info=b"sender info")
406
407 with pytest.raises(InvalidTag):
408 suite.decrypt(ciphertext, sk_r, info=b"different info")
409
410 def test_ciphertext_format(self):
411 suite = Suite(KEM.X25519, KDF.HKDF_SHA256, AEAD.AES_128_GCM)

Callers

nothing calls this directly

Calls 4

generateMethod · 0.45
public_keyMethod · 0.45
encryptMethod · 0.45
decryptMethod · 0.45

Tested by

no test coverage detected