Changed excpetion name based on feedback from dreid

This commit is contained in:
Alex Gaynor 2013-11-02 16:57:10 -07:00
parent 738ac5a8e9
commit 3949f11710
5 changed files with 11 additions and 11 deletions

View file

@ -12,5 +12,5 @@
# limitations under the License.
class NoSuchAlgorithm(Exception):
class UnsupportedAlgorithm(Exception):
pass

View file

@ -18,7 +18,7 @@ import sys
import cffi
from cryptography.exceptions import NoSuchAlgorithm
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.primitives import interfaces
from cryptography.hazmat.primitives.block.ciphers import (
AES, Blowfish, Camellia, CAST5, TripleDES,
@ -132,7 +132,7 @@ class _CipherContext(object):
try:
adapter = registry[type(cipher), type(mode)]
except KeyError:
raise NoSuchAlgorithm
raise UnsupportedAlgorithm
evp_cipher = adapter(self._backend, cipher, mode)
assert evp_cipher != self._backend.ffi.NULL

View file

@ -3,7 +3,7 @@ Exceptions
.. currentmodule:: cryptography.exceptions
.. class:: NoSuchAlgorithm
.. class:: UnsupportedAlgorithm
This is raised when a backend doesn't support the requested algorithm (or
combination of algorithms).

View file

@ -43,8 +43,8 @@ where the encrypter and decrypter both use the same key.
provider.
If the backend doesn't support the requested combination of ``cipher``
and ``mode`` a :class:`cryptography.exceptions.NoSuchAlgorithm` will
be raised.
and ``mode`` an :class:`cryptography.exceptions.UnsupportedAlgorithm`
will be raised.
.. method:: decryptor()
@ -53,8 +53,8 @@ where the encrypter and decrypter both use the same key.
provider.
If the backend doesn't support the requested combination of ``cipher``
and ``mode`` a :class:`cryptography.exceptions.NoSuchAlgorithm` will
be raised.
and ``mode`` an :class:`cryptography.exceptions.UnsupportedAlgorithm`
will be raised.
.. currentmodule:: cryptography.hazmat.primitives.interfaces

View file

@ -17,7 +17,7 @@ import binascii
import pytest
from cryptography.exceptions import NoSuchAlgorithm
from cryptography.exceptions import UnsupportedAlgorithm
from cryptography.hazmat.primitives import interfaces
from cryptography.hazmat.primitives.block import BlockCipher, ciphers, modes
@ -90,8 +90,8 @@ class TestBlockCipherContext(object):
cipher = BlockCipher(
object(), object(), backend
)
with pytest.raises(NoSuchAlgorithm):
with pytest.raises(UnsupportedAlgorithm):
cipher.encryptor()
with pytest.raises(NoSuchAlgorithm):
with pytest.raises(UnsupportedAlgorithm):
cipher.decryptor()