(Lianja) Load PFX/P12 File into Certificate Store Object
Demonstrates how to load a .pfx/.p12 into a certificate store object. Note: This example requires Chilkat v10.1.2 or greater.
loCertStore = createobject("CkCertStore")
// This only loads the contents of the PFX file into the certStore object.
// It is not importing the PFX into the Windows certificate stores.
lcPfxPassword = "badssl.com"
llSuccess = loCertStore.LoadPfxFile("qa_data/pfx/badssl.com-client.p12",lcPfxPassword)
if (llSuccess = .F.) then
? loCertStore.LastErrorText
release loCertStore
return
endif
// Examine each certificate (loaded from the PFX) in this certStore object
loCert = createobject("CkCert")
lnNumCerts = loCertStore.NumCertificates
i = 0
do while i < lnNumCerts
loCertStore.GetCert(i,loCert)
? "hasPrivateKey=" + str(loCert.HasPrivateKey()) + ", " + loCert.SubjectCN
i = i + 1
enddo
release loCertStore
release loCert
|