Sample code for 30+ languages & platforms
AutoIt

Load PFX/P12 File into Certificate Store Object

Demonstrates how to load a .pfx/.p12 into a certificate store object.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

$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"
$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
$oCert = ObjCreate("Chilkat.Cert")
Local $iNumCerts = $oCertStore.NumCertificates
Local $i = 0
While $i < $iNumCerts
    $oCertStore.GetCert($i,$oCert)
    ConsoleWrite("hasPrivateKey=" & $oCert.HasPrivateKey() & ", " & $oCert.SubjectCN & @CRLF)
    $i = $i + 1
Wend