Sample code for 30+ languages & platforms
Visual Basic 6.0

Load PFX (PKCS#12) and List Certificates

See more Certificates Examples

Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim certStore As New ChilkatCertStore

Dim pfxPath As String
pfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"
Dim pfxPassword As String
pfxPassword = "test"
success = certStore.LoadPfxFile(pfxPath,pfxPassword)
If (success <> 1) Then
    Debug.Print certStore.LastErrorText
    Exit Sub
End If

Dim numCerts As Long
numCerts = certStore.NumCertificates

Debug.Print "PFX contains " & numCerts & " certificates"

Dim cert As New ChilkatCert
Dim i As Long
i = 0
Do While i < numCerts
    success = certStore.GetCert(i,cert)

    Debug.Print i & ": (Common Name) " & cert.SubjectCN
    Debug.Print i & ": (Serial Number) " & cert.SerialNumber
    Debug.Print i & ": (Distinguished Name) " & cert.SubjectDN

    i = i + 1
Loop