Skip to content

Instantly share code, notes, and snippets.

@hdknr
Created November 6, 2009 07:19
Show Gist options
  • Save hdknr/227793 to your computer and use it in GitHub Desktop.
Save hdknr/227793 to your computer and use it in GitHub Desktop.
# Load X.509 data from XML-Security signed XML file with KeyInfo
#
# import xmlsec,libxml2
from M2Crypto import X509
s= xmlsec.findNode(
libxml2.parseDoc(self.signed_xml.encode('UTF-8')).getRootElement(),
xmlsec.NodeX509Certificate,xmlsec.DSigNs).content
s = '-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n' % s
cert = X509.load_cert_string(s)
print type(cert),cert.__class__
# <type 'instance'> M2Crypto.X509.X509
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment