AutoIt
AutoIt
Load a PFX from BinData
See more PFX/P12 Examples
Demonstrates Pfx.LoadPfxBd, which loads a PFX / PKCS#12 container from the bytes held in a BinData object.
The file path is relative to the application's current working directory. An absolute path may also be used. Supply the path appropriate to your own environment.
Background. This is the in-memory equivalent of LoadPfxFile, for when the PKCS#12 data is already available as bytes rather than in a file.
Chilkat AutoIt Downloads
Local $bSuccess = False
$oPfx = ObjCreate("Chilkat.Pfx")
; The file path is relative to the application's current working directory. An absolute path
; may also be used. Supply the path appropriate to your own environment.
; Load the PFX bytes into a BinData.
$oBd = ObjCreate("Chilkat.BinData")
Local $bLoaded = $oBd.LoadFile("qa_data/identity.pfx")
If ($bLoaded <> True) Then
ConsoleWrite("Failed to load the PFX file." & @CRLF)
Exit
EndIf
; The PFX password should come from a secure source rather than being hard-coded.
Local $sPassword = "myPfxPassword"
; Load the PFX / PKCS#12 container from the bytes held in the BinData.
$bSuccess = $oPfx.LoadPfxBd($oBd,$sPassword)
If ($bSuccess = False) Then
ConsoleWrite($oPfx.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Loaded " & $oPfx.NumCerts & " certificate(s)." & @CRLF)