Sample code for 30+ languages & platforms
Lua

Example: Crypt2.SetDecryptCert method

Demonstrates how to call the SetDecryptCert method.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local cert = chilkat.Cert.new()

local success = cert:load_pfx_file("c:/pfx_files/my.pfx", "password")
if not success then
    print(cert.last_error_text)
    return
end

local decrypt = chilkat.Crypt2.new()
decrypt.crypt_algorithm = "pki"

success = decrypt:set_decrypt_cert(cert)
if not success then
    print(decrypt.last_error_text)
    return
end

local bd = chilkat.BinData.new()
success = bd:load_file("c:/someDir/pkcs7_encrypted.dat")

success = decrypt:decrypt_bd(bd)
if not success then
    print(decrypt.last_error_text)
    return
end

-- bd contains the decrypted content.