diff options
-rw-r--r-- | CONTRIBUTING.rst | 4 | ||||
-rw-r--r-- | cryptography/hazmat/bindings/openssl/err.py | 1 | ||||
-rw-r--r-- | cryptography/hazmat/primitives/twofactor/hotp.py | 5 | ||||
-rw-r--r-- | docs/hazmat/primitives/twofactor.rst | 8 | ||||
-rw-r--r-- | tests/hazmat/primitives/twofactor/test_hotp.py | 4 |
5 files changed, 10 insertions, 12 deletions
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b47f77e5..6cd409a1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -10,9 +10,9 @@ Examples of contributions include: * Bug reports and patch reviews Extensive contribution guidelines are available in the repository at -``docs/contributing.rst``, or online at: +``docs/development/index.rst``, or online at: -https://cryptography.io/en/latest/contributing/ +https://cryptography.io/en/latest/development/ Security issues --------------- diff --git a/cryptography/hazmat/bindings/openssl/err.py b/cryptography/hazmat/bindings/openssl/err.py index ddb60ef7..56e9a6bc 100644 --- a/cryptography/hazmat/bindings/openssl/err.py +++ b/cryptography/hazmat/bindings/openssl/err.py @@ -151,7 +151,6 @@ static const int EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED; static const int EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH; static const int EVP_R_DECODE_ERROR; static const int EVP_R_DIFFERENT_KEY_TYPES; -static const int EVP_R_DISABLED_FOR_FIPS; static const int EVP_R_ENCODE_ERROR; static const int EVP_R_INITIALIZATION_ERROR; static const int EVP_R_INPUT_NOT_INITIALIZED; diff --git a/cryptography/hazmat/primitives/twofactor/hotp.py b/cryptography/hazmat/primitives/twofactor/hotp.py index 24f5f465..88bde715 100644 --- a/cryptography/hazmat/primitives/twofactor/hotp.py +++ b/cryptography/hazmat/primitives/twofactor/hotp.py @@ -17,7 +17,7 @@ import struct import six -from cryptography.exceptions import InvalidToken, UnsupportedAlgorithm +from cryptography.exceptions import InvalidToken from cryptography.hazmat.primitives import constant_time, hmac from cryptography.hazmat.primitives.hashes import SHA1, SHA256, SHA512 @@ -31,8 +31,7 @@ class HOTP(object): raise ValueError("Length of HOTP has to be between 6 to 8.") if not isinstance(algorithm, (SHA1, SHA256, SHA512)): - raise UnsupportedAlgorithm( - "Algorithm must be SHA1, SHA256 or SHA512") + raise TypeError("Algorithm must be SHA1, SHA256 or SHA512") self._key = key self._length = length diff --git a/docs/hazmat/primitives/twofactor.rst b/docs/hazmat/primitives/twofactor.rst index 3df1a147..0e781439 100644 --- a/docs/hazmat/primitives/twofactor.rst +++ b/docs/hazmat/primitives/twofactor.rst @@ -47,8 +47,8 @@ codes (HMAC). provider. :raises ValueError: This is raised if the provided ``key`` is shorter than 128 bits or if the ``length`` parameter is not 6, 7 or 8. - :raises UnsupportedAlgorithm: This is raised if the provided ``algorithm`` - is not :class:`~cryptography.hazmat.primitives.hashes.SHA1()`, + :raises TypeError: This is raised if the provided ``algorithm`` is not + :class:`~cryptography.hazmat.primitives.hashes.SHA1()`, :class:`~cryptography.hazmat.primitives.hashes.SHA256()` or :class:`~cryptography.hazmat.primitives.hashes.SHA512()`. @@ -142,8 +142,8 @@ similar to the following code. provider. :raises ValueError: This is raised if the provided ``key`` is shorter than 128 bits or if the ``length`` parameter is not 6, 7 or 8. - :raises UnsupportedAlgorithm: This is raised if the provided ``algorithm`` - is not :class:`~cryptography.hazmat.primitives.hashes.SHA1()`, + :raises TypeError: This is raised if the provided ``algorithm`` is not + :class:`~cryptography.hazmat.primitives.hashes.SHA1()`, :class:`~cryptography.hazmat.primitives.hashes.SHA256()` or :class:`~cryptography.hazmat.primitives.hashes.SHA512()`. diff --git a/tests/hazmat/primitives/twofactor/test_hotp.py b/tests/hazmat/primitives/twofactor/test_hotp.py index 7c584271..4c726b77 100644 --- a/tests/hazmat/primitives/twofactor/test_hotp.py +++ b/tests/hazmat/primitives/twofactor/test_hotp.py @@ -15,7 +15,7 @@ import os import pytest -from cryptography.exceptions import InvalidToken, UnsupportedAlgorithm +from cryptography.exceptions import InvalidToken from cryptography.hazmat.primitives.twofactor.hotp import HOTP from cryptography.hazmat.primitives import hashes from tests.utils import load_vectors_from_file, load_nist_vectors @@ -46,7 +46,7 @@ class TestHOTP(object): def test_invalid_algorithm(self, backend): secret = os.urandom(16) - with pytest.raises(UnsupportedAlgorithm): + with pytest.raises(TypeError): HOTP(secret, 6, MD5(), backend) @pytest.mark.parametrize("params", vectors) |