HOWTO: ZSmime

Ng Pheng Siong <ngps@post1.com>
Copyright 2000-2001. All rights reserved.


What is ZSmime?

ZSmime enables Zope to generate S/MIME-signed and -encrypted messages.

This is useful where Zope accepts confidential information over the web, e.g., credit card numbers, Swiss bank account instructions, etc. Such information can be protected by ZSmime and relayed off-site immediately. This reduces the value of the information carried on-site and in turn reduces the impact of a successful attack against the site.

Even if the S/MIME-protected information remains on-site, it is now encrypted - this introduces additional cost in defeating the protection and may mitigate the effect of a successful site penetration.

What is S/MIME?

S/MIME - Secure Multipurpose Internet Mail Extensions [RFC 2311, RFC 2312] - provides a consistent way to send and receive secure MIME data. Based on the popular Internet MIME standard, S/MIME provides the following cryptographic security services for electronic messaging applications - authentication, message integrity and non-repudiation of origin (using digital signatures) and privacy and data security (using encryption).

Keys and Certificates

To create an S/MIME-signed message, ZSmime needs an RSA key pair (this consists of a public key and a private key) and an X.509 certificate of said public key.

To create an S/MIME-encrypted message, ZSmime needs the recipients' certificates.

To create an S/MIME-signed and -encrypted message, ZSmime first signs the data to create a signed message, then encrypts the signed message with the public keys of the recipients.

You may generate key pairs and obtain certificates by using a commercial certification authority service such as Verisign.

You can also do so using freely-available software. For the purpose of automated S/MIME message-generation by Zope, this approach is cheap and effective.

We now work through the process using OpenSSL. This assumes you have OpenSSL installed properly on your system.

GuardedFile

GuardedFile is a Zope product that eases the creation of protected Zope File objects called, unsurprisingly, GuardedFiles. A GuardedFile is a Zope File that is accessible by proxy only.

You can configure a Zope File to be like a GuardedFile through Zope's management interface. The GuardedFile product simply makes the process much more convenient.

Setting Up ZSmime

Using ZSmime

Setting Up Netscape Messenger

Suppose The Back Office reads mail using Netscape Messenger. Here's how to import the signer's certificate and the recipient certificate and key into Messenger, in order to read S/MIME messages from The Order Bot:

The Back Office is now able to decrypt and read The Order Bot's messages with Messenger. Messenger will indicate that each message is "encrypted and signed" via the "stamp" icon on the message window's top right corner.

Clicking on the "stamp" icon will bring you to the Security Info dialog box. Messenger informs you that the message is encrypted with 168-bit DES-EDE3-CBC and that it is digitally signed by the public key contained in the certificate zsmime_sender.pem.

Setting Up Microsoft Outlook

I do not know how to do this since I do not use Outlook. Information on this, as well as on other S/MIME tools, is gratefully accepted.

Security Discussion

ZSmime is designed to run autonomously; as such, the signer key cannot be passphrase-protected, since there may not be a human operator available to supply the passphrase. This means anyone who has access to the signer key can generate signatures with it.

(This practice causes debate in the security community periodically. Some argue that your operational procedure should be such that a person is always required (and available!) to supply passphrases and other necessary information. Ultimately, your security posture depends on the value of your web site and its threat model.)

The signer key should be single-purpose, i.e., its only use should be for your Zope application to generate S/MIME messages. It should also be reasonably well-handled from creation to installation on the Zope site. Within Zope, it is protected by Zope's permissions settings; as such, it should be installed as a GuardedFile.

ZSmime uses the signer key to provide message integrity and non-repudiation of origin.

It is possible to operate ZSmime with just recipient certificates; however, this means S/MIME messages you receive that are encrypted to those recipient certificates may not necessarily originate from your Zope site. (This mode of operation is not enabled.)

The recipient certificates should also be uploaded into Zope as GuardedFiles. This prevents an adversary from grabbing those certificates off your site and flooding you with S/MIME-encrypted mail.

You should upload the key and certificates over HTTPS.

Cryptography

ZSmime uses three-key triple-DES, as supported by "strong cryptography" versions of Netscape Messenger and Microsoft Outlook.

You can change the cryptographic algorithm to 40-bit RC2, as supported by "weak cryptography" versions of Messenger and Outlook, by modifying ZSmime's source code. This is not recommended.

ZSmime Licensing

ZSmime is published under the Zope Public Licence (ZPL). All rights reserved. Usual disclaimers apply.

Acknowledgements

Thanks to: