(Lianja) Load PFX (PKCS#12) and List Certificates
Loads a PFX file (.pfx, .p12) and iterates over the certificates found within. Note: This example requires Chilkat v10.1.2 or greater.
loCertStore = createobject("CkCertStore")
lcPfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"
lcPfxPassword = "test"
llSuccess = loCertStore.LoadPfxFile(lcPfxPath,lcPfxPassword)
if (llSuccess <> .T.) then
? loCertStore.LastErrorText
release loCertStore
return
endif
lnNumCerts = loCertStore.NumCertificates
? "PFX contains " + str(lnNumCerts) + " certificates"
loCert = createobject("CkCert")
i = 0
do while i < lnNumCerts
loCertStore.GetCert(i,loCert)
? str(i) + ": (Common Name) " + loCert.SubjectCN
? str(i) + ": (Serial Number) " + loCert.SerialNumber
? str(i) + ": (Distinguished Name) " + loCert.SubjectDN
i = i + 1
enddo
release loCertStore
release loCert
|