aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-11-13 13:52:55 -0800
committerDavid Reid <dreid@dreid.org>2013-11-13 13:52:55 -0800
commitee66145fc79f1ef2840267718f54fd89463c67f5 (patch)
treeab9ec47f8eeba9329b4f1c11ca98c4cbde8e266c
parent2cce618311c892aa5a1be2ef899e8ff7a08ae5ef (diff)
downloadcryptography-ee66145fc79f1ef2840267718f54fd89463c67f5.tar.gz
cryptography-ee66145fc79f1ef2840267718f54fd89463c67f5.tar.bz2
cryptography-ee66145fc79f1ef2840267718f54fd89463c67f5.zip
Add a message.
-rw-r--r--cryptography/hazmat/primitives/hmac.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cryptography/hazmat/primitives/hmac.py b/cryptography/hazmat/primitives/hmac.py
index cd0fd813..1bbe39c7 100644
--- a/cryptography/hazmat/primitives/hmac.py
+++ b/cryptography/hazmat/primitives/hmac.py
@@ -39,14 +39,14 @@ class HMAC(object):
def update(self, msg):
if self._ctx is None:
- raise AlreadyFinalized()
+ raise AlreadyFinalized("Context was already finalized")
if isinstance(msg, six.text_type):
raise TypeError("Unicode-objects must be encoded before hashing")
self._ctx.update(msg)
def copy(self):
if self._ctx is None:
- raise AlreadyFinalized()
+ raise AlreadyFinalized("Context was already finalized")
return HMAC(
self._key,
self.algorithm,
@@ -56,8 +56,7 @@ class HMAC(object):
def finalize(self):
if self._ctx is None:
- raise AlreadyFinalized()
-
+ raise AlreadyFinalized("Context was already finalized")
digest = self._ctx.finalize()
self._ctx = None
return digest