Skip to content

Commit f74ace1

Browse files
committed
Clarification in HPKE docs
1 parent ebcf09f commit f74ace1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Doc/src/protocol/hpke.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,20 @@ The receiver must have the matching public key:
3737
:align: center
3838
:width: 500px
3939

40-
Second (*PSK* mode), the sender and the receiver can both agree on the same
41-
secret key (at least 32 random bytes), and contribute that to the encryption.
40+
Second (*PSK* mode), the sender and the receiver can agree on the same
41+
secret key (at least 32 random bytes), and contribute that to both encryption and decryption.
4242

4343
.. figure:: hpkePSK.png
4444
:align: center
4545
:width: 500px
4646

4747
Finally, the two authentication modes can also be combined together (*AuthPSK* mode).
4848

49+
.. note::
50+
51+
The PSK is only used to authenticate the messages; it is not a replacement
52+
for the asymmetric key that the receiver must provide to the sender.
53+
4954
Examples
5055
~~~~~~~~~
5156

@@ -69,7 +74,7 @@ This is how the sender can encrypt two messages::
6974
ct_2 = encryptor.seal(b'Message 2')
7075

7176
# The sender will deliver:
72-
# - encryptor.enc
77+
# - encryptor.enc as enc
7378
# - ct_1
7479
# - ct_2
7580

@@ -86,7 +91,7 @@ And this is how the receiver can decrypt them::
8691

8792
decryptor = HPKE.new(receiver_key=my_key,
8893
aead_id=HPKE.AEAD.AES128_GCM,
89-
enc=encryptor.enc)
94+
enc=enc)
9095

9196
# Any of the calls to unseal() can raise ValueError
9297
# if a key mismatch, modification to a message, or reordering is detected

0 commit comments

Comments
 (0)