Lua
Lua
Clear the S/MIME Recipient Certificate List
See more MIME Examples
Demonstrates ClearEncryptCerts, which empties the recipient-certificate list previously populated by AddEncryptCert. This is useful to start over with a different set of recipients before calling EncryptN.
Background. The recipient list is internal state that accumulates across AddEncryptCert calls. ClearEncryptCerts resets it so a subsequent EncryptN encrypts only for the certificates added afterward.
Chilkat Lua Downloads
local chilkat = require("chilkat")
local mime = chilkat.Mime.new()
local success = mime:set_body_from_plain_text("This message will be encrypted.")
if not success then
print(mime.last_error_text)
return
end
-- Add a recipient certificate.
local cert = chilkat.Cert.new()
success = cert:load_from_file("qa_data/recipient.cer")
if not success then
print(cert.last_error_text)
return
end
success = mime:add_encrypt_cert(cert)
if not success then
print(mime.last_error_text)
return
end
-- ClearEncryptCerts empties the recipient-certificate list, for example to start over with a
-- different set of recipients before calling EncryptN. It is a void method.
mime:clear_encrypt_certs()
print("Recipient certificate list cleared.")