(AutoIt) Load PFX/P12 File into Certificate Store Object
Demonstrates how to load a .pfx/.p12 into a certificate store object.
$oCertStore = ObjCreate("Chilkat.CertStore")
; This only loads the contents of the PFX file into the certStore object.
; It is not importing the PFX into the Windows certificate stores.
Local $sPfxPassword = "badssl.com"
Local $bSuccess = $oCertStore.LoadPfxFile("qa_data/pfx/badssl.com-client.p12",$sPfxPassword)
If ($bSuccess = False) Then
ConsoleWrite($oCertStore.LastErrorText & @CRLF)
Exit
EndIf
; Examine each certificate (loaded from the PFX) in this certStore object
Local $iNumCerts = $oCertStore.NumCertificates
Local $i = 0
While $i < $iNumCerts
Local $oCert = $oCertStore.GetCertificate($i)
ConsoleWrite("hasPrivateKey=" & $oCert.HasPrivateKey() & ", " & $oCert.SubjectCN & @CRLF)
$i = $i + 1
Wend
|