Rust
Rust
Get an S/MIME Signing Time
See more MIME Examples
Demonstrates the Chilkat Mime.GetSignatureSigningTimeStr method, which returns the CMS signingTime attribute for the signer at a zero-based index, as an RFC 822-style date string in GMT. The only argument is the signer index.
Note: The file paths are relative to the application's current working directory. Absolute paths may also be used. Supply the paths appropriate to your own environment.
Background: This is the timestamp the signer asserted at signing — useful for "when was this signed" audit trails and for evaluating whether the signing certificate was valid at that moment. Because it is a signed attribute, it is tamper-evident. Guard the call with
HasSignatureSigningTime, since the attribute is optional. Note it is the signer's claim, not a trusted third-party timestamp.Chilkat Rust Downloads
let mime = chilkat::Mime::new();
if mime.load_mime_file("qa_data/signed.eml").is_err() {
println!("{}", mime.last_error_text());
return;
}
// After verifying, get the CMS signingTime for each signer that has one, as an RFC 822 date string
// in GMT. The only argument is the zero-based signer index.
if mime.verify().is_err() {
println!("{}", mime.last_error_text());
return;
}
let n = mime.num_signer_certs();
for i in 0..n {
// Only signers that included a signing time have one to retrieve.
if mime.has_signature_signing_time(i) {
let Ok(signing_time) = mime.get_signature_signing_time_str(i) else {
println!("{}", mime.last_error_text());
return;
};
println!("Signer {} signing time: {}", i, signing_time);
}
}