aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorJens Lechtenboerger2016-01-03 01:10:34 +0000
committerKatsumi Yamaoka2016-01-03 01:10:34 +0000
commit5213ded9aab68d83c306aa2f4880c8a1abd3608c (patch)
tree67bf83af8552079df3a2f559174a02e58fdd739e /doc/misc
parent43662a240b682de94299e797452ba56d01a04883 (diff)
downloademacs-5213ded9aab68d83c306aa2f4880c8a1abd3608c.tar.gz
emacs-5213ded9aab68d83c306aa2f4880c8a1abd3608c.zip
Refactor mml-smime.el, mml1991.el, mml2015.el
(Maybe this is the last merge from Gnus git to Emacs git) Cf. discussion on ding mailing list, messages in <http://thread.gmane.org/gmane.emacs.gnus.general/86228>. Common code from the three files mml-smime.el, mml1991.el, and mml2015.el is moved to mml-sec.el. Auxiliary functions are added to gnus-util.el. The code is supported by test cases with necessary test keys. Documentation in message.texi is updated. * doc/misc/message.texi (Security, Using S/MIME): Update for refactoring mml-smime.el, mml1991.el, mml2015.el. (Using OpenPGP): Rename from "Using PGP/MIME"; update contents. (Passphrase caching, Encrypt-to-self, Bcc Warning): New sections. * lisp/gnus/gnus-util.el (gnus-test-list, gnus-subsetp, gnus-setdiff): New functions. * lisp/gnus/mml-sec.el: Require gnus-util and epg. (epa--select-keys): Autoload. (mml-signencrypt-style-alist, mml-secure-cache-passphrase): Doc fix. (mml-secure-openpgp-signers): New user option; make mml1991-signers and mml2015-signers obsolete aliases to it. (mml-secure-smime-signers): New user option; make mml-smime-signers an obsolete alias to it. (mml-secure-openpgp-encrypt-to-self): New user option; make mml1991-encrypt-to-self and mml2015-encrypt-to-self obsolete aliases to it. (mml-secure-smime-encrypt-to-self): New user option; make mml-smime-encrypt-to-self an obsolete alias to it. (mml-secure-openpgp-sign-with-sender): New user option; make mml2015-sign-with-sender an obsolete alias to it. (mml-secure-smime-sign-with-sender): New user option; make mml-smime-sign-with-sender an obsolete alias to it. (mml-secure-openpgp-always-trust): New user option; make mml2015-always-trust an obsolete alias to it. (mml-secure-fail-when-key-problem, mml-secure-key-preferences): New user options. (mml-secure-cust-usage-lookup, mml-secure-cust-fpr-lookup) (mml-secure-cust-record-keys, mml-secure-cust-remove-keys) (mml-secure-add-secret-key-id, mml-secure-clear-secret-key-id-list) (mml-secure-cache-passphrase-p, mml-secure-cache-expiry-interval) (mml-secure-passphrase-callback, mml-secure-check-user-id) (mml-secure-secret-key-exists-p, mml-secure-check-sub-key) (mml-secure-find-usable-keys, mml-secure-select-preferred-keys) (mml-secure-fingerprint, mml-secure-filter-keys) (mml-secure-normalize-cust-name, mml-secure-select-keys) (mml-secure-select-keys-1, mml-secure-signer-names, mml-secure-signers) (mml-secure-self-recipients, mml-secure-recipients) (mml-secure-epg-encrypt, mml-secure-epg-sign): New functions. * lisp/gnus/mml-smime.el: Require epg; refactor declaration and autoloading of epg functions. (mml-smime-use): Doc fix. (mml-smime-cache-passphrase, mml-smime-passphrase-cache-expiry): Obsolete. (mml-smime-get-dns-cert, mml-smime-get-ldap-cert): Use format instead of gnus-format-message. (mml-smime-epg-secret-key-id-list): Remove variable. (mml-smime-epg-passphrase-callback, mml-smime-epg-find-usable-key) (mml-smime-epg-find-usable-secret-key): Remove functions. (mml-smime-epg-sign, mml-smime-epg-encrypt): Refactor. * lisp/gnus/mml1991.el (mml1991-cache-passphrase) (mml1991-passphrase-cache-expiry): Obsolete. (mml1991-epg-secret-key-id-list): Remove variable. (mml1991-epg-passphrase-callback, mml1991-epg-find-usable-key) (mml1991-epg-find-usable-secret-key): Remove functions. (mml1991-epg-sign, mml1991-epg-encrypt): Refactor. * lisp/gnus/mml2015.el (mml2015-cache-passphrase) (mml2015-passphrase-cache-expiry): Obsolete. (mml2015-epg-secret-key-id-list): Remove variable. (mml2015-epg-passphrase-callback, mml2015-epg-check-user-id) (mml2015-epg-check-sub-key, mml2015-epg-find-usable-key) (mml2015-epg-find-usable-secret-key): Remove functions. (mml2015-epg-decrypt, mml2015-epg-clear-decrypt, mml2015-epg-sign) (mml2015-epg-encrypt): Refactor.
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/message.texi195
1 files changed, 172 insertions, 23 deletions
diff --git a/doc/misc/message.texi b/doc/misc/message.texi
index dbc77592a03..761fb772f46 100644
--- a/doc/misc/message.texi
+++ b/doc/misc/message.texi
@@ -938,16 +938,82 @@ Libidn} installed in order to use this functionality.
938@cindex encrypt 938@cindex encrypt
939@cindex secure 939@cindex secure
940 940
941Using the @acronym{MML} language, Message is able to create digitally 941By default, e-mails are transmitted without any protection around the
942signed and digitally encrypted messages. Message (or rather 942Internet, which implies that they can be read and changed by lots of
943@acronym{MML}) currently support @acronym{PGP} (RFC 1991), 943different parties. In particular, they are analyzed under bulk
944@acronym{PGP/MIME} (RFC 2015/3156) and @acronym{S/MIME}. 944surveillance, which violates basic human rights. To defend those
945rights, digital self-defense is necessary (in addition to legal
946changes), and encryption and digital signatures are powerful
947techniques for self-defense. In essence, encryption ensures that
948only the intended recipient will be able to read a message, while
949digital signatures make sure that modifications to messages can be
950detected by the recipient.
951
952Nowadays, there are two major incompatible e-mail encryption
953standards, namely @acronym{OpenPGP} and @acronym{S/MIME}. Both of
954these standards are implemented by the @uref{https://www.gnupg.org/,
955GNU Privacy Guard (GnuPG)}, which needs to be installed as external
956software in addition to GNU Emacs. Before you can start to encrypt,
957decrypt, and sign messages, you need to create a so-called key-pair,
958which consists of a private key and a public key. Your @emph{public} key
959(also known as @emph{certificate}, in particular with @acronym{S/MIME}), is
960used by others (a) to encrypt messages intended for you and (b) to verify
961digital signatures created by you. In contrast, you use your @emph{private}
962key (a) to decrypt messages and (b) to sign messages. (You may want to
963think of your public key as an open safe that you offer to others such
964that they can deposit messages and lock the door, while your private
965key corresponds to the opening combination for the safe.)
966
967Thus, you need to perform the following steps for e-mail encryption,
968typically outside Emacs. See, for example, the
969@uref{https://www.gnupg.org/gph/en/manual.html, The GNU Privacy
970Handbook} for details covering the standard @acronym{OpenPGP} with
971@acronym{GnuPG}.
972@enumerate
973@item
974Install GnuPG.
975@item
976Create a key-pair for your own e-mail address.
977@item
978Distribute your public key, e.g., via upload to key servers.
979@item
980Import the public keys for the recipients to which you want to send
981encrypted e-mails.
982@end enumerate
983
984Whether to use the standard @acronym{OpenPGP} or @acronym{S/MIME} is
985beyond the scope of this documentation. Actually, you can use one
986standard for one set of recipients and the other standard for
987different recipients (depending their preferences or capabilities).
988
989In case you are not familiar with all those acronyms: The standard
990@acronym{OpenPGP} is also called @acronym{PGP} (Pretty Good Privacy).
991The command line tools offered by @acronym{GnuPG} for
992@acronym{OpenPGP} are called @command{gpg} and @command{gpg2}, while
993the one for @acronym{S/MIME} is called @command{gpgsm}. An
994alternative, but discouraged, tool for @acronym{S/MIME} is
995@command{openssl}. To make matters worse, e-mail messages can be
996formed in two different ways with @acronym{OpenPGP}, namely
997@acronym{PGP} (RFC 1991/4880) and @acronym{PGP/MIME} (RFC 2015/3156).
998
999The good news, however, is the following: In GNU Emacs, Message
1000supports all those variants, comes with reasonable defaults that can
1001be customized according to your needs, and invokes the proper command
1002line tools behind the scenes for encryption, decryption, as well as
1003creation and verification of digital signatures.
1004
1005Message uses the @acronym{MML} language for the creation of signed
1006and/or encrypted messages as explained in the following.
1007
945 1008
946@menu 1009@menu
947* Signing and encryption:: Signing and encrypting commands. 1010* Signing and encryption:: Signing and encrypting commands.
948* Using S/MIME:: Using S/MIME 1011* Using S/MIME:: Using S/MIME
949* Using PGP/MIME:: Using PGP/MIME 1012* Using OpenPGP:: Using OpenPGP
1013* Passphrase caching:: How to cache passphrases
950* PGP Compatibility:: Compatibility with older implementations 1014* PGP Compatibility:: Compatibility with older implementations
1015* Encrypt-to-self:: Reading your own encrypted messages
1016* Bcc Warning:: Do not use encryption with Bcc headers
951@end menu 1017@end menu
952 1018
953@node Signing and encryption 1019@node Signing and encryption
@@ -1041,11 +1107,45 @@ programs are required to make things work, and some small general hints.
1041@node Using S/MIME 1107@node Using S/MIME
1042@subsection Using S/MIME 1108@subsection Using S/MIME
1043 1109
1044@emph{Note!} This section assume you have a basic familiarity with 1110@acronym{S/MIME} requires an external implementation, such as
1045modern cryptography, @acronym{S/MIME}, various PKCS standards, OpenSSL and 1111@uref{https://www.gnupg.org/, GNU Privacy Guard} or
1046so on. 1112@uref{https://www.openssl.org/, OpenSSL}. The default Emacs interface
1113to the S/MIME implementation is EasyPG (@pxref{Top,,EasyPG Assistant
1114User's Manual, epa, EasyPG Assistant User's Manual}), which has been
1115included in Emacs since version 23 and which relies on the command
1116line tool @command{gpgsm} provided by @acronym{GnuPG}. That tool
1117implements certificate management, including certificate revocation
1118and expiry, while such tasks need to be performed manually, if OpenSSL
1119is used.
1120
1121The choice between EasyPG and OpenSSL is controlled by the variable
1122@code{mml-smime-use}, which needs to be set to the value @code{epg}
1123for EasyPG. Depending on your version of Emacs that value may be the
1124default; if not, you can either customize that variable or place the
1125following line in your @file{.emacs} file (that line needs to be
1126placed above other code related to message/gnus/encryption):
1127
1128@lisp
1129(require 'epg)
1130@end lisp
1131
1132Moreover, you may want to customize the variables
1133@code{mml-default-encrypt-method} and
1134@code{mml-default-sign-method} to the string @code{"smime"}.
1135
1136That's all if you want to use S/MIME with EasyPG, and that's the
1137recommended way of using S/MIME with Message.
1138
1139If you think about using OpenSSL instead of EasyPG, please read the
1140BUGS section in the manual for the @command{smime} command coming with
1141OpenSSL first. If you still want to use OpenSSL, the following
1142applies.
1143
1144@emph{Note!} The remainder of this section assumes you have a basic
1145familiarity with modern cryptography, @acronym{S/MIME}, various PKCS
1146standards, OpenSSL and so on.
1047 1147
1048The @acronym{S/MIME} support in Message (and @acronym{MML}) require 1148The @acronym{S/MIME} support in Message (and @acronym{MML}) can use
1049OpenSSL@. OpenSSL performs the actual @acronym{S/MIME} sign/encrypt 1149OpenSSL@. OpenSSL performs the actual @acronym{S/MIME} sign/encrypt
1050operations. OpenSSL can be found at @uref{http://www.openssl.org/}. 1150operations. OpenSSL can be found at @uref{http://www.openssl.org/}.
1051OpenSSL 0.9.6 and later should work. Version 0.9.5a cannot extract mail 1151OpenSSL 0.9.6 and later should work. Version 0.9.5a cannot extract mail
@@ -1101,26 +1201,44 @@ you use unencrypted keys (e.g., if they are on a secure storage, or if
1101you are on a secure single user machine) simply press @code{RET} at 1201you are on a secure single user machine) simply press @code{RET} at
1102the passphrase prompt. 1202the passphrase prompt.
1103 1203
1104@node Using PGP/MIME 1204@node Using OpenPGP
1105@subsection Using PGP/MIME 1205@subsection Using OpenPGP
1106 1206
1107@acronym{PGP/MIME} requires an external OpenPGP implementation, such 1207Use of OpenPGP requires an external software, such
1108as @uref{http://www.gnupg.org/, GNU Privacy Guard}. Pre-OpenPGP 1208as @uref{https://www.gnupg.org/, GNU Privacy Guard}. Pre-OpenPGP
1109implementations such as PGP 2.x and PGP 5.x are also supported. The 1209implementations such as PGP 2.x and PGP 5.x are also supported. The
1110default Emacs interface to the PGP implementation is EasyPG 1210default Emacs interface to the PGP implementation is EasyPG
1111(@pxref{Top,,EasyPG Assistant User's Manual, epa, EasyPG Assistant 1211(@pxref{Top,,EasyPG Assistant User's Manual, epa, EasyPG Assistant
1112User's Manual}), but PGG (@pxref{Top, ,PGG, pgg, PGG Manual}) and 1212User's Manual}), but PGG (@pxref{Top, ,PGG, pgg, PGG Manual}) and
1113Mailcrypt are also supported. @xref{PGP Compatibility}. 1213Mailcrypt are also supported. @xref{PGP Compatibility}.
1114 1214
1215As stated earlier, messages encrypted with OpenPGP can be formatted
1216according to two different standards, namely @acronym{PGP} or
1217@acronym{PGP/MIME}. The variables
1218@code{mml-default-encrypt-method} and
1219@code{mml-default-sign-method} determine which variant to prefer,
1220@acronym{PGP/MIME} by default.
1221
1222@node Passphrase caching
1223@subsection Passphrase caching
1224
1115@cindex gpg-agent 1225@cindex gpg-agent
1116Message internally calls GnuPG (the @command{gpg} command) to perform 1226Message with EasyPG internally calls GnuPG (the @command{gpg} or
1227@command{gpgsm} command) to perform
1117data encryption, and in certain cases (decrypting or signing for 1228data encryption, and in certain cases (decrypting or signing for
1118example), @command{gpg} requires user's passphrase. Currently the 1229example), @command{gpg}/@command{gpgsm} requires user's passphrase.
1119recommended way to supply your passphrase to @command{gpg} is to use the 1230Currently the recommended way to supply your passphrase is to use the
1120@command{gpg-agent} program. 1231@command{gpg-agent} program.
1121 1232
1122To use @command{gpg-agent} in Emacs, you need to run the following 1233In particular, the @command{gpg-agent} program supports passphrase
1123command from the shell before starting Emacs. 1234caching so that you do not need to enter your passphrase for every
1235decryption/sign operation. @xref{Agent Options, , , gnupg, Using the
1236GNU Privacy Guard}.
1237
1238How to use @command{gpg-agent} in Emacs depends on your version of
1239GnuPG. With GnuPG version 2.1, @command{gpg-agent} is started
1240automatically if necessary. With older versions you may need to run
1241the following command from the shell before starting Emacs.
1124 1242
1125@example 1243@example
1126eval `gpg-agent --daemon` 1244eval `gpg-agent --daemon`
@@ -1135,11 +1253,10 @@ GNU Privacy Guard}.
1135Once your @command{gpg-agent} is set up, it will ask you for a 1253Once your @command{gpg-agent} is set up, it will ask you for a
1136passphrase as needed for @command{gpg}. Under the X Window System, 1254passphrase as needed for @command{gpg}. Under the X Window System,
1137you will see a new passphrase input dialog appear. The dialog is 1255you will see a new passphrase input dialog appear. The dialog is
1138provided by PIN Entry (the @command{pinentry} command), and as of 1256provided by PIN Entry (the @command{pinentry} command), reasonably
1139version 0.7.2, @command{pinentry} cannot cooperate with Emacs on a 1257recent versions of which can also cooperate with Emacs on a text
1140single tty. So, if you are using a text console, you may need to put 1258console. If that does not work, you may need to put a passphrase into
1141a passphrase into gpg-agent's cache beforehand. The following command 1259gpg-agent's cache beforehand. The following command does the trick.
1142does the trick.
1143 1260
1144@example 1261@example
1145gpg --use-agent --sign < /dev/null > /dev/null 1262gpg --use-agent --sign < /dev/null > /dev/null
@@ -1181,6 +1298,38 @@ message that can be understood by PGP version 2.
1181(Refer to @uref{http://www.gnupg.org/gph/en/pgp2x.html} for more 1298(Refer to @uref{http://www.gnupg.org/gph/en/pgp2x.html} for more
1182information about the problem.) 1299information about the problem.)
1183 1300
1301@node Encrypt-to-self
1302@subsection Encrypt-to-self
1303
1304By default, messages are encrypted to all recipients (@code{To},
1305@code{Cc}, @code{Bcc} headers). Thus, you will not be able to decrypt
1306your own messages. To make sure that messages are also encrypted to
1307your own key(s), several alternative solutions exist:
1308@enumerate
1309@item
1310Use the @code{encrypt-to} option in the file @file{gpg.conf} (for
1311OpenPGP) or @file{gpgsm.conf} (for @acronym{S/MIME} with EasyPG).
1312@xref{Invoking GPG, , , gnupg, Using the GNU Privacy Guard}, or
1313@xref{Invoking GPGSM, , , gnupg, Using the GNU Privacy Guard}.
1314@item
1315Include your own e-mail address (for which you created a key-pair)
1316among the recipients.
1317@item
1318Customize the variable @code{mml-secure-openpgp-encrypt-to-self} (for
1319OpenPGP) or @code{mml-secure-smime-encrypt-to-self} (for
1320@acronym{S/MIME} with EasyPG).
1321@end enumerate
1322
1323@node Bcc Warning
1324@subsection Bcc Warning
1325
1326The @code{Bcc} header is meant to hide recipients of messages.
1327However, when encrypted messages are used, the e-mail addresses of all
1328@code{Bcc}-headers are given away to all recipients without
1329warning, which is a bug, see
1330@uref{https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18718}.
1331
1332
1184@node Various Commands 1333@node Various Commands
1185@section Various Commands 1334@section Various Commands
1186 1335