aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/asymmetric/utils.rst
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2016-11-20 22:48:10 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2016-11-20 09:48:10 -0500
commitf555c74d5419a52648e2a903595c13bd13d13ce2 (patch)
tree592b855980fecba54c51924b58457607c6da1463 /docs/hazmat/primitives/asymmetric/utils.rst
parent033bd7167d6546d34576dd0d798318999ec82a07 (diff)
downloadcryptography-f555c74d5419a52648e2a903595c13bd13d13ce2.tar.gz
cryptography-f555c74d5419a52648e2a903595c13bd13d13ce2.tar.bz2
cryptography-f555c74d5419a52648e2a903595c13bd13d13ce2.zip
support RSA verify with prehashing (#3265)
* support RSA verify with prehashing * review feedback * more dedupe * refactor and move to a separate module
Diffstat (limited to 'docs/hazmat/primitives/asymmetric/utils.rst')
-rw-r--r--docs/hazmat/primitives/asymmetric/utils.rst14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/hazmat/primitives/asymmetric/utils.rst b/docs/hazmat/primitives/asymmetric/utils.rst
index f29b3e99..ab49e551 100644
--- a/docs/hazmat/primitives/asymmetric/utils.rst
+++ b/docs/hazmat/primitives/asymmetric/utils.rst
@@ -35,7 +35,9 @@ Asymmetric Utilities
``Prehashed`` can be passed as the ``algorithm`` in
:meth:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey.sign`
- if the data to be signed has been hashed beforehand.
+ or
+ :meth:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey.verify`
+ if the data to be signed or verified has been hashed beforehand.
:param algorithm: An instance of
:class:`~cryptography.hazmat.primitives.hashes.HashAlgorithm`.
@@ -62,3 +64,13 @@ Asymmetric Utilities
... ),
... utils.Prehashed(hashes.SHA256())
... )
+ >>> public_key = private_key.public_key()
+ >>> public_key.verify(
+ ... signature,
+ ... prehashed_msg,
+ ... padding.PSS(
+ ... mgf=padding.MGF1(hashes.SHA256()),
+ ... salt_length=padding.PSS.MAX_LENGTH
+ ... ),
+ ... utils.Prehashed(hashes.SHA256())
+ ... )