Missing public key is a KeyFormatError

This commit is contained in:
Stuart D. Gathman
2011-10-25 13:12:02 -04:00
parent 47a5d949ea
commit e9e4775c3c
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -520,6 +520,8 @@ class DKIM(object):
raise KeyFormatError(e)
try:
pk = parse_public_key(base64.b64decode(pub[b'p']))
except KeyError:
raise KeyFormatError("incomplete public key: %s" % s)
except (TypeError,UnparsableKeyError) as e:
raise KeyFormatError("could not parse public key (%s): %s" % (pub[b'p'],e))
include_headers = [x.lower() for x in re.split(br"\s*:\s*", sig[b'h'])]
+1 -1
View File
@@ -32,7 +32,7 @@ if sys.version_info[0] >= 3:
sys.stdin = sys.stdin.detach()
message = sys.stdin.read()
verbose = False
verbose = True
if verbose:
d = dkim.DKIM(message)
res = d.verify()