Sign method will digitally sign your message before it's
delivered to the recipient. You need valid certificate (and private
key) in order to sign a message. Messages are signed using S/MIME
version 3 specification.
Typical usage will be like this:
- ' initialize wodSmtp and create some message
Dim Smtp1 As New wodSmtpCom
Smtp1.CreateSimple "someone@somehost.com", "recipient@otherhost.com",
"Subject goes here", "Text goes here"
' now initialize certificate and load
your personal certificate
Dim cert As New Certificate
cert.LoadKey "c:\mbx\thawte.pfx", "your_password"
cert.Load "c:\mbx\thawte.pfx", "your_password"
'and sign the message
Smtp1.Message.Sign cert
' optionally, save the message
Smtp1.Message.Save App.Path & "\signed.eml"
above code will create new message and sign it using certificate
stored in PFX file.
It is important that you DO NOT CHANGE
message contents after signing it - meaning Sign method call should
be LAST method/property used
before you call
SendMessage method. Failing to do so will cause clients to
report 'message has been tampered' when they try to open it.
Note: currently wodSmtp does not support signing using
(protected) certificates in Windows certificate store, but support
for that will be added shortly, so that, for example, code like this
will be valid:
- Dim cert As New CertLocation
Smtp1.Message.Sign cert(CurrentUser).Item("My").Item("Thawte Freemail
Member")