Sample code for 30+ languages & platforms
B4X Requires Chilkat v10.1.2+

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 B4X Downloads

B4X
Dim success As Boolean = False

Dim certStore As ChilkatCertStore
certStore.Initialize

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
    Log(certStore.LastErrorText)
    Return
End If


Dim numCerts As Int = certStore.NumCertificates

Log("PFX contains " & numCerts & " certificates")

Dim cert As ChilkatCert
cert.Initialize("cert")
Dim i As Int = 0
Do While i < numCerts
    certStore.GetCert(i, cert)

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

    i = i + 1
Loop