Sample code for 30+ languages & platforms
AutoIt

Load Certificate from .cer and Private Key from .pem

See more Certificates Examples

Load a certificate from a .cer and its associated private key from a .pem.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

$oCert = ObjCreate("Chilkat.Cert")
$bSuccess = $oCert.LoadFromFile("C:/certs_and_keys/Certificate.cer")
If ($bSuccess = False) Then
    ConsoleWrite($oCert.LastErrorText & @CRLF)
    Exit
EndIf

$oSbPem = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oSbPem.LoadFile("C:/certs_and_keys/PrivateKey.pem","utf-8")
If ($bSuccess = False) Then
    ConsoleWrite("Failed to load private key PEM" & @CRLF)
    Exit
EndIf

$bSuccess = $oCert.SetPrivateKeyPem($oSbPem.GetAsString())
If ($bSuccess = False) Then
    ConsoleWrite($oCert.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("The certificate and associated private key are now loaded and ready for signing." & @CRLF)