Sample code for 30+ languages & platforms
AutoIt

Load P7B and List Certificates

Demonstrates how to load a .p7b containing certificates and accesses each individual certificate.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$bSuccess = False

$oPem = ObjCreate("Chilkat.Pem")

; Load the .p7b from a file.
$bSuccess = $oPem.LoadP7bFile("/Users/chilkat/testData/p7b/myCerts.p7b")
If ($bSuccess <> True) Then
    ConsoleWrite($oPem.LastErrorText & @CRLF)
    Exit
EndIf

Local $i
Local $iNumCerts = $oPem.NumCerts
If ($iNumCerts = 0) Then
    ConsoleWrite((("Error: Expected the .p7b to contain certificates.")) & @CRLF)
    Exit
EndIf

; Access each certificate and show the DN (Distinguished Name)
For $i = 1 To $iNumCerts
Local $oCert = $oPem.GetCert($i - 1)
    ConsoleWrite($i & ": " & $oCert.SubjectDN & @CRLF)

Next