Sample code for 30+ languages & platforms
Visual Basic 6.0

Get Certificate Policy

See more Certificates Examples

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

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim cert As New ChilkatCert

success = cert.LoadFromFile("qa_data/certs/sample.cer")
If (success = 0) Then
    Debug.Print cert.LastErrorText
    Exit Sub
End If

' The certificatePolicies OID is 2.5.29.32
Dim oid As String
oid = "2.5.29.32"
Dim strXml As String
strXml = cert.GetExtensionAsXml(oid)
If (cert.LastMethodSuccess = 1) Then
    Debug.Print strXml

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

    Dim xml As New ChilkatXml
    success = xml.LoadXml(strXml)
    Debug.Print "Policy OID = " & xml.GetChildContent("sequence|oid")
End If