PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Crypt
oleobject loo_CmsOptions
string ls_OutputFile
string ls_InFile
li_Success = 0
loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
destroy loo_Crypt
MessageBox("Error","Connecting to COM object failed")
return
end if
// Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
loo_CmsOptions = create oleobject
li_rc = loo_CmsOptions.ConnectToNewObject("Chilkat.JsonObject")
loo_CmsOptions.UpdateBool("ValidateTimestampTokens",1)
loo_Crypt.CmsOptions = loo_CmsOptions.Emit()
ls_OutputFile = "qa_output/original.xml"
ls_InFile = "qa_data/p7m/fattura_signature.xml.p7m"
// Verify the signature and extract the contained file, which in this case is XML.
li_Success = loo_Crypt.VerifyP7M(ls_InFile,ls_OutputFile)
if li_Success = 0 then
Write-Debug loo_Crypt.LastErrorText
destroy loo_Crypt
destroy loo_CmsOptions
return
end if
Write-Debug "Signature validated."
destroy loo_Crypt
destroy loo_CmsOptions