Sample code for 30+ languages & platforms
Visual FoxPro

Get Certificate Policy

See more Certificates Examples

Demonstrates how to get a certificate's policy OIDs (if any)

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loCert
LOCAL lcOid
LOCAL lcStrXml
LOCAL loXml

lnSuccess = 0

loCert = CreateObject('Chilkat.Cert')

lnSuccess = loCert.LoadFromFile("qa_data/certs/sample.cer")
IF (lnSuccess = 0) THEN
    ? loCert.LastErrorText
    RELEASE loCert
    CANCEL
ENDIF

* The certificatePolicies OID is 2.5.29.32
lcOid = "2.5.29.32"
lcStrXml = loCert.GetExtensionAsXml(lcOid)
IF (loCert.LastMethodSuccess = 1) THEN
    ? lcStrXml

    * Sample result:
    * <sequence><sequence><oid>2.16.840.1.101.2.1.11.39</oid></sequence></sequence>

    loXml = CreateObject('Chilkat.Xml')
    loXml.LoadXml(lcStrXml)
    ? "Policy OID = " + loXml.GetChildContent("sequence|oid")
ENDIF

RELEASE loCert
RELEASE loXml