6268b351c8eaed8184467f7784bb8e4d16658322
[apps/madmutt.git] / doc / PGP-Notes.txt
1 User's guide - Using PGP/GnuPG with Mutt-ng
2 ===========================================
3
4 How do I use mutt with PGP, PGP5, or GnuPG?
5 -------------------------------------------
6
7 Go to the contrib subdirectory of the source tree.  You'll find
8 three files there, pgp2.rc, pgp5.rc, and gpg.rc.  These files
9 contain ready-to-use configurations for using mutt with pgp2, pgp5,
10 and gpg.
11
12 Include one of these files with your Mutt-ng config file (e.g. ~/.muttngrc), 
13 and things should work out fine.
14
15 You may wish to verify that all paths and  the language parameters
16 given to the PGP binaries match your needs.
17
18
19
20 Frequently Asked Questions and Tips
21 -----------------------------------
22
23 Q: "People are sending PGP messages which Mutt-ng doesn't
24     recognize.  What can I do?"
25
26 A: The new way is to leave headers alone and use mutt's
27    check-traditional-pgp function, which can detect PGP messages at
28    runtime, and adjust content-types.
29
30     The old way is to configure your mail filter so it fixes headers:
31
32     Add the following lines to your ~/.procmailrc (you are
33     using procmail, aren't you?):
34
35                    ------------------------------
36
37 ##
38 ## PGP
39 ##
40   
41 :0
42 * !^Content-Type: message/
43 * !^Content-Type: multipart/
44 * !^Content-Type: application/pgp
45 {
46         :0 fBw
47         * ^-----BEGIN PGP MESSAGE-----
48         * ^-----END PGP MESSAGE-----
49         | formail \
50             -i "Content-Type: application/pgp; format=text; x-action=encrypt"
51
52         :0 fBw
53         * ^-----BEGIN PGP SIGNED MESSAGE-----
54         * ^-----BEGIN PGP SIGNATURE-----
55         * ^-----END PGP SIGNATURE-----
56         | formail \
57             -i "Content-Type: application/pgp; format=text; x-action=sign"
58 }
59
60
61                    ------------------------------
62
63 For users of maildrop, "Mark Weinem"
64 <mark.weinem@unidui.uni-duisburg.de> suggests the following recipe:
65
66                    ------------------------------
67
68 BPGPM="-----BEGIN PGP MESSAGE-----"
69 EPGPM="-----END PGP MESSAGE-----"
70 BPGPS="-----BEGIN PGP SIGNATURE-----"
71 EPGPS="-----END PGP SIGNATURE-----"
72
73 if (!/^Content-Type: message/ && !/^Content-Type: multipart/ \
74         && !/^Content-Type: application\/pgp/)
75 {       
76 if (/^$BPGPM/:b && /^$EPGPM/:b)
77         xfilter "reformail -A 'Content-Type: application/pgp; format=text; \
78                 x-action=encrypt'"
79
80 if (/^$BPGPS/:b && /^$EPGPS/:b)
81         xfilter "reformail -A 'Content-Type: application/pgp; format=text; \
82                 x-action=sign'"
83 }
84
85                    ------------------------------
86
87
88
89 Q: "I don't like that PGP/MIME stuff, but want to use the
90     old way of PGP-signing my mails.  Can't you include
91     that with Mutt-ng?"
92
93 A: No.  Application/pgp is not really suited to a world with MIME,
94    non-textual body parts and similar things.  Anyway, if you really
95    want to generate these old-style attachments, include the
96    following macro in your ~/.muttngrc (line breaks for readability,
97    this is actually one line):
98
99   macro compose S "Fpgp +verbose=0 -fast
100         +clearsig=on\ny^T^Uapplication/pgp; format=text;
101         x-action=sign\n"
102
103
104 There's a new answer, though: Set the pgp_autoinline
105 configuration variable (it's a quad-option) to something different
106 from "no" (that's the default).  Mutt-ng will then try to use
107 application/pgp whereever it makes sense.  In particular, it does
108 not make any sense with multiparts, or non-ASCII or non-text bodies.
109 In all other cases, PGP/MIME is used unconditionally.
110
111 Note that application/pgp is still strongly deprecated.
112
113
114
115 Q: "I don't like all the ^Gs and various other verbosity
116     PGP is presenting me with."
117
118 A: Roland Rosenfeld <roland@spinnaker.rhein.de> has found a quite
119    elegant solution to this problem: PGP has some pretty good foreign
120    language support.  So we just introduce a language called "mutt"
121    which contains empty strings for the messages we don't want to see.
122    To use this, copy either language.txt or language50.txt (depending
123    on what PGP version you are using) to your $PGPPATH.  Make sure the
124    PGP command formats pass "+language=pgp" to all the PGP binaries
125    (but not to pgpringng!).
126  
127 For PGP 2.6, a German version called "muttde" is available
128 as well.
129
130
131 Q: "My PGP signatures are being invalidated.  BTW, I'm using Courier
132     MTA."
133
134 A: The author of the Courier MTA believes that the standard specifying
135    multipart/signed is broken.  For that reason, he has choosen to
136    implement his MTA in a way which does not assure that
137    multipart/signed body parts are left untouched.
138
139    We suggest that you abandon courier and change to qmail, postfix,
140    or exim.
141
142
143
144 BACKGROUND
145 ==========
146
147 Auxiliary Programs
148 ------------------
149
150 Mutt-ng needs two auxiliary programs for its PGP support: pgpewrapng and
151 pgpringng.
152
153
154 1. pgpringng
155
156 pgpringng is a key ring dumper.  It extracts information from PGP's
157 binary key ring and emits it in an (almost) readable output format
158 understood by mutt's key selection routines.  This output format
159 mimics the one used by the GNU Privacy Guard (GPG).
160
161 You'll need this program with PGP 2 and PGP 5.
162
163 Command line options:
164
165         -k <key ring>   Dump the contents of the key ring specified
166                         as an argument to -k.
167                         
168         -2, -5          Use the default key ring for PGP 2 or 5, 
169                         respectively.
170                         
171         -s              Dump the secret key ring.
172
173
174
175 2. pgpewrapng
176
177 This is a little C program which does some command line munging: The
178 first argument is a command to be executed.  When pgpewrapng
179 encounters a "--" (dash-dash) argument, it will interpret the next
180 argument as a prefix which is put in front of all following
181 arguments.
182
183 Example:
184
185         pgpewrapng pgpe file -- -r a b c
186
187 will execute:
188
189         pgpe file -r a -r b -r c
190
191 This script is needed with PGP 5 and with GPG, since their command
192 line interfaces can't be properly served by mutt's format mechanism.
193
194
195
196 The Configuration Interface
197 ---------------------------
198
199 As usual within Mutt-ng, the configuration interface for the PGP
200 commands relies on printf-like formats.  For all PGP commands, the
201 following %-sequences are defined.
202
203   %p    The empty string when no passphrase is needed,
204         the string "PGPPASSFD=0" if one is needed.
205
206         This is mostly used in conditional % sequences.
207
208   %f    Most PGP commands operate on a single file or a file
209         containing a message.  %f expands to this file's name.
210
211   %s    When verifying signatures, there is another temporary file
212         containing the detached signature.  %s expands to this
213         file's name.
214
215   %a    In "signing" contexts, this expands to the value of the
216         configuration variable $pgp_sign_as.  You probably need to
217         use this within a conditional % sequence.
218
219   %r    In many contexts, mutt passes key IDs to pgp.  %r expands to
220         a list of key IDs.
221
222 The following command formats are defined:
223
224   $pgp_decode_command   Decode application/pgp messages.  This
225                         command operates with and without pass phrases.
226                         
227   $pgp_verify_command   Verify a PGP/MIME signature.
228
229   $pgp_decrypt_command  Decrypt a PGP/MIME encrypted MIME body.
230                         This command always gets a pass phrase.
231
232   $pgp_sign_command     Sign a PGP/MIME body.  This command always
233                         gets a pass phrase.
234
235
236   $pgp_encrypt_sign_command Encrypt and sign a MIME body.  This
237                         command always gets a pass phrase.
238                         
239   $pgp_encrypt_only_command Encrypt a MIME body, but don't sign it.
240   
241   $pgp_import_command   Import PGP keys from a file.
242   
243   $pgp_export_command   Export PGP keys to a file.  The output must
244                         be ASCII armored.
245                         
246   $pgp_verify_key_command Check a public key. This is used from the
247                         key selection menu.
248
249   $pgp_list_secring_command List the secret keys matching some hints
250                         given in %r.
251
252   $pgp_list_pubring_command List the public keys matching some hints
253                         given in %r.
254
255 The passphrase is always passed on stdin; all commands must send
256 their output to stdout and stderr.
257
258
259