From 13ff5e8899300c9b359fa1bdfdb3d412be0d7356 Mon Sep 17 00:00:00 2001 From: Roland Hedberg Date: Wed, 11 Mar 2015 09:58:42 +0100 Subject: [PATCH] Slightly better handling of outstanding_certs. --- src/saml2/entity.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/saml2/entity.py b/src/saml2/entity.py index 82c932f09..eadeb1051 100644 --- a/src/saml2/entity.py +++ b/src/saml2/entity.py @@ -1,5 +1,5 @@ import base64 -from binascii import hexlify +#from binascii import hexlify import logging from hashlib import sha1 from Crypto.PublicKey import RSA @@ -937,13 +937,13 @@ def _parse_response(self, xmlstr, response_cls, service, binding, if response: if outstanding_certs: - cert = outstanding_certs[ - response.in_response_to] - if cert: - _, key_file = make_temp( - "%s" % cert["key"], decode=False) - else: + try: + cert = outstanding_certs[response.in_response_to] + except KeyError: key_file = "" + else: + _, key_file = make_temp("%s" % cert["key"], + decode=False) else: key_file = "" response = response.verify(key_file)