Sample code for 30+ languages & platforms
AutoIt

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 AutoIt Downloads

AutoIt
Local $bSuccess = False

$oCrypt = ObjCreate("Chilkat.Crypt2")

; Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
$oCmsOptions = ObjCreate("Chilkat.JsonObject")
$oCmsOptions.UpdateBool("ValidateTimestampTokens",True)
$oCrypt.CmsOptions = $oCmsOptions.Emit()

Local $sOutputFile = "qa_output/original.xml"
Local $sInFile = "qa_data/p7m/fattura_signature.xml.p7m"

; Verify the signature and extract the contained file, which in this case is XML.
$bSuccess = $oCrypt.VerifyP7M($sInFile,$sOutputFile)
If ($bSuccess = False) Then
    ConsoleWrite($oCrypt.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("Signature validated." & @CRLF)