Persits Software, Inc. Knowledge Base Articles

HOWTO: Sending secure mail encrypted with 168-bit Triple-DES

Problem Summary

This article explains how to send secure mail encrypted with the 168-bit Triple-DES cipher as opposed to 40-bit RC2 using AspEncrypt and AspEmail.


The following code snippet (taken from the web site) sends 40-bit encrypted email:

Set CM = Server.CreateObject("Persits.CryptoManager")
Set Mail = Server.CreateObject("Persits.MailSender")
Set Context = CM.OpenContext("mycontainer", True )
Set RecipientCert = CM.ImportCertFromFile("d:\his.cer")

Set Msg = Context.CreateMessage
Msg.AddRecipientCert RecipientCert

' Send Encrypted Message
Mail.Host = ""
Mail.Subject = "Encrypted message"
Mail.From = ""
Mail.FromName = "Very Hot Cakes, Inc."
Mail.AddAddress ""
Mail.Body = "Here is your receipt."
Mail.SendEncrypted Msg
' Use CryptoMessage object

To change the cipher from 40-bit RC2 to 168-bit Triple-DES, pass True to the CreateMessage method, as follows:

Set Msg = Context.CreateMessage( True )

Note that the use of the Triple-DES algorithm requires the Microsoft Enhanced Cryptographic provider, otherwise the error "Invalid algorithm specified" will be thrown. See the following article for details on how to install and configure the necessary cryptographic provider.

PS01032928 - Invalid flags specified/Invalid algorithm specified error when using strong encryption