(Visual Basic 6.0) Load PFX (PKCS#12) and List Certificates
Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.
Dim certStore As New ChilkatCertStore
Dim success As Long
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 i As Long
i = 0
Do While i < numCerts
Dim cert As ChilkatCert
Set cert = certStore.GetCertificate(i)
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
|