Sample code for 30+ languages & platforms
AutoIt

Example: Crypt2.ClearEncryptCerts method

Demonstrates how to call the ClearEncryptCerts method.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

$oCrypt = ObjCreate("Chilkat.Crypt2")

; Tell the crypt object to use 3 certificates.
; Do this by calling AddEncryptCert for each certificate.

$oCert1 = ObjCreate("Chilkat.Cert")
; ...
; Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
; ...
$oCrypt.AddEncryptCert $oCert1

$oCert2 = ObjCreate("Chilkat.Cert")
; ...
$oCrypt.AddEncryptCert $oCert2

$oCert3 = ObjCreate("Chilkat.Cert")
; ...
$oCrypt.AddEncryptCert $oCert3

; Params for public-key encryption to create PKCS7 enveloped-data
$oCrypt.CryptAlgorithm = "pki"
$oCrypt.Pkcs7CryptAlg = "aes"
$oCrypt.KeyLength = 256
$oCrypt.OaepHash = "sha256"
$oCrypt.OaepPadding = True

$oBd = ObjCreate("Chilkat.BinData")
; ...
$bSuccess = $oCrypt.EncryptBd($oBd)

; Let's say we now want to encrypt something else with different certs..
; First clear the encryption certs.
$oCrypt.ClearEncryptCerts 

$oCert4 = ObjCreate("Chilkat.Cert")
; ...
$oCrypt.AddEncryptCert $oCert4

$oCert5 = ObjCreate("Chilkat.Cert")
; ...
$oCrypt.AddEncryptCert $oCert5

; ...
; ...

; Encrypt using cert4 and cert5.
$bSuccess = $oCrypt.EncryptBd($oBd)