PowerBuilder
PowerBuilder
Check for an S/MIME Signing Time
See more MIME Examples
Demonstrates the Chilkat Mime.HasSignatureSigningTime method, which returns whether the signer at a zero-based index included a CMS signingTime signed attribute. The only argument is the signer index; use NumSignerCerts for the count.
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: A signing time records when the signer claims to have signed, which matters for auditing and for validating a certificate that has since expired. It is an optional signed attribute, so not every signature has one — this predicate lets you check before calling
GetSignatureSigningTimeStr, avoiding an error for signers that omitted it. Being a signed attribute, it is covered by the signature and cannot be altered undetected.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Mime
integer n
integer i
li_Success = 0
loo_Mime = create oleobject
li_rc = loo_Mime.ConnectToNewObject("Chilkat.Mime")
if li_rc < 0 then
destroy loo_Mime
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = loo_Mime.LoadMimeFile("qa_data/signed.eml")
if li_Success = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
// After verifying, check whether each signer included a CMS signingTime signed attribute. The
// only argument is the zero-based signer index.
li_Success = loo_Mime.Verify()
if li_Success <> 1 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
n = loo_Mime.NumSignerCerts
for i = 0 to n - 1
if loo_Mime.HasSignatureSigningTime(i) then
Write-Debug "Signer " + string(i) + " included a signing time."
else
Write-Debug "Signer " + string(i) + " did not include a signing time."
end if
next
destroy loo_Mime