mirror of
https://github.com/Legrandin/pycryptodome.git
synced 2025-10-19 16:03:45 +00:00
Update PSS verify signature code example.
This commit is contained in:
parent
4ec4b85c65
commit
10e8216079
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue