Sample code for 30+ languages & platforms
Lua

Example: Crypt2.ClearSigningCerts method

Demonstrates how to call the ClearSigningCerts method.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local crypt = chilkat.Crypt2.new()
local success = false

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

local cert1 = chilkat.Cert.new()
-- ...
-- Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
-- ...
crypt:add_signing_cert(cert1)

local cert2 = chilkat.Cert.new()
-- ...
crypt:add_signing_cert(cert2)

local cert3 = chilkat.Cert.new()
-- ...
crypt:add_signing_cert(cert3)

local bd = chilkat.BinData.new()
-- ...

success = crypt:opaque_sign_bd(bd)

-- Let's say we now want to sign something else with different certs..
-- First clear the signing certs.
crypt:clear_signing_certs()

local cert4 = chilkat.Cert.new()
-- ...
crypt:add_signing_cert(cert4)

local cert5 = chilkat.Cert.new()
-- ...
crypt:add_signing_cert(cert5)

-- ...
-- ...

-- Sign using cert4 and cert5.
success = crypt:opaque_sign_bd(bd)