Chilkat2-Python
Chilkat2-Python
Get Certificate Policy
See more Certificates Examples
Demonstrates how to get a certificate's policy OIDs (if any)Chilkat Chilkat2-Python Downloads
import sys
import chilkat2
success = False
cert = chilkat2.Cert()
success = cert.LoadFromFile("qa_data/certs/sample.cer")
if (success == False):
print(cert.LastErrorText)
sys.exit()
# The certificatePolicies OID is 2.5.29.32
oid = "2.5.29.32"
strXml = cert.GetExtensionAsXml(oid)
if (cert.LastMethodSuccess == True):
print(strXml)
# Sample result:
# <sequence><sequence><oid>2.16.840.1.101.2.1.11.39</oid></sequence></sequence>
xml = chilkat2.Xml()
xml.LoadXml(strXml)
print("Policy OID = " + xml.GetChildContent("sequence|oid"))