(AutoIt) Example: Crypt2.SetDecryptCert2 method
Demonstrates how to call the SetDecryptCert2 method. This example loads the certificate and private key from PEM files:
PEM Format
Certificate file (cert.pem or cert.crt ):
-----BEGIN CERTIFICATE-----
MIID... (base64-encoded data)
-----END CERTIFICATE-----
Private key file (key.pem or key.key ):
-----BEGIN PRIVATE KEY-----
MIIE... (base64-encoded data)
-----END PRIVATE KEY-----
$oCert = ObjCreate("Chilkat.Cert")
Local $bSuccess = $oCert.LoadFromFile("c:/certs_and_keys/certAbc.pem")
; Assume success...
$oPrivKey = ObjCreate("Chilkat.PrivateKey")
$bSuccess = $oPrivKey.LoadAnyFormatFile("c:/certs_and_keys/certAbc_key.pem")
; Assume success...
$oCrypt = ObjCreate("Chilkat.Crypt2")
$oCrypt.CryptAlgorithm = "pki"
; ...
; ...
$bSuccess = $oCrypt.SetDecryptCert2($oCert,$oPrivKey)
If ($bSuccess = False) Then
ConsoleWrite($oCrypt.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Success." & @CRLF)
|