summaryrefslogtreecommitdiff
path: root/passlib/handlers/scram.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2012-04-17 23:14:51 -0400
committerEli Collins <elic@assurancetechnologies.com>2012-04-17 23:14:51 -0400
commit64ab6fc89b497efa9169f11d55251e417c4db0ba (patch)
treeb3f6f5dc27b87a6bc90cb3686fa98239ee8ff053 /passlib/handlers/scram.py
parent8eb4c4d3b58eec6802c698ddbf357b2fd243a68c (diff)
parentcd029846fdc0c3d7ffc7f53caad4579e7e0e8725 (diff)
downloadpasslib-ironpython-support-dev.tar.gz
Merge from defaultironpython-support-dev
Diffstat (limited to 'passlib/handlers/scram.py')
-rw-r--r--passlib/handlers/scram.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/passlib/handlers/scram.py b/passlib/handlers/scram.py
index e7919a2..036d7c2 100644
--- a/passlib/handlers/scram.py
+++ b/passlib/handlers/scram.py
@@ -285,7 +285,7 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
raise ValueError("SCRAM limits algorithm names to "
"9 characters: %r" % (alg,))
if not isinstance(digest, bytes):
- raise TypeError("digests must be raw bytes")
+ raise uh.exc.ExpectedTypeError(digest, "raw bytes", "digests")
# TODO: verify digest size (if digest is known)
if 'sha-1' not in checksum:
# NOTE: required because of SCRAM spec.
@@ -374,9 +374,8 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
else:
failed = True
if correct and failed:
- warning("scram hash verified inconsistently, may be corrupted",
- PasslibHashWarning)
- return False
+ raise ValueError("scram hash verified inconsistently, "
+ "may be corrupted")
else:
return correct
else:
@@ -385,7 +384,8 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
if alg in chkmap:
other = self._calc_checksum(secret, alg)
return consteq(other, chkmap[alg])
- # there should *always* be at least sha-1.
+ # there should always be sha-1 at the very least,
+ # or something went wrong inside _norm_algs()
raise AssertionError("sha-1 digest not found!")
#=========================================================