aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/asymmetric/rsa.rst
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-04-23 12:37:59 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-04-23 12:37:59 -0700
commitff2b8cebe85c5326c52a0b4ffe467f99e5526849 (patch)
tree0aa12fbd439c44c9c9750e2babb3a7f5df5efa28 /docs/hazmat/primitives/asymmetric/rsa.rst
parente5a3ccfb8fdbbfd8b6f20a9fc720d88ce1e40b9b (diff)
parent50e6230014e298658c7776e0659223e664265c4a (diff)
downloadcryptography-ff2b8cebe85c5326c52a0b4ffe467f99e5526849.tar.gz
cryptography-ff2b8cebe85c5326c52a0b4ffe467f99e5526849.tar.bz2
cryptography-ff2b8cebe85c5326c52a0b4ffe467f99e5526849.zip
Merge pull request #949 from reaperhulk/rsa-oaep-decrypt
OAEP support for RSA decryption
Diffstat (limited to 'docs/hazmat/primitives/asymmetric/rsa.rst')
-rw-r--r--docs/hazmat/primitives/asymmetric/rsa.rst28
1 files changed, 26 insertions, 2 deletions
diff --git a/docs/hazmat/primitives/asymmetric/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst
index c282d9ef..862df635 100644
--- a/docs/hazmat/primitives/asymmetric/rsa.rst
+++ b/docs/hazmat/primitives/asymmetric/rsa.rst
@@ -138,13 +138,37 @@ RSA
the provided ``backend`` does not implement
:class:`~cryptography.hazmat.backends.interfaces.RSABackend` or if
the backend does not support the chosen hash or padding algorithm.
+ If the padding is
+ :class:`~cryptography.hazmat.primitives.asymmetric.padding.OAEP`
+ with the
+ :class:`~cryptography.hazmat.primitives.asymmetric.padding.MGF1`
+ mask generation function it may also refer to the ``MGF1`` hash
+ algorithm.
:raises TypeError: This is raised when the padding is not an
:class:`~cryptography.hazmat.primitives.interfaces.AsymmetricPadding`
provider.
- :raises ValueError: This is raised when decryption fails or the chosen
- hash algorithm is too large for the key size.
+ :raises ValueError: This is raised when decryption fails or the data
+ is too large for the key size. If the padding is
+ :class:`~cryptography.hazmat.primitives.asymmetric.padding.OAEP`
+ it may also be raised for invalid label values.
+
+ .. code-block:: python
+
+ from cryptography.hazmat.backends import default_backend
+ from cryptography.hazmat.primitives import hashes
+ from cryptography.hazmat.primitives.asymmetric import padding
+
+ plaintext = private_key.decrypt(
+ ciphertext,
+ padding.OAEP(
+ mgf=padding.MGF1(algorithm=hashes.SHA1()),
+ algorithm=hashes.SHA1(),
+ label=None
+ ),
+ default_backend()
+ )
.. class:: RSAPublicKey(public_exponent, modulus)