From 7a489dbd116edd4ca5a6104b74748f3a4f712d15 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 22 Mar 2014 15:09:34 -0700 Subject: Fixed #809 -- switch back to always using UnsupportedAlgorithm --- docs/hazmat/primitives/asymmetric/rsa.rst | 45 +++++++++------------- docs/hazmat/primitives/cryptographic-hashes.rst | 5 ++- docs/hazmat/primitives/hmac.rst | 5 ++- .../hazmat/primitives/key-derivation-functions.rst | 4 +- docs/hazmat/primitives/symmetric-encryption.rst | 6 +-- docs/hazmat/primitives/twofactor.rst | 4 +- 6 files changed, 32 insertions(+), 37 deletions(-) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/asymmetric/rsa.rst b/docs/hazmat/primitives/asymmetric/rsa.rst index 57c8eec2..182e35d2 100644 --- a/docs/hazmat/primitives/asymmetric/rsa.rst +++ b/docs/hazmat/primitives/asymmetric/rsa.rst @@ -50,7 +50,7 @@ RSA provider. :return: A new instance of ``RSAPrivateKey``. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.RSABackend` @@ -100,9 +100,16 @@ RSA :returns: :class:`~cryptography.hazmat.primitives.interfaces.AsymmetricSignatureContext` - :raises cryptography.exceptions.UnsupportedInterface: This is raised if + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement - :class:`~cryptography.hazmat.backends.interfaces.RSABackend` + :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.PSS` + 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` @@ -111,17 +118,6 @@ RSA :raises ValueError: This is raised when the chosen hash algorithm is too large for the key size. - :raises UnsupportedHash: This is raised when the backend does not - support the chosen hash algorithm. If the padding is - :class:`~cryptography.hazmat.primitives.asymmetric.padding.PSS` - with the - :class:`~cryptography.hazmat.primitives.asymmetric.padding.MGF1` - mask generation function it may also refer to the `MGF1` hash - algorithm. - - :raises UnsupportedPadding: This is raised when the backend does not - support the chosen padding. - .. class:: RSAPublicKey(public_exponent, modulus) @@ -205,9 +201,16 @@ RSA :returns: :class:`~cryptography.hazmat.primitives.interfaces.AsymmetricVerificationContext` - :raises cryptography.exceptions.UnsupportedInterface: This is raised if + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement - :class:`~cryptography.hazmat.backends.interfaces.RSABackend` + :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.PSS` + 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` @@ -216,16 +219,6 @@ RSA :raises ValueError: This is raised when the chosen hash algorithm is too large for the key size. - :raises UnsupportedHash: This is raised when the backend does not - support the chosen hash algorithm. If the padding is - :class:`~cryptography.hazmat.primitives.asymmetric.padding.PSS` - with the - :class:`~cryptography.hazmat.primitives.asymmetric.padding.MGF1` - mask generation function it may also refer to the `MGF1` hash - algorithm. - - :raises UnsupportedPadding: This is raised when the backend does not - support the chosen padding. .. _`RSA`: https://en.wikipedia.org/wiki/RSA_(cryptosystem) .. _`public-key`: https://en.wikipedia.org/wiki/Public-key_cryptography diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst index c318feeb..773d97f6 100644 --- a/docs/hazmat/primitives/cryptographic-hashes.rst +++ b/docs/hazmat/primitives/cryptographic-hashes.rst @@ -29,7 +29,8 @@ Message digests 'l\xa1=R\xcap\xc8\x83\xe0\xf0\xbb\x10\x1eBZ\x89\xe8bM\xe5\x1d\xb2\xd29%\x93\xafj\x84\x11\x80\x90' If the backend doesn't support the requested ``algorithm`` an - :class:`~cryptography.exceptions.UnsupportedHash` exception will be raised. + :class:`~cryptography.exceptions.UnsupportedAlgorithm` exception will be + raised. Keep in mind that attacks against cryptographic hashes only get stronger with time, and that often algorithms that were once thought to be strong, @@ -45,7 +46,7 @@ Message digests :class:`~cryptography.hazmat.backends.interfaces.HashBackend` provider. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if the + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.HashBackend` diff --git a/docs/hazmat/primitives/hmac.rst b/docs/hazmat/primitives/hmac.rst index 5d511bc4..11b10735 100644 --- a/docs/hazmat/primitives/hmac.rst +++ b/docs/hazmat/primitives/hmac.rst @@ -35,7 +35,8 @@ of a message. '#F\xdaI\x8b"e\xc4\xf1\xbb\x9a\x8fc\xff\xf5\xdex.\xbc\xcd/+\x8a\x86\x1d\x84\'\xc3\xa6\x1d\xd8J' If the backend doesn't support the requested ``algorithm`` an - :class:`~cryptography.exceptions.UnsupportedHash` exception will be raised. + :class:`~cryptography.exceptions.UnsupportedAlgorithm` exception will be + raised. To check that a given signature is correct use the :meth:`verify` method. You will receive an exception if the signature is wrong: @@ -56,7 +57,7 @@ of a message. :class:`~cryptography.hazmat.backends.interfaces.HMACBackend` provider. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if the + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.HMACBackend` diff --git a/docs/hazmat/primitives/key-derivation-functions.rst b/docs/hazmat/primitives/key-derivation-functions.rst index 6196d951..269f949d 100644 --- a/docs/hazmat/primitives/key-derivation-functions.rst +++ b/docs/hazmat/primitives/key-derivation-functions.rst @@ -84,7 +84,7 @@ Different KDFs are suitable for different tasks such as: :class:`~cryptography.hazmat.backends.interfaces.PBKDF2HMACBackend` provider. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if the + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.PBKDF2HMACBackend` @@ -187,7 +187,7 @@ Different KDFs are suitable for different tasks such as: :class:`~cryptography.hazmat.backends.interfaces.HMACBackend` provider. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if the + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.HMACBackend` diff --git a/docs/hazmat/primitives/symmetric-encryption.rst b/docs/hazmat/primitives/symmetric-encryption.rst index f7e8d5b7..28de611e 100644 --- a/docs/hazmat/primitives/symmetric-encryption.rst +++ b/docs/hazmat/primitives/symmetric-encryption.rst @@ -56,7 +56,7 @@ an "encrypt-then-MAC" formulation as `described by Colin Percival`_. :class:`~cryptography.hazmat.backends.interfaces.CipherBackend` provider. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if the + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.CipherBackend` @@ -67,7 +67,7 @@ an "encrypt-then-MAC" formulation as `described by Colin Percival`_. provider. If the backend doesn't support the requested combination of ``cipher`` - and ``mode`` an :class:`~cryptography.exceptions.UnsupportedCipher` + and ``mode`` an :class:`~cryptography.exceptions.UnsupportedAlgorithm` exception will be raised. .. method:: decryptor() @@ -77,7 +77,7 @@ an "encrypt-then-MAC" formulation as `described by Colin Percival`_. provider. If the backend doesn't support the requested combination of ``cipher`` - and ``mode`` an :class:`cryptography.exceptions.UnsupportedCipher` + and ``mode`` an :class:`cryptography.exceptions.UnsupportedAlgorithm` exception will be raised. .. _symmetric-encryption-algorithms: diff --git a/docs/hazmat/primitives/twofactor.rst b/docs/hazmat/primitives/twofactor.rst index e9f5c7ff..f19cf0e6 100644 --- a/docs/hazmat/primitives/twofactor.rst +++ b/docs/hazmat/primitives/twofactor.rst @@ -52,7 +52,7 @@ codes (HMAC). :class:`~cryptography.hazmat.primitives.hashes.SHA256()` or :class:`~cryptography.hazmat.primitives.hashes.SHA512()` or if the ``length`` parameter is not an integer. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if the + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.HMACBackend` @@ -151,7 +151,7 @@ similar to the following code. :class:`~cryptography.hazmat.primitives.hashes.SHA256()` or :class:`~cryptography.hazmat.primitives.hashes.SHA512()` or if the ``length`` parameter is not an integer. - :raises cryptography.exceptions.UnsupportedInterface: This is raised if the + :raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if the provided ``backend`` does not implement :class:`~cryptography.hazmat.backends.interfaces.HMACBackend` -- cgit v1.2.3