~ubuntu-branches/ubuntu/precise/gnupg2/precise-proposed

« back to all changes in this revision

Viewing changes to doc/FAQ

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2006-01-24 04:31:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060124043142-pbg192or6qxv3yk2
Tags: 1.9.20-1
* New Upstream version. Closes:#306890,#344530
  * Closes:#320490: gpg-protect-tool fails to decrypt PKCS-12 files 
* Depend on libopensc2-dev, not -1-. Closes:#348106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
            GNU Privacy Guard -- Frequently Asked Questions
 
2
           =================================================
 
3
 
 
4
  This FAQ is partly compiled from messages of the developers mailing list.
 
5
 
 
6
  Many thanks to Kirk Fort, Brian Warner, ...
 
7
 
 
8
 
 
9
  Q: How does this whole thing work?
 
10
  A: To generate a secret/public keypair, run
 
11
 
 
12
      gpg --gen-key
 
13
 
 
14
  and choose the default values.
 
15
 
 
16
  Data that is encrypted with a public key can only be decrypted by the
 
17
  matching secret key.  The secret key is protected by a password, the
 
18
  public key is not.
 
19
 
 
20
  So to send your friend a message, you would encrypt your message with his
 
21
  public key, and he would only be able to decrypt it by having the secret
 
22
  key and putting in the password to use his secret key.
 
23
 
 
24
  GnuPG is also useful for signing things.  Things that are encrypted with
 
25
  the secret key can be decrypted with the public key. To sign something, a
 
26
  hash is taken of the data, and then the hash is in some form encoded with
 
27
  the secret key. If someone has your public key, they can verify that it
 
28
  is from you and that it hasn't changed by checking the encoded form of
 
29
  the hash with the public key.
 
30
 
 
31
  A keyring is just a large file that stores keys. You have a public keyring
 
32
  where you store yours and your friend's public keys.  You have a secret
 
33
  keyring that you keep your secret key on, and be very careful with this
 
34
  secret keyring: Never ever give anyone else access to it and use a *good*
 
35
  passphrase to protect the data in it.
 
36
 
 
37
  You can 'conventionally' encrypt something by using the option 'gpg -c'.
 
38
  It is encrypted using a passphrase, and does not use public and secret
 
39
  keys.  If the person you send the data to knows that passphrase, they can
 
40
  decrypt it. This is usually most useful for encrypting things to
 
41
  yourself, although you can encrypt things to your own public key in the
 
42
  same way.  It should be used for communication with partners you know and
 
43
  where it is easy to exchange the passphrases (e.g. with your boy friend or
 
44
  your wife).  The advantage is that you can change the passphrase from time
 
45
  to time and decrease the risk, that many old messages may be decrypted by
 
46
  people who accidently got your passphrase.
 
47
 
 
48
  You can add and copy keys to and from your keyring with the 'gpg --import'
 
49
  and 'gpg --export' option. 'gpg --export-secret-keys' will export secret
 
50
  keys. This is normally not useful, but you can generate the key on one
 
51
  machine then move it to another machine.
 
52
 
 
53
  Keys can be signed under the 'gpg --edit-key' option.  When you sign a
 
54
  key, you are saying that you are certain that the key belongs to the
 
55
  person it says it comes from.  You should be very sure that is really
 
56
  that person:  You should verify the key fingerprint
 
57
 
 
58
      gpg --fingerprint user-id
 
59
 
 
60
  over phone (if you really know the voice of the other person) or at
 
61
  a key signing party (which are often held at computer conferences)
 
62
  or at a meeting of your local GNU/Linux User Group.
 
63
 
 
64
  Hmm, what else.  You may use the option  "-o filename" to force output
 
65
  to this filename (use "-" to force output to stdout). "-r" just lets you
 
66
  specify the recipient (which public key you encrypt with) on the command
 
67
  line instead of typing it interactively.
 
68
 
 
69
  Oh yeah, this is important. By default all data is encrypted in some weird
 
70
  binary format.  If you want to have things appear in ASCII text that is
 
71
  readable, just add the '-a' option.  But the preferred method is to use
 
72
  a MIME aware mail reader (Mutt, Pine and many more).
 
73
 
 
74
  There is a small security glitch in the OpenPGP (and therefore GnuPG) system;
 
75
  to avoid this you should always sign and encrypt a message instead of only
 
76
  encrypting it.
 
77
 
 
78
 
 
79
 Q: What is the recommended key size?
 
80
 A: 1024 bit for DSA signatures; even for plain ElGamal
 
81
    signatures this is sufficient as the size of the hash
 
82
    is probably the weakest link if the keysize is larger
 
83
    than 1024 bits.  Encryption keys may have greater sizes,
 
84
    but you should than check the fingerprint of this key:
 
85
    "gpg --fingerprint --fingerprint <user ID>".
 
86
 
 
87
 Q: Why are some signatures with an ELG-E key valid?
 
88
 A: These are ElGamal Key generated by GnuPG in v3 (rfc1991)
 
89
    packets.  The OpenPGP draft later changed the algorithm
 
90
    identifier for ElGamal keys which are usable for signatures
 
91
    and encryption from 16 to 20.  GnuPG now uses 20 when it
 
92
    generates new ElGamal keys but still accept 16 (which is
 
93
    according to OpenPGP "encryption only") if this key is in
 
94
    a v3 packet.  GnuPG is the only program which had used
 
95
    these v3 ElGamal keys - so this assumption is quite safe.
 
96
 
 
97
 Q: Why is PGP 5.x not able to encrypt messages with some keys?
 
98
 A: PGP Inc refuses to accept ElGamal keys of type 20 even for
 
99
    encryption.  They only support type 16 (which is identical
 
100
    at least for decryption).  To be more inter-operable, GnuPG
 
101
    (starting with version 0.3.3) now also uses type 16 for the
 
102
    ElGamal subkey which is created if the default key algorithm
 
103
    is chosen.  You may add an type 16 ElGamal key to your public
 
104
    key which is easy as your key signatures are still valid.
 
105
 
 
106
 Q: Why is PGP 5.x not able to verify my messages?
 
107
 A: PGP 5.x does not accept V4 signatures for data material but
 
108
    OpenPGP requires generation of V4 signatures for all kind of
 
109
    data.  Use the option "--force-v3-sigs" to generate V3 signatures
 
110
    for data.
 
111
 
 
112
 Q: I can't delete an user id because it is already deleted on my
 
113
    public keyring?
 
114
 A: Because you can only select from the public key ring, there is
 
115
    no direct way to do this.  However it is not very complicated
 
116
    to do it anyway.  Create a new user id with exactly the same name
 
117
    and you will see that there are now two identical user ids on the
 
118
    secret ring.  Now select this user id and delete it.  Both user
 
119
    ids will be removed from the secret ring.
 
120
 
 
121
 Q: How can I encrypt a message so that pgp 2.x is able to decrypt it?
 
122
 A: You can't do that because pgp 2.x normally uses IDEA which is not
 
123
    supported by GnuPG because it is patented, but if you have a modified
 
124
    version of PGP you can try this:
 
125
 
 
126
       gpg --rfc1991 --cipher-algo 3des ...
 
127
 
 
128
    Please don't pipe the data to encrypt to gpg but give it as a filename;
 
129
    other wise, pgp 2 will not be able to handle it.
 
130
 
 
131
 Q: How can I conventional encrypt a message, so that PGP can decrypt it?
 
132
 A: You can't do this for PGP 2.  For PGP 5 you should use this:
 
133
 
 
134
       gpg -c --cipher-algo 3des --compress-algo 1 myfile
 
135
 
 
136
    You may replace "3des" by "cast5". "blowfish" does not work with
 
137
    all versions of pgp5.  You may also want to put
 
138
       compress-algo 1
 
139
    into your ~/.gnupg/options file - this does not affect normal
 
140
    gnupg operation.
 
141
 
 
142
 
 
143
  Q: Why does it sometimes take so long to create keys?
 
144
  A: The problem here is that we need a lot of random bytes and for that
 
145
  we (on Linux the /dev/random device) must collect some random data.
 
146
  It is really not easy to fill the Linux internal entropy buffer; I
 
147
  talked to Ted Ts'o and he commented that the best way to fill the buffer
 
148
  is to play with your keyboard. Good security has it's price. What I do
 
149
  is to hit several times on the shift, control, alternate, and capslock
 
150
  keys, because these keys do not produce output to the screen. This way
 
151
  you get your keys really fast (it's the same thing pgp2 does).
 
152
 
 
153
  Another problem might be another program which eats up your random bytes
 
154
  (a program (look at your daemons) that reads from /dev/[u]random).
 
155
 
 
156
  Q: And it really takes long when I work on a remote system. Why?
 
157
  A: Don't do this at all! You should never create keys or even use GnuPG
 
158
  on a remote system because you normally have no physical control over
 
159
  your secret keyring (which is in most cases vulnerable to advanced
 
160
  dictionary attacks) - I strongly encourage everyone to only create keys
 
161
  on a local computer (a disconnected laptop is probably the best choice)
 
162
  and if you need it on your connected box (I know: We all do this) be
 
163
  sure to have a strong password for your account and for your secret key
 
164
  and that you can trust your system administrator.
 
165
 
 
166
  When I check GnuPG on a remote system via ssh (I have no Alpha here ;-)
 
167
  I have the same problem.  It takes a *very* long time to create the
 
168
  keys, so I use a special option, --quick-random, to generate insecure
 
169
  keys which are only good for some tests.
 
170
 
 
171
 
 
172
  Q: How does the whole trust thing work?
 
173
  A: It works more or less like PGP.  The difference is that the trust is
 
174
  computed at the time it is needed. This is one of the reasons for the
 
175
  trustdb which holds a list of valid key signatures.  If you are not
 
176
  running in batch mode you will be asked to assign a trust parameter
 
177
  (ownertrust) to a key.
 
178
 
 
179
  You can see the validity (calculated trust value) using this command.
 
180
 
 
181
      gpg --list-keys --with-colons
 
182
 
 
183
  If the first field is "pub" or "uid", the second field shows you the trust:
 
184
 
 
185
     o = Unknown (this key is new to the system)
 
186
     e = The key has expired
 
187
     q = Undefined (no value assigned)
 
188
     n = Don't trust this key at all
 
189
     m = There is marginal trust in this key
 
190
     f = The key is full trusted.
 
191
     u = The key is ultimately trusted; this
 
192
         is only used for keys for which
 
193
         the secret key is also available.
 
194
     r = The key has been revoked
 
195
     d = The key has been disabled
 
196
 
 
197
  The value in the "pub" record is the best one of all "uid" records.
 
198
 
 
199
  You can get a list of the assigned trust values (how much you trust
 
200
  the owner to correctly sign another person's key)
 
201
 
 
202
      gpg --list-ownertrust
 
203
 
 
204
  The first field is the fingerprint of the primary key, the second field
 
205
  is the assigned value:
 
206
 
 
207
      - = No Ownertrust value yet assigned.
 
208
      n = Never trust this keyholder to correctly verify others signatures.
 
209
      m = Have marginal trust in the keyholders capability to sign other keys.
 
210
      f = Assume that the key holder really knows how to sign keys.
 
211
      u = No need to trust ourself because we have the secret key.
 
212
 
 
213
  Keep these values confidential because they express your opinions
 
214
  about others.  PGP stores this information with the keyring thus
 
215
  it is not a good idea to publish a PGP keyring instead of exporting the
 
216
  keyring.  gnupg stores the trust in the trust-DB so it is okay
 
217
  to give a gpg keyring away (but we have a --export command too).
 
218
 
 
219
 
 
220
  Q: What is the difference between options and commands?
 
221
  A: If you do a "gpg --help", you will get two separate lists. The first is
 
222
  a list of commands. The second is a list of options. Whenever you run GPG,
 
223
  you *must* pick exactly one command (**with one exception, see below). You
 
224
  *may* pick one or more options.  The command should, just by convention,
 
225
  come at the end of the argument list, after all the options. If the
 
226
  command takes a file (all the basic ones do), the filename comes at the
 
227
  very end. So the basic way to run gpg is:
 
228
 
 
229
   gpg [--option something] [--option2] [--option3 something] --command file
 
230
 
 
231
  Some options take arguments, for example the --output option (which can be
 
232
  abbreviated -o) is an option that takes a filename. The option's argument
 
233
  must follow immediately after the option itself, otherwise gpg doesn't know
 
234
  which option the argument is supposed to go with. As an option, --output and
 
235
  its filename must come before the command. The --recipient (-r) option takes
 
236
  a name or keyid to encrypt the message to, which must come right after the -r
 
237
  argument.  The --encrypt (or -e) command comes after all the options followed
 
238
  by the file you wish to encrypt. So use
 
239
 
 
240
   gpg -r alice -o secret.txt -e test.txt
 
241
 
 
242
  If you write the options out in full, it is easier to read
 
243
 
 
244
   gpg --recipient alice --output secret.txt --encrypt test.txt
 
245
 
 
246
  If you're saving it in a file called ".txt" then you'd probably expect to see
 
247
  ASCII-armored text in there, so you need to add the --armor (-a) option,
 
248
  which doesn't take any arguments.
 
249
 
 
250
   gpg --armor --recipient alice --output secret.txt --encrypt test.txt
 
251
 
 
252
  If you imagine square brackets around the optional parts, it becomes a bit
 
253
  clearer:
 
254
 
 
255
   gpg [--armor] [--recipient alice] [--output secret.txt] --encrypt test.txt
 
256
 
 
257
  The optional parts can be rearranged any way you want.
 
258
 
 
259
   gpg --output secret.txt --recipient alice --armor --encrypt test.txt
 
260
 
 
261
  If your filename begins with a hyphen (e.g. "-a.txt"), gnupg assumes this is
 
262
  an option and may complain.  To avoid this you have either to use
 
263
  "./-a.txt" or stop the option and command processing  with two hyphens:
 
264
  "-- -a.txt".
 
265
 
 
266
  ** the exception: signing and encrypting at the same time. Use
 
267
 
 
268
   gpg [--options] --sign --encrypt foo.txt
 
269
 
 
270
 
 
271
  Q: What kind of output is this: "key C26EE891.298, uid 09FB: ...."?
 
272
  A: This is the internal representation of an user id in the trustdb.
 
273
     "C26EE891" is the keyid, "298" is the local id (a record number
 
274
     in the trustdb) and "09FB" is the last two bytes of a ripe-md-160
 
275
     hash of the user id for this key.
 
276
 
 
277
 
 
278
  Q: What is trust, validity and ownertrust?
 
279
  A: "ownertrust" is used instead of "trust" to make clear that
 
280
     this is the value you have assigned to a key to express how much you
 
281
     trust the owner of this key to correctly sign (and so introduce)
 
282
     other keys.  "validity", or calculated trust, is a value which
 
283
     says how much GnuPG thinks a key is valid (that it really belongs
 
284
     to the one who claims to be the owner of the key).
 
285
     For more see the chapter "The Web of Trust" in the Manual
 
286
 
 
287
  Q: How do I interpret some of the informational outputs?
 
288
  A: While checking the validity of a key, GnuPG sometimes prints
 
289
     some information which is prefixed with information about
 
290
     the checked item.
 
291
        "key 12345678.3456"
 
292
     This is about the key with key ID 12345678 and the internal
 
293
     number 3456, which is the record number of the so called
 
294
     directory record in the trustdb.
 
295
        "uid 12345678.3456/ACDE"
 
296
     This is about the user ID for the same key.  To identify the
 
297
     user ID the last two bytes of a ripe-md-160 over the user ID
 
298
     ring is printed.
 
299
        "sig 12345678.3456/ACDE/9A8B7C6D"
 
300
     This is about the signature with key ID 9A8B7C6D for the
 
301
     above key and user ID, if it is a signature which is direct
 
302
     on a key, the user ID part is empty (..//..).
 
303
 
 
304
 
 
305
  Q: How do I sign a patch file?
 
306
  A: Use "gpg --clearsign --not-dash-escaped ...".
 
307
     The problem with --clearsign is that all lines starting with a dash are
 
308
     quoted with "- "; obviously diff produces many of lines starting with a
 
309
     dash and these are then quoted and that is not good for patch ;-).  To
 
310
     use a patch file without removing the cleartext signature, the special
 
311
     option --not-dash-escaped may be used to suppress generation of these
 
312
     escape sequences.  You should not mail such a patch because spaces and
 
313
     line endings are also subject to the signature and a mailer may not
 
314
     preserve these.  If you want to mail a file you can simply sign it
 
315
     using your MUA.
 
316
 
 
317
 
 
318
  Q: Where is the "encrypt-to-self" option?
 
319
  A: Use "--encrypt-to your_keyid".  You can use more than one
 
320
     of these options. To temporary override the use of this additional
 
321
     keys, you can use the option "--no-encrypt-to".
 
322
 
 
323
 
 
324
  Q: How can I get rid of the Version and Comment headers in
 
325
     armored messages?
 
326
  A: Use "--no-version --comment ''".  Note that the left over blank line
 
327
     is required by the protocol.
 
328
 
 
329
 
 
330
  Q: What does the "You are using the xxxx character set." mean?
 
331
  A: This note is printed when UTF8 mapping has to be done.  Make sure that
 
332
     the displayed charset is the one you have activated on your system
 
333
     "iso-8859-1" is the most used one, so this is the default.  You can
 
334
     change the charset with the option "--charset".  It is important that
 
335
     you active character set matches the one displayed - if not, restrict
 
336
     yourself to plain 7 bit ASCII and no mapping has to be done.
 
337
 
 
338
  Q: How do I transfer owner trust values from PGP to GnuPG?
 
339
  A: There is a script in the tools directory to help you:
 
340
     After you have imported the PGP keyring you can give this command:
 
341
        $ lspgpot pgpkeyring | gpg --import-ownertrust
 
342
     where pgpkeyring is the original keyring and not the GnuPG one you
 
343
     might have created in the first step.
 
344
 
 
345
  Q: Are the headerlines of a cleartext signater part of the signed
 
346
     material?
 
347
  A: No.  For example you can add or remove "Comment:" lines.  They
 
348
     have a purpose like the mail header lines.  However a "Hash:"
 
349
     line is needed for modern signatures, to tell the parser which
 
350
     hash algorithm to use.
 
351
 
 
352