Sample code for 30+ languages & platforms
VB.NET

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 VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim certStore As New Chilkat.CertStore

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 cert As New Chilkat.Cert
Dim i As Integer = 0
While i < numCerts
    certStore.GetCert(i,cert)

    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