@@ -54,9 +54,15 @@ This is how the sender can encrypt two messages::
5454 from Crypto.Protocol import HPKE
5555
5656 # Let's assume that the recipient delivered its public key
57- # which is already loaded in a variable called destination_key
58-
59- encryptor = HPKE.new(receiver_key=destination_key,
57+ # which is already loaded in a variable called their_pub_key
58+ #
59+ # For the sake of clarity, it could be simulated with:
60+ #
61+ # from Crypto.PublicKey import ECC
62+ # their_key = ECC.generate(curve='p256')
63+ # their_pub_key = their_key.public_key()
64+
65+ encryptor = HPKE.new(receiver_key=their_pub_key,
6066 aead_id=HPKE.AEAD.AES128_GCM)
6167
6268 ct_1 = encryptor.seal(b'Message 1')
@@ -67,19 +73,23 @@ This is how the sender can encrypt two messages::
6773 # - ct_1
6874 # - ct_2
6975
70- And this is how the receive can decrypt them::
76+ And this is how the receiver can decrypt them::
7177
7278 from Crypto.Protocol import HPKE
7379
7480 # Let's assume that the recipient has its own private key
7581 # which is already loaded in a variable called my_key
82+ #
83+ # To continue the simulation, assign:
84+ #
85+ # my_key = their_key
7686
7787 decryptor = HPKE.new(receiver_key=my_key,
7888 aead_id=HPKE.AEAD.AES128_GCM,
7989 enc=encryptor.enc)
8090
8191 # Any of the calls to unseal() can raise ValueError
82- # if a key mismatch, modified messages , or reordering is detected
92+ # if a key mismatch, modification to a message , or reordering is detected
8393 pt1 = decryptor.unseal(ct_1)
8494 pt2 = decryptor.unseal(ct_2)
8595
0 commit comments