Skip to Content
Linux Security Cookbook
book

Linux Security Cookbook

by Daniel J. Barrett, Richard E. Silverman, Robert G. Byrnes
June 2003
Intermediate to advanced
336 pages
8h 54m
English
O'Reilly Media, Inc.
Content preview from Linux Security Cookbook

8.1. Encrypted Mail with Emacs

Problem

You use an Emacs mailer (vm, rmail, etc.) and want to send and receive encrypted email messages.

Solution

Use mailcrypt.el with GnuPG:

               ~/.emacs:
(load-library "mailcrypt")
(mc-setversion "gpg")

Then open a mail buffer, and use any Mailcrypt functions or variables as desired:

mc-encrypt

Encrypt the mail message in the current buffer

mc-decrypt

Decrypt the mail message in the current buffer

mc-sign

Sign the mail message in the current buffer

mc-verify

Verify the signature of the mail message in the current buffer

mc-insert-public-key

Insert your public key, in ASCII format, into the current buffer

...and many more.

Discussion

Mailcrypt is an Emacs package for encrypting, decrypting, and cryptographically signing email messages. Once you have installed mailcrypt.el in your Emacs load path, e.g., by installing it in /usr/share/emacs/site-lisp, and loaded and configured it in your ~/.emacs file:

(load-library "mailcrypt")
(mc-setversion "gpg")

compose a mail message in your favorite Emacs-based mailer. When done writing the message, invoke:

M-x mc-encrypt

(or select the Encrypt function from the Mailcrypt menu). You’ll be prompted for the recipient, whose public key must be on your GnuPG keyring:

Recipients: jones@example.com

and then asked whether you want to sign the message, which is an optional step and requires your GnuPG passphrase.

Sign the message? (y or n)

Then voilà, your message becomes GnuPG-encrypted for that recipient:

-----BEGIN PGP MESSAGE----- ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Linux Security Cookbook - Second Edition

Practical Linux Security Cookbook - Second Edition

Tajinder Kalsi
Mastering Linux Command Line

Mastering Linux Command Line

Coding Gears | Train Your Brain

Publisher Resources

ISBN: 0596003919Errata Page