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

Method test_ciphertext_format

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

Source from the content-addressed store, hash-verified

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)
412
413 sk_r = x25519.X25519PrivateKey.generate()
414 pk_r = sk_r.public_key()
415
416 ciphertext = suite.encrypt(b"test", pk_r)
417
418 # ciphertext should be: enc (32 bytes) + ct (4 bytes pt + 16 bytes tag)
419 assert len(ciphertext) == X25519_ENC_LENGTH + 4 + 16
420
421 def test_ciphertext_format_p256(self):
422 suite = Suite(KEM.P256, KDF.HKDF_SHA256, AEAD.AES_128_GCM)

Callers

nothing calls this directly

Calls 3

generateMethod · 0.45
public_keyMethod · 0.45
encryptMethod · 0.45

Tested by

no test coverage detected