Rust
Rust
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 Rust Downloads
let crypt = chilkat::Crypt2::new();
// Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes.
let cms_options = chilkat::JsonObject::new();
let _ = cms_options.update_bool("ValidateTimestampTokens", true);
crypt.set_cms_options(&cms_options.emit().unwrap_or_default());
let output_file = "qa_output/original.xml".to_string();
let in_file = "qa_data/p7m/fattura_signature.xml.p7m".to_string();
// Verify the signature and extract the contained file, which in this case is XML.
if crypt.verify_p7_m(&in_file, &output_file).is_err() {
println!("{}", crypt.last_error_text());
return;
}
println!("Signature validated.");