def verify_envelope(reply, key_file):
doc = etree.fromstring(reply)<EOL>node = doc.find("<STR_LIT>" % xmlsec.DSigNs)<EOL>if node is None:<EOL><INDENT>raise CertificationError("<STR_LIT>")<EOL><DEDENT>dsigCtx = xmlsec.DSigCtx()<EOL>xmlsec.addIDs(doc, ['<STR_LIT>'])<EOL>signKey = xmlsec.Key.load(key_file, xmlsec.KeyDataFormatPem)<EOL>signKey.name = os.path.basename(key_file)<EOL>dsigCtx.signKey = signKey<EOL>try:<EOL><INDENT>dsigCtx.verify(node)<EOL><DEDENT>except xmlsec.VerificationError:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>
Verify that the given soap request is signed with the certificate