Skip to content

Commit 13ff5e8

Browse files
author
Roland Hedberg
committed
Slightly better handling of outstanding_certs.
1 parent 055b314 commit 13ff5e8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: src/saml2/entity.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import base64
2-
from binascii import hexlify
2+
#from binascii import hexlify
33
import logging
44
from hashlib import sha1
55
from Crypto.PublicKey import RSA
@@ -937,13 +937,13 @@ def _parse_response(self, xmlstr, response_cls, service, binding,
937937

938938
if response:
939939
if outstanding_certs:
940-
cert = outstanding_certs[
941-
response.in_response_to]
942-
if cert:
943-
_, key_file = make_temp(
944-
"%s" % cert["key"], decode=False)
945-
else:
940+
try:
941+
cert = outstanding_certs[response.in_response_to]
942+
except KeyError:
946943
key_file = ""
944+
else:
945+
_, key_file = make_temp("%s" % cert["key"],
946+
decode=False)
947947
else:
948948
key_file = ""
949949
response = response.verify(key_file)

0 commit comments

Comments
 (0)