(VB.NET) Load PFX (PKCS#12) and List Certificates
Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.
Dim certStore As New Chilkat.CertStore
Dim success As Boolean
Dim pfxPath As String = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"
Dim pfxPassword As String = "test"
success = certStore.LoadPfxFile(pfxPath,pfxPassword)
If (success <> True) Then
Debug.WriteLine(certStore.LastErrorText)
Exit Sub
End If
Dim numCerts As Integer = certStore.NumCertificates
Debug.WriteLine("PFX contains " & numCerts & " certificates")
Dim i As Integer = 0
While i < numCerts
Dim cert As Chilkat.Cert = certStore.GetCertificate(i)
Debug.WriteLine(i & ": (Common Name) " & cert.SubjectCN)
Debug.WriteLine(i & ": (Serial Number) " & cert.SerialNumber)
Debug.WriteLine(i & ": (Distinguished Name) " & cert.SubjectDN)
i = i + 1
End While
|