B4X Requires Chilkat v10.1.2+
B4X
Load PFX/P12 File into Certificate Store Object
Demonstrates how to load a .pfx/.p12 into a certificate store object.Chilkat B4X Downloads
Dim success As Boolean = False
Dim certStore As ChilkatCertStore
certStore.Initialize
' This only loads the contents of the PFX file into the certStore object.
' It is not importing the PFX into the Windows certificate stores.
Dim pfxPassword As String = "badssl.com"
success = certStore.LoadPfxFile("qa_data/pfx/badssl.com-client.p12", pfxPassword)
If success = False Then
Log(certStore.LastErrorText)
Return
End If
' Examine each certificate (loaded from the PFX) in this certStore object
Dim cert As ChilkatCert
cert.Initialize("cert")
Dim numCerts As Int = certStore.NumCertificates
Dim i As Int = 0
Do While i < numCerts
certStore.GetCert(i, cert)
Log("hasPrivateKey=" & cert.HasPrivateKey & ", " & cert.SubjectCN)
i = i + 1
Loop