(Tcl) 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.
load ./chilkat.dll
set crypt [new_CkCrypt2]
# Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
set cmsOptions [new_CkJsonObject]
CkJsonObject_UpdateBool $cmsOptions "ValidateTimestampTokens" 1
CkCrypt2_put_CmsOptions $crypt [CkJsonObject_emit $cmsOptions]
set outputFile "qa_output/original.xml"
set inFile "qa_data/p7m/fattura_signature.xml.p7m"
# Verify the signature and extract the contained file, which in this case is XML.
set success [CkCrypt2_VerifyP7M $crypt $inFile $outputFile]
if {$success == 0} then {
puts [CkCrypt2_lastErrorText $crypt]
delete_CkCrypt2 $crypt
delete_CkJsonObject $cmsOptions
exit
}
puts "Signature validated."
delete_CkCrypt2 $crypt
delete_CkJsonObject $cmsOptions
|