aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-03-26 17:39:29 +0000
committerAlex Stapleton <alexs@prol.etari.at>2014-03-27 07:31:12 +0000
commit112963e296aadfdeaa4e2624c3b81b6b8c726a06 (patch)
treecd3c462d09860a8c01ad756acf60acb89b23fd1b /cryptography
parent7a489dbd116edd4ca5a6104b74748f3a4f712d15 (diff)
downloadcryptography-112963e296aadfdeaa4e2624c3b81b6b8c726a06.tar.gz
cryptography-112963e296aadfdeaa4e2624c3b81b6b8c726a06.tar.bz2
cryptography-112963e296aadfdeaa4e2624c3b81b6b8c726a06.zip
Address most of my own comments
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/exceptions.py4
-rw-r--r--cryptography/hazmat/primitives/twofactor/hotp.py6
-rw-r--r--cryptography/hazmat/primitives/twofactor/totp.py6
3 files changed, 10 insertions, 6 deletions
diff --git a/cryptography/exceptions.py b/cryptography/exceptions.py
index d97f20cc..8825d3b4 100644
--- a/cryptography/exceptions.py
+++ b/cryptography/exceptions.py
@@ -14,8 +14,8 @@
from __future__ import absolute_import, division, print_function
-class _Causes(object):
- BACKEND_MISSING_INTERFACE = 0
+class _Reasons(object):
+ BACKEND_MISSING_INTERFACE = object()
class UnsupportedAlgorithm(Exception):
diff --git a/cryptography/hazmat/primitives/twofactor/hotp.py b/cryptography/hazmat/primitives/twofactor/hotp.py
index bac23d1b..41c467c8 100644
--- a/cryptography/hazmat/primitives/twofactor/hotp.py
+++ b/cryptography/hazmat/primitives/twofactor/hotp.py
@@ -17,7 +17,9 @@ import struct
import six
-from cryptography.exceptions import InvalidToken, UnsupportedAlgorithm, _Causes
+from cryptography.exceptions import (
+ InvalidToken, UnsupportedAlgorithm, _Reasons
+)
from cryptography.hazmat.backends.interfaces import HMACBackend
from cryptography.hazmat.primitives import constant_time, hmac
from cryptography.hazmat.primitives.hashes import SHA1, SHA256, SHA512
@@ -28,7 +30,7 @@ class HOTP(object):
if not isinstance(backend, HMACBackend):
raise UnsupportedAlgorithm(
"Backend object does not implement HMACBackend",
- _Causes.BACKEND_MISSING_INTERFACE
+ _Reasons.BACKEND_MISSING_INTERFACE
)
if len(key) < 16:
diff --git a/cryptography/hazmat/primitives/twofactor/totp.py b/cryptography/hazmat/primitives/twofactor/totp.py
index d0162395..e55ba00d 100644
--- a/cryptography/hazmat/primitives/twofactor/totp.py
+++ b/cryptography/hazmat/primitives/twofactor/totp.py
@@ -13,7 +13,9 @@
from __future__ import absolute_import, division, print_function
-from cryptography.exceptions import InvalidToken, UnsupportedAlgorithm, _Causes
+from cryptography.exceptions import (
+ InvalidToken, UnsupportedAlgorithm, _Reasons
+)
from cryptography.hazmat.backends.interfaces import HMACBackend
from cryptography.hazmat.primitives import constant_time
from cryptography.hazmat.primitives.twofactor.hotp import HOTP
@@ -24,7 +26,7 @@ class TOTP(object):
if not isinstance(backend, HMACBackend):
raise UnsupportedAlgorithm(
"Backend object does not implement HMACBackend",
- _Causes.BACKEND_MISSING_INTERFACE
+ _Reasons.BACKEND_MISSING_INTERFACE
)
self._time_step = time_step