1 @c Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2 @c 2008, 2009 Free Software Foundation, Inc.
3 @c This is part of the GnuPG manual.
4 @c For copying conditions, see the file gnupg.texi.
8 @cindex GPG command options
9 @cindex command options
10 @cindex options, GPG command
12 @c Begin GnuPG 1.x specific stuff
20 \- OpenPGP encryption and signing tool
35 @c End GnuPG 1.x specific stuff
37 @c Begin GnuPG 2 specific stuff
45 \- OpenPGP encryption and signing tool
60 @c Begin GnuPG 2 specific stuff
63 @command{@gpgname} is the OpenPGP part of the GNU Privacy Guard (GnuPG). It
64 is a tool to provide digital encryption and signing services using the
65 OpenPGP standard. @command{@gpgname} features complete key management and
66 all bells and whistles you can expect from a decent OpenPGP
70 This is the standalone version of @command{gpg}. For desktop use you
71 should consider using @command{gpg2}.
75 In contrast to the standalone version @command{gpg}, which is more
76 suited for server and embedded platforms, this version is installed
77 under the name @command{gpg2} and more targeted to the desktop as it
78 requires several other modules to be installed. The standalone version
79 will be kept maintained and it is possible to install both versions on
80 the same system. If you need to use different configuration files, you
81 should make use of something like @file{gpg.conf-2} instead of just
87 Documentation for the old standard @command{gpg} is available as a man
88 page and at @inforef{Top,GnuPG 1,gpg}.
91 @xref{Option Index}, for an index to @command{@gpgname}'s commands and options.
95 * GPG Commands:: List of all commands.
96 * GPG Options:: List of all options.
97 * GPG Configuration:: Configuration files.
98 * GPG Examples:: Some usage examples.
100 Developer information:
101 @c * Unattended Usage:: Using @command{gpg} from other programs.
102 @c * GPG Protocol:: The protocol the server mode uses.
107 @c *******************************************
108 @c *************** ****************
109 @c *************** COMMANDS ****************
110 @c *************** ****************
111 @c *******************************************
116 Commands are not distinguished from options except for the fact that
117 only one command is allowed.
119 @command{@gpgname} may be run with no commands, in which case it will
120 perform a reasonable action depending on the type of file it is given
121 as input (an encrypted message is decrypted, a signature is verified,
122 a file containing keys is listed).
124 Please remember that option as well as command parsing stops as soon as
125 a non-option is encountered, you can explicitly stop parsing by
126 using the special option @option{--}.
130 * General GPG Commands:: Commands not specific to the functionality.
131 * Operational GPG Commands:: Commands to select the type of operation.
132 * OpenPGP Key Management:: How to manage your keys.
136 @c *******************************************
137 @c ********** GENERAL COMMANDS *************
138 @c *******************************************
139 @node General GPG Commands
140 @subsection Commands not specific to the function
145 Print the program version and licensing information. Note that you
146 cannot abbreviate this command.
151 Print a usage message summarizing the most useful command line options.
152 Note that you cannot abbreviate this command.
156 Print warranty information.
159 @opindex dump-options
160 Print a list of all available options and commands. Note that you cannot
161 abbreviate this command.
165 @c *******************************************
166 @c ******** OPERATIONAL COMMANDS ***********
167 @c *******************************************
168 @node Operational GPG Commands
169 @subsection Commands to select the type of operation
177 Make a signature. This command may be combined with @option{--encrypt}
178 (for a signed and encrypted message), @option{--symmetric} (for a
179 signed and symmetrically encrypted message), or @option{--encrypt} and
180 @option{--symmetric} together (for a signed message that may be
181 decrypted via a secret key or a passphrase). The key to be used for
182 signing is chosen by default or can be set with the
183 @option{--local-user} and @option{--default-key} options.
187 Make a clear text signature. The content in a clear text signature is
188 readable without any special software. OpenPGP software is only needed
189 to verify the signature. Clear text signatures may modify end-of-line
190 whitespace for platform independence and are not intended to be
191 reversible. The key to be used for signing is chosen by default or
192 can be set with the @option{--local-user} and @option{--default-key}
199 Make a detached signature.
204 Encrypt data. This option may be combined with @option{--sign} (for a
205 signed and encrypted message), @option{--symmetric} (for a message that
206 may be decrypted via a secret key or a passphrase), or @option{--sign}
207 and @option{--symmetric} together (for a signed message that may be
208 decrypted via a secret key or a passphrase).
213 Encrypt with a symmetric cipher using a passphrase. The default
214 symmetric cipher used is CAST5, but may be chosen with the
215 @option{--cipher-algo} option. This option may be combined with
216 @option{--sign} (for a signed and symmetrically encrypted message),
217 @option{--encrypt} (for a message that may be decrypted via a secret key
218 or a passphrase), or @option{--sign} and @option{--encrypt} together
219 (for a signed message that may be decrypted via a secret key or a
224 Store only (make a simple RFC1991 literal data packet).
229 Decrypt the file given on the command line (or STDIN if no file
230 is specified) and write it to STDOUT (or the file specified with
231 @option{--output}). If the decrypted file is signed, the signature is also
232 verified. This command differs from the default operation, as it never
233 writes to the filename which is included in the file and it rejects
234 files which don't begin with an encrypted message.
238 Assume that the first argument is a signed file or a detached signature
239 and verify it without generating any output. With no arguments, the
240 signature packet is read from STDIN. If only a sigfile is given, it may
241 be a complete signature or a detached signature, in which case the
242 signed stuff is expected in a file without the ".sig" or ".asc"
243 extension. With more than 1 argument, the first should be a detached
244 signature and the remaining files are the signed stuff. To read the
245 signed stuff from STDIN, use @samp{-} as the second filename. For
246 security reasons a detached signature cannot read the signed material
247 from STDIN without denoting it in the above way.
251 This modifies certain other commands to accept multiple files for
252 processing on the command line or read from STDIN with each filename on
253 a separate line. This allows for many files to be processed at
254 once. @option{--multifile} may currently be used along with
255 @option{--verify}, @option{--encrypt}, and @option{--decrypt}. Note that
256 @option{--multifile --verify} may not be used with detached signatures.
259 @opindex verify-files
260 Identical to @option{--multifile --verify}.
262 @item --encrypt-files
263 @opindex encrypt-files
264 Identical to @option{--multifile --encrypt}.
266 @item --decrypt-files
267 @opindex decrypt-files
268 Identical to @option{--multifile --decrypt}.
272 @itemx --list-public-keys
274 List all keys from the public keyrings, or just the keys given on the
277 @option{-k} is slightly different from @option{--list-keys} in that it
278 allows only for one argument and takes the second argument as the
279 keyring to search. This is for command line compatibility with PGP 2
280 and has been removed in @command{gpg2}.
283 Avoid using the output of this command in scripts or other programs as
284 it is likely to change as GnuPG changes. See @option{--with-colons} for a
285 machine-parseable key listing command that is appropriate for use in
286 scripts and other programs.
288 @item --list-secret-keys
290 @opindex list-secret-keys
291 List all keys from the secret keyrings, or just the ones given on the
292 command line. A @code{#} after the letters @code{sec} means that the
293 secret key is not usable (for example, if it was created via
294 @option{--export-secret-subkeys}).
298 Same as @option{--list-keys}, but the signatures are listed too.
300 This command has the same effect as
301 using @option{--list-keys} with @option{--with-sig-list}.
304 For each signature listed, there are several flags in between the "sig"
305 tag and keyid. These flags give additional information about each
306 signature. From left to right, they are the numbers 1-3 for certificate
307 check level (see @option{--ask-cert-level}), "L" for a local or
308 non-exportable signature (see @option{--lsign-key}), "R" for a
309 nonRevocable signature (see the @option{--edit-key} command "nrsign"),
310 "P" for a signature that contains a policy URL (see
311 @option{--cert-policy-url}), "N" for a signature that contains a
312 notation (see @option{--cert-notation}), "X" for an eXpired signature
313 (see @option{--ask-cert-expire}), and the numbers 1-9 or "T" for 10 and
314 above to indicate trust signature levels (see the @option{--edit-key}
319 Same as @option{--list-sigs}, but the signatures are verified. Note
320 that for performance reasons the revocation status of a signing key is
323 This command has the same effect as
324 using @option{--list-keys} with @option{--with-sig-check}.
327 The status of the verification is indicated by a flag directly following
328 the "sig" tag (and thus before the flags described above for
329 @option{--list-sigs}). A "!" indicates that the signature has been
330 successfully verified, a "-" denotes a bad signature and a "%" is used
331 if an error occurred while checking the signature (e.g. a non supported
337 Locate the keys given as arguments. This command basically uses the
338 same algorithm as used when locating keys for encryption or signing and
339 may thus be used to see what keys @command{@gpgname} might use. In
340 particular external methods as defined by @option{--auto-key-locate} may
341 be used to locate a key. Only public keys are listed.
347 List all keys (or the specified ones) along with their
348 fingerprints. This is the same output as @option{--list-keys} but with
349 the additional output of a line with the fingerprint. May also be
350 combined with @option{--list-sigs} or @option{--check-sigs}. If this
351 command is given twice, the fingerprints of all secondary keys are
355 @opindex list-packets
356 List only the sequence of packets. This is mainly
357 useful for debugging.
362 Present a menu to work with a smartcard. The subcommand "help" provides
363 an overview on available commands. For a detailed description, please
364 see the Card HOWTO at
365 http://www.gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
369 Show the content of the smart card.
373 Present a menu to allow changing the PIN of a smartcard. This
374 functionality is also available as the subcommand "passwd" with the
375 @option{--card-edit} command.
377 @item --delete-key @code{name}
379 Remove key from the public keyring. In batch mode either @option{--yes} is
380 required or the key must be specified by fingerprint. This is a
381 safeguard against accidental deletion of multiple keys.
383 @item --delete-secret-key @code{name}
384 @opindex delete-secret-key
385 Remove key from the secret and public keyring. In batch mode the key
386 must be specified by fingerprint.
388 @item --delete-secret-and-public-key @code{name}
389 @opindex delete-secret-and-public-key
390 Same as @option{--delete-key}, but if a secret key exists, it will be
391 removed first. In batch mode the key must be specified by fingerprint.
395 Either export all keys from all keyrings (default keyrings and those
396 registered via option @option{--keyring}), or if at least one name is given,
397 those of the given name. The new keyring is written to STDOUT or to the
398 file given with option @option{--output}. Use together with
399 @option{--armor} to mail those keys.
401 @item --send-keys @code{key IDs}
403 Similar to @option{--export} but sends the keys to a keyserver.
404 Fingerprints may be used instead of key IDs. Option @option{--keyserver}
405 must be used to give the name of this keyserver. Don't send your
406 complete keyring to a keyserver --- select only those keys which are new
407 or changed by you. If no key IDs are given, @command{gpg} does nothing.
409 @item --export-secret-keys
410 @itemx --export-secret-subkeys
411 @opindex export-secret-keys
412 @opindex export-secret-subkeys
413 Same as @option{--export}, but exports the secret keys instead. This is
414 normally not very useful and a security risk. The second form of the
415 command has the special property to render the secret part of the
416 primary key useless; this is a GNU extension to OpenPGP and other
417 implementations can not be expected to successfully import such a key.
418 See the option @option{--simple-sk-checksum} if you want to import such
419 an exported key with an older OpenPGP implementation.
424 Import/merge keys. This adds the given keys to the
425 keyring. The fast version is currently just a synonym.
427 There are a few other options which control how this command works.
428 Most notable here is the @option{--import-options merge-only} option
429 which does not insert new keys but does only the merging of new
430 signatures, user-IDs and subkeys.
432 @item --recv-keys @code{key IDs}
434 Import the keys with the given key IDs from a keyserver. Option
435 @option{--keyserver} must be used to give the name of this keyserver.
438 @opindex refresh-keys
439 Request updates from a keyserver for keys that already exist on the
440 local keyring. This is useful for updating a key with the latest
441 signatures, user IDs, etc. Calling this with no arguments will refresh
442 the entire keyring. Option @option{--keyserver} must be used to give the
443 name of the keyserver for all keys that do not have preferred keyservers
444 set (see @option{--keyserver-options honor-keyserver-url}).
446 @item --search-keys @code{names}
448 Search the keyserver for the given names. Multiple names given here will
449 be joined together to create the search string for the keyserver.
450 Option @option{--keyserver} must be used to give the name of this
451 keyserver. Keyservers that support different search methods allow using
452 the syntax specified in "How to specify a user ID" below. Note that
453 different keyserver types support different search methods. Currently
454 only LDAP supports them all.
456 @item --fetch-keys @code{URIs}
458 Retrieve keys located at the specified URIs. Note that different
459 installations of GnuPG may support different protocols (HTTP, FTP,
462 @item --update-trustdb
463 @opindex update-trustdb
464 Do trust database maintenance. This command iterates over all keys and
465 builds the Web of Trust. This is an interactive command because it may
466 have to ask for the "ownertrust" values for keys. The user has to give
467 an estimation of how far she trusts the owner of the displayed key to
468 correctly certify (sign) other keys. GnuPG only asks for the ownertrust
469 value if it has not yet been assigned to a key. Using the
470 @option{--edit-key} menu, the assigned value can be changed at any time.
472 @item --check-trustdb
473 @opindex check-trustdb
474 Do trust database maintenance without user interaction. From time to
475 time the trust database must be updated so that expired keys or
476 signatures and the resulting changes in the Web of Trust can be
477 tracked. Normally, GnuPG will calculate when this is required and do it
478 automatically unless @option{--no-auto-check-trustdb} is set. This
479 command can be used to force a trust database check at any time. The
480 processing is identical to that of @option{--update-trustdb} but it
481 skips keys with a not yet defined "ownertrust".
483 For use with cron jobs, this command can be used together with
484 @option{--batch} in which case the trust database check is done only if
485 a check is needed. To force a run even in batch mode add the option
488 @anchor{option --export-ownertrust}
489 @item --export-ownertrust
490 @opindex export-ownertrust
491 Send the ownertrust values to STDOUT. This is useful for backup purposes
492 as these values are the only ones which can't be re-created from a
493 corrupted trustdb. Example:
496 @gpgname{} --export-ownertrust > otrust.txt
501 @item --import-ownertrust
502 @opindex import-ownertrust
503 Update the trustdb with the ownertrust values stored in @code{files} (or
504 STDIN if not given); existing values will be overwritten. In case of a
505 severely damaged trustdb and if you have a recent backup of the
506 ownertrust values (e.g. in the file @file{otrust.txt}, you may re-create
507 the trustdb using these commands:
512 @gpgname{} --import-ownertrust < otrust.txt
517 @item --rebuild-keydb-caches
518 @opindex rebuild-keydb-caches
519 When updating from version 1.0.6 to 1.0.7 this command should be used
520 to create signature caches in the keyring. It might be handy in other
523 @item --print-md @code{algo}
526 Print message digest of algorithm ALGO for all given files or STDIN.
527 With the second form (or a deprecated "*" as algo) digests for all
528 available algorithms are printed.
530 @item --gen-random @code{0|1|2}
532 Emit @var{count} random bytes of the given quality level. If count is
533 not given or zero, an endless sequence of random bytes will be emitted.
534 PLEASE, don't use this command unless you know what you are doing; it
535 may remove precious entropy from the system!
537 @item --gen-prime @code{mode} @code{bits}
539 Use the source, Luke :-). The output format is still subject to change.
546 Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
547 This is a GnuPG extension to OpenPGP and in general not very useful.
552 @c *******************************************
553 @c ******* KEY MANGEMENT COMMANDS **********
554 @c *******************************************
555 @node OpenPGP Key Management
556 @subsection How to manage your keys
558 This section explains the main commands for key management
564 Generate a new key pair. This command is normally only used
567 There is an experimental feature which allows you to create keys in
568 batch mode. See the file @file{doc/DETAILS} in the source distribution
571 @item --gen-revoke @code{name}
573 Generate a revocation certificate for the complete key. To revoke
574 a subkey or a signature, use the @option{--edit} command.
576 @item --desig-revoke @code{name}
577 @opindex desig-revoke
578 Generate a designated revocation certificate for a key. This allows a
579 user (with the permission of the keyholder) to revoke someone else's
585 Present a menu which enables you to do most of the key management
586 related tasks. It expects the specification of a key on the command
589 @c ******** Begin Edit-key Options **********
593 @opindex keyedit:sign
594 Make a signature on key of user @code{name} If the key is not yet
595 signed by the default user (or the users given with -u), the program
596 displays the information of the key again, together with its
597 fingerprint and asks whether it should be signed. This question is
598 repeated for all users specified with
602 @opindex keyedit:lsign
603 Same as "sign" but the signature is marked as non-exportable and will
604 therefore never be used by others. This may be used to make keys
605 valid only in the local environment.
608 @opindex keyedit:nrsign
609 Same as "sign" but the signature is marked as non-revocable and can
610 therefore never be revoked.
613 @opindex keyedit:tsign
614 Make a trust signature. This is a signature that combines the notions
615 of certification (like a regular signature), and trust (like the
616 "trust" command). It is generally only useful in distinct communities
621 Note that "l" (for local / non-exportable), "nr" (for non-revocable,
622 and "t" (for trust) may be freely mixed and prefixed to "sign" to
623 create a signature of any type desired.
629 @opindex keyedit:revsig
630 Revoke a signature. For every signature which has been generated by
631 one of the secret keys, GnuPG asks whether a revocation certificate
635 @opindex keyedit:trust
636 Change the owner trust value. This updates the
637 trust-db immediately and no save is required.
641 @opindex keyedit:disable
642 @opindex keyedit:enable
643 Disable or enable an entire key. A disabled key can not normally be
647 @opindex keyedit:adduid
648 Create an alternate user id.
651 @opindex keyedit:addphoto
652 Create a photographic user id. This will prompt for a JPEG file that
653 will be embedded into the user ID. Note that a very large JPEG will make
654 for a very large key. Also note that some programs will display your
655 JPEG unchanged (GnuPG), and some programs will scale it to fit in a
659 @opindex keyedit:deluid
660 Delete a user id. Note that it is not possible to retract a user id,
661 once it has been send to the public (i.e. to a keyserver). In that case
662 you better use @code{revuid}.
665 @opindex keyedit:delsig
666 Delete a signature. Note that it is not possible to retract a signature,
667 once it has been send to the public (i.e. to a keyserver). In that case
668 you better use @code{revsig}.
671 @opindex keyedit:revuid
675 @opindex keyedit:addkey
676 Add a subkey to this key.
679 @opindex keyedit:addcardkey
680 Generate a key on a card and add it to this key.
683 @opindex keyedit:keytocard
684 Transfer the selected secret key (or the primary key if no key has been
685 selected) to a smartcard. The secret key in the keyring will be replaced
686 by a stub if the key could be stored successfully on the card and you
687 use the save command later. Only certain key types may be transferred to
688 the card. A sub menu allows you to select on what card to store the
689 key. Note that it is not possible to get that key back from the card -
690 if the card gets broken your secret key will be lost unless you have a
693 @item bkuptocard @code{file}
694 @opindex keyedit:bkuptocard
695 Restore the given file to a card. This command may be used to restore a
696 backup key (as generated during card initialization) to a new card. In
697 almost all cases this will be the encryption key. You should use this
698 command only with the corresponding public key and make sure that the
699 file given as argument is indeed the backup to restore. You should then
700 select 2 to restore as encryption key. You will first be asked to enter
701 the passphrase of the backup key and then for the Admin PIN of the card.
704 @opindex keyedit:delkey
705 Remove a subkey (secondart key). Note that it is not possible to retract
706 a subkey, once it has been send to the public (i.e. to a keyserver). In
707 that case you better use @code{revkey}.
710 @opindex keyedit:addrevoker
711 Add a designated revoker. This takes one optional argument:
712 "sensitive". If a designated revoker is marked as sensitive, it will not
713 be exported by default (see export-options).
716 @opindex keyedit:revkey
720 @opindex keyedit:expire
721 Change the key expiration time. If a subkey is selected, the
722 expiration time of this subkey will be changed. With no selection,
723 the key expiration of the primary key is changed.
726 @opindex keyedit:passwd
727 Change the passphrase of the secret key.
730 @opindex keyedit:primary
731 Flag the current user id as the primary one, removes the primary user
732 id flag from all other user ids and sets the timestamp of all affected
733 self-signatures one second ahead. Note that setting a photo user ID
734 as primary makes it primary over other photo user IDs, and setting a
735 regular user ID as primary makes it primary over other regular user
740 Toggle selection of user id with index @code{n}.
741 Use 0 to deselect all.
745 Toggle selection of subkey with index @code{n}.
746 Use 0 to deselect all.
749 @opindex keyedit:check
750 Check all selected user ids.
753 @opindex keyedit:showphoto
754 Display the selected photographic user
758 @opindex keyedit:pref
759 List preferences from the selected user ID. This shows the actual
760 preferences, without including any implied preferences.
763 @opindex keyedit:showpref
764 More verbose preferences listing for the selected user ID. This shows
765 the preferences in effect by including the implied preferences of 3DES
766 (cipher), SHA-1 (digest), and Uncompressed (compression) if they are
767 not already included in the preference list. In addition, the
768 preferred keyserver and signature notations (if any) are shown.
770 @item setpref @code{string}
771 @opindex keyedit:setpref
772 Set the list of user ID preferences to @code{string} for all (or just
773 the selected) user IDs. Calling setpref with no arguments sets the
774 preference list to the default (either built-in or set via
775 @option{--default-preference-list}), and calling setpref with "none"
776 as the argument sets an empty preference list. Use @command{@gpgname
777 --version} to get a list of available algorithms. Note that while you
778 can change the preferences on an attribute user ID (aka "photo ID"),
779 GnuPG does not select keys via attribute user IDs so these preferences
780 will not be used by GnuPG.
782 When setting preferences, you should list the algorithms in the order
783 which you'd like to see them used by someone else when encrypting a
784 message to your key. If you don't include 3DES, it will be
785 automatically added at the end. Note that there are many factors that
786 go into choosing an algorithm (for example, your key may not be the
787 only recipient), and so the remote OpenPGP application being used to
788 send to you may or may not follow your exact chosen order for a given
789 message. It will, however, only choose an algorithm that is present
790 on the preference list of every recipient key. See also the
791 INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
794 @opindex keyedit:keyserver
795 Set a preferred keyserver for the specified user ID(s). This allows
796 other users to know where you prefer they get your key from. See
797 @option{--keyserver-options honor-keyserver-url} for more on how this
798 works. Setting a value of "none" removes an existing preferred
802 @opindex keyedit:notation
803 Set a name=value notation for the specified user ID(s). See
804 @option{--cert-notation} for more on how this works. Setting a value of
805 "none" removes all notations, setting a notation prefixed with a minus
806 sign (-) removes that notation, and setting a notation name (without the
807 =value) prefixed with a minus sign removes all notations with that name.
810 @opindex keyedit:toggle
811 Toggle between public and secret key listing.
814 @opindex keyedit:clean
815 Compact (by removing all signatures except the selfsig) any user ID
816 that is no longer usable (e.g. revoked, or expired). Then, remove any
817 signatures that are not usable by the trust calculations.
818 Specifically, this removes any signature that does not validate, any
819 signature that is superseded by a later signature, revoked signatures,
820 and signatures issued by keys that are not present on the keyring.
823 @opindex keyedit:minimize
824 Make the key as small as possible. This removes all signatures from
825 each user ID except for the most recent self-signature.
828 @opindex keyedit:cross-certify
829 Add cross-certification signatures to signing subkeys that may not
830 currently have them. Cross-certification signatures protect against a
831 subtle attack against signing subkeys. See
832 @option{--require-cross-certification}.
835 @opindex keyedit:save
836 Save all changes to the key rings and quit.
839 @opindex keyedit:quit
840 Quit the program without updating the
846 The listing shows you the key with its secondary keys and all user
847 ids. Selected keys or user ids are indicated by an asterisk. The trust
848 value is displayed with the primary key: the first is the assigned owner
849 trust and the second is the calculated trust value. Letters are used for
856 No ownertrust assigned / not yet calculated.
860 calculation has failed; probably due to an expired key.
863 Not enough information for calculation.
866 Never trust this key.
877 @c ******** End Edit-key Options **********
879 @item --sign-key @code{name}
881 Signs a public key with your secret key. This is a shortcut version of
882 the subcommand "sign" from @option{--edit}.
884 @item --lsign-key @code{name}
886 Signs a public key with your secret key but marks it as
887 non-exportable. This is a shortcut version of the subcommand "lsign"
888 from @option{--edit-key}.
894 @c *******************************************
895 @c *************** ****************
896 @c *************** OPTIONS ****************
897 @c *************** ****************
898 @c *******************************************
901 @section Option Summary
903 @command{@gpgname} comes features a bunch of options to control the exact
904 behaviour and to change the default configuration.
907 * GPG Configuration Options:: How to change the configuration.
908 * GPG Key related Options:: Key related options.
909 * GPG Input and Output:: Input and Output.
910 * OpenPGP Options:: OpenPGP protocol specific options.
911 * GPG Esoteric Options:: Doing things one usually don't want to do.
914 Long options can be put in an options file (default
915 "~/.gnupg/gpg.conf"). Short option names will not work - for example,
916 "armor" is a valid option for the options file, while "a" is not. Do not
917 write the 2 dashes, but simply the name of the option and any required
918 arguments. Lines with a hash ('#') as the first non-white-space
919 character are ignored. Commands may be put in this file too, but that is
920 not generally useful as the command will execute automatically with
921 every execution of gpg.
923 Please remember that option parsing stops as soon as a non-option is
924 encountered, you can explicitly stop parsing by using the special option
927 @c *******************************************
928 @c ******** CONFIGURATION OPTIONS **********
929 @c *******************************************
930 @node GPG Configuration Options
931 @subsection How to change the configuration
933 These options are used to change the configuration and are usually found
938 @item --default-key @var{name}
940 Use @var{name} as the default key to sign with. If this option is not
941 used, the default key is the first key found in the secret keyring.
942 Note that @option{-u} or @option{--local-user} overrides this option.
944 @item --default-recipient @var{name}
945 @opindex default-recipient
946 Use @var{name} as default recipient if option @option{--recipient} is
947 not used and don't ask if this is a valid one. @var{name} must be
950 @item --default-recipient-self
951 @opindex default-recipient-self
952 Use the default key as default recipient if option @option{--recipient} is not
953 used and don't ask if this is a valid one. The default key is the first
954 one from the secret keyring or the one set with @option{--default-key}.
956 @item --no-default-recipient
957 @opindex no-default-recipient
958 Reset @option{--default-recipient} and @option{--default-recipient-self}.
962 Give more information during processing. If used
963 twice, the input data is listed in detail.
967 Reset verbose level to 0.
971 Try to be as quiet as possible.
977 Use batch mode. Never ask, do not allow interactive commands.
978 @option{--no-batch} disables this option. Note that even with a
979 filename given on the command line, gpg might still need to read from
980 STDIN (in particular if gpg figures that the input is a
981 detached signature and no data file has been specified). Thus if you
982 do not want to feed data via STDIN, you should connect STDIN to
987 Make sure that the TTY (terminal) is never used for any output.
988 This option is needed in some cases because GnuPG sometimes prints
989 warnings to the TTY even if @option{--batch} is used.
993 Assume "yes" on most questions.
997 Assume "no" on most questions.
1000 @item --list-options @code{parameters}
1001 @opindex list-options
1002 This is a space or comma delimited string that gives options used when
1003 listing keys and signatures (that is, @option{--list-keys},
1004 @option{--list-sigs}, @option{--list-public-keys},
1005 @option{--list-secret-keys}, and the @option{--edit-key} functions).
1006 Options can be prepended with a @option{no-} (after the two dashes) to
1007 give the opposite meaning. The options are:
1012 @opindex list-options:show-photos
1013 Causes @option{--list-keys}, @option{--list-sigs},
1014 @option{--list-public-keys}, and @option{--list-secret-keys} to display
1015 any photo IDs attached to the key. Defaults to no. See also
1016 @option{--photo-viewer}.
1018 @item show-policy-urls
1019 @opindex list-options:show-policy-urls
1020 Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
1021 listings. Defaults to no.
1023 @item show-notations
1024 @itemx show-std-notations
1025 @itemx show-user-notations
1026 @opindex list-options:show-notations
1027 @opindex list-options:show-std-notations
1028 @opindex list-options:show-user-notations
1029 Show all, IETF standard, or user-defined signature notations in the
1030 @option{--list-sigs} or @option{--check-sigs} listings. Defaults to no.
1032 @item show-keyserver-urls
1034 Show any preferred keyserver URL in the @option{--list-sigs} or
1035 @option{--check-sigs} listings. Defaults to no.
1037 @item show-uid-validity
1038 Display the calculated validity of user IDs during key listings.
1041 @item show-unusable-uids
1042 Show revoked and expired user IDs in key listings. Defaults to no.
1044 @item show-unusable-subkeys
1045 Show revoked and expired subkeys in key listings. Defaults to no.
1048 Display the keyring name at the head of key listings to show which
1049 keyring a given key resides on. Defaults to no.
1051 @item show-sig-expire
1052 Show signature expiration dates (if any) during @option{--list-sigs} or
1053 @option{--check-sigs} listings. Defaults to no.
1055 @item show-sig-subpackets
1056 Include signature subpackets in the key listing. This option can take an
1057 optional argument list of the subpackets to list. If no argument is
1058 passed, list all subpackets. Defaults to no. This option is only
1059 meaningful when using @option{--with-colons} along with
1060 @option{--list-sigs} or @option{--check-sigs}.
1063 @item --verify-options @code{parameters}
1064 This is a space or comma delimited string that gives options used when
1065 verifying signatures. Options can be prepended with a `no-' to give
1066 the opposite meaning. The options are:
1071 Display any photo IDs present on the key that issued the signature.
1072 Defaults to no. See also @option{--photo-viewer}.
1074 @item show-policy-urls
1075 Show policy URLs in the signature being verified. Defaults to no.
1077 @item show-notations
1078 @itemx show-std-notations
1079 @itemx show-user-notations
1080 Show all, IETF standard, or user-defined signature notations in the
1081 signature being verified. Defaults to IETF standard.
1083 @item show-keyserver-urls
1084 Show any preferred keyserver URL in the signature being verified.
1087 @item show-uid-validity
1088 Display the calculated validity of the user IDs on the key that issued
1089 the signature. Defaults to no.
1091 @item show-unusable-uids
1092 Show revoked and expired user IDs during signature verification.
1095 @item show-primary-uid-only
1096 Show only the primary user ID during signature verification. That is
1097 all the AKA lines as well as photo Ids are not shown with the signature
1098 verification status.
1101 Enable PKA lookups to verify sender addresses. Note that PKA is based
1102 on DNS, and so enabling this option may disclose information on when
1103 and what signatures are verified or to whom data is encrypted. This
1104 is similar to the "web bug" described for the auto-key-retrieve
1107 @item pka-trust-increase
1108 Raise the trust in a signature to full if the signature passes PKA
1109 validation. This option is only meaningful if pka-lookups is set.
1113 @itemx --disable-dsa2
1114 Enable hash truncation for all DSA keys even for old DSA Keys up to
1115 1024 bit. This is also the default with @option{--openpgp}. Note
1116 that older versions of GnuPG also required this flag to allow the
1117 generation of DSA larger than 1024 bit.
1119 @item --photo-viewer @code{string}
1120 This is the command line that should be run to view a photo ID. "%i"
1121 will be expanded to a filename containing the photo. "%I" does the
1122 same, except the file will not be deleted once the viewer exits.
1123 Other flags are "%k" for the key ID, "%K" for the long key ID, "%f"
1124 for the key fingerprint, "%t" for the extension of the image type
1125 (e.g. "jpg"), "%T" for the MIME type of the image (e.g. "image/jpeg"),
1126 and "%%" for an actual percent sign. If neither %i or %I are present,
1127 then the photo will be supplied to the viewer on standard input.
1129 The default viewer is "xloadimage -fork -quiet -title 'KeyID 0x%k'
1130 STDIN". Note that if your image viewer program is not secure, then
1131 executing it from GnuPG does not make it secure.
1133 @item --exec-path @code{string}
1134 Sets a list of directories to search for photo viewers and keyserver
1135 helpers. If not provided, keyserver helpers use the compiled-in
1136 default directory, and photo viewers use the $PATH environment
1138 Note, that on W32 system this value is ignored when searching for
1141 @item --keyring @code{file}
1142 Add @code{file} to the current list of keyrings. If @code{file} begins
1143 with a tilde and a slash, these are replaced by the $HOME directory. If
1144 the filename does not contain a slash, it is assumed to be in the GnuPG
1145 home directory ("~/.gnupg" if @option{--homedir} or $GNUPGHOME is not
1148 Note that this adds a keyring to the current list. If the intent is to
1149 use the specified keyring alone, use @option{--keyring} along with
1150 @option{--no-default-keyring}.
1152 @item --secret-keyring @code{file}
1153 Same as @option{--keyring} but for the secret keyrings.
1155 @item --primary-keyring @code{file}
1156 Designate @code{file} as the primary public keyring. This means that
1157 newly imported keys (via @option{--import} or keyserver
1158 @option{--recv-from}) will go to this keyring.
1160 @item --trustdb-name @code{file}
1161 Use @code{file} instead of the default trustdb. If @code{file} begins
1162 with a tilde and a slash, these are replaced by the $HOME directory. If
1163 the filename does not contain a slash, it is assumed to be in the GnuPG
1164 home directory (@file{~/.gnupg} if @option{--homedir} or $GNUPGHOME is
1168 @anchor{option --homedir}
1170 @include opt-homedir.texi
1174 @item --pcsc-driver @code{file}
1175 Use @code{file} to access the smartcard reader. The current default is
1176 `libpcsclite.so.1' for GLIBC based systems,
1177 `/System/Library/Frameworks/PCSC.framework/PCSC' for MAC OS X,
1178 `winscard.dll' for Windows and `libpcsclite.so' for other systems.
1182 @item --disable-ccid
1183 Disable the integrated support for CCID compliant readers. This
1184 allows to fall back to one of the other drivers even if the internal
1185 CCID driver can handle the reader. Note, that CCID support is only
1186 available if libusb was available at build time.
1190 @item --reader-port @code{number_or_string}
1191 This option may be used to specify the port of the card terminal. A
1192 value of 0 refers to the first serial device; add 32768 to access USB
1193 devices. The default is 32768 (first USB device). PC/SC or CCID
1194 readers might need a string here; run the program in verbose mode to get
1195 a list of available readers. The default is then the first reader
1199 @item --display-charset @code{name}
1200 Set the name of the native character set. This is used to convert
1201 some informational strings like user IDs to the proper UTF-8 encoding.
1202 Note that this has nothing to do with the character set of data to be
1203 encrypted or signed; GnuPG does not recode user-supplied data. If
1204 this option is not used, the default character set is determined from
1205 the current locale. A verbosity level of 3 shows the chosen set.
1206 Valid values for @code{name} are:
1211 This is the Latin 1 set.
1217 This is currently an alias for
1221 The usual Russian set (rfc1489).
1224 Bypass all translations and assume
1225 that the OS uses native UTF-8 encoding.
1228 @item --utf8-strings
1229 @itemx --no-utf8-strings
1230 Assume that command line arguments are given as UTF8 strings. The
1231 default (@option{--no-utf8-strings}) is to assume that arguments are
1232 encoded in the character set as specified by
1233 @option{--display-charset}. These options affect all following
1234 arguments. Both options may be used multiple times.
1237 @anchor{option --options}
1239 @item --options @code{file}
1240 Read options from @code{file} and do not try to read them from the
1241 default options file in the homedir (see @option{--homedir}). This
1242 option is ignored if used in an options file.
1245 Shortcut for @option{--options /dev/null}. This option is detected
1246 before an attempt to open an option file. Using this option will also
1247 prevent the creation of a @file{~/.gnupg} homedir.
1252 @itemx --compress-level @code{n}
1253 @itemx --bzip2-compress-level @code{n}
1254 Set compression level to @code{n} for the ZIP and ZLIB compression
1255 algorithms. The default is to use the default compression level of zlib
1256 (normally 6). @option{--bzip2-compress-level} sets the compression level
1257 for the BZIP2 compression algorithm (defaulting to 6 as well). This is a
1258 different option from @option{--compress-level} since BZIP2 uses a
1259 significant amount of memory for each additional compression level.
1260 @option{-z} sets both. A value of 0 for @code{n} disables compression.
1262 @item --bzip2-decompress-lowmem
1263 Use a different decompression method for BZIP2 compressed files. This
1264 alternate method uses a bit more than half the memory, but also runs
1265 at half the speed. This is useful under extreme low memory
1266 circumstances when the file was originally compressed at a high
1267 @option{--bzip2-compress-level}.
1270 @item --mangle-dos-filenames
1271 @itemx --no-mangle-dos-filenames
1272 @opindex mangle-dos-filenames
1273 @opindex no-mangle-dos-filenames
1274 Older version of Windows cannot handle filenames with more than one
1275 dot. @option{--mangle-dos-filenames} causes GnuPG to replace (rather
1276 than add to) the extension of an output filename to avoid this
1277 problem. This option is off by default and has no effect on non-Windows
1280 @item --ask-cert-level
1281 @itemx --no-ask-cert-level
1282 When making a key signature, prompt for a certification level. If this
1283 option is not specified, the certification level used is set via
1284 @option{--default-cert-level}. See @option{--default-cert-level} for
1285 information on the specific levels and how they are
1286 used. @option{--no-ask-cert-level} disables this option. This option
1289 @item --default-cert-level @code{n}
1290 The default to use for the check level when signing a key.
1292 0 means you make no particular claim as to how carefully you verified
1295 1 means you believe the key is owned by the person who claims to own
1296 it but you could not, or did not verify the key at all. This is
1297 useful for a "persona" verification, where you sign the key of a
1300 2 means you did casual verification of the key. For example, this
1301 could mean that you verified that the key fingerprint and checked the
1302 user ID on the key against a photo ID.
1304 3 means you did extensive verification of the key. For example, this
1305 could mean that you verified the key fingerprint with the owner of the
1306 key in person, and that you checked, by means of a hard to forge
1307 document with a photo ID (such as a passport) that the name of the key
1308 owner matches the name in the user ID on the key, and finally that you
1309 verified (by exchange of email) that the email address on the key
1310 belongs to the key owner.
1312 Note that the examples given above for levels 2 and 3 are just that:
1313 examples. In the end, it is up to you to decide just what "casual"
1314 and "extensive" mean to you.
1316 This option defaults to 0 (no particular claim).
1318 @item --min-cert-level
1319 When building the trust database, treat any signatures with a
1320 certification level below this as invalid. Defaults to 2, which
1321 disregards level 1 signatures. Note that level 0 "no particular
1322 claim" signatures are always accepted.
1324 @item --trusted-key @code{long key ID}
1325 Assume that the specified key (which must be given
1326 as a full 8 byte key ID) is as trustworthy as one of
1327 your own secret keys. This option is useful if you
1328 don't want to keep your secret keys (or one of them)
1329 online but still want to be able to check the validity of a given
1330 recipient's or signator's key.
1332 @item --trust-model @code{pgp|classic|direct|always|auto}
1333 Set what trust model GnuPG should follow. The models are:
1338 This is the Web of Trust combined with trust signatures as used in PGP
1339 5.x and later. This is the default trust model when creating a new
1343 This is the standard Web of Trust as used in PGP 2.x and earlier.
1346 Key validity is set directly by the user and not calculated via the
1350 Skip key validation and assume that used keys are always fully
1351 trusted. You generally won't use this unless you are using some
1352 external validation scheme. This option also suppresses the
1353 "[uncertain]" tag printed with signature checks when there is no
1354 evidence that the user ID is bound to the key.
1357 Select the trust model depending on whatever the internal trust
1358 database says. This is the default model if such a database already
1362 @item --auto-key-locate @code{parameters}
1363 @itemx --no-auto-key-locate
1364 GnuPG can automatically locate and retrieve keys as needed using this
1365 option. This happens when encrypting to an email address (in the
1366 "user@@example.com" form), and there are no user@@example.com keys on
1367 the local keyring. This option takes any number of the following
1368 mechanisms, in the order they are to be tried:
1373 Locate a key using DNS CERT, as specified in rfc4398.
1376 Locate a key using DNS PKA.
1379 Locate a key using the PGP Universal method of checking
1380 @samp{ldap://keys.(thedomain)}.
1383 Locate a key using whatever keyserver is defined using the
1384 @option{--keyserver} option.
1387 In addition, a keyserver URL as used in the @option{--keyserver} option
1388 may be used here to query that particular keyserver.
1391 Locate the key using the local keyrings. This mechanism allows to
1392 select the order a local key lookup is done. Thus using
1393 @samp{--auto-key-locate local} is identical to
1394 @option{--no-auto-key-locate}.
1397 This flag disables the standard local key lookup, done before any of the
1398 mechanisms defined by the @option{--auto-key-locate} are tried. The
1399 position of this mechanism in the list does not matter. It is not
1400 required if @code{local} is also used.
1404 @item --keyid-format @code{short|0xshort|long|0xlong}
1405 Select how to display key IDs. "short" is the traditional 8-character
1406 key ID. "long" is the more accurate (but less convenient)
1407 16-character key ID. Add an "0x" to either to include an "0x" at the
1408 beginning of the key ID, as in 0x99242560.
1410 @item --keyserver @code{name}
1411 Use @code{name} as your keyserver. This is the server that
1412 @option{--recv-keys}, @option{--send-keys}, and @option{--search-keys}
1413 will communicate with to receive keys from, send keys to, and search for
1414 keys on. The format of the @code{name} is a URI:
1415 `scheme:[//]keyservername[:port]' The scheme is the type of keyserver:
1416 "hkp" for the HTTP (or compatible) keyservers, "ldap" for the LDAP
1417 keyservers, or "mailto" for the Graff email keyserver. Note that your
1418 particular installation of GnuPG may have other keyserver types
1419 available as well. Keyserver schemes are case-insensitive. After the
1420 keyserver name, optional keyserver configuration options may be
1421 provided. These are the same as the global @option{--keyserver-options}
1422 from below, but apply only to this particular keyserver.
1424 Most keyservers synchronize with each other, so there is generally no
1425 need to send keys to more than one server. The keyserver
1426 @code{hkp://keys.gnupg.net} uses round robin DNS to give a different
1427 keyserver each time you use it.
1429 @item --keyserver-options @code{name=value1 }
1430 This is a space or comma delimited string that gives options for the
1431 keyserver. Options can be prepended with a `no-' to give the opposite
1432 meaning. Valid import-options or export-options may be used here as well
1433 to apply to importing (@option{--recv-key}) or exporting
1434 (@option{--send-key}) a key from a keyserver. While not all options are
1435 available for all keyserver types, some common options are:
1439 @item include-revoked
1440 When searching for a key with @option{--search-keys}, include keys that
1441 are marked on the keyserver as revoked. Note that not all keyservers
1442 differentiate between revoked and unrevoked keys, and for such
1443 keyservers this option is meaningless. Note also that most keyservers do
1444 not have cryptographic verification of key revocations, and so turning
1445 this option off may result in skipping keys that are incorrectly marked
1448 @item include-disabled
1449 When searching for a key with @option{--search-keys}, include keys that
1450 are marked on the keyserver as disabled. Note that this option is not
1451 used with HKP keyservers.
1453 @item auto-key-retrieve
1454 This option enables the automatic retrieving of keys from a keyserver
1455 when verifying signatures made by keys that are not on the local
1458 Note that this option makes a "web bug" like behavior possible.
1459 Keyserver operators can see which keys you request, so by sending you
1460 a message signed by a brand new key (which you naturally will not have
1461 on your local keyring), the operator can tell both your IP address and
1462 the time when you verified the signature.
1464 @item honor-keyserver-url
1465 When using @option{--refresh-keys}, if the key in question has a preferred
1466 keyserver URL, then use that preferred keyserver to refresh the key
1467 from. In addition, if auto-key-retrieve is set, and the signature
1468 being verified has a preferred keyserver URL, then use that preferred
1469 keyserver to fetch the key from. Defaults to yes.
1471 @item honor-pka-record
1472 If auto-key-retrieve is set, and the signature being verified has a
1473 PKA record, then use the PKA information to fetch the key. Defaults
1476 @item include-subkeys
1477 When receiving a key, include subkeys as potential targets. Note that
1478 this option is not used with HKP keyservers, as they do not support
1479 retrieving keys by subkey id.
1481 @item use-temp-files
1482 On most Unix-like platforms, GnuPG communicates with the keyserver
1483 helper program via pipes, which is the most efficient method. This
1484 option forces GnuPG to use temporary files to communicate. On some
1485 platforms (such as Win32 and RISC OS), this option is always enabled.
1487 @item keep-temp-files
1488 If using `use-temp-files', do not delete the temp files after using
1489 them. This option is useful to learn the keyserver communication
1490 protocol by reading the temporary files.
1493 Tell the keyserver helper program to be more verbose. This option can
1494 be repeated multiple times to increase the verbosity level.
1497 Tell the keyserver helper program how long (in seconds) to try and
1498 perform a keyserver action before giving up. Note that performing
1499 multiple actions at the same time uses this timeout value per action.
1500 For example, when retrieving multiple keys via @option{--recv-keys}, the
1501 timeout applies separately to each key retrieval, and not to the
1502 @option{--recv-keys} command as a whole. Defaults to 30 seconds.
1504 @item http-proxy=@code{value}
1505 Set the proxy to use for HTTP and HKP keyservers. This overrides the
1506 "http_proxy" environment variable, if any.
1509 When retrieving a key via DNS CERT, only accept keys up to this size.
1510 Defaults to 16384 bytes.
1513 Turn on debug output in the keyserver helper program. Note that the
1514 details of debug output depends on which keyserver helper program is
1515 being used, and in turn, on any libraries that the keyserver helper
1516 program uses internally (libcurl, openldap, etc).
1519 @item --completes-needed @code{n}
1520 Number of completely trusted users to introduce a new
1521 key signer (defaults to 1).
1523 @item --marginals-needed @code{n}
1524 Number of marginally trusted users to introduce a new
1525 key signer (defaults to 3)
1527 @item --max-cert-depth @code{n}
1528 Maximum depth of a certification chain (default is 5).
1530 @item --simple-sk-checksum
1531 Secret keys are integrity protected by using a SHA-1 checksum. This
1532 method is part of the upcoming enhanced OpenPGP specification but
1533 GnuPG already uses it as a countermeasure against certain attacks.
1534 Old applications don't understand this new format, so this option may
1535 be used to switch back to the old behaviour. Using this option bears
1536 a security risk. Note that using this option only takes effect when
1537 the secret key is encrypted - the simplest way to make this happen is
1538 to change the passphrase on the key (even changing it to the same
1539 value is acceptable).
1541 @item --no-sig-cache
1542 Do not cache the verification status of key signatures.
1543 Caching gives a much better performance in key listings. However, if
1544 you suspect that your public keyring is not save against write
1545 modifications, you can use this option to disable the caching. It
1546 probably does not make sense to disable it because all kind of damage
1547 can be done if someone else has write access to your public keyring.
1549 @item --no-sig-create-check
1550 GnuPG normally verifies each signature right after creation to protect
1551 against bugs and hardware malfunctions which could leak out bits from
1552 the secret key. This extra verification needs some time (about 115%
1553 for DSA keys), and so this option can be used to disable it.
1554 However, due to the fact that the signature creation needs manual
1555 interaction, this performance penalty does not matter in most settings.
1557 @item --auto-check-trustdb
1558 @itemx --no-auto-check-trustdb
1559 If GnuPG feels that its information about the Web of Trust has to be
1560 updated, it automatically runs the @option{--check-trustdb} command
1561 internally. This may be a time consuming
1562 process. @option{--no-auto-check-trustdb} disables this option.
1565 @itemx --no-use-agent
1567 This is dummy option. @command{@gpgname} always requires the agent.
1570 Try to use the GnuPG-Agent. With this option, GnuPG first tries to
1571 connect to the agent before it asks for a
1572 passphrase. @option{--no-use-agent} disables this option.
1575 @item --gpg-agent-info
1577 This is dummy option. It has no effect when used with @command{gpg2}.
1580 Override the value of the environment variable
1581 @samp{GPG_AGENT_INFO}. This is only used when @option{--use-agent} has
1582 been given. Given that this option is not anymore used by
1583 @command{gpg2}, it should be avoided if possible.
1587 Lock the databases the first time a lock is requested
1588 and do not release the lock until the process
1591 @item --lock-multiple
1592 Release the locks every time a lock is no longer
1593 needed. Use this to override a previous @option{--lock-once}
1597 Disable locking entirely. This option should be used only in very
1598 special environments, where it can be assured that only one process
1599 is accessing those files. A bootable floppy with a stand-alone
1600 encryption system will probably use this. Improper usage of this
1601 option may lead to data and key corruption.
1603 @item --exit-on-status-write-error
1604 This option will cause write errors on the status FD to immediately
1605 terminate the process. That should in fact be the default but it never
1606 worked this way and thus we need an option to enable this, so that the
1607 change won't break applications which close their end of a status fd
1608 connected pipe too early. Using this option along with
1609 @option{--enable-progress-filter} may be used to cleanly cancel long
1610 running gpg operations.
1612 @item --limit-card-insert-tries @code{n}
1613 With @code{n} greater than 0 the number of prompts asking to insert a
1614 smartcard gets limited to N-1. Thus with a value of 1 gpg won't at
1615 all ask to insert a card if none has been inserted at startup. This
1616 option is useful in the configuration file in case an application does
1617 not know about the smartcard support and waits ad infinitum for an
1620 @item --no-random-seed-file
1621 GnuPG uses a file to store its internal random pool over invocations.
1622 This makes random generation faster; however sometimes write operations
1623 are not desired. This option can be used to achieve that with the cost of
1624 slower random generation.
1627 Suppress the initial copyright message.
1629 @item --no-secmem-warning
1630 Suppress the warning about "using insecure memory".
1632 @item --no-permission-warning
1633 Suppress the warning about unsafe file and home directory (@option{--homedir})
1634 permissions. Note that the permission checks that GnuPG performs are
1635 not intended to be authoritative, but rather they simply warn about
1636 certain common permission problems. Do not assume that the lack of a
1637 warning means that your system is secure.
1639 Note that the warning for unsafe @option{--homedir} permissions cannot be
1640 suppressed in the gpg.conf file, as this would allow an attacker to
1641 place an unsafe gpg.conf file in place, and use this file to suppress
1642 warnings about itself. The @option{--homedir} permissions warning may only be
1643 suppressed on the command line.
1645 @item --no-mdc-warning
1646 Suppress the warning about missing MDC integrity protection.
1648 @item --require-secmem
1649 @itemx --no-require-secmem
1650 Refuse to run if GnuPG cannot get secure memory. Defaults to no
1651 (i.e. run, but give a warning).
1654 @item --require-cross-certification
1655 @itemx --no-require-cross-certification
1656 When verifying a signature made from a subkey, ensure that the cross
1657 certification "back signature" on the subkey is present and valid. This
1658 protects against a subtle attack against subkeys that can sign.
1659 Defaults to @option{--require-cross-certification} for
1664 Allow the user to do certain nonsensical or "silly" things like
1665 signing an expired or revoked key, or certain potentially incompatible
1666 things like generating unusual key types. This also disables certain
1667 warning messages about potentially incompatible actions. As the name
1668 implies, this option is for experts only. If you don't fully
1669 understand the implications of what it allows you to do, leave this
1670 off. @option{--no-expert} disables this option.
1678 @c *******************************************
1679 @c ******** KEY RELATED OPTIONS ************
1680 @c *******************************************
1681 @node GPG Key related Options
1682 @subsection Key related options
1686 @item --recipient @var{name}
1689 Encrypt for user id @var{name}. If this option or
1690 @option{--hidden-recipient} is not specified, GnuPG asks for the user-id
1691 unless @option{--default-recipient} is given.
1693 @item --hidden-recipient @var{name}
1695 @opindex hidden-recipient
1696 Encrypt for user ID @var{name}, but hide the key ID of this user's
1697 key. This option helps to hide the receiver of the message and is a
1698 limited countermeasure against traffic analysis. If this option or
1699 @option{--recipient} is not specified, GnuPG asks for the user ID unless
1700 @option{--default-recipient} is given.
1702 @item --encrypt-to @code{name}
1703 Same as @option{--recipient} but this one is intended for use in the
1704 options file and may be used with your own user-id as an
1705 "encrypt-to-self". These keys are only used when there are other
1706 recipients given either by use of @option{--recipient} or by the asked
1707 user id. No trust checking is performed for these user ids and even
1708 disabled keys can be used.
1710 @item --hidden-encrypt-to @code{name}
1711 Same as @option{--hidden-recipient} but this one is intended for use in the
1712 options file and may be used with your own user-id as a hidden
1713 "encrypt-to-self". These keys are only used when there are other
1714 recipients given either by use of @option{--recipient} or by the asked user id.
1715 No trust checking is performed for these user ids and even disabled
1718 @item --no-encrypt-to
1719 Disable the use of all @option{--encrypt-to} and
1720 @option{--hidden-encrypt-to} keys.
1722 @item --group @code{name=value1 }
1723 Sets up a named group, which is similar to aliases in email programs.
1724 Any time the group name is a recipient (@option{-r} or
1725 @option{--recipient}), it will be expanded to the values
1726 specified. Multiple groups with the same name are automatically merged
1727 into a single group.
1729 The values are @code{key IDs} or fingerprints, but any key description
1730 is accepted. Note that a value with spaces in it will be treated as
1731 two different values. Note also there is only one level of expansion
1732 --- you cannot make an group that points to another group. When used
1733 from the command line, it may be necessary to quote the argument to
1734 this option to prevent the shell from treating it as multiple
1737 @item --ungroup @code{name}
1738 Remove a given entry from the @option{--group} list.
1741 Remove all entries from the @option{--group} list.
1743 @item --local-user @var{name}
1746 Use @var{name} as the key to sign with. Note that this option overrides
1747 @option{--default-key}.
1749 @item --try-all-secrets
1750 Don't look at the key ID as stored in the message but try all secret
1751 keys in turn to find the right decryption key. This option forces the
1752 behaviour as used by anonymous recipients (created by using
1753 @option{--throw-keyids}) and might come handy in case where an encrypted
1754 message contains a bogus key ID.
1762 @c *******************************************
1763 @c ******** INPUT AND OUTPUT ***************
1764 @c *******************************************
1765 @node GPG Input and Output
1766 @subsection Input and Output
1773 Create ASCII armored output. The default is to create the binary
1777 Assume the input data is not in ASCII armored format.
1779 @item --output @var{file}
1780 @itemx -o @var{file}
1782 Write output to @var{file}.
1784 @item --max-output @code{n}
1786 This option sets a limit on the number of bytes that will be generated
1787 when processing a file. Since OpenPGP supports various levels of
1788 compression, it is possible that the plaintext of a given message may be
1789 significantly larger than the original OpenPGP message. While GnuPG
1790 works properly with such messages, there is often a desire to set a
1791 maximum file size that will be generated before processing is forced to
1792 stop by the OS limits. Defaults to 0, which means "no limit".
1794 @item --import-options @code{parameters}
1795 This is a space or comma delimited string that gives options for
1796 importing keys. Options can be prepended with a `no-' to give the
1797 opposite meaning. The options are:
1801 @item import-local-sigs
1802 Allow importing key signatures marked as "local". This is not
1803 generally useful unless a shared keyring scheme is being used.
1806 @item repair-pks-subkey-bug
1807 During import, attempt to repair the damage caused by the PKS keyserver
1808 bug (pre version 0.9.6) that mangles keys with multiple subkeys. Note
1809 that this cannot completely repair the damaged key as some crucial data
1810 is removed by the keyserver, but it does at least give you back one
1811 subkey. Defaults to no for regular @option{--import} and to yes for
1812 keyserver @option{--recv-keys}.
1815 During import, allow key updates to existing keys, but do not allow
1816 any new keys to be imported. Defaults to no.
1819 After import, compact (remove all signatures except the
1820 self-signature) any user IDs from the new key that are not usable.
1821 Then, remove any signatures from the new key that are not usable.
1822 This includes signatures that were issued by keys that are not present
1823 on the keyring. This option is the same as running the @option{--edit-key}
1824 command "clean" after import. Defaults to no.
1826 @item import-minimal
1827 Import the smallest key possible. This removes all signatures except
1828 the most recent self-signature on each user ID. This option is the
1829 same as running the @option{--edit-key} command "minimize" after import.
1833 @item --export-options @code{parameters}
1834 This is a space or comma delimited string that gives options for
1835 exporting keys. Options can be prepended with a `no-' to give the
1836 opposite meaning. The options are:
1840 @item export-local-sigs
1841 Allow exporting key signatures marked as "local". This is not
1842 generally useful unless a shared keyring scheme is being used.
1845 @item export-attributes
1846 Include attribute user IDs (photo IDs) while exporting. This is
1847 useful to export keys if they are going to be used by an OpenPGP
1848 program that does not accept attribute user IDs. Defaults to yes.
1850 @item export-sensitive-revkeys
1851 Include designated revoker information that was marked as
1852 "sensitive". Defaults to no.
1854 @item export-reset-subkey-passwd
1855 When using the @option{--export-secret-subkeys} command, this option resets
1856 the passphrases for all exported subkeys to empty. This is useful
1857 when the exported subkey is to be used on an unattended machine where
1858 a passphrase doesn't necessarily make sense. Defaults to no.
1861 Compact (remove all signatures from) user IDs on the key being
1862 exported if the user IDs are not usable. Also, do not export any
1863 signatures that are not usable. This includes signatures that were
1864 issued by keys that are not present on the keyring. This option is
1865 the same as running the @option{--edit-key} command "clean" before export
1866 except that the local copy of the key is not modified. Defaults to
1869 @item export-minimal
1870 Export the smallest key possible. This removes all signatures except the
1871 most recent self-signature on each user ID. This option is the same as
1872 running the @option{--edit-key} command "minimize" before export except
1873 that the local copy of the key is not modified. Defaults to no.
1877 @opindex with-colons
1878 Print key listings delimited by colons. Note that the output will be
1879 encoded in UTF-8 regardless of any @option{--display-charset} setting. This
1880 format is useful when GnuPG is called from scripts and other programs
1881 as it is easily machine parsed. The details of this format are
1882 documented in the file @file{doc/DETAILS}, which is included in the GnuPG
1883 source distribution.
1885 @item --fixed-list-mode
1886 @opindex fixed-list-mode
1887 Do not merge primary user ID and primary key in @option{--with-colon}
1888 listing mode and print all timestamps as seconds since 1970-01-01.
1890 Since GnuPG 2.0.10, this mode is always used and thus this option is
1891 obsolete; it does not harm to use it though.
1894 @item --with-fingerprint
1895 @opindex with-fingerprint
1896 Same as the command @option{--fingerprint} but changes only the format
1897 of the output and may be used together with another command.
1902 @c *******************************************
1903 @c ******** OPENPGP OPTIONS ****************
1904 @c *******************************************
1905 @node OpenPGP Options
1906 @subsection OpenPGP protocol specific options.
1910 @item -t, --textmode
1911 @itemx --no-textmode
1912 Treat input files as text and store them in the OpenPGP canonical text
1913 form with standard "CRLF" line endings. This also sets the necessary
1914 flags to inform the recipient that the encrypted or signed data is text
1915 and may need its line endings converted back to whatever the local
1916 system uses. This option is useful when communicating between two
1917 platforms that have different line ending conventions (UNIX-like to Mac,
1918 Mac to Windows, etc). @option{--no-textmode} disables this option, and
1922 If @option{-t} (but not @option{--textmode}) is used together with
1923 armoring and signing, this enables clearsigned messages. This kludge is
1924 needed for command-line compatibility with command-line versions of PGP;
1925 normally you would use @option{--sign} or @option{--clearsign} to select
1926 the type of the signature.
1929 @item --force-v3-sigs
1930 @itemx --no-force-v3-sigs
1931 OpenPGP states that an implementation should generate v4 signatures
1932 but PGP versions 5 through 7 only recognize v4 signatures on key
1933 material. This option forces v3 signatures for signatures on data.
1934 Note that this option implies @option{--ask-sig-expire},
1935 @option{--sig-policy-url}, @option{--sig-notation}, and
1936 @option{--sig-keyserver-url}, as these features cannot be used with v3
1937 signatures. @option{--no-force-v3-sigs} disables this option.
1939 @item --force-v4-certs
1940 @itemx --no-force-v4-certs
1941 Always use v4 key signatures even on v3 keys. This option also
1942 changes the default hash algorithm for v3 RSA keys from MD5 to SHA-1.
1943 @option{--no-force-v4-certs} disables this option.
1946 Force the use of encryption with a modification detection code. This
1947 is always used with the newer ciphers (those with a blocksize greater
1948 than 64 bits), or if all of the recipient keys indicate MDC support in
1949 their feature flags.
1952 Disable the use of the modification detection code. Note that by
1953 using this option, the encrypted message becomes vulnerable to a
1954 message modification attack.
1956 @item --personal-cipher-preferences @code{string}
1957 Set the list of personal cipher preferences to @code{string}. Use
1958 @command{@gpgname --version} to get a list of available algorithms,
1959 and use @code{none} to set no preference at all. This allows the user
1960 to factor in their own preferred algorithms when algorithms are chosen
1961 via recipient key preferences. The most highly ranked cipher in this
1962 list is also used for the @option{--symmetric} encryption command.
1964 @item --personal-digest-preferences @code{string}
1965 Set the list of personal digest preferences to @code{string}. Use
1966 @command{@gpgname --version} to get a list of available algorithms,
1967 and use @code{none} to set no preference at all. This allows the user
1968 to factor in their own preferred algorithms when algorithms are chosen
1969 via recipient key preferences. The most highly ranked digest
1970 algorithm in this list is also used when signing without encryption
1971 (e.g. @option{--clearsign} or @option{--sign}). The default value is
1974 @item --personal-compress-preferences @code{string}
1975 Set the list of personal compression preferences to @code{string}.
1976 Use @command{@gpgname --version} to get a list of available
1977 algorithms, and use @code{none} to set no preference at all. This
1978 allows the user to factor in their own preferred algorithms when
1979 algorithms are chosen via recipient key preferences. The most highly
1980 ranked compression algorithm in this list is also used when there are
1981 no recipient keys to consider (e.g. @option{--symmetric}).
1983 @item --s2k-cipher-algo @code{name}
1984 Use @code{name} as the cipher algorithm used to protect secret keys.
1985 The default cipher is CAST5. This cipher is also used for
1986 conventional encryption if @option{--personal-cipher-preferences} and
1987 @option{--cipher-algo} is not given.
1989 @item --s2k-digest-algo @code{name}
1990 Use @code{name} as the digest algorithm used to mangle the passphrases.
1991 The default algorithm is SHA-1.
1993 @item --s2k-mode @code{n}
1994 Selects how passphrases are mangled. If @code{n} is 0 a plain
1995 passphrase (which is not recommended) will be used, a 1 adds a salt to
1996 the passphrase and a 3 (the default) iterates the whole process a
1997 number of times (see --s2k-count). Unless @option{--rfc1991} is used,
1998 this mode is also used for conventional encryption.
2000 @item --s2k-count @code{n}
2001 Specify how many times the passphrase mangling is repeated. This
2002 value may range between 1024 and 65011712 inclusive, and the default
2003 is 65536. Note that not all values in the 1024-65011712 range are
2004 legal and if an illegal value is selected, GnuPG will round up to the
2005 nearest legal value. This option is only meaningful if
2006 @option{--s2k-mode} is 3.
2011 @c ***************************
2012 @c ******* Compliance ********
2013 @c ***************************
2014 @subsection Compliance options
2016 These options control what GnuPG is compliant to. Only one of these
2017 options may be active at a time. Note that the default setting of
2018 this is nearly always the correct one. See the INTEROPERABILITY WITH
2019 OTHER OPENPGP PROGRAMS section below before using one of these
2026 Use standard GnuPG behavior. This is essentially OpenPGP behavior
2027 (see @option{--openpgp}), but with some additional workarounds for common
2028 compatibility problems in different versions of PGP. This is the
2029 default option, so it is not generally needed, but it may be useful to
2030 override a different compliance option in the gpg.conf file.
2034 Reset all packet, cipher and digest options to strict OpenPGP
2035 behavior. Use this option to reset all previous options like
2036 @option{--s2k-*}, @option{--cipher-algo}, @option{--digest-algo} and
2037 @option{--compress-algo} to OpenPGP compliant values. All PGP
2038 workarounds are disabled.
2042 Reset all packet, cipher and digest options to strict RFC-4880
2043 behavior. Note that this is currently the same thing as
2048 Reset all packet, cipher and digest options to strict RFC-2440
2053 Try to be more RFC-1991 (PGP 2.x) compliant.
2057 Set up all options to be as PGP 2.x compliant as possible, and warn if
2058 an action is taken (e.g. encrypting to a non-RSA key) that will create
2059 a message that PGP 2.x will not be able to handle. Note that `PGP
2060 2.x' here means `MIT PGP 2.6.2'. There are other versions of PGP 2.x
2061 available, but the MIT release is a good common baseline.
2063 This option implies @option{--rfc1991 --disable-mdc
2064 --no-force-v4-certs --no-sk-comment --escape-from-lines
2065 --force-v3-sigs --cipher-algo IDEA --digest-algo MD5 --compress-algo
2066 ZIP}. It also disables @option{--textmode} when encrypting.
2070 Set up all options to be as PGP 6 compliant as possible. This
2071 restricts you to the ciphers IDEA (if the IDEA plugin is installed),
2072 3DES, and CAST5, the hashes MD5, SHA1 and RIPEMD160, and the
2073 compression algorithms none and ZIP. This also disables
2074 --throw-keyids, and making signatures with signing subkeys as PGP 6
2075 does not understand signatures made by signing subkeys.
2077 This option implies @option{--disable-mdc --no-sk-comment
2078 --escape-from-lines --force-v3-sigs}.
2082 Set up all options to be as PGP 7 compliant as possible. This is
2083 identical to @option{--pgp6} except that MDCs are not disabled, and the
2084 list of allowable ciphers is expanded to add AES128, AES192, AES256, and
2089 Set up all options to be as PGP 8 compliant as possible. PGP 8 is a lot
2090 closer to the OpenPGP standard than previous versions of PGP, so all
2091 this does is disable @option{--throw-keyids} and set
2092 @option{--escape-from-lines}. All algorithms are allowed except for the
2093 SHA224, SHA384, and SHA512 digests.
2098 @c *******************************************
2099 @c ******** ESOTERIC OPTIONS ***************
2100 @c *******************************************
2101 @node GPG Esoteric Options
2102 @subsection Doing things one usually doesn't want to do.
2109 Don't make any changes (this is not completely implemented).
2112 Changes the behaviour of some commands. This is like @option{--dry-run} but
2113 different in some cases. The semantic of this command may be extended in
2114 the future. Currently it only skips the actual decryption pass and
2115 therefore enables a fast listing of the encryption keys.
2118 @itemx --interactive
2119 @opindex interactive
2120 Prompt before overwriting any files.
2122 @item --debug @var{flags}
2124 Set debugging flags. All flags are or-ed and @var{flags} may
2125 be given in C syntax (e.g. 0x0042).
2128 Set all useful debugging flags.
2131 @item --debug-ccid-driver
2132 Enable debug output from the included CCID driver for smartcards.
2133 Note that this option is only available on some system.
2136 @item --enable-progress-filter
2137 Enable certain PROGRESS status outputs. This option allows frontends
2138 to display a progress indicator while gpg is processing larger files.
2139 There is a slight performance overhead using it.
2141 @item --status-fd @code{n}
2142 Write special status strings to the file descriptor @code{n}.
2143 See the file DETAILS in the documentation for a listing of them.
2145 @item --status-file @code{file}
2146 Same as @option{--status-fd}, except the status data is written to file
2149 @item --logger-fd @code{n}
2150 Write log output to file descriptor @code{n} and not to STDERR.
2152 @item --log-file @code{file}
2153 @itemx --logger-file @code{file}
2154 Same as @option{--logger-fd}, except the logger data is written to file
2155 @code{file}. Note that @option{--log-file} is only implemented for
2158 @item --attribute-fd @code{n}
2159 Write attribute subpackets to the file descriptor @code{n}. This is most
2160 useful for use with @option{--status-fd}, since the status messages are
2161 needed to separate out the various subpackets from the stream delivered
2162 to the file descriptor.
2164 @item --attribute-file @code{file}
2165 Same as @option{--attribute-fd}, except the attribute data is written to
2168 @item --comment @code{string}
2169 @itemx --no-comments
2170 Use @code{string} as a comment string in clear text signatures and ASCII
2171 armored messages or keys (see @option{--armor}). The default behavior is
2172 not to use a comment string. @option{--comment} may be repeated multiple
2173 times to get multiple comment strings. @option{--no-comments} removes
2174 all comments. It is a good idea to keep the length of a single comment
2175 below 60 characters to avoid problems with mail programs wrapping such
2176 lines. Note that comment lines, like all other header lines, are not
2177 protected by the signature.
2179 @item --emit-version
2180 @itemx --no-emit-version
2181 Force inclusion of the version string in ASCII armored output.
2182 @option{--no-emit-version} disables this option.
2184 @item --sig-notation @code{name=value}
2185 @itemx --cert-notation @code{name=value}
2186 @itemx -N, --set-notation @code{name=value}
2187 Put the name value pair into the signature as notation data.
2188 @code{name} must consist only of printable characters or spaces, and
2189 must contain a '@@' character in the form keyname@@domain.example.com
2190 (substituting the appropriate keyname and domain name, of course). This
2191 is to help prevent pollution of the IETF reserved notation
2192 namespace. The @option{--expert} flag overrides the '@@'
2193 check. @code{value} may be any printable string; it will be encoded in
2194 UTF8, so you should check that your @option{--display-charset} is set
2195 correctly. If you prefix @code{name} with an exclamation mark (!), the
2196 notation data will be flagged as critical
2197 (rfc2440:5.2.3.15). @option{--sig-notation} sets a notation for data
2198 signatures. @option{--cert-notation} sets a notation for key signatures
2199 (certifications). @option{--set-notation} sets both.
2201 There are special codes that may be used in notation names. "%k" will
2202 be expanded into the key ID of the key being signed, "%K" into the
2203 long key ID of the key being signed, "%f" into the fingerprint of the
2204 key being signed, "%s" into the key ID of the key making the
2205 signature, "%S" into the long key ID of the key making the signature,
2206 "%g" into the fingerprint of the key making the signature (which might
2207 be a subkey), "%p" into the fingerprint of the primary key of the key
2208 making the signature, "%c" into the signature count from the OpenPGP
2209 smartcard, and "%%" results in a single "%". %k, %K, and %f are only
2210 meaningful when making a key signature (certification), and %c is only
2211 meaningful when using the OpenPGP smartcard.
2213 @item --sig-policy-url @code{string}
2214 @itemx --cert-policy-url @code{string}
2215 @itemx --set-policy-url @code{string}
2216 Use @code{string} as a Policy URL for signatures (rfc2440:5.2.3.19). If
2217 you prefix it with an exclamation mark (!), the policy URL packet will
2218 be flagged as critical. @option{--sig-policy-url} sets a policy url for
2219 data signatures. @option{--cert-policy-url} sets a policy url for key
2220 signatures (certifications). @option{--set-policy-url} sets both.
2222 The same %-expandos used for notation data are available here as well.
2224 @item --sig-keyserver-url @code{string}
2225 Use @code{string} as a preferred keyserver URL for data signatures. If
2226 you prefix it with an exclamation mark (!), the keyserver URL packet
2227 will be flagged as critical.
2229 The same %-expandos used for notation data are available here as well.
2231 @item --set-filename @code{string}
2232 Use @code{string} as the filename which is stored inside messages.
2233 This overrides the default, which is to use the actual filename of the
2234 file being encrypted.
2236 @item --for-your-eyes-only
2237 @itemx --no-for-your-eyes-only
2238 Set the `for your eyes only' flag in the message. This causes GnuPG to
2239 refuse to save the file unless the @option{--output} option is given,
2240 and PGP to use a "secure viewer" with a claimed Tempest-resistant font
2241 to display the message. This option overrides @option{--set-filename}.
2242 @option{--no-for-your-eyes-only} disables this option.
2244 @item --use-embedded-filename
2245 @itemx --no-use-embedded-filename
2246 Try to create a file with a name as embedded in the data. This can be
2247 a dangerous option as it allows to overwrite files. Defaults to no.
2249 @item --cipher-algo @code{name}
2250 Use @code{name} as cipher algorithm. Running the program with the
2251 command @option{--version} yields a list of supported algorithms. If
2252 this is not used the cipher algorithm is selected from the preferences
2253 stored with the key. In general, you do not want to use this option as
2254 it allows you to violate the OpenPGP standard.
2255 @option{--personal-cipher-preferences} is the safe way to accomplish the
2258 @item --digest-algo @code{name}
2259 Use @code{name} as the message digest algorithm. Running the program
2260 with the command @option{--version} yields a list of supported algorithms. In
2261 general, you do not want to use this option as it allows you to
2262 violate the OpenPGP standard. @option{--personal-digest-preferences} is the
2263 safe way to accomplish the same thing.
2265 @item --compress-algo @code{name}
2266 Use compression algorithm @code{name}. "zlib" is RFC-1950 ZLIB
2267 compression. "zip" is RFC-1951 ZIP compression which is used by PGP.
2268 "bzip2" is a more modern compression scheme that can compress some
2269 things better than zip or zlib, but at the cost of more memory used
2270 during compression and decompression. "uncompressed" or "none"
2271 disables compression. If this option is not used, the default
2272 behavior is to examine the recipient key preferences to see which
2273 algorithms the recipient supports. If all else fails, ZIP is used for
2274 maximum compatibility.
2276 ZLIB may give better compression results than ZIP, as the compression
2277 window size is not limited to 8k. BZIP2 may give even better
2278 compression results than that, but will use a significantly larger
2279 amount of memory while compressing and decompressing. This may be
2280 significant in low memory situations. Note, however, that PGP (all
2281 versions) only supports ZIP compression. Using any algorithm other
2282 than ZIP or "none" will make the message unreadable with PGP. In
2283 general, you do not want to use this option as it allows you to
2284 violate the OpenPGP standard. @option{--personal-compress-preferences} is the
2285 safe way to accomplish the same thing.
2287 @item --cert-digest-algo @code{name}
2288 Use @code{name} as the message digest algorithm used when signing a
2289 key. Running the program with the command @option{--version} yields a
2290 list of supported algorithms. Be aware that if you choose an algorithm
2291 that GnuPG supports but other OpenPGP implementations do not, then some
2292 users will not be able to use the key signatures you make, or quite
2293 possibly your entire key.
2295 @item --disable-cipher-algo @code{name}
2296 Never allow the use of @code{name} as cipher algorithm.
2297 The given name will not be checked so that a later loaded algorithm
2298 will still get disabled.
2300 @item --disable-pubkey-algo @code{name}
2301 Never allow the use of @code{name} as public key algorithm.
2302 The given name will not be checked so that a later loaded algorithm
2303 will still get disabled.
2305 @item --throw-keyids
2306 @itemx --no-throw-keyids
2307 Do not put the recipient key IDs into encrypted messages. This helps to
2308 hide the receivers of the message and is a limited countermeasure
2309 against traffic analysis.@footnote{Using a little social engineering
2310 anyone who is able to decrypt the message can check whether one of the
2311 other recipients is the one he suspects.} On the receiving side, it may
2312 slow down the decryption process because all available secret keys must
2313 be tried. @option{--no-throw-keyids} disables this option. This option
2314 is essentially the same as using @option{--hidden-recipient} for all
2317 @item --not-dash-escaped
2318 This option changes the behavior of cleartext signatures
2319 so that they can be used for patch files. You should not
2320 send such an armored file via email because all spaces
2321 and line endings are hashed too. You can not use this
2322 option for data which has 5 dashes at the beginning of a
2323 line, patch files don't have this. A special armor header
2324 line tells GnuPG about this cleartext signature option.
2326 @item --escape-from-lines
2327 @itemx --no-escape-from-lines
2328 Because some mailers change lines starting with "From " to ">From " it
2329 is good to handle such lines in a special way when creating cleartext
2330 signatures to prevent the mail system from breaking the signature. Note
2331 that all other PGP versions do it this way too. Enabled by
2332 default. @option{--no-escape-from-lines} disables this option.
2334 @item --passphrase-repeat @code{n}
2335 Specify how many times @command{@gpgname} will request a new
2336 passphrase be repeated. This is useful for helping memorize a
2337 passphrase. Defaults to 1 repetition.
2339 @item --passphrase-fd @code{n}
2340 Read the passphrase from file descriptor @code{n}. Only the first line
2341 will be read from file descriptor @code{n}. If you use 0 for @code{n},
2342 the passphrase will be read from STDIN. This can only be used if only
2343 one passphrase is supplied.
2345 Note that this passphrase is only used if the option @option{--batch}
2346 has also been given. This is different from @command{gpg}.
2349 @item --passphrase-file @code{file}
2350 Read the passphrase from file @code{file}. Only the first line will
2351 be read from file @code{file}. This can only be used if only one
2352 passphrase is supplied. Obviously, a passphrase stored in a file is
2353 of questionable security if other users can read this file. Don't use
2354 this option if you can avoid it.
2356 Note that this passphrase is only used if the option @option{--batch}
2357 has also been given. This is different from @command{gpg}.
2360 @item --passphrase @code{string}
2361 Use @code{string} as the passphrase. This can only be used if only one
2362 passphrase is supplied. Obviously, this is of very questionable
2363 security on a multi-user system. Don't use this option if you can
2366 Note that this passphrase is only used if the option @option{--batch}
2367 has also been given. This is different from @command{gpg}.
2370 @item --command-fd @code{n}
2371 This is a replacement for the deprecated shared-memory IPC mode.
2372 If this option is enabled, user input on questions is not expected
2373 from the TTY but from the given file descriptor. It should be used
2374 together with @option{--status-fd}. See the file doc/DETAILS in the source
2375 distribution for details on how to use it.
2377 @item --command-file @code{file}
2378 Same as @option{--command-fd}, except the commands are read out of file
2381 @item --allow-non-selfsigned-uid
2382 @itemx --no-allow-non-selfsigned-uid
2383 Allow the import and use of keys with user IDs which are not
2384 self-signed. This is not recommended, as a non self-signed user ID is
2385 trivial to forge. @option{--no-allow-non-selfsigned-uid} disables.
2387 @item --allow-freeform-uid
2388 Disable all checks on the form of the user ID while generating a new
2389 one. This option should only be used in very special environments as
2390 it does not ensure the de-facto standard format of user IDs.
2392 @item --ignore-time-conflict
2393 GnuPG normally checks that the timestamps associated with keys and
2394 signatures have plausible values. However, sometimes a signature
2395 seems to be older than the key due to clock problems. This option
2396 makes these checks just a warning. See also @option{--ignore-valid-from} for
2397 timestamp issues on subkeys.
2399 @item --ignore-valid-from
2400 GnuPG normally does not select and use subkeys created in the future.
2401 This option allows the use of such keys and thus exhibits the
2402 pre-1.0.7 behaviour. You should not use this option unless you there
2403 is some clock problem. See also @option{--ignore-time-conflict} for timestamp
2404 issues with signatures.
2406 @item --ignore-crc-error
2407 The ASCII armor used by OpenPGP is protected by a CRC checksum against
2408 transmission errors. Occasionally the CRC gets mangled somewhere on
2409 the transmission channel but the actual content (which is protected by
2410 the OpenPGP protocol anyway) is still okay. This option allows GnuPG
2411 to ignore CRC errors.
2413 @item --ignore-mdc-error
2414 This option changes a MDC integrity protection failure into a warning.
2415 This can be useful if a message is partially corrupt, but it is
2416 necessary to get as much data as possible out of the corrupt message.
2417 However, be aware that a MDC protection failure may also mean that the
2418 message was tampered with intentionally by an attacker.
2420 @item --no-default-keyring
2421 Do not add the default keyrings to the list of keyrings. Note that
2422 GnuPG will not operate without any keyrings, so if you use this option
2423 and do not provide alternate keyrings via @option{--keyring} or
2424 @option{--secret-keyring}, then GnuPG will still use the default public or
2428 Skip the signature verification step. This may be
2429 used to make the decryption faster if the signature
2430 verification is not needed.
2432 @item --with-key-data
2433 Print key listings delimited by colons (like @option{--with-colons}) and
2434 print the public key data.
2436 @item --fast-list-mode
2437 Changes the output of the list commands to work faster; this is achieved
2438 by leaving some parts empty. Some applications don't need the user ID
2439 and the trust information given in the listings. By using this options
2440 they can get a faster listing. The exact behaviour of this option may
2441 change in future versions. If you are missing some information, don't
2445 This is not for normal use. Use the source to see for what it might be useful.
2447 @item --set-filesize
2448 This is not for normal use. Use the source to see for what it might be useful.
2450 @item --show-session-key
2451 Display the session key used for one message. See
2452 @option{--override-session-key} for the counterpart of this option.
2454 We think that Key Escrow is a Bad Thing; however the user should have
2455 the freedom to decide whether to go to prison or to reveal the content
2456 of one specific message without compromising all messages ever
2457 encrypted for one secret key. DON'T USE IT UNLESS YOU ARE REALLY
2460 @item --override-session-key @code{string}
2461 Don't use the public key but the session key @code{string}. The format
2462 of this string is the same as the one printed by
2463 @option{--show-session-key}. This option is normally not used but comes
2464 handy in case someone forces you to reveal the content of an encrypted
2465 message; using this option you can do this without handing out the
2468 @item --ask-sig-expire
2469 @itemx --no-ask-sig-expire
2470 When making a data signature, prompt for an expiration time. If this
2471 option is not specified, the expiration time set via
2472 @option{--default-sig-expire} is used. @option{--no-ask-sig-expire}
2473 disables this option. Note that by default, @option{--force-v3-sigs} is
2474 set which also disables this option. If you want signature expiration,
2475 you must set @option{--no-force-v3-sigs} as well as turning
2476 @option{--ask-sig-expire} on.
2478 @item --default-sig-expire
2479 The default expiration time to use for signature expiration. Valid
2480 values are "0" for no expiration, a number followed by the letter d
2481 (for days), w (for weeks), m (for months), or y (for years) (for
2482 example "2m" for two months, or "5y" for five years), or an absolute
2483 date in the form YYYY-MM-DD. Defaults to "0".
2485 @item --ask-cert-expire
2486 @itemx --no-ask-cert-expire
2487 When making a key signature, prompt for an expiration time. If this
2488 option is not specified, the expiration time set via
2489 @option{--default-cert-expire} is used. @option{--no-ask-cert-expire}
2490 disables this option.
2492 @item --default-cert-expire
2493 The default expiration time to use for key signature expiration.
2494 Valid values are "0" for no expiration, a number followed by the
2495 letter d (for days), w (for weeks), m (for months), or y (for years)
2496 (for example "2m" for two months, or "5y" for five years), or an
2497 absolute date in the form YYYY-MM-DD. Defaults to "0".
2499 @item --allow-secret-key-import
2500 This is an obsolete option and is not used anywhere.
2502 @item --allow-multiple-messages
2503 @item --no-allow-multiple-messages
2504 Allow processing of multiple OpenPGP messages contained in a single file
2505 or stream. Some programs that call GPG are not prepared to deal with
2506 multiple messages being processed together, so this option defaults to
2507 no. Note that versions of GPG prior to 1.4.7 always allowed multiple
2510 Warning: Do not use this option unless you need it as a temporary
2514 @item --enable-special-filenames
2515 This options enables a mode in which filenames of the form
2516 @file{-&n}, where n is a non-negative decimal number,
2517 refer to the file descriptor n and not to a file with that name.
2519 @item --no-expensive-trust-checks
2520 Experimental use only.
2522 @item --preserve-permissions
2523 Don't change the permissions of a secret keyring back to user
2524 read/write only. Use this option only if you really know what you are doing.
2526 @item --default-preference-list @code{string}
2527 @opindex default-preference-list
2528 Set the list of default preferences to @code{string}. This preference
2529 list is used for new keys and becomes the default for "setpref" in the
2532 @item --default-keyserver-url @code{name}
2533 @opindex default-keyserver-url
2534 Set the default keyserver URL to @code{name}. This keyserver will be
2535 used as the keyserver URL when writing a new self-signature on a key,
2536 which includes key generation and changing preferences.
2539 @opindex list-config
2540 Display various internal configuration parameters of GnuPG. This option
2541 is intended for external programs that call GnuPG to perform tasks, and
2542 is thus not generally useful. See the file @file{doc/DETAILS} in the
2543 source distribution for the details of which configuration items may be
2544 listed. @option{--list-config} is only usable with
2545 @option{--with-colons} set.
2547 @item --gpgconf-list
2548 @opindex gpgconf-list
2549 This command is similar to @option{--list-config} but in general only
2550 internally used by the @command{gpgconf} tool.
2552 @item --gpgconf-test
2553 @opindex gpgconf-test
2554 This is more or less dummy action. However it parses the configuration
2555 file and returns with failure if the configuration file would prevent
2556 @command{gpg} from startup. Thus it may be used to run a syntax check
2557 on the configuration file.
2561 @c *******************************
2562 @c ******* Deprecated ************
2563 @c *******************************
2564 @subsection Deprecated options
2569 @item --load-extension @code{name}
2570 Load an extension module. If @code{name} does not contain a slash it is
2571 searched for in the directory configured when GnuPG was built
2572 (generally "/usr/local/lib/gnupg"). Extensions are not generally
2573 useful anymore, and the use of this option is deprecated.
2577 @itemx --no-show-photos
2578 Causes @option{--list-keys}, @option{--list-sigs},
2579 @option{--list-public-keys}, @option{--list-secret-keys}, and verifying
2580 a signature to also display the photo ID attached to the key, if
2581 any. See also @option{--photo-viewer}. These options are deprecated. Use
2582 @option{--list-options [no-]show-photos} and/or @option{--verify-options
2583 [no-]show-photos} instead.
2585 @item --show-keyring
2586 Display the keyring name at the head of key listings to show which
2587 keyring a given key resides on. This option is deprecated: use
2588 @option{--list-options [no-]show-keyring} instead.
2591 @item --ctapi-driver @code{file}
2592 Use @code{file} to access the smartcard reader. The current default
2593 is `libtowitoko.so'. Note that the use of this interface is
2594 deprecated; it may be removed in future releases.
2597 @item --always-trust
2598 Identical to @option{--trust-model always}. This option is deprecated.
2600 @item --show-notation
2601 @itemx --no-show-notation
2602 Show signature notations in the @option{--list-sigs} or @option{--check-sigs} listings
2603 as well as when verifying a signature with a notation in it. These
2604 options are deprecated. Use @option{--list-options [no-]show-notation}
2605 and/or @option{--verify-options [no-]show-notation} instead.
2607 @item --show-policy-url
2608 @itemx --no-show-policy-url
2609 Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
2610 listings as well as when verifying a signature with a policy URL in
2611 it. These options are deprecated. Use @option{--list-options
2612 [no-]show-policy-url} and/or @option{--verify-options
2613 [no-]show-policy-url} instead.
2619 @c *******************************************
2620 @c *************** ****************
2621 @c *************** FILES ****************
2622 @c *************** ****************
2623 @c *******************************************
2625 @node GPG Configuration
2626 @section Configuration files
2628 There are a few configuration files to control certain aspects of
2629 @command{@gpgname}'s operation. Unless noted, they are expected in the
2630 current home directory (@pxref{option --homedir}).
2636 This is the standard configuration file read by @command{@gpgname} on
2637 startup. It may contain any valid long option; the leading two dashes
2638 may not be entered and the option may not be abbreviated. This default
2639 name may be changed on the command line (@pxref{option --options}).
2640 You should backup this file.
2645 Note that on larger installations, it is useful to put predefined files
2646 into the directory @file{/etc/skel/.gnupg/} so that newly created users
2647 start up with a working configuration.
2649 For existing users the a small
2650 helper script is provided to create these files (@pxref{addgnupghome}).
2653 For internal purposes @command{@gpgname} creates and maintains a few other
2654 files; They all live in in the current home directory (@pxref{option
2655 --homedir}). Only the @command{@gpgname} may modify these files.
2659 @item ~/.gnupg/secring.gpg
2660 The secret keyring. You should backup this file.
2662 @item ~/.gnupg/secring.gpg.lock
2663 The lock file for the secret keyring.
2665 @item ~/.gnupg/pubring.gpg
2666 The public keyring. You should backup this file.
2668 @item ~/.gnupg/pubring.gpg.lock
2669 The lock file for the public keyring.
2671 @item ~/.gnupg/trustdb.gpg
2672 The trust database. There is no need to backup this file; it is better
2673 to backup the ownertrust values (@pxref{option --export-ownertrust}).
2675 @item ~/.gnupg/trustdb.gpg.lock
2676 The lock file for the trust database.
2678 @item ~/.gnupg/random_seed
2679 A file used to preserve the state of the internal random pool.
2681 @item /usr[/local]/share/gnupg/options.skel
2682 The skeleton options file.
2684 @item /usr[/local]/lib/gnupg/
2685 Default location for extensions.
2690 Operation is further controlled by a few environment variables:
2695 Used to locate the default home directory.
2698 If set directory used instead of "~/.gnupg".
2700 @item GPG_AGENT_INFO
2701 Used to locate the gpg-agent.
2703 This is only honored when @option{--use-agent} is set.
2705 The value consists of 3 colon delimited fields: The first is the path
2706 to the Unix Domain Socket, the second the PID of the gpg-agent and the
2707 protocol version which should be set to 1. When starting the gpg-agent
2708 as described in its documentation, this variable is set to the correct
2709 value. The option @option{--gpg-agent-info} can be used to override it.
2711 @item PINENTRY_USER_DATA
2712 This value is passed via gpg-agent to pinentry. It is useful to convey
2713 extra information to a custom pinentry.
2717 Used to size some displays to the full size of the screen.
2721 Apart from its use by GNU, it is used in the W32 version to override the
2722 language selection done through the Registry. If used and set to a
2723 valid and available language name (@var{langid}), the file with the
2724 translation is loaded from
2725 @code{@var{gpgdir}/gnupg.nls/@var{langid}.mo}. Here @var{gpgdir} is the
2726 directory out of which the gpg binary has been loaded. If it can't be
2727 loaded the Registry is tried and as last resort the native Windows
2728 locale system is used.
2733 @c *******************************************
2734 @c *************** ****************
2735 @c *************** EXAMPLES ****************
2736 @c *************** ****************
2737 @c *******************************************
2744 @item gpg -se -r @code{Bob} @code{file}
2745 sign and encrypt for user Bob
2747 @item gpg --clearsign @code{file}
2748 make a clear text signature
2750 @item gpg -sb @code{file}
2751 make a detached signature
2753 @item gpg -u 0x12345678 -sb @code{file}
2754 make a detached signature with the key 0x12345678
2756 @item gpg --list-keys @code{user_ID}
2759 @item gpg --fingerprint @code{user_ID}
2762 @item gpg --verify @code{pgpfile}
2763 @itemx gpg --verify @code{sigfile}
2764 Verify the signature of the file but do not output the data. The
2765 second form is used for detached signatures, where @code{sigfile}
2766 is the detached signature (either ASCII armored or binary) and
2767 are the signed data; if this is not given, the name of
2768 the file holding the signed data is constructed by cutting off the
2769 extension (".asc" or ".sig") of @code{sigfile} or by asking the
2770 user for the filename.
2774 @c *******************************************
2775 @c *************** ****************
2776 @c *************** USER ID ****************
2777 @c *************** ****************
2778 @c *******************************************
2779 @mansect how to specify a user id
2781 @include specify-user-id.texi
2784 @mansect return value
2785 @chapheading RETURN VALUE
2787 The program returns 0 if everything was fine, 1 if at least
2788 a signature was bad, and other error codes for fatal errors.
2791 @chapheading WARNINGS
2793 Use a *good* password for your user account and a *good* passphrase
2794 to protect your secret key. This passphrase is the weakest part of the
2795 whole system. Programs to do dictionary attacks on your secret keyring
2796 are very easy to write and so you should protect your "~/.gnupg/"
2797 directory very well.
2799 Keep in mind that, if this program is used over a network (telnet), it
2800 is *very* easy to spy out your passphrase!
2802 If you are going to verify detached signatures, make sure that the
2803 program knows about it; either give both filenames on the command line
2804 or use @samp{-} to specify STDIN.
2806 @mansect interoperability
2807 @chapheading INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS
2809 GnuPG tries to be a very flexible implementation of the OpenPGP
2810 standard. In particular, GnuPG implements many of the optional parts
2811 of the standard, such as the SHA-512 hash, and the ZLIB and BZIP2
2812 compression algorithms. It is important to be aware that not all
2813 OpenPGP programs implement these optional algorithms and that by
2814 forcing their use via the @option{--cipher-algo},
2815 @option{--digest-algo}, @option{--cert-digest-algo}, or
2816 @option{--compress-algo} options in GnuPG, it is possible to create a
2817 perfectly valid OpenPGP message, but one that cannot be read by the
2820 There are dozens of variations of OpenPGP programs available, and each
2821 supports a slightly different subset of these optional algorithms.
2822 For example, until recently, no (unhacked) version of PGP supported
2823 the BLOWFISH cipher algorithm. A message using BLOWFISH simply could
2824 not be read by a PGP user. By default, GnuPG uses the standard
2825 OpenPGP preferences system that will always do the right thing and
2826 create messages that are usable by all recipients, regardless of which
2827 OpenPGP program they use. Only override this safe default if you
2828 really know what you are doing.
2830 If you absolutely must override the safe default, or if the preferences
2831 on a given key are invalid for some reason, you are far better off using
2832 the @option{--pgp6}, @option{--pgp7}, or @option{--pgp8} options. These
2833 options are safe as they do not force any particular algorithms in
2834 violation of OpenPGP, but rather reduce the available algorithms to a
2840 On many systems this program should be installed as setuid(root). This
2841 is necessary to lock memory pages. Locking memory pages prevents the
2842 operating system from writing memory pages (which may contain
2843 passphrases or other sensitive material) to disk. If you get no
2844 warning message about insecure memory your operating system supports
2845 locking without being root. The program drops root privileges as soon
2846 as locked memory is allocated.
2848 Note also that some systems (especially laptops) have the ability to
2849 ``suspend to disk'' (also known as ``safe sleep'' or ``hibernate'').
2850 This writes all memory to disk before going into a low power or even
2851 powered off mode. Unless measures are taken in the operating system
2852 to protect the saved memory, passphrases or other sensitive material
2853 may be recoverable from it later.
2860 @command{gpg-agent}(1)
2863 @include see-also-note.texi