(Visual FoxPro) 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.
LOCAL loCrypt
LOCAL loCmsOptions
LOCAL lcOutputFile
LOCAL lcInFile
LOCAL lnSuccess
loCrypt = CreateObject('Chilkat.Crypt2')
* Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
loCmsOptions = CreateObject('Chilkat.JsonObject')
loCmsOptions.UpdateBool("ValidateTimestampTokens",1)
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.
lnSuccess = loCrypt.VerifyP7M(lcInFile,lcOutputFile)
IF (lnSuccess = 0) THEN
? loCrypt.LastErrorText
RELEASE loCrypt
RELEASE loCmsOptions
CANCEL
ENDIF
? "Signature validated."
RELEASE loCrypt
RELEASE loCmsOptions
|