2 GnuPG - The GNU Privacy Guard
3 -------------------------------
6 Copyright 1998, 1999, 2000, 2001, 2002, 2003,
7 2004 Free Software Foundation, Inc.
9 This file is free software; as a special exception the author
10 gives unlimited permission to copy and/or distribute it, with or
11 without modifications, as long as this notice is preserved.
13 This file is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY, to the extent permitted by law; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A
22 GnuPG is GNU's tool for secure communication and data storage.
23 It can be used to encrypt data and to create digital signatures.
24 It includes an advanced key management facility and is compliant
25 with the proposed OpenPGP Internet standard as described in RFC2440.
27 GnuPG works best on GNU/Linux or *BSD systems. Most other Unices
28 are also supported but are not as well tested as the Free Unices.
29 See http://www.gnupg.org/download/supported_systems.html for a
30 list of systems which are known to work.
32 See the file COPYING for copyright and warranty information.
34 Because GnuPG does not use use any patented algorithms it is not
35 by default fully compatible with PGP 2.x, which uses the patented
36 IDEA algorithm. See http://www.gnupg.org/why-not-idea.html for
37 more information on this subject, including what to do if you are
38 legally entitled to use IDEA.
40 The default public key algorithms are DSA and Elgamal, but RSA is
41 also supported. Symmetric algorithms available are AES (with 128,
42 192, and 256 bit keys), 3DES, Blowfish, CAST5 and Twofish. Digest
43 algorithms available are MD5, RIPEMD/160, SHA-1, SHA-256, SHA-384,
44 and SHA-512. Compression algorithms available are ZIP, ZLIB, and
45 BZIP2 (with libbz2 installed).
50 Please read the file INSTALL and the sections in this file
51 related to the installation. Here is a quick summary:
53 1) Check that you have unmodified sources. See below on how to do
54 this. Don't skip it - this is an important step!
56 2) Unpack the tarball. With GNU tar you can do it this way:
57 "tar xzvf gnupg-x.y.z.tar.gz"
67 7) You end up with a "gpg" binary in /usr/local/bin.
69 8) To avoid swapping out of sensitive data, you can install "gpg"
70 setuid root. If you don't do so, you may want to add the
71 option "no-secmem-warning" to ~/.gnupg/gpg.conf
74 How to Verify the Source
75 ------------------------
76 In order to check that the version of GnuPG which you are going to
77 install is an original and unmodified one, you can do it in one of
80 a) If you already have a trusted Version of GnuPG installed, you
81 can simply check the supplied signature:
83 $ gpg --verify gnupg-x.y.z.tar.gz.asc
85 This checks that the detached signature gnupg-x.y.z.tar.gz.asc
86 is indeed a a signature of gnupg-x.y.z.tar.gz. The key used to
87 create this signature is:
89 "pub 1024D/57548DCD 1998-07-07 Werner Koch (gnupg sig) <dd9jn@gnu.org>"
91 If you do not have this key, you can get it from the source in
92 the file doc/samplekeys.asc (use "gpg --import doc/samplekeys.asc"
93 to add it to the keyring) or from any keyserver. You have to
94 make sure that this is really the key and not a faked one. You
95 can do this by comparing the output of:
97 $ gpg --fingerprint 0x57548DCD
99 with the fingerprint published elsewhere.
101 Please note, that you have to use an old version of GnuPG to
102 do all this stuff. *Never* use the version which you are going
106 b) If you don't have any of the above programs, you have to verify
109 $ md5sum gnupg-x.y.z.tar.gz
111 This should yield an output _similar_ to this:
113 fd9351b26b3189c1d577f0970f9dcadc gnupg-x.y.z.tar.gz
115 Now check that this checksum is _exactly_ the same as the one
116 published via the announcement list and probably via Usenet.
122 The manual will be distributed separately under the name "gph".
123 An online version of the latest manual draft is available at the
126 http://www.gnupg.org/documentation/
128 A list of frequently asked questions is available in the GnuPG
129 distribution in the file doc/FAQ and online as:
131 http://www.gnupg.org/documentation/faqs.html
133 A couple of HOWTO documents are available online; for a listing see:
135 http://www.gnupg.org/documentation/howtos.html
137 A man page with a description of all commands and options gets installed
138 along with the program.
143 Here is a brief overview on how to use GnuPG - it is strongly suggested
144 that you read the manual and other information about the use of
145 cryptography. GnuPG is only a tool, secure usage requires that
146 YOU KNOW WHAT YOU ARE DOING.
148 The first time you run gpg, it will create a .gnupg directory in
149 your home directory and populate it with a default configuration
150 file. Once this is done, you may create a new key, or if you
151 already have keyrings from PGP, you can import them into GnuPG
154 gpg --import path/to/pgp/keyring/pubring.pkr
156 gpg --import path/to/pgp/keyring/secring.skr
158 The normal way to create a key is
162 This asks some questions and then starts key generation. To create
163 good random numbers for the key parameters, GnuPG needs to gather
164 enough noise (entropy) from your system. If you see no progress
165 during key generation you should start some other activities such
166 as moving the mouse or hitting the CTRL and SHIFT keys.
168 Generate a key ONLY on a machine where you have direct physical
169 access - don't do it over the network or on a machine also used
170 by others, especially if you have no access to the root account.
172 When you are asked for a passphrase use a good one which you can
173 easily remember. Don't make the passphrase too long because you
174 have to type it for every decryption or signing; but, - AND THIS
175 IS VERY IMPORTANT - use a good one that is not easily to guess
176 because the security of the whole system relies on your secret key
177 and the passphrase that protects it when someone gains access to
178 your secret keyring. One good way to select a passphrase is to
179 figure out a short nonsense sentence which makes some sense for
180 you and modify it by inserting extra spaces, non-letters and
181 changing the case of some characters - this is really easy to
182 remember especially if you associate some pictures with it.
184 Next, you should create a revocation certificate in case someone
185 gets knowledge of your secret key or you forgot your passphrase
187 gpg --gen-revoke your_user_id
189 Run this command and store the revocation certificate away. The output
190 is always ASCII armored, so that you can print it and (hopefully
191 never) re-create it if your electronic media fails.
193 Now you can use your key to create digital signatures
197 This creates a file "file.gpg" which is compressed and has a
202 Same as above, but creates a file "file.asc" which is ASCII armored
203 and and ready for sending by mail. It is better to use your
204 mailers features to create signatures (The mailer uses GnuPG to do
205 this) because the mailer has the ability to MIME encode such
206 signatures - but this is not a security issue.
210 Creates a signature of "file", but writes the output to the file
213 Everyone who knows your public key (you can and should publish
214 your key by putting it on a key server, a web page or in your .plan
215 file) is now able to check whether you really signed this text
219 GnuPG now checks whether the signature is valid and prints an
220 appropriate message. If the signature is good, you know at least
221 that the person (or machine) has access to the secret key which
222 corresponds to the published public key.
224 If you run gpg without an option it will verify the signature and
225 create a new file that is identical to the original. gpg can also
226 run as a filter, so that you can pipe data to verify trough it
228 cat signed-file | gpg | wc -l
230 which will check the signature of signed-file and then display the
231 number of lines in the original file.
233 To send a message encrypted to someone you can use
237 This encrypts "file" with the public key of the user "heine" and
238 writes it to "file.gpg"
240 echo "hello" | gpg -ea -r heine | mail heine
242 Ditto, but encrypts "hello\n" and mails it as ASCII armored message
243 to the user with the mail address heine.
245 gpg -se -r heine file
247 This encrypts "file" with the public key of "heine" and writes it
248 to "file.gpg" after signing it with your user id.
250 gpg -se -r heine -u Suttner file
252 Ditto, but sign the file with your alternative user id "Suttner"
255 GnuPG has some options to help you publish public keys. This is
256 called "exporting" a key, thus
258 gpg --export >all-my-keys
260 exports all the keys in the keyring and writes them (in a binary
261 format) to "all-my-keys". You may then mail "all-my-keys" as an
262 MIME attachment to someone else or put it on an FTP server. To
263 export only some user IDs, you give them as arguments on the command
266 To mail a public key or put it on a web page you have to create
267 the key in ASCII armored format
269 gpg --export --armor | mail panther@tiger.int
271 This will send all your public keys to your friend panther.
273 If you have received a key from someone else you can put it
274 into your public keyring. This is called "importing"
276 gpg --import [filenames]
278 New keys are appended to your keyring and already existing
279 keys are updated. Note that GnuPG does not import keys that
282 Because anyone can claim that a public key belongs to her
283 we must have some way to check that a public key really belongs
284 to the owner. This can be achieved by comparing the key during
285 a phone call. Sure, it is not very easy to compare a binary file
286 by reading the complete hex dump of the file - GnuPG (and nearly
287 every other program used for management of cryptographic keys)
288 provides other solutions.
290 gpg --fingerprint <username>
292 prints the so called "fingerprint" of the given username which
293 is a sequence of hex bytes (which you may have noticed in mail
294 sigs or on business cards) that uniquely identifies the public
295 key - different keys will always have different fingerprints.
296 It is easy to compare fingerprints by phone and I suggest
297 that you print your fingerprint on the back of your business
298 card. To see the fingerprints of the secondary keys, you can
299 give the command twice; but this is normally not needed.
301 If you don't know the owner of the public key you are in trouble.
302 Suppose however that friend of yours knows someone who knows someone
303 who has met the owner of the public key at some computer conference.
304 Suppose that all the people between you and the public key holder
305 may now act as introducers to you. Introducers signing keys thereby
306 certify that they know the owner of the keys they sign. If you then
307 trust all the introducers to have correctly signed other keys, you
308 can be be sure that the other key really belongs to the one who
311 There are 2 steps to validate a key:
312 1. First check that there is a complete chain
313 of signed keys from the public key you want to use
314 and your key and verify each signature.
315 2. Make sure that you have full trust in the certificates
316 of all the introduces between the public key holder and
318 Step 2 is the more complicated part because there is no easy way
319 for a computer to decide who is trustworthy and who is not. GnuPG
320 leaves this decision to you and will ask you for a trust value
321 (here also referenced as the owner-trust of a key) for every key
322 needed to check the chain of certificates. You may choose from:
323 a) "I don't know" - then it is not possible to use any
324 of the chains of certificates, in which this key is used
325 as an introducer, to validate the target key. Use this if
326 you don't know the introducer.
327 b) "I do not trust" - Use this if you know that the introducer
328 does not do a good job in certifying other keys. The effect
329 is the same as with a) but for a) you may later want to
330 change the value because you got new information about this
332 c) "I trust marginally" - Use this if you assume that the
333 introducer knows what he is doing. Together with some
334 other marginally trusted keys, GnuPG validates the target
336 d) "I fully trust" - Use this if you really know that this
337 introducer does a good job when certifying other keys.
338 If all the introducer are of this trust value, GnuPG
339 normally needs only one chain of signatures to validate
340 a target key okay. (But this may be adjusted with the help
342 This information is confidential because it gives your personal
343 opinion on the trustworthiness of someone else. Therefore this data
344 is not stored in the keyring but in the "trustdb"
345 (~/.gnupg/trustdb.gpg). Do not assign a high trust value just
346 because the introducer is a friend of yours - decide how well she
347 understands the implications of key signatures and you may want to
348 tell her more about public key cryptography so you can later change
349 the trust value you assigned.
351 Okay, here is how GnuPG helps you with key management. Most stuff
352 is done with the --edit-key command
354 gpg --edit-key <keyid or username>
356 GnuPG displays some information about the key and then prompts
357 for a command (enter "help" to see a list of commands and see
358 the man page for a more detailed explanation). To sign a key
359 you select the user ID you want to sign by entering the number
360 that is displayed in the leftmost column (or do nothing if the
361 key has only one user ID) and then enter the command "sign" and
362 follow all the prompts. When you are ready, give the command
363 "save" (or use "quit" to cancel your actions).
365 If you want to sign the key with another of your user IDs, you
366 must give an "-u" option on the command line together with the
369 Normally you want to sign only one user ID because GnuPG
370 uses only one and this keeps the public key certificate
371 small. Because such key signatures are very important you
372 should make sure that the signatories of your key sign a user ID
373 which is very likely to stay for a long time - choose one with an
374 email address you have full control of or do not enter an email
375 address at all. In future GnuPG will have a way to tell which
376 user ID is the one with an email address you prefer - because
377 you have no signatures on this email address it is easy to change
378 this address. Remember, your signatories sign your public key (the
379 primary one) together with one of your user IDs - so it is not possible
380 to change the user ID later without voiding all the signatures.
382 Tip: If you hear about a key signing party on a computer conference
383 join it because this is a very convenient way to get your key
384 certified (But remember that signatures have nothing to to with the
385 trust you assign to a key).
388 8 Ways to Specify a User ID
389 --------------------------
390 There are several ways to specify a user ID, here are some examples.
392 * Only by the short keyid (prepend a zero if it begins with A..F):
399 * By a complete keyid:
408 "1234343434343434C434343434343434"
409 "123434343434343C3434343434343734349A3434"
410 "0E12343434343434343434EAB3484343434343434"
412 The first one is a short fingerprint for PGP 2.x style keys.
413 The others are long fingerprints for OpenPGP keys.
415 * By an exact string:
417 "=Heinrich Heine <heinrichh@uni-duesseldorf.de>"
419 * By an email address:
421 "<heinrichh@uni-duesseldorf.de>"
425 "+Heinrich Heine duesseldorf"
427 All words must match exactly (not case sensitive) and appear in
428 any order in the user ID. Words are any sequences of letters,
429 digits, the underscore and characters with bit 7 set.
431 * Or by the usual substring:
436 The '*' indicates substring search explicitly.
441 If you use the option "--batch", GnuPG runs in non-interactive mode and
442 never prompts for input data. This does not even allow entering the
443 passphrase. Until we have a better solution (something like ssh-agent),
444 you can use the option "--passphrase-fd n", which works like PGP's
447 Batch mode also causes GnuPG to terminate as soon as a BAD signature is
453 GnuPG returns with an exit status of 1 if in batch mode and a bad signature
454 has been detected or 2 or higher for all other errors. You should parse
455 stderr or, better, the output of the fd specified with --status-fd to get
456 detailed information about the errors.
461 Here is a list of configure options which are sometime useful
464 --enable-static-rnd=<name>
465 Force the use of the random byte gathering
466 module <name>. Default is either to use /dev/random
467 or the auto mode. Value for name:
468 egd - Use the module which accesses the
469 Entropy Gathering Daemon. See the webpages
470 for more information about it.
471 unix - Use the standard Unix module which does not
472 have a very good performance.
473 linux - Use the module which accesses /dev/random.
474 This is the first choice and the default one
475 for GNU/Linux or *BSD.
476 auto - Compile linux, egd and unix in and
477 automagically select at runtime.
479 --with-egd-socket=<name>
480 This is only used when EGD is used as random
481 gatherer. GnuPG uses by default "~/.gnupg/entropy"
482 as the socket to connect EGD. Using this option the
483 socket name can be changed. You may use any filename
484 here with 2 exceptions: a filename starting with
485 "~/" uses the socket in the home directory of the user
486 and one starting with a "=" uses a socket in the
487 GnuPG home directory which is "~/.gnupg" by default.
490 Forces usage of the local zlib sources. Default is
491 to use the (shared) library of the system.
494 Look for the system zlib in DIR.
497 Look for the system libbz2 in DIR.
500 Disable the BZIP2 compression algorithm.
502 --with-included-gettext
503 Forces usage of the local gettext sources instead of
504 the one provided by your system.
507 Disable NLS support (See the file ABOUT-NLS)
510 Enable the integrated malloc checking code. Please
511 note that this feature does not work on all CPUs
512 (e.g. SunOS 5.7 on UltraSparc-2) and might give
516 If you have problems with dynamic loading, this
517 option disables all dynamic loading stuff. Note
518 that the use of dynamic linking is very limited.
521 Do not use assembler modules. It is not possible
522 to use this on some CPU types.
525 Disable all remote program execution. This
526 disables photo ID viewing as well as all keyserver
529 --disable-photo-viewers
530 Disable only photo ID viewing.
532 --disable-keyserver-helpers
533 Disable only keyserver helpers.
535 --disable-keyserver-path
536 Disables the user's ability to use the exec-path
537 feature to add additional search directories when
538 executing a keyserver helper.
540 --with-photo-viewer=FIXED_VIEWER
541 Force the photo viewer to be FIXED_VIEWER and
542 disable any ability for the user to change it in
546 Removes support for the RSA public key algorithm.
547 This can give a smaller gpg binary for places
548 where space is tight.
557 Removes support for the selected symmetric
558 algorithm. This can give a smaller gpg binary for
559 places where space is tight.
561 **** Note that if there are existing keys that
562 have one of these algorithms as a preference,
563 messages may be received that use one of these
564 algorithms and you will not be able to decrypt the
567 The public key preference list can be updated to
568 match the list of available algorithms by using
569 "gpg --edit-key (thekey)", and running the
573 Build the smallest gpg possible (disables all
574 optional algorithms, disables keyserver access,
575 and disables photo IDs). Specifically, this means
576 --disable-rsa --disable-idea, --disable-cast5,
577 --disable-blowfish, --disable-aes,
578 --disable-twofish, --disable-sha256,
579 --disable-sha512, --without-bzip2, and
580 --disable-exec. Configure command lines are read
581 from left to right, so if you want to have an
582 "almost minimal" configuration, you can do (for
583 example) "--enable-minimal --enable-rsa" to have
584 RSA added to the minimal build.
586 --enable-key-cache=SIZE
587 Set the internal key and UID cache size. This has
588 a significant impact on performance with large
589 keyrings. The default is 4096, but for use on
590 platforms where memory is an issue, it can be set
594 Installation Problems
595 ---------------------
596 If you get unresolved externals "gettext" you should run configure
597 again with the option "--with-included-gettext"; this is version
598 0.12.1 which is available at ftp.gnu.org.
600 If you have other compile problems, try the configure options
601 "--with-included-zlib" or "--disable-nls" (See ABOUT-NLS) or
604 We can't check all assembler files, so if you have problems
605 assembling them (or the program crashes) use --disable-asm with
606 ./configure. If you opt to delete individual replacement files in
607 hopes of using the remaining ones, be aware that the configure
608 scripts may consider several subdirectories to get all available
609 assembler files; be sure to delete the correct ones. The assembler
610 replacements are in C and in mpi/generic; never delete
611 udiv-qrnnd.S in any CPU directory, because there may be no C
612 substitute. Don't forget to delete "config.cache" and run
613 "./config.status --recheck". We have also heard reports of
614 problems when using versions of gcc earlier than 2.96 along with a
615 non-GNU assembler (as). If this applies to your platform, you can
616 either upgrade gcc to a more recent version, or use the GNU
619 Some make tools are broken - the best solution is to use GNU's
620 make. Try gmake or grab the sources from a GNU archive and
623 On some OSF systems you may get unresolved externals. This is a
624 libtool problem and the workaround is to manually remove all the
625 "-lc -lz" but the last one from the linker line and execute them
628 On some architectures you see warnings like:
629 longlong.h:175: warning: function declaration isn't a prototype
631 http.c:647: warning: cast increases required alignment of target type
632 This doesn't matter and we know about it (actually it is due to
633 some warning options which we have enabled for gcc)
636 Specific problems on some machines
637 ----------------------------------
641 ./configure --with-libiconv-prefix=/sw
643 * Compaq C V6.2 for alpha:
645 You may want to use the option "-msg-disable ptrmismatch1"
646 to get rid of the sign/unsigned char mismatch warnings.
648 * IBM RS/6000 running AIX:
650 Due to a change in gcc (since version 2.8) the MPI stuff may
651 not build. In this case try to run configure using:
652 CFLAGS="-g -O2 -mcpu=powerpc" ./configure
654 * SVR4.2 (ESIX V4.2 cc)
656 Due to problems with the ESIX as, you probably want to do
657 CFLAGS="-O -K pentium" ./configure --disable-asm
661 ./configure ac_cv_sys_symbol_underscore=yes
666 Random devices are available in Linux, FreeBSD and OpenBSD.
667 Operating systems without a random devices must use another
670 This collector works by running a lot of commands that yield more
671 or less unpredictable output and feds this as entropy into the
672 random generator - It should work reliably but you should check
673 whether it produces good output for your version of Unix. There
674 are some debug options to help you (see cipher/rndunix.c).
677 Creating an RPM package
678 -----------------------
679 The file scripts/gnupg.spec is used to build a RPM package (both
681 1. copy the spec file into /usr/src/redhat/SPECS
682 2. copy the tar file into /usr/src/redhat/SOURCES
683 3. type: rpm -ba SPECS/gnupg.spec
685 Or use the -t (--tarbuild) option of rpm:
686 1. rpm -ta gnupg-x.x.x.tar.gz
688 The binary rpm file can now be found in /usr/src/redhat/RPMS, source
689 rpm in /usr/src/redhat/SRPMS
692 How to Get More Information
693 ---------------------------
695 The primary WWW page is "http://www.gnupg.org"
696 The primary FTP site is "ftp://ftp.gnupg.org/gcrypt/"
698 See http://www.gnupg.org/download/mirrors.html for a list of
699 mirrors and use them if possible. You may also find GnuPG
700 mirrored on some of the regular GNU mirrors.
702 We have some mailing lists dedicated to GnuPG:
704 gnupg-announce@gnupg.org For important announcements like
705 new versions and such stuff.
706 This is a moderated list and has
709 gnupg-users@gnupg.org For general user discussion and
712 gnupg-devel@gnupg.org GnuPG developers main forum.
714 You subscribe to one of the list by sending mail with a subject
715 of "subscribe" to x-request@gnupg.org, where x is the name of the
716 mailing list (gnupg-announce, gnupg-users, etc.). An archive of
717 the mailing lists are available at
718 http://www.gnupg.org/documentation/mailing-lists.html
720 Please direct bug reports to http://bugs.gnupg.org or post
721 them direct to the mailing list <gnupg-devel@gnupg.org>.
723 Please direct questions about GnuPG to the users mailing list or
724 one of the pgp newsgroups; please do not direct questions to one
725 of the authors directly as we are busy working on improvements
726 and bug fixes. Both mailing lists are watched by the authors
727 and we try to answer questions when time allows us to do so.
729 Commercial grade support for GnuPG is available; please see
730 the GNU service directory or search other resources.