(AutoIt) Load PFX (PKCS#12) and List Certificates
Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.
$oCertStore = ObjCreate("Chilkat.CertStore")
Local $bSuccess
Local $sPfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"
Local $sPfxPassword = "test"
$bSuccess = $oCertStore.LoadPfxFile($sPfxPath,$sPfxPassword)
If ($bSuccess <> True) Then
ConsoleWrite($oCertStore.LastErrorText & @CRLF)
Exit
EndIf
Local $iNumCerts = $oCertStore.NumCertificates
ConsoleWrite("PFX contains " & $iNumCerts & " certificates" & @CRLF)
Local $i = 0
While $i < $iNumCerts
Local $oCert = $oCertStore.GetCertificate($i)
ConsoleWrite($i & ": (Common Name) " & $oCert.SubjectCN & @CRLF)
ConsoleWrite($i & ": (Serial Number) " & $oCert.SerialNumber & @CRLF)
ConsoleWrite($i & ": (Distinguished Name) " & $oCert.SubjectDN & @CRLF)
$i = $i + 1
Wend
|