Skip to content

Commit

Permalink
Update PSS verify signature code example.
Browse files Browse the repository at this point in the history
  • Loading branch information
jelaiw authored and Legrandin committed Dec 27, 2023
1 parent 4ec4b85 commit 10e8216
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Doc/src/signature/pkcs1_pss.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ The following example shows how the sender can use its own *private* key
At the receiver side, the matching *public* RSA key is used to verify
authenticity of the incoming message::

>>> key = RSA.import_key(open('pubkey.der').read())
>>> key = RSA.import_key(open('pubkey.der', 'rb').read())
>>> h = SHA256.new(message)
>>> verifier = pss.new(key)
>>> try:
>>> verifier.verify(h, signature)
>>> print "The signature is authentic."
>>> except (ValueError, TypeError):
>>> print "The signature is not authentic."
>>> print("The signature is authentic.")
>>> except (ValueError):
>>> print("The signature is not authentic.")

.. __: https://tools.ietf.org/html/rfc8017#section-8.1

Expand Down

0 comments on commit 10e8216

Please sign in to comment.