diff --git a/src/saml2/entity.py b/src/saml2/entity.py index be5977fb2..82c932f09 100644 --- a/src/saml2/entity.py +++ b/src/saml2/entity.py @@ -937,9 +937,13 @@ def _parse_response(self, xmlstr, response_cls, service, binding, if response: if outstanding_certs: - _, key_file = make_temp( - "%s" % outstanding_certs[ - response.in_response_to]["key"], decode=False) + cert = outstanding_certs[ + response.in_response_to] + if cert: + _, key_file = make_temp( + "%s" % cert["key"], decode=False) + else: + key_file = "" else: key_file = "" response = response.verify(key_file)