aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography/hazmat/primitives/hmac.py
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-05-18 14:35:23 +0800
committerAyrx <terrycwk1994@gmail.com>2014-05-18 14:35:23 +0800
commite7d199684d69c0dbd17ebeaca6a7c9d9ffc7df10 (patch)
treec9d1fe43130e7700d82505b58244c577620d8465 /cryptography/hazmat/primitives/hmac.py
parent3884b6afbf484dc49a0ba6fdaf7be4343ed480cf (diff)
downloadcryptography-e7d199684d69c0dbd17ebeaca6a7c9d9ffc7df10.tar.gz
cryptography-e7d199684d69c0dbd17ebeaca6a7c9d9ffc7df10.tar.bz2
cryptography-e7d199684d69c0dbd17ebeaca6a7c9d9ffc7df10.zip
Make exceptions end with a period consistently
Diffstat (limited to 'cryptography/hazmat/primitives/hmac.py')
-rw-r--r--cryptography/hazmat/primitives/hmac.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py
index 0f89df94..026ad3b3 100644
--- a/cryptography/hazmat/primitives/hmac.py
+++ b/cryptography/hazmat/primitives/hmac.py
@@ -26,7 +26,7 @@ class HMAC(object):
def __init__(self, key, algorithm, backend, ctx=None):
if not isinstance(backend, HMACBackend):
raise UnsupportedAlgorithm(
- "Backend object does not implement HMACBackend",
+ "Backend object does not implement HMACBackend.",
_Reasons.BACKEND_MISSING_INTERFACE
)
@@ -43,14 +43,14 @@ class HMAC(object):
def update(self, msg):
if self._ctx is None:
- raise AlreadyFinalized("Context was already finalized")
+ raise AlreadyFinalized("Context was already finalized.")
if not isinstance(msg, bytes):
- raise TypeError("msg must be bytes")
+ raise TypeError("msg must be bytes.")
self._ctx.update(msg)
def copy(self):
if self._ctx is None:
- raise AlreadyFinalized("Context was already finalized")
+ raise AlreadyFinalized("Context was already finalized.")
return HMAC(
self._key,
self.algorithm,
@@ -60,14 +60,14 @@ class HMAC(object):
def finalize(self):
if self._ctx is None:
- raise AlreadyFinalized("Context was already finalized")
+ raise AlreadyFinalized("Context was already finalized.")
digest = self._ctx.finalize()
self._ctx = None
return digest
def verify(self, signature):
if not isinstance(signature, bytes):
- raise TypeError("signature must be bytes")
+ raise TypeError("signature must be bytes.")
digest = self.finalize()
if not constant_time.bytes_eq(digest, signature):
raise InvalidSignature("Signature did not match digest.")