Sample code for 30+ languages & platforms
Lianja

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

Lianja
llSuccess = .F.

loCrypt = createobject("CkCrypt2")

// Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
loCmsOptions = createobject("CkJsonObject")
loCmsOptions.UpdateBool("ValidateTimestampTokens",.T.)
loCrypt.CmsOptions = loCmsOptions.Emit()

lcOutputFile = "qa_output/original.xml"
lcInFile = "qa_data/p7m/fattura_signature.xml.p7m"

// Verify the signature and extract the contained file, which in this case is XML.
llSuccess = loCrypt.VerifyP7M(lcInFile,lcOutputFile)
if (llSuccess = .F.) then
    ? loCrypt.LastErrorText
    release loCrypt
    release loCmsOptions
    return
endif

? "Signature validated."


release loCrypt
release loCmsOptions