DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMime
Integer n
Integer i
String sSigningTime
String sTemp1
Boolean bTemp1
Move False To iSuccess
Get Create (RefClass(cComChilkatMime)) To hoMime
If (Not(IsComObjectCreated(hoMime))) Begin
Send CreateComObject of hoMime
End
Get ComLoadMimeFile Of hoMime "qa_data/signed.eml" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
// 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.
Get ComVerify Of hoMime To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComNumSignerCerts Of hoMime To n
For i From 0 To (n - 1)
// Only signers that included a signing time have one to retrieve.
Get ComHasSignatureSigningTime Of hoMime i To bTemp1
If (bTemp1) Begin
Get ComGetSignatureSigningTimeStr Of hoMime i To sSigningTime
Get ComLastMethodSuccess Of hoMime To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Signer " i " signing time: " sSigningTime
End
Loop
End_Procedure