diff options
| author | Jens Lechtenboerger | 2016-01-03 01:10:34 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2016-01-03 01:10:34 +0000 |
| commit | 5213ded9aab68d83c306aa2f4880c8a1abd3608c (patch) | |
| tree | 67bf83af8552079df3a2f559174a02e58fdd739e /doc/misc | |
| parent | 43662a240b682de94299e797452ba56d01a04883 (diff) | |
| download | emacs-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.texi | 195 |
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 | ||
| 941 | Using the @acronym{MML} language, Message is able to create digitally | 941 | By default, e-mails are transmitted without any protection around the |
| 942 | signed and digitally encrypted messages. Message (or rather | 942 | Internet, which implies that they can be read and changed by lots of |
| 943 | @acronym{MML}) currently support @acronym{PGP} (RFC 1991), | 943 | different parties. In particular, they are analyzed under bulk |
| 944 | @acronym{PGP/MIME} (RFC 2015/3156) and @acronym{S/MIME}. | 944 | surveillance, which violates basic human rights. To defend those |
| 945 | rights, digital self-defense is necessary (in addition to legal | ||
| 946 | changes), and encryption and digital signatures are powerful | ||
| 947 | techniques for self-defense. In essence, encryption ensures that | ||
| 948 | only the intended recipient will be able to read a message, while | ||
| 949 | digital signatures make sure that modifications to messages can be | ||
| 950 | detected by the recipient. | ||
| 951 | |||
| 952 | Nowadays, there are two major incompatible e-mail encryption | ||
| 953 | standards, namely @acronym{OpenPGP} and @acronym{S/MIME}. Both of | ||
| 954 | these standards are implemented by the @uref{https://www.gnupg.org/, | ||
| 955 | GNU Privacy Guard (GnuPG)}, which needs to be installed as external | ||
| 956 | software in addition to GNU Emacs. Before you can start to encrypt, | ||
| 957 | decrypt, and sign messages, you need to create a so-called key-pair, | ||
| 958 | which 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 | ||
| 960 | used by others (a) to encrypt messages intended for you and (b) to verify | ||
| 961 | digital signatures created by you. In contrast, you use your @emph{private} | ||
| 962 | key (a) to decrypt messages and (b) to sign messages. (You may want to | ||
| 963 | think of your public key as an open safe that you offer to others such | ||
| 964 | that they can deposit messages and lock the door, while your private | ||
| 965 | key corresponds to the opening combination for the safe.) | ||
| 966 | |||
| 967 | Thus, you need to perform the following steps for e-mail encryption, | ||
| 968 | typically outside Emacs. See, for example, the | ||
| 969 | @uref{https://www.gnupg.org/gph/en/manual.html, The GNU Privacy | ||
| 970 | Handbook} for details covering the standard @acronym{OpenPGP} with | ||
| 971 | @acronym{GnuPG}. | ||
| 972 | @enumerate | ||
| 973 | @item | ||
| 974 | Install GnuPG. | ||
| 975 | @item | ||
| 976 | Create a key-pair for your own e-mail address. | ||
| 977 | @item | ||
| 978 | Distribute your public key, e.g., via upload to key servers. | ||
| 979 | @item | ||
| 980 | Import the public keys for the recipients to which you want to send | ||
| 981 | encrypted e-mails. | ||
| 982 | @end enumerate | ||
| 983 | |||
| 984 | Whether to use the standard @acronym{OpenPGP} or @acronym{S/MIME} is | ||
| 985 | beyond the scope of this documentation. Actually, you can use one | ||
| 986 | standard for one set of recipients and the other standard for | ||
| 987 | different recipients (depending their preferences or capabilities). | ||
| 988 | |||
| 989 | In case you are not familiar with all those acronyms: The standard | ||
| 990 | @acronym{OpenPGP} is also called @acronym{PGP} (Pretty Good Privacy). | ||
| 991 | The command line tools offered by @acronym{GnuPG} for | ||
| 992 | @acronym{OpenPGP} are called @command{gpg} and @command{gpg2}, while | ||
| 993 | the one for @acronym{S/MIME} is called @command{gpgsm}. An | ||
| 994 | alternative, but discouraged, tool for @acronym{S/MIME} is | ||
| 995 | @command{openssl}. To make matters worse, e-mail messages can be | ||
| 996 | formed in two different ways with @acronym{OpenPGP}, namely | ||
| 997 | @acronym{PGP} (RFC 1991/4880) and @acronym{PGP/MIME} (RFC 2015/3156). | ||
| 998 | |||
| 999 | The good news, however, is the following: In GNU Emacs, Message | ||
| 1000 | supports all those variants, comes with reasonable defaults that can | ||
| 1001 | be customized according to your needs, and invokes the proper command | ||
| 1002 | line tools behind the scenes for encryption, decryption, as well as | ||
| 1003 | creation and verification of digital signatures. | ||
| 1004 | |||
| 1005 | Message uses the @acronym{MML} language for the creation of signed | ||
| 1006 | and/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 |
| 1045 | modern cryptography, @acronym{S/MIME}, various PKCS standards, OpenSSL and | 1111 | @uref{https://www.gnupg.org/, GNU Privacy Guard} or |
| 1046 | so on. | 1112 | @uref{https://www.openssl.org/, OpenSSL}. The default Emacs interface |
| 1113 | to the S/MIME implementation is EasyPG (@pxref{Top,,EasyPG Assistant | ||
| 1114 | User's Manual, epa, EasyPG Assistant User's Manual}), which has been | ||
| 1115 | included in Emacs since version 23 and which relies on the command | ||
| 1116 | line tool @command{gpgsm} provided by @acronym{GnuPG}. That tool | ||
| 1117 | implements certificate management, including certificate revocation | ||
| 1118 | and expiry, while such tasks need to be performed manually, if OpenSSL | ||
| 1119 | is used. | ||
| 1120 | |||
| 1121 | The 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} | ||
| 1123 | for EasyPG. Depending on your version of Emacs that value may be the | ||
| 1124 | default; if not, you can either customize that variable or place the | ||
| 1125 | following line in your @file{.emacs} file (that line needs to be | ||
| 1126 | placed above other code related to message/gnus/encryption): | ||
| 1127 | |||
| 1128 | @lisp | ||
| 1129 | (require 'epg) | ||
| 1130 | @end lisp | ||
| 1131 | |||
| 1132 | Moreover, 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 | |||
| 1136 | That's all if you want to use S/MIME with EasyPG, and that's the | ||
| 1137 | recommended way of using S/MIME with Message. | ||
| 1138 | |||
| 1139 | If you think about using OpenSSL instead of EasyPG, please read the | ||
| 1140 | BUGS section in the manual for the @command{smime} command coming with | ||
| 1141 | OpenSSL first. If you still want to use OpenSSL, the following | ||
| 1142 | applies. | ||
| 1143 | |||
| 1144 | @emph{Note!} The remainder of this section assumes you have a basic | ||
| 1145 | familiarity with modern cryptography, @acronym{S/MIME}, various PKCS | ||
| 1146 | standards, OpenSSL and so on. | ||
| 1047 | 1147 | ||
| 1048 | The @acronym{S/MIME} support in Message (and @acronym{MML}) require | 1148 | The @acronym{S/MIME} support in Message (and @acronym{MML}) can use |
| 1049 | OpenSSL@. OpenSSL performs the actual @acronym{S/MIME} sign/encrypt | 1149 | OpenSSL@. OpenSSL performs the actual @acronym{S/MIME} sign/encrypt |
| 1050 | operations. OpenSSL can be found at @uref{http://www.openssl.org/}. | 1150 | operations. OpenSSL can be found at @uref{http://www.openssl.org/}. |
| 1051 | OpenSSL 0.9.6 and later should work. Version 0.9.5a cannot extract mail | 1151 | OpenSSL 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 | |||
| 1101 | you are on a secure single user machine) simply press @code{RET} at | 1201 | you are on a secure single user machine) simply press @code{RET} at |
| 1102 | the passphrase prompt. | 1202 | the 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 | 1207 | Use of OpenPGP requires an external software, such |
| 1108 | as @uref{http://www.gnupg.org/, GNU Privacy Guard}. Pre-OpenPGP | 1208 | as @uref{https://www.gnupg.org/, GNU Privacy Guard}. Pre-OpenPGP |
| 1109 | implementations such as PGP 2.x and PGP 5.x are also supported. The | 1209 | implementations such as PGP 2.x and PGP 5.x are also supported. The |
| 1110 | default Emacs interface to the PGP implementation is EasyPG | 1210 | default 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 |
| 1112 | User's Manual}), but PGG (@pxref{Top, ,PGG, pgg, PGG Manual}) and | 1212 | User's Manual}), but PGG (@pxref{Top, ,PGG, pgg, PGG Manual}) and |
| 1113 | Mailcrypt are also supported. @xref{PGP Compatibility}. | 1213 | Mailcrypt are also supported. @xref{PGP Compatibility}. |
| 1114 | 1214 | ||
| 1215 | As stated earlier, messages encrypted with OpenPGP can be formatted | ||
| 1216 | according 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 |
| 1116 | Message internally calls GnuPG (the @command{gpg} command) to perform | 1226 | Message with EasyPG internally calls GnuPG (the @command{gpg} or |
| 1227 | @command{gpgsm} command) to perform | ||
| 1117 | data encryption, and in certain cases (decrypting or signing for | 1228 | data encryption, and in certain cases (decrypting or signing for |
| 1118 | example), @command{gpg} requires user's passphrase. Currently the | 1229 | example), @command{gpg}/@command{gpgsm} requires user's passphrase. |
| 1119 | recommended way to supply your passphrase to @command{gpg} is to use the | 1230 | Currently the recommended way to supply your passphrase is to use the |
| 1120 | @command{gpg-agent} program. | 1231 | @command{gpg-agent} program. |
| 1121 | 1232 | ||
| 1122 | To use @command{gpg-agent} in Emacs, you need to run the following | 1233 | In particular, the @command{gpg-agent} program supports passphrase |
| 1123 | command from the shell before starting Emacs. | 1234 | caching so that you do not need to enter your passphrase for every |
| 1235 | decryption/sign operation. @xref{Agent Options, , , gnupg, Using the | ||
| 1236 | GNU Privacy Guard}. | ||
| 1237 | |||
| 1238 | How to use @command{gpg-agent} in Emacs depends on your version of | ||
| 1239 | GnuPG. With GnuPG version 2.1, @command{gpg-agent} is started | ||
| 1240 | automatically if necessary. With older versions you may need to run | ||
| 1241 | the following command from the shell before starting Emacs. | ||
| 1124 | 1242 | ||
| 1125 | @example | 1243 | @example |
| 1126 | eval `gpg-agent --daemon` | 1244 | eval `gpg-agent --daemon` |
| @@ -1135,11 +1253,10 @@ GNU Privacy Guard}. | |||
| 1135 | Once your @command{gpg-agent} is set up, it will ask you for a | 1253 | Once your @command{gpg-agent} is set up, it will ask you for a |
| 1136 | passphrase as needed for @command{gpg}. Under the X Window System, | 1254 | passphrase as needed for @command{gpg}. Under the X Window System, |
| 1137 | you will see a new passphrase input dialog appear. The dialog is | 1255 | you will see a new passphrase input dialog appear. The dialog is |
| 1138 | provided by PIN Entry (the @command{pinentry} command), and as of | 1256 | provided by PIN Entry (the @command{pinentry} command), reasonably |
| 1139 | version 0.7.2, @command{pinentry} cannot cooperate with Emacs on a | 1257 | recent versions of which can also cooperate with Emacs on a text |
| 1140 | single tty. So, if you are using a text console, you may need to put | 1258 | console. If that does not work, you may need to put a passphrase into |
| 1141 | a passphrase into gpg-agent's cache beforehand. The following command | 1259 | gpg-agent's cache beforehand. The following command does the trick. |
| 1142 | does the trick. | ||
| 1143 | 1260 | ||
| 1144 | @example | 1261 | @example |
| 1145 | gpg --use-agent --sign < /dev/null > /dev/null | 1262 | gpg --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 |
| 1182 | information about the problem.) | 1299 | information about the problem.) |
| 1183 | 1300 | ||
| 1301 | @node Encrypt-to-self | ||
| 1302 | @subsection Encrypt-to-self | ||
| 1303 | |||
| 1304 | By default, messages are encrypted to all recipients (@code{To}, | ||
| 1305 | @code{Cc}, @code{Bcc} headers). Thus, you will not be able to decrypt | ||
| 1306 | your own messages. To make sure that messages are also encrypted to | ||
| 1307 | your own key(s), several alternative solutions exist: | ||
| 1308 | @enumerate | ||
| 1309 | @item | ||
| 1310 | Use the @code{encrypt-to} option in the file @file{gpg.conf} (for | ||
| 1311 | OpenPGP) 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 | ||
| 1315 | Include your own e-mail address (for which you created a key-pair) | ||
| 1316 | among the recipients. | ||
| 1317 | @item | ||
| 1318 | Customize the variable @code{mml-secure-openpgp-encrypt-to-self} (for | ||
| 1319 | OpenPGP) 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 | |||
| 1326 | The @code{Bcc} header is meant to hide recipients of messages. | ||
| 1327 | However, when encrypted messages are used, the e-mail addresses of all | ||
| 1328 | @code{Bcc}-headers are given away to all recipients without | ||
| 1329 | warning, 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 | ||