(Swift) 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.
func chilkatTest() {
let crypt = CkoCrypt2()!
// Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
let cmsOptions = CkoJsonObject()!
cmsOptions.updateBool("ValidateTimestampTokens", value: true)
crypt.cmsOptions = cmsOptions.emit()
var outputFile: String? = "qa_output/original.xml"
var inFile: String? = "qa_data/p7m/fattura_signature.xml.p7m"
// Verify the signature and extract the contained file, which in this case is XML.
var success: Bool = crypt.verifyP7M(inFile, destPath: outputFile)
if success == false {
print("\(crypt.lastErrorText!)")
return
}
print("Signature validated.")
}
|