Skip to content

Commit

Permalink
Update RSA-PSS docs for Python 3.
Browse files Browse the repository at this point in the history
Update message to byte string.

Update RSA.import_key() to read DER file in binary.
  • Loading branch information
jelaiw authored and Legrandin committed Dec 12, 2023
1 parent 00a6287 commit c9f1288
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Doc/src/signature/pkcs1_pss.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ The following example shows how the sender can use its own *private* key
>>> from Crypto.Signature import pss
>>> from Crypto.Hash import SHA256
>>> from Crypto.PublicKey import RSA
>>> from Crypto import Random
>>>
>>> message = 'To be signed'
>>> key = RSA.import_key(open('privkey.der').read())
>>> message = b'To be signed'
>>> key = RSA.import_key(open('privkey.der', 'rb').read())
>>> h = SHA256.new(message)
>>> signature = pss.new(key).sign(h)

Expand Down

0 comments on commit c9f1288

Please sign in to comment.