Lua
Lua
Verify the Timestamp Server Token (if any) while Validating a CMS Signature
Demonstrates how to also validate the timestamp server token (if any) while validating a CMS signature.Chilkat Lua Downloads
local chilkat = require("chilkat")
local crypt = chilkat.Crypt2.new()
-- Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
local cmsOptions = chilkat.JsonObject.new()
cmsOptions:update_bool("ValidateTimestampTokens", true)
crypt.cms_options = cmsOptions:emit()
local outputFile = "qa_output/original.xml"
local inFile = "qa_data/p7m/fattura_signature.xml.p7m"
-- Verify the signature and extract the contained file, which in this case is XML.
local success = crypt:verify_p7_m(inFile, outputFile)
if not success then
print(crypt.last_error_text)
return
end
print("Signature validated.")