Missing public key is a KeyFormatError
This commit is contained in:
@@ -520,6 +520,8 @@ class DKIM(object):
|
|||||||
raise KeyFormatError(e)
|
raise KeyFormatError(e)
|
||||||
try:
|
try:
|
||||||
pk = parse_public_key(base64.b64decode(pub[b'p']))
|
pk = parse_public_key(base64.b64decode(pub[b'p']))
|
||||||
|
except KeyError:
|
||||||
|
raise KeyFormatError("incomplete public key: %s" % s)
|
||||||
except (TypeError,UnparsableKeyError) as e:
|
except (TypeError,UnparsableKeyError) as e:
|
||||||
raise KeyFormatError("could not parse public key (%s): %s" % (pub[b'p'],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'])]
|
include_headers = [x.lower() for x in re.split(br"\s*:\s*", sig[b'h'])]
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ if sys.version_info[0] >= 3:
|
|||||||
sys.stdin = sys.stdin.detach()
|
sys.stdin = sys.stdin.detach()
|
||||||
|
|
||||||
message = sys.stdin.read()
|
message = sys.stdin.read()
|
||||||
verbose = False
|
verbose = True
|
||||||
if verbose:
|
if verbose:
|
||||||
d = dkim.DKIM(message)
|
d = dkim.DKIM(message)
|
||||||
res = d.verify()
|
res = d.verify()
|
||||||
|
|||||||
Reference in New Issue
Block a user