1 @c Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2 @c 2008, 2009, 2010 Free Software Foundation, Inc.
3 @c This is part of the GnuPG manual.
4 @c For copying conditions, see the file gnupg.texi.
10 @cindex GPG command options
11 @cindex command options
12 @cindex options, GPG command
15 @c Begin standard stuff
20 \- OpenPGP encryption and signing tool
37 @c Begin gpg2 hack stuff
42 \- OpenPGP encryption and signing tool
57 @c End gpg2 hack stuff
61 @command{@gpgname} is the OpenPGP part of the GNU Privacy Guard (GnuPG). It
62 is a tool to provide digital encryption and signing services using the
63 OpenPGP standard. @command{@gpgname} features complete key management and
64 all the bells and whistles you would expect from a full OpenPGP
67 There are two main versions of GnuPG: GnuPG 1.x and GnuPG 2.x. GnuPG
68 2.x supports modern encryption algorithms and thus should be preferred
69 over GnuPG 1.x. You only need to use GnuPG 1.x if your platform
70 doesn't support GnuPG 2.x, or you need support for some features that
71 GnuPG 2.x has deprecated, e.g., decrypting data created with PGP-2
75 If you are looking for version 1 of GnuPG, you may find that version
76 installed under the name @command{gpg1}.
79 In contrast to the standalone command @command{gpg} from GnuPG 1.x,
80 the 2.x version is commonly installed under the name
86 @xref{Option Index}, for an index to @command{@gpgname}'s commands and options.
90 * GPG Commands:: List of all commands.
91 * GPG Options:: List of all options.
92 * GPG Configuration:: Configuration files.
93 * GPG Examples:: Some usage examples.
95 Developer information:
96 * Unattended Usage of GPG:: Using @command{gpg} from other programs.
99 @c * GPG Protocol:: The protocol the server mode uses.
102 @c *******************************************
103 @c *************** ****************
104 @c *************** COMMANDS ****************
105 @c *************** ****************
106 @c *******************************************
111 Commands are not distinguished from options except for the fact that
112 only one command is allowed. Generally speaking, irrelevant options
113 are silently ignored, and may not be checked for correctness.
115 @command{@gpgname} may be run with no commands. In this case it will
116 perform a reasonable action depending on the type of file it is given
117 as input (an encrypted message is decrypted, a signature is verified,
118 a file containing keys is listed, etc.).
122 * General GPG Commands:: Commands not specific to the functionality.
123 * Operational GPG Commands:: Commands to select the type of operation.
124 * OpenPGP Key Management:: How to manage your keys.
128 @c *******************************************
129 @c ********** GENERAL COMMANDS *************
130 @c *******************************************
131 @node General GPG Commands
132 @subsection Commands not specific to the function
137 Print the program version and licensing information. Note that you
138 cannot abbreviate this command.
143 Print a usage message summarizing the most useful command-line options.
144 Note that you cannot arbitrarily abbreviate this command
145 (though you can use its short form @option{-h}).
149 Print warranty information.
152 @opindex dump-options
153 Print a list of all available options and commands. Note that you cannot
154 abbreviate this command.
158 @c *******************************************
159 @c ******** OPERATIONAL COMMANDS ***********
160 @c *******************************************
161 @node Operational GPG Commands
162 @subsection Commands to select the type of operation
170 Sign a message. This command may be combined with @option{--encrypt}
171 (to sign and encrypt a message), @option{--symmetric} (to sign and
172 symmetrically encrypt a message), or both @option{--encrypt} and
173 @option{--symmetric} (to sign and encrypt a message that can be
174 decrypted using a secret key or a passphrase). The signing key is
175 chosen by default or can be set explicitly using the
176 @option{--local-user} and @option{--default-key} options.
182 Make a cleartext signature. The content in a cleartext signature is
183 readable without any special software. OpenPGP software is only needed
184 to verify the signature. cleartext signatures may modify end-of-line
185 whitespace for platform independence and are not intended to be
186 reversible. The signing key is chosen by default or can be set
187 explicitly using the @option{--local-user} and @option{--default-key}
194 Make a detached signature.
199 Encrypt data. This command may be combined with @option{--sign} (to
200 sign and encrypt a message), @option{--symmetric} (to encrypt a
201 message that can decrypted using a secret key or a passphrase), or
202 @option{--sign} and @option{--symmetric} together (for a signed
203 message that can be decrypted using a secret key or a passphrase).
208 Encrypt with a symmetric cipher using a passphrase. The default
209 symmetric cipher used is @value{GPGSYMENCALGO}, but may be chosen with the
210 @option{--cipher-algo} option. This command may be combined with
211 @option{--sign} (for a signed and symmetrically encrypted message),
212 @option{--encrypt} (for a message that may be decrypted via a secret key
213 or a passphrase), or @option{--sign} and @option{--encrypt} together
214 (for a signed message that may be decrypted via a secret key or a
219 Store only (make a simple literal data packet).
224 Decrypt the file given on the command line (or STDIN if no file
225 is specified) and write it to STDOUT (or the file specified with
226 @option{--output}). If the decrypted file is signed, the signature is also
227 verified. This command differs from the default operation, as it never
228 writes to the filename which is included in the file and it rejects
229 files that don't begin with an encrypted message.
233 Assume that the first argument is a signed file and verify it without
234 generating any output. With no arguments, the signature packet is
235 read from STDIN. If only one argument is given, the specified file is
236 expected to include a complete signature.
238 With more than one argument, the first argument should specify a file
239 with a detached signature and the remaining files should contain the
240 signed data. To read the signed data from STDIN, use @samp{-} as the
241 second filename. For security reasons, a detached signature will not
242 read the signed material from STDIN if not explicitly specified.
244 Note: If the option @option{--batch} is not used, @command{@gpgname}
245 may assume that a single argument is a file with a detached signature,
246 and it will try to find a matching data file by stripping certain
247 suffixes. Using this historical feature to verify a detached
248 signature is strongly discouraged; you should always specify the data file
251 Note: When verifying a cleartext signature, @command{@gpgname} verifies
252 only what makes up the cleartext signed data and not any extra data
253 outside of the cleartext signature or the header lines directly following
254 the dash marker line. The option @code{--output} may be used to write
255 out the actual signed data, but there are other pitfalls with this
256 format as well. It is suggested to avoid cleartext signatures in
257 favor of detached signatures.
259 Note: Sometimes the use of the @command{gpgv} tool is easier than
260 using the full-fledged @command{gpg} with this option. @command{gpgv}
261 is designed to compare signed data against a list of trusted keys and
262 returns with success only for a good signature. It has its own manual
268 This modifies certain other commands to accept multiple files for
269 processing on the command line or read from STDIN with each filename on
270 a separate line. This allows for many files to be processed at
271 once. @option{--multifile} may currently be used along with
272 @option{--verify}, @option{--encrypt}, and @option{--decrypt}. Note that
273 @option{--multifile --verify} may not be used with detached signatures.
276 @opindex verify-files
277 Identical to @option{--multifile --verify}.
279 @item --encrypt-files
280 @opindex encrypt-files
281 Identical to @option{--multifile --encrypt}.
283 @item --decrypt-files
284 @opindex decrypt-files
285 Identical to @option{--multifile --decrypt}.
289 @itemx --list-public-keys
291 List the specified keys. If no keys are specified, then all keys from
292 the configured public keyrings are listed.
294 Never use the output of this command in scripts or other programs.
295 The output is intended only for humans and its format is likely to
296 change. The @option{--with-colons} option emits the output in a
297 stable, machine-parseable format, which is intended for use by scripts
300 @item --list-secret-keys
302 @opindex list-secret-keys
303 List the specified secret keys. If no keys are specified, then all
304 known secret keys are listed. A @code{#} after the initial tags
305 @code{sec} or @code{ssb} means that the secret key or subkey is
306 currently not usable. We also say that this key has been taken
307 offline (for example, a primary key can be taken offline by exported
308 the key using the command @option{--export-secret-subkeys}). A
309 @code{>} after these tags indicate that the key is stored on a
310 smartcard. See also @option{--list-keys}.
312 @item --list-signatures
313 @opindex list-signatures
316 Same as @option{--list-keys}, but the signatures are listed too.
317 This command has the same effect as
318 using @option{--list-keys} with @option{--with-sig-list}.
320 For each signature listed, there are several flags in between the "sig"
321 tag and keyid. These flags give additional information about each
322 signature. From left to right, they are the numbers 1-3 for certificate
323 check level (see @option{--ask-cert-level}), "L" for a local or
324 non-exportable signature (see @option{--lsign-key}), "R" for a
325 nonRevocable signature (see the @option{--edit-key} command "nrsign"),
326 "P" for a signature that contains a policy URL (see
327 @option{--cert-policy-url}), "N" for a signature that contains a
328 notation (see @option{--cert-notation}), "X" for an eXpired signature
329 (see @option{--ask-cert-expire}), and the numbers 1-9 or "T" for 10 and
330 above to indicate trust signature levels (see the @option{--edit-key}
333 @item --check-signatures
334 @opindex check-signatures
337 Same as @option{--list-signatures}, but the signatures are verified. Note
338 that for performance reasons the revocation status of a signing key is
340 This command has the same effect as
341 using @option{--list-keys} with @option{--with-sig-check}.
343 The status of the verification is indicated by a flag directly following
344 the "sig" tag (and thus before the flags described above for
345 @option{--list-signatures}). A "!" indicates that the signature has been
346 successfully verified, a "-" denotes a bad signature and a "%" is used
347 if an error occurred while checking the signature (e.g. a non supported
352 Locate the keys given as arguments. This command basically uses the
353 same algorithm as used when locating keys for encryption or signing and
354 may thus be used to see what keys @command{@gpgname} might use. In
355 particular external methods as defined by @option{--auto-key-locate} may
356 be used to locate a key. Only public keys are listed.
360 List all keys (or the specified ones) along with their
361 fingerprints. This is the same output as @option{--list-keys} but with
362 the additional output of a line with the fingerprint. May also be
363 combined with @option{--list-signatures} or @option{--check-signatures}. If this
364 command is given twice, the fingerprints of all secondary keys are
365 listed too. This command also forces pretty printing of fingerprints
366 if the keyid format has been set to "none".
369 @opindex list-packets
370 List only the sequence of packets. This command is only useful for
371 debugging. When used with option @option{--verbose} the actual MPI
372 values are dumped and not only their lengths. Note that the output of
373 this command may change with new releases.
380 Present a menu to work with a smartcard. The subcommand "help" provides
381 an overview on available commands. For a detailed description, please
382 see the Card HOWTO at
383 https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
387 Show the content of the smart card.
391 Present a menu to allow changing the PIN of a smartcard. This
392 functionality is also available as the subcommand "passwd" with the
393 @option{--edit-card} command.
395 @item --delete-keys @var{name}
397 Remove key from the public keyring. In batch mode either @option{--yes} is
398 required or the key must be specified by fingerprint. This is a
399 safeguard against accidental deletion of multiple keys.
401 @item --delete-secret-keys @var{name}
402 @opindex delete-secret-keys
403 Remove key from the secret keyring. In batch mode the key must be
404 specified by fingerprint. The option @option{--yes} can be used to
405 advice gpg-agent not to request a confirmation. This extra
406 pre-caution is done because @command{@gpgname} can't be sure that the
407 secret key (as controlled by gpg-agent) is only used for the given
411 @item --delete-secret-and-public-key @var{name}
412 @opindex delete-secret-and-public-key
413 Same as @option{--delete-key}, but if a secret key exists, it will be
414 removed first. In batch mode the key must be specified by fingerprint.
415 The option @option{--yes} can be used to advice gpg-agent not to
416 request a confirmation.
420 Either export all keys from all keyrings (default keyrings and those
421 registered via option @option{--keyring}), or if at least one name is given,
422 those of the given name. The exported keys are written to STDOUT or to the
423 file given with option @option{--output}. Use together with
424 @option{--armor} to mail those keys.
426 @item --send-keys @var{keyIDs}
428 Similar to @option{--export} but sends the keys to a keyserver.
429 Fingerprints may be used instead of key IDs. Option
430 @option{--keyserver} must be used to give the name of this
431 keyserver. Don't send your complete keyring to a keyserver --- select
432 only those keys which are new or changed by you. If no @var{keyIDs}
433 are given, @command{@gpgname} does nothing.
435 @item --export-secret-keys
436 @itemx --export-secret-subkeys
437 @opindex export-secret-keys
438 @opindex export-secret-subkeys
439 Same as @option{--export}, but exports the secret keys instead. The
440 exported keys are written to STDOUT or to the file given with option
441 @option{--output}. This command is often used along with the option
442 @option{--armor} to allow for easy printing of the key for paper backup;
443 however the external tool @command{paperkey} does a better job of
444 creating backups on paper. Note that exporting a secret key can be a
445 security risk if the exported keys are sent over an insecure channel.
447 The second form of the command has the special property to render the
448 secret part of the primary key useless; this is a GNU extension to
449 OpenPGP and other implementations can not be expected to successfully
450 import such a key. Its intended use is in generating a full key with
451 an additional signing subkey on a dedicated machine. This command
452 then exports the key without the primary key to the main machine.
454 GnuPG may ask you to enter the passphrase for the key. This is
455 required, because the internal protection method of the secret key is
456 different from the one specified by the OpenPGP protocol.
458 @item --export-ssh-key
459 @opindex export-ssh-key
460 This command is used to export a key in the OpenSSH public key format.
461 It requires the specification of one key by the usual means and
462 exports the latest valid subkey which has an authentication capability
463 to STDOUT or to the file given with option @option{--output}. That
464 output can directly be added to ssh's @file{authorized_key} file.
466 By specifying the key to export using a key ID or a fingerprint
467 suffixed with an exclamation mark (!), a specific subkey or the
468 primary key can be exported. This does not even require that the key
469 has the authentication capability flag set.
474 Import/merge keys. This adds the given keys to the
475 keyring. The fast version is currently just a synonym.
477 There are a few other options which control how this command works.
478 Most notable here is the @option{--import-options merge-only} option
479 which does not insert new keys but does only the merging of new
480 signatures, user-IDs and subkeys.
482 @item --receive-keys @var{keyIDs}
483 @opindex receive-keys
484 @itemx --recv-keys @var{keyIDs}
486 Import the keys with the given @var{keyIDs} from a keyserver. Option
487 @option{--keyserver} must be used to give the name of this keyserver.
490 @opindex refresh-keys
491 Request updates from a keyserver for keys that already exist on the
492 local keyring. This is useful for updating a key with the latest
493 signatures, user IDs, etc. Calling this with no arguments will refresh
494 the entire keyring. Option @option{--keyserver} must be used to give the
495 name of the keyserver for all keys that do not have preferred keyservers
496 set (see @option{--keyserver-options honor-keyserver-url}).
498 @item --search-keys @var{names}
500 Search the keyserver for the given @var{names}. Multiple names given here will
501 be joined together to create the search string for the keyserver.
502 Option @option{--keyserver} must be used to give the name of this
503 keyserver. Keyservers that support different search methods allow using
504 the syntax specified in "How to specify a user ID" below. Note that
505 different keyserver types support different search methods. Currently
506 only LDAP supports them all.
508 @item --fetch-keys @var{URIs}
510 Retrieve keys located at the specified @var{URIs}. Note that different
511 installations of GnuPG may support different protocols (HTTP, FTP,
512 LDAP, etc.). When using HTTPS the system provided root certificates
513 are used by this command.
515 @item --update-trustdb
516 @opindex update-trustdb
517 Do trust database maintenance. This command iterates over all keys and
518 builds the Web of Trust. This is an interactive command because it may
519 have to ask for the "ownertrust" values for keys. The user has to give
520 an estimation of how far she trusts the owner of the displayed key to
521 correctly certify (sign) other keys. GnuPG only asks for the ownertrust
522 value if it has not yet been assigned to a key. Using the
523 @option{--edit-key} menu, the assigned value can be changed at any time.
525 @item --check-trustdb
526 @opindex check-trustdb
527 Do trust database maintenance without user interaction. From time to
528 time the trust database must be updated so that expired keys or
529 signatures and the resulting changes in the Web of Trust can be
530 tracked. Normally, GnuPG will calculate when this is required and do it
531 automatically unless @option{--no-auto-check-trustdb} is set. This
532 command can be used to force a trust database check at any time. The
533 processing is identical to that of @option{--update-trustdb} but it
534 skips keys with a not yet defined "ownertrust".
536 For use with cron jobs, this command can be used together with
537 @option{--batch} in which case the trust database check is done only if
538 a check is needed. To force a run even in batch mode add the option
541 @anchor{option --export-ownertrust}
542 @item --export-ownertrust
543 @opindex export-ownertrust
544 Send the ownertrust values to STDOUT. This is useful for backup purposes
545 as these values are the only ones which can't be re-created from a
546 corrupted trustdb. Example:
549 @gpgname{} --export-ownertrust > otrust.txt
554 @item --import-ownertrust
555 @opindex import-ownertrust
556 Update the trustdb with the ownertrust values stored in @code{files} (or
557 STDIN if not given); existing values will be overwritten. In case of a
558 severely damaged trustdb and if you have a recent backup of the
559 ownertrust values (e.g. in the file @file{otrust.txt}), you may re-create
560 the trustdb using these commands:
565 @gpgname{} --import-ownertrust < otrust.txt
570 @item --rebuild-keydb-caches
571 @opindex rebuild-keydb-caches
572 When updating from version 1.0.6 to 1.0.7 this command should be used
573 to create signature caches in the keyring. It might be handy in other
576 @item --print-md @var{algo}
579 Print message digest of algorithm @var{algo} for all given files or STDIN.
580 With the second form (or a deprecated "*" for @var{algo}) digests for all
581 available algorithms are printed.
583 @item --gen-random @var{0|1|2} @var{count}
585 Emit @var{count} random bytes of the given quality level 0, 1 or 2. If
586 @var{count} is not given or zero, an endless sequence of random bytes
587 will be emitted. If used with @option{--armor} the output will be
588 base64 encoded. PLEASE, don't use this command unless you know what
589 you are doing; it may remove precious entropy from the system!
591 @item --gen-prime @var{mode} @var{bits}
593 Use the source, Luke :-). The output format is subject to change
601 Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
602 This is a GnuPG extension to OpenPGP and in general not very useful.
604 @item --tofu-policy @{auto|good|unknown|bad|ask@} @var{keys}
606 Set the TOFU policy for all the bindings associated with the specified
607 @var{keys}. For more information about the meaning of the policies,
608 @pxref{trust-model-tofu}. The @var{keys} may be specified either by their
609 fingerprint (preferred) or their keyid.
613 @c Run gpg in server mode. This feature is not yet ready for use and
614 @c thus not documented.
619 @c *******************************************
620 @c ******* KEY MANGEMENT COMMANDS **********
621 @c *******************************************
622 @node OpenPGP Key Management
623 @subsection How to manage your keys
625 This section explains the main commands for key management.
629 @item --quick-generate-key @var{user-id} [@var{algo} [@var{usage} [@var{expire}]]]
630 @opindex quick-generate-key
631 This is a simple command to generate a standard key with one user id.
632 In contrast to @option{--generate-key} the key is generated directly
633 without the need to answer a bunch of prompts. Unless the option
634 @option{--yes} is given, the key creation will be canceled if the
635 given user id already exists in the keyring.
637 If invoked directly on the console without any special options an
638 answer to a ``Continue?'' style confirmation prompt is required. In
639 case the user id already exists in the keyring a second prompt to
640 force the creation of the key will show up.
642 If @var{algo} or @var{usage} are given, only the primary key is
643 created and no prompts are shown. To specify an expiration date but
644 still create a primary and subkey use ``default'' or
645 ``future-default'' for @var{algo} and ``default'' for @var{usage}.
646 For a description of these optional arguments see the command
647 @code{--quick-add-key}. The @var{usage} accepts also the value
648 ``cert'' which can be used to create a certification only primary key;
649 the default is to a create certification and signing key.
651 The @var{expire} argument can be used to specify an expiration date
652 for the key. Several formats are supported; commonly the ISO formats
653 ``YYYY-MM-DD'' or ``YYYYMMDDThhmmss'' are used. To make the key
654 expire in N seconds, N days, N weeks, N months, or N years use
655 ``seconds=N'', ``Nd'', ``Nw'', ``Nm'', or ``Ny'' respectively. Not
656 specifying a value, or using ``-'' results in a key expiring in a
657 reasonable default interval. The values ``never'', ``none'' can be
658 used for no expiration date.
660 If this command is used with @option{--batch},
661 @option{--pinentry-mode} has been set to @code{loopback}, and one of
662 the passphrase options (@option{--passphrase},
663 @option{--passphrase-fd}, or @option{passphrase-file}) is used, the
664 supplied passphrase is used for the new key and the agent does not ask
665 for it. To create a key without any protection @code{--passphrase ''}
668 @item --quick-set-expire @var{fpr} @var{expire} [*|@var{subfprs}]
669 @opindex quick-set-expire
670 With two arguments given, directly set the expiration time of the
671 primary key identified by @var{fpr} to @var{expire}. To remove the
672 expiration time @code{0} can be used. With three arguments and the
673 third given as an asterisk, the expiration time of all non-revoked and
674 not yet expired subkeys are set to @var{expire}. With more than two
675 arguments and a list of fingerprints given for @var{subfprs}, all
676 non-revoked subkeys matching these fingerprints are set to
680 @item --quick-add-key @var{fpr} [@var{algo} [@var{usage} [@var{expire}]]]
681 @opindex quick-add-key
682 Directly add a subkey to the key identified by the fingerprint
683 @var{fpr}. Without the optional arguments an encryption subkey is
684 added. If any of the arguments are given a more specific subkey is
687 @var{algo} may be any of the supported algorithms or curve names
688 given in the format as used by key listings. To use the default
689 algorithm the string ``default'' or ``-'' can be used. Supported
690 algorithms are ``rsa'', ``dsa'', ``elg'', ``ed25519'', ``cv25519'',
691 and other ECC curves. For example the string ``rsa'' adds an RSA key
692 with the default key length; a string ``rsa4096'' requests that the
693 key length is 4096 bits. The string ``future-default'' is an alias
694 for the algorithm which will likely be used as default algorithm in
695 future versions of gpg.
697 Depending on the given @var{algo} the subkey may either be an
698 encryption subkey or a signing subkey. If an algorithm is capable of
699 signing and encryption and such a subkey is desired, a @var{usage}
700 string must be given. This string is either ``default'' or ``-'' to
701 keep the default or a comma delimited list (or space delimited list)
702 of keywords: ``sign'' for a signing subkey, ``auth'' for an
703 authentication subkey, and ``encr'' for an encryption subkey
704 (``encrypt'' can be used as alias for ``encr''). The valid
705 combinations depend on the algorithm.
707 The @var{expire} argument can be used to specify an expiration date
708 for the key. Several formats are supported; commonly the ISO formats
709 ``YYYY-MM-DD'' or ``YYYYMMDDThhmmss'' are used. To make the key
710 expire in N seconds, N days, N weeks, N months, or N years use
711 ``seconds=N'', ``Nd'', ``Nw'', ``Nm'', or ``Ny'' respectively. Not
712 specifying a value, or using ``-'' results in a key expiring in a
713 reasonable default interval. The values ``never'', ``none'' can be
714 used for no expiration date.
717 @opindex generate-key
720 Generate a new key pair using the current default parameters. This is
721 the standard command to create a new key. In addition to the key a
722 revocation certificate is created and stored in the
723 @file{openpgp-revocs.d} directory below the GnuPG home directory.
725 @item --full-generate-key
726 @opindex full-generate-key
727 @itemx --full-gen-key
728 @opindex full-gen-key
729 Generate a new key pair with dialogs for all options. This is an
730 extended version of @option{--generate-key}.
732 There is also a feature which allows you to create keys in batch
733 mode. See the manual section ``Unattended key generation'' on how
737 @item --generate-revocation @var{name}
738 @opindex generate-revocation
739 @itemx --gen-revoke @var{name}
741 Generate a revocation certificate for the complete key. To only revoke
742 a subkey or a key signature, use the @option{--edit} command.
744 This command merely creates the revocation certificate so that it can
745 be used to revoke the key if that is ever needed. To actually revoke
746 a key the created revocation certificate needs to be merged with the
747 key to revoke. This is done by importing the revocation certificate
748 using the @option{--import} command. Then the revoked key needs to be
749 published, which is best done by sending the key to a keyserver
750 (command @option{--send-key}) and by exporting (@option{--export}) it
751 to a file which is then send to frequent communication partners.
754 @item --generate-designated-revocation @var{name}
755 @opindex generate-designated-revocation
756 @itemx --desig-revoke @var{name}
757 @opindex desig-revoke
758 Generate a designated revocation certificate for a key. This allows a
759 user (with the permission of the keyholder) to revoke someone else's
765 Present a menu which enables you to do most of the key management
766 related tasks. It expects the specification of a key on the command
769 @c ******** Begin Edit-key Options **********
774 Toggle selection of user ID or photographic user ID with index @var{n}.
775 Use @code{*} to select all and @code{0} to deselect all.
779 Toggle selection of subkey with index @var{n} or key ID @var{n}.
780 Use @code{*} to select all and @code{0} to deselect all.
783 @opindex keyedit:sign
784 Make a signature on key of user @code{name}. If the key is not yet
785 signed by the default user (or the users given with @option{-u}), the program
786 displays the information of the key again, together with its
787 fingerprint and asks whether it should be signed. This question is
788 repeated for all users specified with
792 @opindex keyedit:lsign
793 Same as "sign" but the signature is marked as non-exportable and will
794 therefore never be used by others. This may be used to make keys
795 valid only in the local environment.
798 @opindex keyedit:nrsign
799 Same as "sign" but the signature is marked as non-revocable and can
800 therefore never be revoked.
803 @opindex keyedit:tsign
804 Make a trust signature. This is a signature that combines the notions
805 of certification (like a regular signature), and trust (like the
806 "trust" command). It is generally only useful in distinct communities
807 or groups. For more information please read the sections
808 ``Trust Signature'' and ``Regular Expression'' in RFC-4880.
812 Note that "l" (for local / non-exportable), "nr" (for non-revocable,
813 and "t" (for trust) may be freely mixed and prefixed to "sign" to
814 create a signature of any type desired.
817 If the option @option{--only-sign-text-ids} is specified, then any
818 non-text based user ids (e.g., photo IDs) will not be selected for
824 @opindex keyedit:delsig
825 Delete a signature. Note that it is not possible to retract a signature,
826 once it has been send to the public (i.e. to a keyserver). In that case
827 you better use @code{revsig}.
830 @opindex keyedit:revsig
831 Revoke a signature. For every signature which has been generated by
832 one of the secret keys, GnuPG asks whether a revocation certificate
836 @opindex keyedit:check
837 Check the signatures on all selected user IDs. With the extra
838 option @code{selfsig} only self-signatures are shown.
841 @opindex keyedit:adduid
842 Create an additional user ID.
845 @opindex keyedit:addphoto
846 Create a photographic user ID. This will prompt for a JPEG file that
847 will be embedded into the user ID. Note that a very large JPEG will make
848 for a very large key. Also note that some programs will display your
849 JPEG unchanged (GnuPG), and some programs will scale it to fit in a
853 @opindex keyedit:showphoto
854 Display the selected photographic user ID.
857 @opindex keyedit:deluid
858 Delete a user ID or photographic user ID. Note that it is not
859 possible to retract a user id, once it has been send to the public
860 (i.e. to a keyserver). In that case you better use @code{revuid}.
863 @opindex keyedit:revuid
864 Revoke a user ID or photographic user ID.
867 @opindex keyedit:primary
868 Flag the current user id as the primary one, removes the primary user
869 id flag from all other user ids and sets the timestamp of all affected
870 self-signatures one second ahead. Note that setting a photo user ID
871 as primary makes it primary over other photo user IDs, and setting a
872 regular user ID as primary makes it primary over other regular user
876 @opindex keyedit:keyserver
877 Set a preferred keyserver for the specified user ID(s). This allows
878 other users to know where you prefer they get your key from. See
879 @option{--keyserver-options honor-keyserver-url} for more on how this
880 works. Setting a value of "none" removes an existing preferred
884 @opindex keyedit:notation
885 Set a name=value notation for the specified user ID(s). See
886 @option{--cert-notation} for more on how this works. Setting a value of
887 "none" removes all notations, setting a notation prefixed with a minus
888 sign (-) removes that notation, and setting a notation name (without the
889 =value) prefixed with a minus sign removes all notations with that name.
892 @opindex keyedit:pref
893 List preferences from the selected user ID. This shows the actual
894 preferences, without including any implied preferences.
897 @opindex keyedit:showpref
898 More verbose preferences listing for the selected user ID. This shows
899 the preferences in effect by including the implied preferences of 3DES
900 (cipher), SHA-1 (digest), and Uncompressed (compression) if they are
901 not already included in the preference list. In addition, the
902 preferred keyserver and signature notations (if any) are shown.
904 @item setpref @var{string}
905 @opindex keyedit:setpref
906 Set the list of user ID preferences to @var{string} for all (or just
907 the selected) user IDs. Calling setpref with no arguments sets the
908 preference list to the default (either built-in or set via
909 @option{--default-preference-list}), and calling setpref with "none"
910 as the argument sets an empty preference list. Use @command{@gpgname
911 --version} to get a list of available algorithms. Note that while you
912 can change the preferences on an attribute user ID (aka "photo ID"),
913 GnuPG does not select keys via attribute user IDs so these preferences
914 will not be used by GnuPG.
916 When setting preferences, you should list the algorithms in the order
917 which you'd like to see them used by someone else when encrypting a
918 message to your key. If you don't include 3DES, it will be
919 automatically added at the end. Note that there are many factors that
920 go into choosing an algorithm (for example, your key may not be the
921 only recipient), and so the remote OpenPGP application being used to
922 send to you may or may not follow your exact chosen order for a given
923 message. It will, however, only choose an algorithm that is present
924 on the preference list of every recipient key. See also the
925 INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
928 @opindex keyedit:addkey
929 Add a subkey to this key.
932 @opindex keyedit:addcardkey
933 Generate a subkey on a card and add it to this key.
936 @opindex keyedit:keytocard
937 Transfer the selected secret subkey (or the primary key if no subkey
938 has been selected) to a smartcard. The secret key in the keyring will
939 be replaced by a stub if the key could be stored successfully on the
940 card and you use the save command later. Only certain key types may be
941 transferred to the card. A sub menu allows you to select on what card
942 to store the key. Note that it is not possible to get that key back
943 from the card - if the card gets broken your secret key will be lost
944 unless you have a backup somewhere.
946 @item bkuptocard @var{file}
947 @opindex keyedit:bkuptocard
948 Restore the given @var{file} to a card. This command may be used to restore a
949 backup key (as generated during card initialization) to a new card. In
950 almost all cases this will be the encryption key. You should use this
951 command only with the corresponding public key and make sure that the
952 file given as argument is indeed the backup to restore. You should then
953 select 2 to restore as encryption key. You will first be asked to enter
954 the passphrase of the backup key and then for the Admin PIN of the card.
957 @opindex keyedit:delkey
958 Remove a subkey (secondary key). Note that it is not possible to retract
959 a subkey, once it has been send to the public (i.e. to a keyserver). In
960 that case you better use @code{revkey}. Also note that this only
961 deletes the public part of a key.
964 @opindex keyedit:revkey
968 @opindex keyedit:expire
969 Change the key or subkey expiration time. If a subkey is selected, the
970 expiration time of this subkey will be changed. With no selection, the
971 key expiration of the primary key is changed.
974 @opindex keyedit:trust
975 Change the owner trust value for the key. This updates the trust-db
976 immediately and no save is required.
980 @opindex keyedit:disable
981 @opindex keyedit:enable
982 Disable or enable an entire key. A disabled key can not normally be
986 @opindex keyedit:addrevoker
987 Add a designated revoker to the key. This takes one optional argument:
988 "sensitive". If a designated revoker is marked as sensitive, it will
989 not be exported by default (see export-options).
992 @opindex keyedit:passwd
993 Change the passphrase of the secret key.
996 @opindex keyedit:toggle
997 This is dummy command which exists only for backward compatibility.
1000 @opindex keyedit:clean
1001 Compact (by removing all signatures except the selfsig) any user ID
1002 that is no longer usable (e.g. revoked, or expired). Then, remove any
1003 signatures that are not usable by the trust calculations.
1004 Specifically, this removes any signature that does not validate, any
1005 signature that is superseded by a later signature, revoked signatures,
1006 and signatures issued by keys that are not present on the keyring.
1009 @opindex keyedit:minimize
1010 Make the key as small as possible. This removes all signatures from
1011 each user ID except for the most recent self-signature.
1014 @opindex keyedit:cross-certify
1015 Add cross-certification signatures to signing subkeys that may not
1016 currently have them. Cross-certification signatures protect against a
1017 subtle attack against signing subkeys. See
1018 @option{--require-cross-certification}. All new keys generated have
1019 this signature by default, so this command is only useful to bring
1020 older keys up to date.
1023 @opindex keyedit:save
1024 Save all changes to the keyrings and quit.
1027 @opindex keyedit:quit
1028 Quit the program without updating the
1033 The listing shows you the key with its secondary keys and all user
1034 ids. The primary user id is indicated by a dot, and selected keys or
1035 user ids are indicated by an asterisk. The trust
1036 value is displayed with the primary key: the first is the assigned owner
1037 trust and the second is the calculated trust value. Letters are used for
1044 No ownertrust assigned / not yet calculated.
1048 calculation has failed; probably due to an expired key.
1051 Not enough information for calculation.
1054 Never trust this key.
1066 @c ******** End Edit-key Options **********
1068 @item --sign-key @var{name}
1070 Signs a public key with your secret key. This is a shortcut version of
1071 the subcommand "sign" from @option{--edit}.
1073 @item --lsign-key @var{name}
1075 Signs a public key with your secret key but marks it as
1076 non-exportable. This is a shortcut version of the subcommand "lsign"
1077 from @option{--edit-key}.
1079 @item --quick-sign-key @var{fpr} [@var{names}]
1080 @itemx --quick-lsign-key @var{fpr} [@var{names}]
1081 @opindex quick-sign-key
1082 @opindex quick-lsign-key
1083 Directly sign a key from the passphrase without any further user
1084 interaction. The @var{fpr} must be the verified primary fingerprint
1085 of a key in the local keyring. If no @var{names} are given, all
1086 useful user ids are signed; with given [@var{names}] only useful user
1087 ids matching one of theses names are signed. By default, or if a name
1088 is prefixed with a '*', a case insensitive substring match is used.
1089 If a name is prefixed with a '=' a case sensitive exact match is done.
1091 The command @option{--quick-lsign-key} marks the signatures as
1092 non-exportable. If such a non-exportable signature already exists the
1093 @option{--quick-sign-key} turns it into a exportable signature.
1095 This command uses reasonable defaults and thus does not provide the
1096 full flexibility of the "sign" subcommand from @option{--edit-key}.
1097 Its intended use is to help unattended key signing by utilizing a list
1098 of verified fingerprints.
1100 @item --quick-add-uid @var{user-id} @var{new-user-id}
1101 @opindex quick-add-uid
1102 This command adds a new user id to an existing key. In contrast to
1103 the interactive sub-command @code{adduid} of @option{--edit-key} the
1104 @var{new-user-id} is added verbatim with only leading and trailing
1105 white space removed, it is expected to be UTF-8 encoded, and no checks
1106 on its form are applied.
1108 @item --quick-revoke-uid @var{user-id} @var{user-id-to-revoke}
1109 @opindex quick-revoke-uid
1110 This command revokes a user ID on an existing key. It cannot be used
1111 to revoke the last user ID on key (some non-revoked user ID must
1112 remain), with revocation reason ``User ID is no longer valid''. If
1113 you want to specify a different revocation reason, or to supply
1114 supplementary revocation text, you should use the interactive
1115 sub-command @code{revuid} of @option{--edit-key}.
1117 @item --quick-set-primary-uid @var{user-id} @var{primary-user-id}
1118 @opindex quick-set-primary-uid
1119 This command sets or updates the primary user ID flag on an existing
1120 key. @var{user-id} specifies the key and @var{primary-user-id} the
1121 user ID which shall be flagged as the primary user ID. The primary
1122 user ID flag is removed from all other user ids and the timestamp of
1123 all affected self-signatures is set one second ahead.
1126 @item --change-passphrase @var{user-id}
1127 @opindex change-passphrase
1128 @itemx --passwd @var{user-id}
1130 Change the passphrase of the secret key belonging to the certificate
1131 specified as @var{user-id}. This is a shortcut for the sub-command
1132 @code{passwd} of the edit key menu.
1137 @c *******************************************
1138 @c *************** ****************
1139 @c *************** OPTIONS ****************
1140 @c *************** ****************
1141 @c *******************************************
1144 @section Option Summary
1146 @command{@gpgname} features a bunch of options to control the exact
1147 behaviour and to change the default configuration.
1150 * GPG Configuration Options:: How to change the configuration.
1151 * GPG Key related Options:: Key related options.
1152 * GPG Input and Output:: Input and Output.
1153 * OpenPGP Options:: OpenPGP protocol specific options.
1154 * Compliance Options:: Compliance options.
1155 * GPG Esoteric Options:: Doing things one usually doesn't want to do.
1156 * Deprecated Options:: Deprecated options.
1159 Long options can be put in an options file (default
1160 "~/.gnupg/gpg.conf"). Short option names will not work - for example,
1161 "armor" is a valid option for the options file, while "a" is not. Do not
1162 write the 2 dashes, but simply the name of the option and any required
1163 arguments. Lines with a hash ('#') as the first non-white-space
1164 character are ignored. Commands may be put in this file too, but that is
1165 not generally useful as the command will execute automatically with
1166 every execution of gpg.
1168 Please remember that option parsing stops as soon as a non-option is
1169 encountered, you can explicitly stop parsing by using the special option
1172 @c *******************************************
1173 @c ******** CONFIGURATION OPTIONS **********
1174 @c *******************************************
1175 @node GPG Configuration Options
1176 @subsection How to change the configuration
1178 These options are used to change the configuration and are usually found
1183 @item --default-key @var{name}
1184 @opindex default-key
1185 Use @var{name} as the default key to sign with. If this option is not
1186 used, the default key is the first key found in the secret keyring.
1187 Note that @option{-u} or @option{--local-user} overrides this option.
1188 This option may be given multiple times. In this case, the last key
1189 for which a secret key is available is used. If there is no secret
1190 key available for any of the specified values, GnuPG will not emit an
1191 error message but continue as if this option wasn't given.
1193 @item --default-recipient @var{name}
1194 @opindex default-recipient
1195 Use @var{name} as default recipient if option @option{--recipient} is
1196 not used and don't ask if this is a valid one. @var{name} must be
1199 @item --default-recipient-self
1200 @opindex default-recipient-self
1201 Use the default key as default recipient if option @option{--recipient} is not
1202 used and don't ask if this is a valid one. The default key is the first
1203 one from the secret keyring or the one set with @option{--default-key}.
1205 @item --no-default-recipient
1206 @opindex no-default-recipient
1207 Reset @option{--default-recipient} and @option{--default-recipient-self}.
1211 Give more information during processing. If used
1212 twice, the input data is listed in detail.
1216 Reset verbose level to 0.
1220 Try to be as quiet as possible.
1226 Use batch mode. Never ask, do not allow interactive commands.
1227 @option{--no-batch} disables this option. Note that even with a
1228 filename given on the command line, gpg might still need to read from
1229 STDIN (in particular if gpg figures that the input is a
1230 detached signature and no data file has been specified). Thus if you
1231 do not want to feed data via STDIN, you should connect STDIN to
1234 It is highly recommended to use this option along with the options
1235 @option{--status-fd} and @option{--with-colons} for any unattended use of
1240 Make sure that the TTY (terminal) is never used for any output.
1241 This option is needed in some cases because GnuPG sometimes prints
1242 warnings to the TTY even if @option{--batch} is used.
1246 Assume "yes" on most questions.
1250 Assume "no" on most questions.
1253 @item --list-options @var{parameters}
1254 @opindex list-options
1255 This is a space or comma delimited string that gives options used when
1256 listing keys and signatures (that is, @option{--list-keys},
1257 @option{--list-signatures}, @option{--list-public-keys},
1258 @option{--list-secret-keys}, and the @option{--edit-key} functions).
1259 Options can be prepended with a @option{no-} (after the two dashes) to
1260 give the opposite meaning. The options are:
1265 @opindex list-options:show-photos
1266 Causes @option{--list-keys}, @option{--list-signatures},
1267 @option{--list-public-keys}, and @option{--list-secret-keys} to
1268 display any photo IDs attached to the key. Defaults to no. See also
1269 @option{--photo-viewer}. Does not work with @option{--with-colons}:
1270 see @option{--attribute-fd} for the appropriate way to get photo data
1271 for scripts and other frontends.
1274 @opindex list-options:show-usage
1275 Show usage information for keys and subkeys in the standard key
1276 listing. This is a list of letters indicating the allowed usage for a
1277 key (@code{E}=encryption, @code{S}=signing, @code{C}=certification,
1278 @code{A}=authentication). Defaults to yes.
1280 @item show-policy-urls
1281 @opindex list-options:show-policy-urls
1282 Show policy URLs in the @option{--list-signatures} or @option{--check-signatures}
1283 listings. Defaults to no.
1285 @item show-notations
1286 @itemx show-std-notations
1287 @itemx show-user-notations
1288 @opindex list-options:show-notations
1289 @opindex list-options:show-std-notations
1290 @opindex list-options:show-user-notations
1291 Show all, IETF standard, or user-defined signature notations in the
1292 @option{--list-signatures} or @option{--check-signatures} listings. Defaults to no.
1294 @item show-keyserver-urls
1295 @opindex list-options:show-keyserver-urls
1296 Show any preferred keyserver URL in the @option{--list-signatures} or
1297 @option{--check-signatures} listings. Defaults to no.
1299 @item show-uid-validity
1300 @opindex list-options:show-uid-validity
1301 Display the calculated validity of user IDs during key listings.
1304 @item show-unusable-uids
1305 @opindex list-options:show-unusable-uids
1306 Show revoked and expired user IDs in key listings. Defaults to no.
1308 @item show-unusable-subkeys
1309 @opindex list-options:show-unusable-subkeys
1310 Show revoked and expired subkeys in key listings. Defaults to no.
1313 @opindex list-options:show-keyring
1314 Display the keyring name at the head of key listings to show which
1315 keyring a given key resides on. Defaults to no.
1317 @item show-sig-expire
1318 @opindex list-options:show-sig-expire
1319 Show signature expiration dates (if any) during @option{--list-signatures} or
1320 @option{--check-signatures} listings. Defaults to no.
1322 @item show-sig-subpackets
1323 @opindex list-options:show-sig-subpackets
1324 Include signature subpackets in the key listing. This option can take an
1325 optional argument list of the subpackets to list. If no argument is
1326 passed, list all subpackets. Defaults to no. This option is only
1327 meaningful when using @option{--with-colons} along with
1328 @option{--list-signatures} or @option{--check-signatures}.
1332 @item --verify-options @var{parameters}
1333 @opindex verify-options
1334 This is a space or comma delimited string that gives options used when
1335 verifying signatures. Options can be prepended with a `no-' to give
1336 the opposite meaning. The options are:
1341 @opindex verify-options:show-photos
1342 Display any photo IDs present on the key that issued the signature.
1343 Defaults to no. See also @option{--photo-viewer}.
1345 @item show-policy-urls
1346 @opindex verify-options:show-policy-urls
1347 Show policy URLs in the signature being verified. Defaults to yes.
1349 @item show-notations
1350 @itemx show-std-notations
1351 @itemx show-user-notations
1352 @opindex verify-options:show-notations
1353 @opindex verify-options:show-std-notations
1354 @opindex verify-options:show-user-notations
1355 Show all, IETF standard, or user-defined signature notations in the
1356 signature being verified. Defaults to IETF standard.
1358 @item show-keyserver-urls
1359 @opindex verify-options:show-keyserver-urls
1360 Show any preferred keyserver URL in the signature being verified.
1363 @item show-uid-validity
1364 @opindex verify-options:show-uid-validity
1365 Display the calculated validity of the user IDs on the key that issued
1366 the signature. Defaults to yes.
1368 @item show-unusable-uids
1369 @opindex verify-options:show-unusable-uids
1370 Show revoked and expired user IDs during signature verification.
1373 @item show-primary-uid-only
1374 @opindex verify-options:show-primary-uid-only
1375 Show only the primary user ID during signature verification. That is
1376 all the AKA lines as well as photo Ids are not shown with the signature
1377 verification status.
1380 @opindex verify-options:pka-lookups
1381 Enable PKA lookups to verify sender addresses. Note that PKA is based
1382 on DNS, and so enabling this option may disclose information on when
1383 and what signatures are verified or to whom data is encrypted. This
1384 is similar to the "web bug" described for the @option{--auto-key-retrieve}
1387 @item pka-trust-increase
1388 @opindex verify-options:pka-trust-increase
1389 Raise the trust in a signature to full if the signature passes PKA
1390 validation. This option is only meaningful if pka-lookups is set.
1393 @item --enable-large-rsa
1394 @itemx --disable-large-rsa
1395 @opindex enable-large-rsa
1396 @opindex disable-large-rsa
1397 With --generate-key and --batch, enable the creation of RSA secret keys as
1398 large as 8192 bit. Note: 8192 bit is more than is generally
1399 recommended. These large keys don't significantly improve security,
1400 but they are more expensive to use, and their signatures and
1401 certifications are larger. This option is only available if the
1402 binary was build with large-secmem support.
1405 @itemx --disable-dsa2
1406 @opindex enable-dsa2
1407 @opindex disable-dsa2
1408 Enable hash truncation for all DSA keys even for old DSA Keys up to
1409 1024 bit. This is also the default with @option{--openpgp}. Note
1410 that older versions of GnuPG also required this flag to allow the
1411 generation of DSA larger than 1024 bit.
1413 @item --photo-viewer @var{string}
1414 @opindex photo-viewer
1415 This is the command line that should be run to view a photo ID. "%i"
1416 will be expanded to a filename containing the photo. "%I" does the
1417 same, except the file will not be deleted once the viewer exits.
1418 Other flags are "%k" for the key ID, "%K" for the long key ID, "%f"
1419 for the key fingerprint, "%t" for the extension of the image type
1420 (e.g. "jpg"), "%T" for the MIME type of the image (e.g. "image/jpeg"),
1421 "%v" for the single-character calculated validity of the image being
1422 viewed (e.g. "f"), "%V" for the calculated validity as a string (e.g.
1423 "full"), "%U" for a base32 encoded hash of the user ID,
1424 and "%%" for an actual percent sign. If neither %i or %I are present,
1425 then the photo will be supplied to the viewer on standard input.
1427 The default viewer is "xloadimage -fork -quiet -title 'KeyID 0x%k'
1428 STDIN". Note that if your image viewer program is not secure, then
1429 executing it from GnuPG does not make it secure.
1431 @item --exec-path @var{string}
1434 Sets a list of directories to search for photo viewers and keyserver
1435 helpers. If not provided, keyserver helpers use the compiled-in
1436 default directory, and photo viewers use the @code{PATH} environment
1438 Note, that on W32 system this value is ignored when searching for
1441 @item --keyring @var{file}
1443 Add @var{file} to the current list of keyrings. If @var{file} begins
1444 with a tilde and a slash, these are replaced by the $HOME directory. If
1445 the filename does not contain a slash, it is assumed to be in the GnuPG
1446 home directory ("~/.gnupg" if @option{--homedir} or $GNUPGHOME is not
1449 Note that this adds a keyring to the current list. If the intent is to
1450 use the specified keyring alone, use @option{--keyring} along with
1451 @option{--no-default-keyring}.
1453 If the option @option{--no-keyring} has been used no keyrings will
1457 @item --secret-keyring @var{file}
1458 @opindex secret-keyring
1459 This is an obsolete option and ignored. All secret keys are stored in
1460 the @file{private-keys-v1.d} directory below the GnuPG home directory.
1462 @item --primary-keyring @var{file}
1463 @opindex primary-keyring
1464 Designate @var{file} as the primary public keyring. This means that
1465 newly imported keys (via @option{--import} or keyserver
1466 @option{--recv-from}) will go to this keyring.
1468 @item --trustdb-name @var{file}
1469 @opindex trustdb-name
1470 Use @var{file} instead of the default trustdb. If @var{file} begins
1471 with a tilde and a slash, these are replaced by the $HOME directory. If
1472 the filename does not contain a slash, it is assumed to be in the GnuPG
1473 home directory (@file{~/.gnupg} if @option{--homedir} or $GNUPGHOME is
1476 @include opt-homedir.texi
1479 @item --display-charset @var{name}
1480 @opindex display-charset
1481 Set the name of the native character set. This is used to convert
1482 some informational strings like user IDs to the proper UTF-8 encoding.
1483 Note that this has nothing to do with the character set of data to be
1484 encrypted or signed; GnuPG does not recode user-supplied data. If
1485 this option is not used, the default character set is determined from
1486 the current locale. A verbosity level of 3 shows the chosen set.
1487 Valid values for @var{name} are:
1492 @opindex display-charset:iso-8859-1
1493 This is the Latin 1 set.
1496 @opindex display-charset:iso-8859-2
1500 @opindex display-charset:iso-8859-15
1501 This is currently an alias for
1505 @opindex display-charset:koi8-r
1506 The usual Russian set (RFC-1489).
1509 @opindex display-charset:utf-8
1510 Bypass all translations and assume
1511 that the OS uses native UTF-8 encoding.
1514 @item --utf8-strings
1515 @itemx --no-utf8-strings
1516 @opindex utf8-strings
1517 Assume that command line arguments are given as UTF-8 strings. The
1518 default (@option{--no-utf8-strings}) is to assume that arguments are
1519 encoded in the character set as specified by
1520 @option{--display-charset}. These options affect all following
1521 arguments. Both options may be used multiple times.
1523 @anchor{gpg-option --options}
1524 @item --options @var{file}
1526 Read options from @var{file} and do not try to read them from the
1527 default options file in the homedir (see @option{--homedir}). This
1528 option is ignored if used in an options file.
1532 Shortcut for @option{--options /dev/null}. This option is detected
1533 before an attempt to open an option file. Using this option will also
1534 prevent the creation of a @file{~/.gnupg} homedir.
1537 @itemx --compress-level @var{n}
1538 @itemx --bzip2-compress-level @var{n}
1539 @opindex compress-level
1540 @opindex bzip2-compress-level
1541 Set compression level to @var{n} for the ZIP and ZLIB compression
1542 algorithms. The default is to use the default compression level of zlib
1543 (normally 6). @option{--bzip2-compress-level} sets the compression level
1544 for the BZIP2 compression algorithm (defaulting to 6 as well). This is a
1545 different option from @option{--compress-level} since BZIP2 uses a
1546 significant amount of memory for each additional compression level.
1547 @option{-z} sets both. A value of 0 for @var{n} disables compression.
1549 @item --bzip2-decompress-lowmem
1550 @opindex bzip2-decompress-lowmem
1551 Use a different decompression method for BZIP2 compressed files. This
1552 alternate method uses a bit more than half the memory, but also runs
1553 at half the speed. This is useful under extreme low memory
1554 circumstances when the file was originally compressed at a high
1555 @option{--bzip2-compress-level}.
1558 @item --mangle-dos-filenames
1559 @itemx --no-mangle-dos-filenames
1560 @opindex mangle-dos-filenames
1561 @opindex no-mangle-dos-filenames
1562 Older version of Windows cannot handle filenames with more than one
1563 dot. @option{--mangle-dos-filenames} causes GnuPG to replace (rather
1564 than add to) the extension of an output filename to avoid this
1565 problem. This option is off by default and has no effect on non-Windows
1568 @item --ask-cert-level
1569 @itemx --no-ask-cert-level
1570 @opindex ask-cert-level
1571 When making a key signature, prompt for a certification level. If this
1572 option is not specified, the certification level used is set via
1573 @option{--default-cert-level}. See @option{--default-cert-level} for
1574 information on the specific levels and how they are
1575 used. @option{--no-ask-cert-level} disables this option. This option
1578 @item --default-cert-level @var{n}
1579 @opindex default-cert-level
1580 The default to use for the check level when signing a key.
1582 0 means you make no particular claim as to how carefully you verified
1585 1 means you believe the key is owned by the person who claims to own
1586 it but you could not, or did not verify the key at all. This is
1587 useful for a "persona" verification, where you sign the key of a
1590 2 means you did casual verification of the key. For example, this
1591 could mean that you verified the key fingerprint and checked the
1592 user ID on the key against a photo ID.
1594 3 means you did extensive verification of the key. For example, this
1595 could mean that you verified the key fingerprint with the owner of the
1596 key in person, and that you checked, by means of a hard to forge
1597 document with a photo ID (such as a passport) that the name of the key
1598 owner matches the name in the user ID on the key, and finally that you
1599 verified (by exchange of email) that the email address on the key
1600 belongs to the key owner.
1602 Note that the examples given above for levels 2 and 3 are just that:
1603 examples. In the end, it is up to you to decide just what "casual"
1604 and "extensive" mean to you.
1606 This option defaults to 0 (no particular claim).
1608 @item --min-cert-level
1609 @opindex min-cert-level
1610 When building the trust database, treat any signatures with a
1611 certification level below this as invalid. Defaults to 2, which
1612 disregards level 1 signatures. Note that level 0 "no particular
1613 claim" signatures are always accepted.
1615 @item --trusted-key @var{long key ID}
1616 @opindex trusted-key
1617 Assume that the specified key (which must be given
1618 as a full 8 byte key ID) is as trustworthy as one of
1619 your own secret keys. This option is useful if you
1620 don't want to keep your secret keys (or one of them)
1621 online but still want to be able to check the validity of a given
1622 recipient's or signator's key.
1624 @item --trust-model @{pgp|classic|tofu|tofu+pgp|direct|always|auto@}
1625 @opindex trust-model
1626 Set what trust model GnuPG should follow. The models are:
1631 @opindex trust-model:pgp
1632 This is the Web of Trust combined with trust signatures as used in PGP
1633 5.x and later. This is the default trust model when creating a new
1637 @opindex trust-model:classic
1638 This is the standard Web of Trust as introduced by PGP 2.
1641 @opindex trust-model:tofu
1642 @anchor{trust-model-tofu}
1643 TOFU stands for Trust On First Use. In this trust model, the first
1644 time a key is seen, it is memorized. If later another key with a
1645 user id with the same email address is seen, both keys are marked as
1646 suspect. In that case, the next time either is used, a warning is
1647 displayed describing the conflict, why it might have occured
1648 (either the user generated a new key and failed to cross sign the
1649 old and new keys, the key is forgery, or a man-in-the-middle attack
1650 is being attempted), and the user is prompted to manually confirm
1651 the validity of the key in question.
1653 Because a potential attacker is able to control the email address
1654 and thereby circumvent the conflict detection algorithm by using an
1655 email address that is similar in appearance to a trusted email
1656 address, whenever a message is verified, statistics about the number
1657 of messages signed with the key are shown. In this way, a user can
1658 easily identify attacks using fake keys for regular correspondents.
1660 When compared with the Web of Trust, TOFU offers significantly
1661 weaker security guarantees. In particular, TOFU only helps ensure
1662 consistency (that is, that the binding between a key and email
1663 address doesn't change). A major advantage of TOFU is that it
1664 requires little maintenance to use correctly. To use the web of
1665 trust properly, you need to actively sign keys and mark users as
1666 trusted introducers. This is a time-consuming process and anecdotal
1667 evidence suggests that even security-conscious users rarely take the
1668 time to do this thoroughly and instead rely on an ad-hoc TOFU
1671 In the TOFU model, policies are associated with bindings between
1672 keys and email addresses (which are extracted from user ids and
1673 normalized). There are five policies, which can be set manually
1674 using the @option{--tofu-policy} option. The default policy can be
1675 set using the @option{--tofu-default-policy} option.
1677 The TOFU policies are: @code{auto}, @code{good}, @code{unknown},
1678 @code{bad} and @code{ask}. The @code{auto} policy is used by
1679 default (unless overridden by @option{--tofu-default-policy}) and
1680 marks a binding as marginally trusted. The @code{good},
1681 @code{unknown} and @code{bad} policies mark a binding as fully
1682 trusted, as having unknown trust or as having trust never,
1683 respectively. The @code{unknown} policy is useful for just using
1684 TOFU to detect conflicts, but to never assign positive trust to a
1685 binding. The final policy, @code{ask} prompts the user to indicate
1686 the binding's trust. If batch mode is enabled (or input is
1687 inappropriate in the context), then the user is not prompted and the
1688 @code{undefined} trust level is returned.
1691 @opindex trust-model:tofu+pgp
1692 This trust model combines TOFU with the Web of Trust. This is done
1693 by computing the trust level for each model and then taking the
1694 maximum trust level where the trust levels are ordered as follows:
1695 @code{unknown < undefined < marginal < fully < ultimate < expired <
1698 By setting @option{--tofu-default-policy=unknown}, this model can be
1699 used to implement the web of trust with TOFU's conflict detection
1700 algorithm, but without its assignment of positive trust values,
1701 which some security-conscious users don't like.
1704 @opindex trust-model:direct
1705 Key validity is set directly by the user and not calculated via the
1706 Web of Trust. This model is solely based on the key and does
1707 not distinguish user IDs. Note that when changing to another trust
1708 model the trust values assigned to a key are transformed into
1709 ownertrust values, which also indicate how you trust the owner of
1710 the key to sign other keys.
1713 @opindex trust-model:always
1714 Skip key validation and assume that used keys are always fully
1715 valid. You generally won't use this unless you are using some
1716 external validation scheme. This option also suppresses the
1717 "[uncertain]" tag printed with signature checks when there is no
1718 evidence that the user ID is bound to the key. Note that this
1719 trust model still does not allow the use of expired, revoked, or
1723 @opindex trust-model:auto
1724 Select the trust model depending on whatever the internal trust
1725 database says. This is the default model if such a database already
1729 @item --auto-key-locate @var{mechanisms}
1730 @itemx --no-auto-key-locate
1731 @opindex auto-key-locate
1732 GnuPG can automatically locate and retrieve keys as needed using this
1733 option. This happens when encrypting to an email address (in the
1734 "user@@example.com" form), and there are no "user@@example.com" keys
1735 on the local keyring. This option takes any number of the mechanisms
1736 listed below, in the order they are to be tried. Instead of listing
1737 the mechanisms as comma delimited arguments, the option may also be
1738 given several times to add more mechanism. The option
1739 @option{--no-auto-key-locate} or the mechanism "clear" resets the
1740 list. The default is "local,wkd".
1745 Locate a key using DNS CERT, as specified in RFC-4398.
1748 Locate a key using DNS PKA.
1751 Locate a key using DANE, as specified
1752 in draft-ietf-dane-openpgpkey-05.txt.
1755 Locate a key using the Web Key Directory protocol.
1758 Using DNS Service Discovery, check the domain in question for any LDAP
1759 keyservers to use. If this fails, attempt to locate the key using the
1760 PGP Universal method of checking @samp{ldap://keys.(thedomain)}.
1763 Locate a key using whatever keyserver is defined using the
1764 @option{--keyserver} option.
1767 In addition, a keyserver URL as used in the @option{--keyserver} option
1768 may be used here to query that particular keyserver.
1771 Locate the key using the local keyrings. This mechanism allows the user to
1772 select the order a local key lookup is done. Thus using
1773 @samp{--auto-key-locate local} is identical to
1774 @option{--no-auto-key-locate}.
1777 This flag disables the standard local key lookup, done before any of the
1778 mechanisms defined by the @option{--auto-key-locate} are tried. The
1779 position of this mechanism in the list does not matter. It is not
1780 required if @code{local} is also used.
1783 Clear all defined mechanisms. This is useful to override
1784 mechanisms given in a config file.
1789 @item --auto-key-retrieve
1790 @itemx --no-auto-key-retrieve
1791 @opindex auto-key-retrieve
1792 @opindex no-auto-key-retrieve
1793 These options enable or disable the automatic retrieving of keys from
1794 a keyserver when verifying signatures made by keys that are not on the
1795 local keyring. The default is @option{--auto-key-retrieve}.
1797 If the method "wkd" is included in the list of methods given to
1798 @option{auto-key-locate}, the signer's user ID is part of the
1799 signature, and the option @option{--disable-signer-uid} is not used,
1800 the "wkd" method may also be used to retrieve a key.
1802 Note that this option makes a "web bug" like behavior possible.
1803 Keyserver or Web Key Directory operators can see which keys you
1804 request, so by sending you a message signed by a brand new key (which
1805 you naturally will not have on your local keyring), the operator can
1806 tell both your IP address and the time when you verified the
1809 @item --keyid-format @{none|short|0xshort|long|0xlong@}
1810 @opindex keyid-format
1811 Select how to display key IDs. "none" does not show the key ID at all
1812 but shows the fingerprint in a separate line. "short" is the
1813 traditional 8-character key ID. "long" is the more accurate (but less
1814 convenient) 16-character key ID. Add an "0x" to either to include an
1815 "0x" at the beginning of the key ID, as in 0x99242560. Note that this
1816 option is ignored if the option @option{--with-colons} is used.
1818 @item --keyserver @var{name}
1820 This option is deprecated - please use the @option{--keyserver} in
1821 @file{dirmngr.conf} instead.
1823 Use @var{name} as your keyserver. This is the server that
1824 @option{--receive-keys}, @option{--send-keys}, and @option{--search-keys}
1825 will communicate with to receive keys from, send keys to, and search for
1826 keys on. The format of the @var{name} is a URI:
1827 `scheme:[//]keyservername[:port]' The scheme is the type of keyserver:
1828 "hkp" for the HTTP (or compatible) keyservers, "ldap" for the LDAP
1829 keyservers, or "mailto" for the Graff email keyserver. Note that your
1830 particular installation of GnuPG may have other keyserver types
1831 available as well. Keyserver schemes are case-insensitive. After the
1832 keyserver name, optional keyserver configuration options may be
1833 provided. These are the same as the global @option{--keyserver-options}
1834 from below, but apply only to this particular keyserver.
1836 Most keyservers synchronize with each other, so there is generally no
1837 need to send keys to more than one server. The keyserver
1838 @code{hkp://keys.gnupg.net} uses round robin DNS to give a different
1839 keyserver each time you use it.
1841 @item --keyserver-options @{@var{name}=@var{value}@}
1842 @opindex keyserver-options
1843 This is a space or comma delimited string that gives options for the
1844 keyserver. Options can be prefixed with a `no-' to give the opposite
1845 meaning. Valid import-options or export-options may be used here as
1846 well to apply to importing (@option{--recv-key}) or exporting
1847 (@option{--send-key}) a key from a keyserver. While not all options
1848 are available for all keyserver types, some common options are:
1852 @item include-revoked
1853 When searching for a key with @option{--search-keys}, include keys that
1854 are marked on the keyserver as revoked. Note that not all keyservers
1855 differentiate between revoked and unrevoked keys, and for such
1856 keyservers this option is meaningless. Note also that most keyservers do
1857 not have cryptographic verification of key revocations, and so turning
1858 this option off may result in skipping keys that are incorrectly marked
1861 @item include-disabled
1862 When searching for a key with @option{--search-keys}, include keys that
1863 are marked on the keyserver as disabled. Note that this option is not
1864 used with HKP keyservers.
1866 @item auto-key-retrieve
1867 This is an obsolete alias for the option @option{auto-key-retrieve}.
1868 Please do not use it; it will be removed in future versions..
1870 @item honor-keyserver-url
1871 When using @option{--refresh-keys}, if the key in question has a preferred
1872 keyserver URL, then use that preferred keyserver to refresh the key
1873 from. In addition, if auto-key-retrieve is set, and the signature
1874 being verified has a preferred keyserver URL, then use that preferred
1875 keyserver to fetch the key from. Note that this option introduces a
1876 "web bug": The creator of the key can see when the keys is
1877 refreshed. Thus this option is not enabled by default.
1879 @item honor-pka-record
1880 If @option{--auto-key-retrieve} is used, and the signature being
1881 verified has a PKA record, then use the PKA information to fetch
1882 the key. Defaults to "yes".
1884 @item include-subkeys
1885 When receiving a key, include subkeys as potential targets. Note that
1886 this option is not used with HKP keyservers, as they do not support
1887 retrieving keys by subkey id.
1890 Tell the keyserver helper program how long (in seconds) to try and
1891 perform a keyserver action before giving up. Note that performing
1892 multiple actions at the same time uses this timeout value per action.
1893 For example, when retrieving multiple keys via @option{--receive-keys}, the
1894 timeout applies separately to each key retrieval, and not to the
1895 @option{--receive-keys} command as a whole. Defaults to 30 seconds.
1897 @item http-proxy=@var{value}
1898 This option is deprecated.
1899 Set the proxy to use for HTTP and HKP keyservers.
1900 This overrides any proxy defined in @file{dirmngr.conf}.
1903 This option has no more function since GnuPG 2.1. Use the
1904 @code{dirmngr} configuration options instead.
1907 This option has no more function since GnuPG 2.1. Use the
1908 @code{dirmngr} configuration options instead.
1911 This option has no more function since GnuPG 2.1. Use the
1912 @code{dirmngr} configuration options instead.
1915 This option has no more function since GnuPG 2.1. Use the
1916 @code{dirmngr} configuration options instead.
1920 @item --completes-needed @var{n}
1921 @opindex compliant-needed
1922 Number of completely trusted users to introduce a new
1923 key signer (defaults to 1).
1925 @item --marginals-needed @var{n}
1926 @opindex marginals-needed
1927 Number of marginally trusted users to introduce a new
1928 key signer (defaults to 3)
1930 @item --tofu-default-policy @{auto|good|unknown|bad|ask@}
1931 @opindex tofu-default-policy
1932 The default TOFU policy (defaults to @code{auto}). For more
1933 information about the meaning of this option, @pxref{trust-model-tofu}.
1935 @item --max-cert-depth @var{n}
1936 @opindex max-cert-depth
1937 Maximum depth of a certification chain (default is 5).
1939 @item --no-sig-cache
1940 @opindex no-sig-cache
1941 Do not cache the verification status of key signatures.
1942 Caching gives a much better performance in key listings. However, if
1943 you suspect that your public keyring is not safe against write
1944 modifications, you can use this option to disable the caching. It
1945 probably does not make sense to disable it because all kind of damage
1946 can be done if someone else has write access to your public keyring.
1948 @item --auto-check-trustdb
1949 @itemx --no-auto-check-trustdb
1950 @opindex auto-check-trustdb
1951 If GnuPG feels that its information about the Web of Trust has to be
1952 updated, it automatically runs the @option{--check-trustdb} command
1953 internally. This may be a time consuming
1954 process. @option{--no-auto-check-trustdb} disables this option.
1957 @itemx --no-use-agent
1959 This is dummy option. @command{@gpgname} always requires the agent.
1961 @item --gpg-agent-info
1962 @opindex gpg-agent-info
1963 This is dummy option. It has no effect when used with @command{@gpgname}.
1966 @item --agent-program @var{file}
1967 @opindex agent-program
1968 Specify an agent program to be used for secret key operations. The
1969 default value is determined by running @command{gpgconf} with the
1970 option @option{--list-dirs}. Note that the pipe symbol (@code{|}) is
1971 used for a regression test suite hack and may thus not be used in the
1974 @item --dirmngr-program @var{file}
1975 @opindex dirmngr-program
1976 Specify a dirmngr program to be used for keyserver access. The
1977 default value is @file{@value{BINDIR}/dirmngr}.
1979 @item --no-autostart
1980 @opindex no-autostart
1981 Do not start the gpg-agent or the dirmngr if it has not yet been
1982 started and its service is required. This option is mostly useful on
1983 machines where the connection to gpg-agent has been redirected to
1984 another machines. If dirmngr is required on the remote machine, it
1985 may be started manually using @command{gpgconf --launch dirmngr}.
1989 Lock the databases the first time a lock is requested
1990 and do not release the lock until the process
1993 @item --lock-multiple
1994 @opindex lock-multiple
1995 Release the locks every time a lock is no longer
1996 needed. Use this to override a previous @option{--lock-once}
2001 Disable locking entirely. This option should be used only in very
2002 special environments, where it can be assured that only one process
2003 is accessing those files. A bootable floppy with a stand-alone
2004 encryption system will probably use this. Improper usage of this
2005 option may lead to data and key corruption.
2007 @item --exit-on-status-write-error
2008 @opindex exit-on-status-write-error
2009 This option will cause write errors on the status FD to immediately
2010 terminate the process. That should in fact be the default but it never
2011 worked this way and thus we need an option to enable this, so that the
2012 change won't break applications which close their end of a status fd
2013 connected pipe too early. Using this option along with
2014 @option{--enable-progress-filter} may be used to cleanly cancel long
2015 running gpg operations.
2017 @item --limit-card-insert-tries @var{n}
2018 @opindex limit-card-insert-tries
2019 With @var{n} greater than 0 the number of prompts asking to insert a
2020 smartcard gets limited to N-1. Thus with a value of 1 gpg won't at
2021 all ask to insert a card if none has been inserted at startup. This
2022 option is useful in the configuration file in case an application does
2023 not know about the smartcard support and waits ad infinitum for an
2026 @item --no-random-seed-file
2027 @opindex no-random-seed-file
2028 GnuPG uses a file to store its internal random pool over invocations.
2029 This makes random generation faster; however sometimes write operations
2030 are not desired. This option can be used to achieve that with the cost of
2031 slower random generation.
2034 @opindex no-greeting
2035 Suppress the initial copyright message.
2037 @item --no-secmem-warning
2038 @opindex no-secmem-warning
2039 Suppress the warning about "using insecure memory".
2041 @item --no-permission-warning
2042 @opindex permission-warning
2043 Suppress the warning about unsafe file and home directory (@option{--homedir})
2044 permissions. Note that the permission checks that GnuPG performs are
2045 not intended to be authoritative, but rather they simply warn about
2046 certain common permission problems. Do not assume that the lack of a
2047 warning means that your system is secure.
2049 Note that the warning for unsafe @option{--homedir} permissions cannot be
2050 suppressed in the gpg.conf file, as this would allow an attacker to
2051 place an unsafe gpg.conf file in place, and use this file to suppress
2052 warnings about itself. The @option{--homedir} permissions warning may only be
2053 suppressed on the command line.
2055 @item --no-mdc-warning
2056 @opindex no-mdc-warning
2057 Suppress the warning about missing MDC integrity protection.
2059 @item --require-secmem
2060 @itemx --no-require-secmem
2061 @opindex require-secmem
2062 Refuse to run if GnuPG cannot get secure memory. Defaults to no
2063 (i.e. run, but give a warning).
2066 @item --require-cross-certification
2067 @itemx --no-require-cross-certification
2068 @opindex require-cross-certification
2069 When verifying a signature made from a subkey, ensure that the cross
2070 certification "back signature" on the subkey is present and valid. This
2071 protects against a subtle attack against subkeys that can sign.
2072 Defaults to @option{--require-cross-certification} for
2078 Allow the user to do certain nonsensical or "silly" things like
2079 signing an expired or revoked key, or certain potentially incompatible
2080 things like generating unusual key types. This also disables certain
2081 warning messages about potentially incompatible actions. As the name
2082 implies, this option is for experts only. If you don't fully
2083 understand the implications of what it allows you to do, leave this
2084 off. @option{--no-expert} disables this option.
2089 @c *******************************************
2090 @c ******** KEY RELATED OPTIONS ************
2091 @c *******************************************
2092 @node GPG Key related Options
2093 @subsection Key related options
2097 @item --recipient @var{name}
2100 Encrypt for user id @var{name}. If this option or
2101 @option{--hidden-recipient} is not specified, GnuPG asks for the user-id
2102 unless @option{--default-recipient} is given.
2104 @item --hidden-recipient @var{name}
2106 @opindex hidden-recipient
2107 Encrypt for user ID @var{name}, but hide the key ID of this user's
2108 key. This option helps to hide the receiver of the message and is a
2109 limited countermeasure against traffic analysis. If this option or
2110 @option{--recipient} is not specified, GnuPG asks for the user ID unless
2111 @option{--default-recipient} is given.
2113 @item --recipient-file @var{file}
2115 @opindex recipient-file
2116 This option is similar to @option{--recipient} except that it
2117 encrypts to a key stored in the given file. @var{file} must be the
2118 name of a file containing exactly one key. @command{@gpgname} assumes that
2119 the key in this file is fully valid.
2121 @item --hidden-recipient-file @var{file}
2123 @opindex hidden-recipient-file
2124 This option is similar to @option{--hidden-recipient} except that it
2125 encrypts to a key stored in the given file. @var{file} must be the
2126 name of a file containing exactly one key. @command{@gpgname} assumes that
2127 the key in this file is fully valid.
2129 @item --encrypt-to @var{name}
2131 Same as @option{--recipient} but this one is intended for use in the
2132 options file and may be used with your own user-id as an
2133 "encrypt-to-self". These keys are only used when there are other
2134 recipients given either by use of @option{--recipient} or by the asked
2135 user id. No trust checking is performed for these user ids and even
2136 disabled keys can be used.
2138 @item --hidden-encrypt-to @var{name}
2139 @opindex hidden-encrypt-to
2140 Same as @option{--hidden-recipient} but this one is intended for use in the
2141 options file and may be used with your own user-id as a hidden
2142 "encrypt-to-self". These keys are only used when there are other
2143 recipients given either by use of @option{--recipient} or by the asked user id.
2144 No trust checking is performed for these user ids and even disabled
2147 @item --no-encrypt-to
2148 @opindex no-encrypt-to
2149 Disable the use of all @option{--encrypt-to} and
2150 @option{--hidden-encrypt-to} keys.
2152 @item --group @{@var{name}=@var{value}@}
2154 Sets up a named group, which is similar to aliases in email programs.
2155 Any time the group name is a recipient (@option{-r} or
2156 @option{--recipient}), it will be expanded to the values
2157 specified. Multiple groups with the same name are automatically merged
2158 into a single group.
2160 The values are @code{key IDs} or fingerprints, but any key description
2161 is accepted. Note that a value with spaces in it will be treated as
2162 two different values. Note also there is only one level of expansion
2163 --- you cannot make an group that points to another group. When used
2164 from the command line, it may be necessary to quote the argument to
2165 this option to prevent the shell from treating it as multiple
2168 @item --ungroup @var{name}
2170 Remove a given entry from the @option{--group} list.
2174 Remove all entries from the @option{--group} list.
2176 @item --local-user @var{name}
2179 Use @var{name} as the key to sign with. Note that this option overrides
2180 @option{--default-key}.
2182 @item --sender @var{mbox}
2184 This option has two purposes. @var{mbox} must either be a complete
2185 user id with a proper mail address or just a mail address. When
2186 creating a signature this option tells gpg the user id of a key used
2187 to make a signature if the key was not directly specified by a user
2188 id. When verifying a signature the @var{mbox} is used to restrict the
2189 information printed by the TOFU code to matching user ids.
2191 @item --try-secret-key @var{name}
2192 @opindex try-secret-key
2193 For hidden recipients GPG needs to know the keys to use for trial
2194 decryption. The key set with @option{--default-key} is always tried
2195 first, but this is often not sufficient. This option allows setting more
2196 keys to be used for trial decryption. Although any valid user-id
2197 specification may be used for @var{name} it makes sense to use at least
2198 the long keyid to avoid ambiguities. Note that gpg-agent might pop up a
2199 pinentry for a lot keys to do the trial decryption. If you want to stop
2200 all further trial decryption you may use close-window button instead of
2203 @item --try-all-secrets
2204 @opindex try-all-secrets
2205 Don't look at the key ID as stored in the message but try all secret
2206 keys in turn to find the right decryption key. This option forces the
2207 behaviour as used by anonymous recipients (created by using
2208 @option{--throw-keyids} or @option{--hidden-recipient}) and might come
2209 handy in case where an encrypted message contains a bogus key ID.
2211 @item --skip-hidden-recipients
2212 @itemx --no-skip-hidden-recipients
2213 @opindex skip-hidden-recipients
2214 @opindex no-skip-hidden-recipients
2215 During decryption skip all anonymous recipients. This option helps in
2216 the case that people use the hidden recipients feature to hide there
2217 own encrypt-to key from others. If oneself has many secret keys this
2218 may lead to a major annoyance because all keys are tried in turn to
2219 decrypt something which was not really intended for it. The drawback
2220 of this option is that it is currently not possible to decrypt a
2221 message which includes real anonymous recipients.
2226 @c *******************************************
2227 @c ******** INPUT AND OUTPUT ***************
2228 @c *******************************************
2229 @node GPG Input and Output
2230 @subsection Input and Output
2237 Create ASCII armored output. The default is to create the binary
2242 Assume the input data is not in ASCII armored format.
2244 @item --output @var{file}
2245 @itemx -o @var{file}
2247 Write output to @var{file}. To write to stdout use @code{-} as the
2250 @item --max-output @var{n}
2252 This option sets a limit on the number of bytes that will be generated
2253 when processing a file. Since OpenPGP supports various levels of
2254 compression, it is possible that the plaintext of a given message may be
2255 significantly larger than the original OpenPGP message. While GnuPG
2256 works properly with such messages, there is often a desire to set a
2257 maximum file size that will be generated before processing is forced to
2258 stop by the OS limits. Defaults to 0, which means "no limit".
2260 @item --input-size-hint @var{n}
2261 @opindex input-size-hint
2262 This option can be used to tell GPG the size of the input data in
2263 bytes. @var{n} must be a positive base-10 number. This option is
2264 only useful if the input is not taken from a file. GPG may use this
2265 hint to optimize its buffer allocation strategy. It is also used by
2266 the @option{--status-fd} line ``PROGRESS'' to provide a value for
2267 ``total'' if that is not available by other means.
2269 @item --key-origin @var{string}[,@var{url}]
2271 gpg can track the origin of a key. Certain origins are implicitly
2272 known (e.g. keyserver, web key directory) and set. For a standard
2273 import the origin of the keys imported can be set with this option.
2274 To list the possible values use "help" for @var{string}. Some origins
2275 can store an optional @var{url} argument. That URL can appended to
2276 @var{string} after a comma.
2278 @item --import-options @var{parameters}
2279 @opindex import-options
2280 This is a space or comma delimited string that gives options for
2281 importing keys. Options can be prepended with a `no-' to give the
2282 opposite meaning. The options are:
2286 @item import-local-sigs
2287 Allow importing key signatures marked as "local". This is not
2288 generally useful unless a shared keyring scheme is being used.
2291 @item keep-ownertrust
2292 Normally possible still existing ownertrust values of a key are
2293 cleared if a key is imported. This is in general desirable so that
2294 a formerly deleted key does not automatically gain an ownertrust
2295 values merely due to import. On the other hand it is sometimes
2296 necessary to re-import a trusted set of keys again but keeping
2297 already assigned ownertrust values. This can be achieved by using
2300 @item repair-pks-subkey-bug
2301 During import, attempt to repair the damage caused by the PKS keyserver
2302 bug (pre version 0.9.6) that mangles keys with multiple subkeys. Note
2303 that this cannot completely repair the damaged key as some crucial data
2304 is removed by the keyserver, but it does at least give you back one
2305 subkey. Defaults to no for regular @option{--import} and to yes for
2306 keyserver @option{--receive-keys}.
2310 Show a listing of the key as imported right before it is stored.
2311 This can be combined with the option @option{--dry-run} to only look
2312 at keys; the option @option{show-only} is a shortcut for this
2316 Run the entire import code but instead of storing the key to the
2317 local keyring write it to the output. The export options
2318 @option{export-pka} and @option{export-dane} affect the output. This
2319 option can be used to remove all invalid parts from a key without the
2323 During import, allow key updates to existing keys, but do not allow
2324 any new keys to be imported. Defaults to no.
2327 After import, compact (remove all signatures except the
2328 self-signature) any user IDs from the new key that are not usable.
2329 Then, remove any signatures from the new key that are not usable.
2330 This includes signatures that were issued by keys that are not present
2331 on the keyring. This option is the same as running the @option{--edit-key}
2332 command "clean" after import. Defaults to no.
2334 @item repair-keys. After import, fix various problems with the
2335 keys. For example, this reorders signatures, and strips duplicate
2336 signatures. Defaults to yes.
2338 @item import-minimal
2339 Import the smallest key possible. This removes all signatures except
2340 the most recent self-signature on each user ID. This option is the
2341 same as running the @option{--edit-key} command "minimize" after import.
2345 @itemx import-restore
2346 Import in key restore mode. This imports all data which is usually
2347 skipped during import; including all GnuPG specific data. All other
2348 contradicting options are overridden.
2351 @item --import-filter @{@var{name}=@var{expr}@}
2352 @itemx --export-filter @{@var{name}=@var{expr}@}
2353 @opindex import-filter
2354 @opindex export-filter
2355 These options define an import/export filter which are applied to the
2356 imported/exported keyblock right before it will be stored/written.
2357 @var{name} defines the type of filter to use, @var{expr} the
2358 expression to evaluate. The option can be used several times which
2359 then appends more expression to the same @var{name}.
2362 The available filter types are:
2367 This filter will keep a user id packet and its dependent packets in
2368 the keyblock if the expression evaluates to true.
2371 This filter drops the selected subkeys.
2372 Currently only implemented for --export-filter.
2375 This filter drops the selected key signatures on user ids.
2376 Self-signatures are not considered.
2377 Currently only implemented for --import-filter.
2381 For the syntax of the expression see the chapter "FILTER EXPRESSIONS".
2382 The property names for the expressions depend on the actual filter
2383 type and are indicated in the following table.
2385 The available properties are:
2390 A string with the user id. (keep-uid)
2393 The addr-spec part of a user id with mailbox or the empty string.
2397 A number with the public key algorithm of a key or subkey packet.
2401 @itemx key_created_d
2402 The first is the timestamp a public key or subkey packet was
2403 created. The second is the same but given as an ISO string,
2404 e.g. "2016-08-17". (drop-subkey)
2407 Boolean indicating whether the user id is the primary one. (keep-uid)
2410 Boolean indicating whether a user id (keep-uid), a key (drop-subkey), or a
2411 signature (drop-sig) expired.
2414 Boolean indicating whether a user id (keep-uid) or a key (drop-subkey) has
2418 Boolean indicating whether a primary key is disabled. (not used)
2421 Boolean indicating whether a key or subkey is a secret one.
2425 @itemx sig_created_d
2426 The first is the timestamp a signature packet was created. The
2427 second is the same but given as an ISO date string,
2428 e.g. "2016-08-17". (drop-sig)
2431 A number with the public key algorithm of a signature packet. (drop-sig)
2433 @item sig_digest_algo
2434 A number with the digest algorithm of a signature packet. (drop-sig)
2438 @item --export-options @var{parameters}
2439 @opindex export-options
2440 This is a space or comma delimited string that gives options for
2441 exporting keys. Options can be prepended with a `no-' to give the
2442 opposite meaning. The options are:
2446 @item export-local-sigs
2447 Allow exporting key signatures marked as "local". This is not
2448 generally useful unless a shared keyring scheme is being used.
2451 @item export-attributes
2452 Include attribute user IDs (photo IDs) while exporting. Not
2453 including attribute user IDs is useful to export keys that are going
2454 to be used by an OpenPGP program that does not accept attribute user
2455 IDs. Defaults to yes.
2457 @item export-sensitive-revkeys
2458 Include designated revoker information that was marked as
2459 "sensitive". Defaults to no.
2461 @c Since GnuPG 2.1 gpg-agent manages the secret key and thus the
2462 @c export-reset-subkey-passwd hack is not anymore justified. Such use
2463 @c cases may be implemented using a specialized secret key export
2465 @c @item export-reset-subkey-passwd
2466 @c When using the @option{--export-secret-subkeys} command, this option resets
2467 @c the passphrases for all exported subkeys to empty. This is useful
2468 @c when the exported subkey is to be used on an unattended machine where
2469 @c a passphrase doesn't necessarily make sense. Defaults to no.
2472 @itemx export-backup
2473 Export for use as a backup. The exported data includes all data
2474 which is needed to restore the key or keys later with GnuPG. The
2475 format is basically the OpenPGP format but enhanced with GnuPG
2476 specific data. All other contradicting options are overridden.
2479 Compact (remove all signatures from) user IDs on the key being
2480 exported if the user IDs are not usable. Also, do not export any
2481 signatures that are not usable. This includes signatures that were
2482 issued by keys that are not present on the keyring. This option is
2483 the same as running the @option{--edit-key} command "clean" before export
2484 except that the local copy of the key is not modified. Defaults to
2487 @item export-minimal
2488 Export the smallest key possible. This removes all signatures except the
2489 most recent self-signature on each user ID. This option is the same as
2490 running the @option{--edit-key} command "minimize" before export except
2491 that the local copy of the key is not modified. Defaults to no.
2494 Instead of outputting the key material output PKA records suitable
2495 to put into DNS zone files. An ORIGIN line is printed before each
2496 record to allow diverting the records to the corresponding zone file.
2499 Instead of outputting the key material output OpenPGP DANE records
2500 suitable to put into DNS zone files. An ORIGIN line is printed before
2501 each record to allow diverting the records to the corresponding zone
2507 @opindex with-colons
2508 Print key listings delimited by colons. Note that the output will be
2509 encoded in UTF-8 regardless of any @option{--display-charset} setting. This
2510 format is useful when GnuPG is called from scripts and other programs
2511 as it is easily machine parsed. The details of this format are
2512 documented in the file @file{doc/DETAILS}, which is included in the GnuPG
2513 source distribution.
2515 @item --fixed-list-mode
2516 @opindex fixed-list-mode
2517 Do not merge primary user ID and primary key in @option{--with-colon}
2518 listing mode and print all timestamps as seconds since 1970-01-01.
2519 Since GnuPG 2.0.10, this mode is always used and thus this option is
2520 obsolete; it does not harm to use it though.
2522 @item --legacy-list-mode
2523 @opindex legacy-list-mode
2524 Revert to the pre-2.1 public key list mode. This only affects the
2525 human readable output and not the machine interface
2526 (i.e. @code{--with-colons}). Note that the legacy format does not
2527 convey suitable information for elliptic curves.
2529 @item --with-fingerprint
2530 @opindex with-fingerprint
2531 Same as the command @option{--fingerprint} but changes only the format
2532 of the output and may be used together with another command.
2534 @item --with-subkey-fingerprint
2535 @opindex with-subkey-fingerprint
2536 If a fingerprint is printed for the primary key, this option forces
2537 printing of the fingerprint for all subkeys. This could also be
2538 achieved by using the @option{--with-fingerprint} twice but by using
2539 this option along with keyid-format "none" a compact fingerprint is
2542 @item --with-icao-spelling
2543 @opindex with-icao-spelling
2544 Print the ICAO spelling of the fingerprint in addition to the hex digits.
2546 @item --with-keygrip
2547 @opindex with-keygrip
2548 Include the keygrip in the key listings. In @code{--with-colons} mode
2549 this is implicitly enable for secret keys.
2551 @item --with-key-origin
2552 @opindex with-key-origin
2553 Include the locally held information on the origin and last update of
2554 a key in a key listing. In @code{--with-colons} mode this is always
2555 printed. This data is currently experimental and shall not be
2556 considered part of the stable API.
2558 @item --with-wkd-hash
2559 @opindex with-wkd-hash
2560 Print a Web Key Directory identifier along with each user ID in key
2561 listings. This is an experimental feature and semantics may change.
2564 @opindex with-secret
2565 Include info about the presence of a secret key in public key listings
2566 done with @code{--with-colons}.
2570 @c *******************************************
2571 @c ******** OPENPGP OPTIONS ****************
2572 @c *******************************************
2573 @node OpenPGP Options
2574 @subsection OpenPGP protocol specific options
2578 @item -t, --textmode
2579 @itemx --no-textmode
2581 Treat input files as text and store them in the OpenPGP canonical text
2582 form with standard "CRLF" line endings. This also sets the necessary
2583 flags to inform the recipient that the encrypted or signed data is text
2584 and may need its line endings converted back to whatever the local
2585 system uses. This option is useful when communicating between two
2586 platforms that have different line ending conventions (UNIX-like to Mac,
2587 Mac to Windows, etc). @option{--no-textmode} disables this option, and
2590 @item --force-v3-sigs
2591 @itemx --no-force-v3-sigs
2592 @item --force-v4-certs
2593 @itemx --no-force-v4-certs
2594 These options are obsolete and have no effect since GnuPG 2.1.
2598 Force the use of encryption with a modification detection code. This
2599 is always used with the newer ciphers (those with a blocksize greater
2600 than 64 bits), or if all of the recipient keys indicate MDC support in
2601 their feature flags.
2604 @opindex disable-mdc
2605 Disable the use of the modification detection code. Note that by
2606 using this option, the encrypted message becomes vulnerable to a
2607 message modification attack.
2609 @item --disable-signer-uid
2610 @opindex disable-signer-uid
2611 By default the user ID of the signing key is embedded in the data
2612 signature. As of now this is only done if the signing key has been
2613 specified with @option{local-user} using a mail address. This
2614 information can be helpful for verifier to locate the key; see
2615 option @option{--auto-key-retrieve}.
2617 @item --personal-cipher-preferences @var{string}
2618 @opindex personal-cipher-preferences
2619 Set the list of personal cipher preferences to @var{string}. Use
2620 @command{@gpgname --version} to get a list of available algorithms,
2621 and use @code{none} to set no preference at all. This allows the user
2622 to safely override the algorithm chosen by the recipient key
2623 preferences, as GPG will only select an algorithm that is usable by
2624 all recipients. The most highly ranked cipher in this list is also
2625 used for the @option{--symmetric} encryption command.
2627 @item --personal-digest-preferences @var{string}
2628 @opindex personal-digest-preferences
2629 Set the list of personal digest preferences to @var{string}. Use
2630 @command{@gpgname --version} to get a list of available algorithms,
2631 and use @code{none} to set no preference at all. This allows the user
2632 to safely override the algorithm chosen by the recipient key
2633 preferences, as GPG will only select an algorithm that is usable by
2634 all recipients. The most highly ranked digest algorithm in this list
2635 is also used when signing without encryption
2636 (e.g. @option{--clear-sign} or @option{--sign}).
2638 @item --personal-compress-preferences @var{string}
2639 @opindex personal-compress-preferences
2640 Set the list of personal compression preferences to @var{string}.
2641 Use @command{@gpgname --version} to get a list of available
2642 algorithms, and use @code{none} to set no preference at all. This
2643 allows the user to safely override the algorithm chosen by the
2644 recipient key preferences, as GPG will only select an algorithm that
2645 is usable by all recipients. The most highly ranked compression
2646 algorithm in this list is also used when there are no recipient keys
2647 to consider (e.g. @option{--symmetric}).
2649 @item --s2k-cipher-algo @var{name}
2650 @opindex s2k-cipher-algo
2651 Use @var{name} as the cipher algorithm for symmetric encryption with
2652 a passphrase if @option{--personal-cipher-preferences} and
2653 @option{--cipher-algo} are not given. The default is @value{GPGSYMENCALGO}.
2655 @item --s2k-digest-algo @var{name}
2656 @opindex s2k-digest-algo
2657 Use @var{name} as the digest algorithm used to mangle the passphrases
2658 for symmetric encryption. The default is SHA-1.
2660 @item --s2k-mode @var{n}
2662 Selects how passphrases for symmetric encryption are mangled. If
2663 @var{n} is 0 a plain passphrase (which is in general not recommended)
2664 will be used, a 1 adds a salt (which should not be used) to the
2665 passphrase and a 3 (the default) iterates the whole process a number
2666 of times (see @option{--s2k-count}).
2668 @item --s2k-count @var{n}
2670 Specify how many times the passphrases mangling for symmetric
2671 encryption is repeated. This value may range between 1024 and
2672 65011712 inclusive. The default is inquired from gpg-agent. Note
2673 that not all values in the 1024-65011712 range are legal and if an
2674 illegal value is selected, GnuPG will round up to the nearest legal
2675 value. This option is only meaningful if @option{--s2k-mode} is set
2676 to the default of 3.
2681 @c ***************************
2682 @c ******* Compliance ********
2683 @c ***************************
2684 @node Compliance Options
2685 @subsection Compliance options
2687 These options control what GnuPG is compliant to. Only one of these
2688 options may be active at a time. Note that the default setting of
2689 this is nearly always the correct one. See the INTEROPERABILITY WITH
2690 OTHER OPENPGP PROGRAMS section below before using one of these
2697 Use standard GnuPG behavior. This is essentially OpenPGP behavior
2698 (see @option{--openpgp}), but with some additional workarounds for common
2699 compatibility problems in different versions of PGP. This is the
2700 default option, so it is not generally needed, but it may be useful to
2701 override a different compliance option in the gpg.conf file.
2705 Reset all packet, cipher and digest options to strict OpenPGP
2706 behavior. Use this option to reset all previous options like
2707 @option{--s2k-*}, @option{--cipher-algo}, @option{--digest-algo} and
2708 @option{--compress-algo} to OpenPGP compliant values. All PGP
2709 workarounds are disabled.
2713 Reset all packet, cipher and digest options to strict RFC-4880
2714 behavior. Note that this is currently the same thing as
2719 Enable experimental features from proposed updates to RFC-4880. This
2720 option can be used in addition to the other compliance options.
2721 Warning: The behavior may change with any GnuPG release and created
2722 keys or data may not be usable with future GnuPG versions.
2726 Reset all packet, cipher and digest options to strict RFC-2440
2731 Set up all options to be as PGP 6 compliant as possible. This
2732 restricts you to the ciphers IDEA (if the IDEA plugin is installed),
2733 3DES, and CAST5, the hashes MD5, SHA1 and RIPEMD160, and the
2734 compression algorithms none and ZIP. This also disables
2735 @option{--throw-keyids}, and making signatures with signing subkeys as PGP 6
2736 does not understand signatures made by signing subkeys.
2738 This option implies @option{--disable-mdc --escape-from-lines}.
2742 Set up all options to be as PGP 7 compliant as possible. This is
2743 identical to @option{--pgp6} except that MDCs are not disabled, and the
2744 list of allowable ciphers is expanded to add AES128, AES192, AES256, and
2749 Set up all options to be as PGP 8 compliant as possible. PGP 8 is a lot
2750 closer to the OpenPGP standard than previous versions of PGP, so all
2751 this does is disable @option{--throw-keyids} and set
2752 @option{--escape-from-lines}. All algorithms are allowed except for the
2753 SHA224, SHA384, and SHA512 digests.
2755 @item --compliance @var{string}
2757 This option can be used instead of one of the options above. Valid
2758 values for @var{string} are the above option names (without the double
2759 dash) and possibly others as shown when using "help" for @var{value}.
2764 @c *******************************************
2765 @c ******** ESOTERIC OPTIONS ***************
2766 @c *******************************************
2767 @node GPG Esoteric Options
2768 @subsection Doing things one usually doesn't want to do
2775 Don't make any changes (this is not completely implemented).
2779 Changes the behaviour of some commands. This is like @option{--dry-run} but
2780 different in some cases. The semantic of this option may be extended in
2781 the future. Currently it only skips the actual decryption pass and
2782 therefore enables a fast listing of the encryption keys.
2785 @itemx --interactive
2786 @opindex interactive
2787 Prompt before overwriting any files.
2789 @item --debug-level @var{level}
2790 @opindex debug-level
2791 Select the debug level for investigating problems. @var{level} may be
2792 a numeric value or by a keyword:
2796 No debugging at all. A value of less than 1 may be used instead of
2799 Some basic debug messages. A value between 1 and 2 may be used
2800 instead of the keyword.
2802 More verbose debug messages. A value between 3 and 5 may be used
2803 instead of the keyword.
2805 Even more detailed messages. A value between 6 and 8 may be used
2806 instead of the keyword.
2808 All of the debug messages you can get. A value greater than 8 may be
2809 used instead of the keyword. The creation of hash tracing files is
2810 only enabled if the keyword is used.
2813 How these messages are mapped to the actual debugging flags is not
2814 specified and may change with newer releases of this program. They are
2815 however carefully selected to best aid in debugging.
2817 @item --debug @var{flags}
2819 Set debugging flags. All flags are or-ed and @var{flags} may be given
2820 in C syntax (e.g. 0x0042) or as a comma separated list of flag names.
2821 To get a list of all supported flags the single word "help" can be
2826 Set all useful debugging flags.
2829 @opindex debug-iolbf
2830 Set stdout into line buffered mode. This option is only honored when
2831 given on the command line.
2833 @item --faked-system-time @var{epoch}
2834 @opindex faked-system-time
2835 This option is only useful for testing; it sets the system time back or
2836 forth to @var{epoch} which is the number of seconds elapsed since the year
2837 1970. Alternatively @var{epoch} may be given as a full ISO time string
2838 (e.g. "20070924T154812").
2840 If you suffix @var{epoch} with an exclamation mark (!), the system time
2841 will appear to be frozen at the specified time.
2843 @item --enable-progress-filter
2844 @opindex enable-progress-filter
2845 Enable certain PROGRESS status outputs. This option allows frontends
2846 to display a progress indicator while gpg is processing larger files.
2847 There is a slight performance overhead using it.
2849 @item --status-fd @var{n}
2851 Write special status strings to the file descriptor @var{n}.
2852 See the file DETAILS in the documentation for a listing of them.
2854 @item --status-file @var{file}
2855 @opindex status-file
2856 Same as @option{--status-fd}, except the status data is written to file
2859 @item --logger-fd @var{n}
2861 Write log output to file descriptor @var{n} and not to STDERR.
2863 @item --log-file @var{file}
2864 @itemx --logger-file @var{file}
2866 Same as @option{--logger-fd}, except the logger data is written to
2867 file @var{file}. Use @file{socket://} to log to s socket.
2869 @item --attribute-fd @var{n}
2870 @opindex attribute-fd
2871 Write attribute subpackets to the file descriptor @var{n}. This is most
2872 useful for use with @option{--status-fd}, since the status messages are
2873 needed to separate out the various subpackets from the stream delivered
2874 to the file descriptor.
2876 @item --attribute-file @var{file}
2877 @opindex attribute-file
2878 Same as @option{--attribute-fd}, except the attribute data is written to
2881 @item --comment @var{string}
2882 @itemx --no-comments
2884 Use @var{string} as a comment string in cleartext signatures and ASCII
2885 armored messages or keys (see @option{--armor}). The default behavior is
2886 not to use a comment string. @option{--comment} may be repeated multiple
2887 times to get multiple comment strings. @option{--no-comments} removes
2888 all comments. It is a good idea to keep the length of a single comment
2889 below 60 characters to avoid problems with mail programs wrapping such
2890 lines. Note that comment lines, like all other header lines, are not
2891 protected by the signature.
2893 @item --emit-version
2894 @itemx --no-emit-version
2895 @opindex emit-version
2896 Force inclusion of the version string in ASCII armored output. If
2897 given once only the name of the program and the major number is
2898 emitted, given twice the minor is also emitted, given thrice
2899 the micro is added, and given four times an operating system identification
2900 is also emitted. @option{--no-emit-version} (default) disables the version
2903 @item --sig-notation @{@var{name}=@var{value}@}
2904 @itemx --cert-notation @{@var{name}=@var{value}@}
2905 @itemx -N, --set-notation @{@var{name}=@var{value}@}
2906 @opindex sig-notation
2907 @opindex cert-notation
2908 @opindex set-notation
2909 Put the name value pair into the signature as notation data.
2910 @var{name} must consist only of printable characters or spaces, and
2911 must contain a '@@' character in the form keyname@@domain.example.com
2912 (substituting the appropriate keyname and domain name, of course). This
2913 is to help prevent pollution of the IETF reserved notation
2914 namespace. The @option{--expert} flag overrides the '@@'
2915 check. @var{value} may be any printable string; it will be encoded in
2916 UTF-8, so you should check that your @option{--display-charset} is set
2917 correctly. If you prefix @var{name} with an exclamation mark (!), the
2918 notation data will be flagged as critical
2919 (rfc4880:5.2.3.16). @option{--sig-notation} sets a notation for data
2920 signatures. @option{--cert-notation} sets a notation for key signatures
2921 (certifications). @option{--set-notation} sets both.
2923 There are special codes that may be used in notation names. "%k" will
2924 be expanded into the key ID of the key being signed, "%K" into the
2925 long key ID of the key being signed, "%f" into the fingerprint of the
2926 key being signed, "%s" into the key ID of the key making the
2927 signature, "%S" into the long key ID of the key making the signature,
2928 "%g" into the fingerprint of the key making the signature (which might
2929 be a subkey), "%p" into the fingerprint of the primary key of the key
2930 making the signature, "%c" into the signature count from the OpenPGP
2931 smartcard, and "%%" results in a single "%". %k, %K, and %f are only
2932 meaningful when making a key signature (certification), and %c is only
2933 meaningful when using the OpenPGP smartcard.
2935 @item --sig-policy-url @var{string}
2936 @itemx --cert-policy-url @var{string}
2937 @itemx --set-policy-url @var{string}
2938 @opindex sig-policy-url
2939 @opindex cert-policy-url
2940 @opindex set-policy-url
2941 Use @var{string} as a Policy URL for signatures (rfc4880:5.2.3.20). If
2942 you prefix it with an exclamation mark (!), the policy URL packet will
2943 be flagged as critical. @option{--sig-policy-url} sets a policy url for
2944 data signatures. @option{--cert-policy-url} sets a policy url for key
2945 signatures (certifications). @option{--set-policy-url} sets both.
2947 The same %-expandos used for notation data are available here as well.
2949 @item --sig-keyserver-url @var{string}
2950 @opindex sig-keyserver-url
2951 Use @var{string} as a preferred keyserver URL for data signatures. If
2952 you prefix it with an exclamation mark (!), the keyserver URL packet
2953 will be flagged as critical.
2955 The same %-expandos used for notation data are available here as well.
2957 @item --set-filename @var{string}
2958 @opindex set-filename
2959 Use @var{string} as the filename which is stored inside messages.
2960 This overrides the default, which is to use the actual filename of the
2961 file being encrypted. Using the empty string for @var{string}
2962 effectively removes the filename from the output.
2964 @item --for-your-eyes-only
2965 @itemx --no-for-your-eyes-only
2966 @opindex for-your-eyes-only
2967 Set the `for your eyes only' flag in the message. This causes GnuPG to
2968 refuse to save the file unless the @option{--output} option is given,
2969 and PGP to use a "secure viewer" with a claimed Tempest-resistant font
2970 to display the message. This option overrides @option{--set-filename}.
2971 @option{--no-for-your-eyes-only} disables this option.
2973 @item --use-embedded-filename
2974 @itemx --no-use-embedded-filename
2975 @opindex use-embedded-filename
2976 Try to create a file with a name as embedded in the data. This can be
2977 a dangerous option as it enables overwriting files. Defaults to no.
2979 @item --cipher-algo @var{name}
2980 @opindex cipher-algo
2981 Use @var{name} as cipher algorithm. Running the program with the
2982 command @option{--version} yields a list of supported algorithms. If
2983 this is not used the cipher algorithm is selected from the preferences
2984 stored with the key. In general, you do not want to use this option as
2985 it allows you to violate the OpenPGP standard.
2986 @option{--personal-cipher-preferences} is the safe way to accomplish the
2989 @item --digest-algo @var{name}
2990 @opindex digest-algo
2991 Use @var{name} as the message digest algorithm. Running the program
2992 with the command @option{--version} yields a list of supported algorithms. In
2993 general, you do not want to use this option as it allows you to
2994 violate the OpenPGP standard. @option{--personal-digest-preferences} is the
2995 safe way to accomplish the same thing.
2997 @item --compress-algo @var{name}
2998 @opindex compress-algo
2999 Use compression algorithm @var{name}. "zlib" is RFC-1950 ZLIB
3000 compression. "zip" is RFC-1951 ZIP compression which is used by PGP.
3001 "bzip2" is a more modern compression scheme that can compress some
3002 things better than zip or zlib, but at the cost of more memory used
3003 during compression and decompression. "uncompressed" or "none"
3004 disables compression. If this option is not used, the default
3005 behavior is to examine the recipient key preferences to see which
3006 algorithms the recipient supports. If all else fails, ZIP is used for
3007 maximum compatibility.
3009 ZLIB may give better compression results than ZIP, as the compression
3010 window size is not limited to 8k. BZIP2 may give even better
3011 compression results than that, but will use a significantly larger
3012 amount of memory while compressing and decompressing. This may be
3013 significant in low memory situations. Note, however, that PGP (all
3014 versions) only supports ZIP compression. Using any algorithm other
3015 than ZIP or "none" will make the message unreadable with PGP. In
3016 general, you do not want to use this option as it allows you to
3017 violate the OpenPGP standard. @option{--personal-compress-preferences} is the
3018 safe way to accomplish the same thing.
3020 @item --cert-digest-algo @var{name}
3021 @opindex cert-digest-algo
3022 Use @var{name} as the message digest algorithm used when signing a
3023 key. Running the program with the command @option{--version} yields a
3024 list of supported algorithms. Be aware that if you choose an algorithm
3025 that GnuPG supports but other OpenPGP implementations do not, then some
3026 users will not be able to use the key signatures you make, or quite
3027 possibly your entire key.
3029 @item --disable-cipher-algo @var{name}
3030 @opindex disable-cipher-algo
3031 Never allow the use of @var{name} as cipher algorithm.
3032 The given name will not be checked so that a later loaded algorithm
3033 will still get disabled.
3035 @item --disable-pubkey-algo @var{name}
3036 @opindex disable-pubkey-algo
3037 Never allow the use of @var{name} as public key algorithm.
3038 The given name will not be checked so that a later loaded algorithm
3039 will still get disabled.
3041 @item --throw-keyids
3042 @itemx --no-throw-keyids
3043 @opindex throw-keyids
3044 Do not put the recipient key IDs into encrypted messages. This helps to
3045 hide the receivers of the message and is a limited countermeasure
3046 against traffic analysis.@footnote{Using a little social engineering
3047 anyone who is able to decrypt the message can check whether one of the
3048 other recipients is the one he suspects.} On the receiving side, it may
3049 slow down the decryption process because all available secret keys must
3050 be tried. @option{--no-throw-keyids} disables this option. This option
3051 is essentially the same as using @option{--hidden-recipient} for all
3054 @item --not-dash-escaped
3055 @opindex not-dash-escaped
3056 This option changes the behavior of cleartext signatures
3057 so that they can be used for patch files. You should not
3058 send such an armored file via email because all spaces
3059 and line endings are hashed too. You can not use this
3060 option for data which has 5 dashes at the beginning of a
3061 line, patch files don't have this. A special armor header
3062 line tells GnuPG about this cleartext signature option.
3064 @item --escape-from-lines
3065 @itemx --no-escape-from-lines
3066 @opindex escape-from-lines
3067 Because some mailers change lines starting with "From " to ">From " it
3068 is good to handle such lines in a special way when creating cleartext
3069 signatures to prevent the mail system from breaking the signature. Note
3070 that all other PGP versions do it this way too. Enabled by
3071 default. @option{--no-escape-from-lines} disables this option.
3073 @item --passphrase-repeat @var{n}
3074 @opindex passphrase-repeat
3075 Specify how many times @command{@gpgname} will request a new
3076 passphrase be repeated. This is useful for helping memorize a
3077 passphrase. Defaults to 1 repetition.
3079 @item --passphrase-fd @var{n}
3080 @opindex passphrase-fd
3081 Read the passphrase from file descriptor @var{n}. Only the first line
3082 will be read from file descriptor @var{n}. If you use 0 for @var{n},
3083 the passphrase will be read from STDIN. This can only be used if only
3084 one passphrase is supplied.
3086 Note that this passphrase is only used if the option @option{--batch}
3087 has also been given. This is different from GnuPG version 1.x.
3089 @item --passphrase-file @var{file}
3090 @opindex passphrase-file
3091 Read the passphrase from file @var{file}. Only the first line will
3092 be read from file @var{file}. This can only be used if only one
3093 passphrase is supplied. Obviously, a passphrase stored in a file is
3094 of questionable security if other users can read this file. Don't use
3095 this option if you can avoid it.
3096 Note that this passphrase is only used if the option @option{--batch}
3097 has also been given. This is different from GnuPG version 1.x.
3099 @item --passphrase @var{string}
3101 Use @var{string} as the passphrase. This can only be used if only one
3102 passphrase is supplied. Obviously, this is of very questionable
3103 security on a multi-user system. Don't use this option if you can
3105 Note that this passphrase is only used if the option @option{--batch}
3106 has also been given. This is different from GnuPG version 1.x.
3108 @item --pinentry-mode @var{mode}
3109 @opindex pinentry-mode
3110 Set the pinentry mode to @var{mode}. Allowed values for @var{mode}
3114 Use the default of the agent, which is @code{ask}.
3116 Force the use of the Pinentry.
3118 Emulate use of Pinentry's cancel button.
3120 Return a Pinentry error (``No Pinentry'').
3122 Redirect Pinentry queries to the caller. Note that in contrast to
3123 Pinentry the user is not prompted again if he enters a bad password.
3126 @item --command-fd @var{n}
3128 This is a replacement for the deprecated shared-memory IPC mode.
3129 If this option is enabled, user input on questions is not expected
3130 from the TTY but from the given file descriptor. It should be used
3131 together with @option{--status-fd}. See the file doc/DETAILS in the source
3132 distribution for details on how to use it.
3134 @item --command-file @var{file}
3135 @opindex command-file
3136 Same as @option{--command-fd}, except the commands are read out of file
3139 @item --allow-non-selfsigned-uid
3140 @itemx --no-allow-non-selfsigned-uid
3141 @opindex allow-non-selfsigned-uid
3142 Allow the import and use of keys with user IDs which are not
3143 self-signed. This is not recommended, as a non self-signed user ID is
3144 trivial to forge. @option{--no-allow-non-selfsigned-uid} disables.
3146 @item --allow-freeform-uid
3147 @opindex allow-freeform-uid
3148 Disable all checks on the form of the user ID while generating a new
3149 one. This option should only be used in very special environments as
3150 it does not ensure the de-facto standard format of user IDs.
3152 @item --ignore-time-conflict
3153 @opindex ignore-time-conflict
3154 GnuPG normally checks that the timestamps associated with keys and
3155 signatures have plausible values. However, sometimes a signature
3156 seems to be older than the key due to clock problems. This option
3157 makes these checks just a warning. See also @option{--ignore-valid-from} for
3158 timestamp issues on subkeys.
3160 @item --ignore-valid-from
3161 @opindex ignore-valid-from
3162 GnuPG normally does not select and use subkeys created in the future.
3163 This option allows the use of such keys and thus exhibits the
3164 pre-1.0.7 behaviour. You should not use this option unless there
3165 is some clock problem. See also @option{--ignore-time-conflict} for timestamp
3166 issues with signatures.
3168 @item --ignore-crc-error
3169 @opindex ignore-crc-error
3170 The ASCII armor used by OpenPGP is protected by a CRC checksum against
3171 transmission errors. Occasionally the CRC gets mangled somewhere on
3172 the transmission channel but the actual content (which is protected by
3173 the OpenPGP protocol anyway) is still okay. This option allows GnuPG
3174 to ignore CRC errors.
3176 @item --ignore-mdc-error
3177 @opindex ignore-mdc-error
3178 This option changes a MDC integrity protection failure into a warning.
3179 This can be useful if a message is partially corrupt, but it is
3180 necessary to get as much data as possible out of the corrupt message.
3181 However, be aware that a MDC protection failure may also mean that the
3182 message was tampered with intentionally by an attacker.
3184 @item --allow-weak-digest-algos
3185 @opindex allow-weak-digest-algos
3186 Signatures made with known-weak digest algorithms are normally
3187 rejected with an ``invalid digest algorithm'' message. This option
3188 allows the verification of signatures made with such weak algorithms.
3189 MD5 is the only digest algorithm considered weak by default. See also
3190 @option{--weak-digest} to reject other digest algorithms.
3192 @item --weak-digest @var{name}
3193 @opindex weak-digest
3194 Treat the specified digest algorithm as weak. Signatures made over
3195 weak digests algorithms are normally rejected. This option can be
3196 supplied multiple times if multiple algorithms should be considered
3197 weak. See also @option{--allow-weak-digest-algos} to disable
3198 rejection of weak digests. MD5 is always considered weak, and does
3199 not need to be listed explicitly.
3201 @item --no-default-keyring
3202 @opindex no-default-keyring
3203 Do not add the default keyrings to the list of keyrings. Note that
3204 GnuPG will not operate without any keyrings, so if you use this option
3205 and do not provide alternate keyrings via @option{--keyring} or
3206 @option{--secret-keyring}, then GnuPG will still use the default public or
3211 Do not add use any keyrings even if specified as options.
3214 @opindex skip-verify
3215 Skip the signature verification step. This may be
3216 used to make the decryption faster if the signature
3217 verification is not needed.
3219 @item --with-key-data
3220 @opindex with-key-data
3221 Print key listings delimited by colons (like @option{--with-colons}) and
3222 print the public key data.
3224 @item --fast-list-mode
3225 @opindex fast-list-mode
3226 Changes the output of the list commands to work faster; this is achieved
3227 by leaving some parts empty. Some applications don't need the user ID
3228 and the trust information given in the listings. By using this options
3229 they can get a faster listing. The exact behaviour of this option may
3230 change in future versions. If you are missing some information, don't
3235 This is not for normal use. Use the source to see for what it might be useful.
3237 @item --set-filesize
3238 @opindex set-filesize
3239 This is not for normal use. Use the source to see for what it might be useful.
3241 @item --show-session-key
3242 @opindex show-session-key
3243 Display the session key used for one message. See
3244 @option{--override-session-key} for the counterpart of this option.
3246 We think that Key Escrow is a Bad Thing; however the user should have
3247 the freedom to decide whether to go to prison or to reveal the content
3248 of one specific message without compromising all messages ever
3249 encrypted for one secret key.
3251 You can also use this option if you receive an encrypted message which
3252 is abusive or offensive, to prove to the administrators of the
3253 messaging system that the ciphertext transmitted corresponds to an
3254 inappropriate plaintext so they can take action against the offending
3257 @item --override-session-key @var{string}
3258 @itemx --override-session-key-fd @var{fd}
3259 @opindex override-session-key
3260 Don't use the public key but the session key @var{string} respective
3261 the session key taken from the first line read from file descriptor
3262 @var{fd}. The format of this string is the same as the one printed
3263 by @option{--show-session-key}. This option is normally not used but
3264 comes handy in case someone forces you to reveal the content of an
3265 encrypted message; using this option you can do this without handing
3266 out the secret key. Note that using @option{--override-session-key}
3267 may reveal the session key to all local users via the global process
3270 @item --ask-sig-expire
3271 @itemx --no-ask-sig-expire
3272 @opindex ask-sig-expire
3273 When making a data signature, prompt for an expiration time. If this
3274 option is not specified, the expiration time set via
3275 @option{--default-sig-expire} is used. @option{--no-ask-sig-expire}
3276 disables this option.
3278 @item --default-sig-expire
3279 @opindex default-sig-expire
3280 The default expiration time to use for signature expiration. Valid
3281 values are "0" for no expiration, a number followed by the letter d
3282 (for days), w (for weeks), m (for months), or y (for years) (for
3283 example "2m" for two months, or "5y" for five years), or an absolute
3284 date in the form YYYY-MM-DD. Defaults to "0".
3286 @item --ask-cert-expire
3287 @itemx --no-ask-cert-expire
3288 @opindex ask-cert-expire
3289 When making a key signature, prompt for an expiration time. If this
3290 option is not specified, the expiration time set via
3291 @option{--default-cert-expire} is used. @option{--no-ask-cert-expire}
3292 disables this option.
3294 @item --default-cert-expire
3295 @opindex default-cert-expire
3296 The default expiration time to use for key signature expiration.
3297 Valid values are "0" for no expiration, a number followed by the
3298 letter d (for days), w (for weeks), m (for months), or y (for years)
3299 (for example "2m" for two months, or "5y" for five years), or an
3300 absolute date in the form YYYY-MM-DD. Defaults to "0".
3302 @item --default-new-key-algo @var{string}
3303 @opindex default-new-key-algo @var{string}
3304 This option can be used to change the default algorithms for key
3305 generation. Note that the advanced key generation commands can always
3306 be used to specify a key algorithm directly. Please consult the
3307 source code to learn the syntax of @var{string}.
3309 @item --allow-secret-key-import
3310 @opindex allow-secret-key-import
3311 This is an obsolete option and is not used anywhere.
3313 @item --allow-multiple-messages
3314 @item --no-allow-multiple-messages
3315 @opindex allow-multiple-messages
3316 Allow processing of multiple OpenPGP messages contained in a single file
3317 or stream. Some programs that call GPG are not prepared to deal with
3318 multiple messages being processed together, so this option defaults to
3319 no. Note that versions of GPG prior to 1.4.7 always allowed multiple
3322 Warning: Do not use this option unless you need it as a temporary
3326 @item --enable-special-filenames
3327 @opindex enable-special-filenames
3328 This option enables a mode in which filenames of the form
3329 @file{-&n}, where n is a non-negative decimal number,
3330 refer to the file descriptor n and not to a file with that name.
3332 @item --no-expensive-trust-checks
3333 @opindex no-expensive-trust-checks
3334 Experimental use only.
3336 @item --preserve-permissions
3337 @opindex preserve-permissions
3338 Don't change the permissions of a secret keyring back to user
3339 read/write only. Use this option only if you really know what you are doing.
3341 @item --default-preference-list @var{string}
3342 @opindex default-preference-list
3343 Set the list of default preferences to @var{string}. This preference
3344 list is used for new keys and becomes the default for "setpref" in the
3347 @item --default-keyserver-url @var{name}
3348 @opindex default-keyserver-url
3349 Set the default keyserver URL to @var{name}. This keyserver will be
3350 used as the keyserver URL when writing a new self-signature on a key,
3351 which includes key generation and changing preferences.
3354 @opindex list-config
3355 Display various internal configuration parameters of GnuPG. This option
3356 is intended for external programs that call GnuPG to perform tasks, and
3357 is thus not generally useful. See the file @file{doc/DETAILS} in the
3358 source distribution for the details of which configuration items may be
3359 listed. @option{--list-config} is only usable with
3360 @option{--with-colons} set.
3362 @item --list-gcrypt-config
3363 @opindex list-gcrypt-config
3364 Display various internal configuration parameters of Libgcrypt.
3366 @item --gpgconf-list
3367 @opindex gpgconf-list
3368 This command is similar to @option{--list-config} but in general only
3369 internally used by the @command{gpgconf} tool.
3371 @item --gpgconf-test
3372 @opindex gpgconf-test
3373 This is more or less dummy action. However it parses the configuration
3374 file and returns with failure if the configuration file would prevent
3375 @command{@gpgname} from startup. Thus it may be used to run a syntax check
3376 on the configuration file.
3380 @c *******************************
3381 @c ******* Deprecated ************
3382 @c *******************************
3383 @node Deprecated Options
3384 @subsection Deprecated options
3389 @itemx --no-show-photos
3390 @opindex show-photos
3391 Causes @option{--list-keys}, @option{--list-signatures},
3392 @option{--list-public-keys}, @option{--list-secret-keys}, and verifying
3393 a signature to also display the photo ID attached to the key, if
3394 any. See also @option{--photo-viewer}. These options are deprecated. Use
3395 @option{--list-options [no-]show-photos} and/or @option{--verify-options
3396 [no-]show-photos} instead.
3398 @item --show-keyring
3399 @opindex show-keyring
3400 Display the keyring name at the head of key listings to show which
3401 keyring a given key resides on. This option is deprecated: use
3402 @option{--list-options [no-]show-keyring} instead.
3404 @item --always-trust
3405 @opindex always-trust
3406 Identical to @option{--trust-model always}. This option is deprecated.
3408 @item --show-notation
3409 @itemx --no-show-notation
3410 @opindex show-notation
3411 Show signature notations in the @option{--list-signatures} or @option{--check-signatures} listings
3412 as well as when verifying a signature with a notation in it. These
3413 options are deprecated. Use @option{--list-options [no-]show-notation}
3414 and/or @option{--verify-options [no-]show-notation} instead.
3416 @item --show-policy-url
3417 @itemx --no-show-policy-url
3418 @opindex show-policy-url
3419 Show policy URLs in the @option{--list-signatures} or @option{--check-signatures}
3420 listings as well as when verifying a signature with a policy URL in
3421 it. These options are deprecated. Use @option{--list-options
3422 [no-]show-policy-url} and/or @option{--verify-options
3423 [no-]show-policy-url} instead.
3429 @c *******************************************
3430 @c *************** ****************
3431 @c *************** FILES ****************
3432 @c *************** ****************
3433 @c *******************************************
3435 @node GPG Configuration
3436 @section Configuration files
3438 There are a few configuration files to control certain aspects of
3439 @command{@gpgname}'s operation. Unless noted, they are expected in the
3440 current home directory (@pxref{option --homedir}).
3446 This is the standard configuration file read by @command{@gpgname} on
3447 startup. It may contain any valid long option; the leading two dashes
3448 may not be entered and the option may not be abbreviated. This default
3449 name may be changed on the command line (@pxref{gpg-option --options}).
3450 You should backup this file.
3454 Note that on larger installations, it is useful to put predefined files
3455 into the directory @file{@value{SYSCONFSKELDIR}} so that
3456 newly created users start up with a working configuration.
3457 For existing users a small
3458 helper script is provided to create these files (@pxref{addgnupghome}).
3460 For internal purposes @command{@gpgname} creates and maintains a few other
3461 files; They all live in the current home directory (@pxref{option
3462 --homedir}). Only the @command{@gpgname} program may modify these files.
3468 This is the default home directory which is used if neither the
3469 environment variable @code{GNUPGHOME} nor the option
3470 @option{--homedir} is given.
3472 @item ~/.gnupg/pubring.gpg
3473 @efindex pubring.gpg
3474 The public keyring. You should backup this file.
3476 @item ~/.gnupg/pubring.gpg.lock
3477 The lock file for the public keyring.
3479 @item ~/.gnupg/pubring.kbx
3480 @efindex pubring.kbx
3481 The public keyring using a different format. This file is shared
3482 with @command{gpgsm}. You should backup this file.
3484 @item ~/.gnupg/pubring.kbx.lock
3485 The lock file for @file{pubring.kbx}.
3487 @item ~/.gnupg/secring.gpg
3488 @efindex secring.gpg
3489 A secret keyring as used by GnuPG versions before 2.1. It is not
3490 used by GnuPG 2.1 and later.
3492 @item ~/.gnupg/secring.gpg.lock
3493 The lock file for the secret keyring.
3495 @item ~/.gnupg/.gpg-v21-migrated
3496 @efindex .gpg-v21-migrated
3497 File indicating that a migration to GnuPG 2.1 has been done.
3499 @item ~/.gnupg/trustdb.gpg
3500 @efindex trustdb.gpg
3501 The trust database. There is no need to backup this file; it is better
3502 to backup the ownertrust values (@pxref{option --export-ownertrust}).
3504 @item ~/.gnupg/trustdb.gpg.lock
3505 The lock file for the trust database.
3507 @item ~/.gnupg/random_seed
3508 @efindex random_seed
3509 A file used to preserve the state of the internal random pool.
3511 @item ~/.gnupg/openpgp-revocs.d/
3512 @efindex openpgp-revocs.d
3513 This is the directory where gpg stores pre-generated revocation
3514 certificates. The file name corresponds to the OpenPGP fingerprint of
3515 the respective key. It is suggested to backup those certificates and
3516 if the primary private key is not stored on the disk to move them to
3517 an external storage device. Anyone who can access theses files is
3518 able to revoke the corresponding key. You may want to print them out.
3519 You should backup all files in this directory and take care to keep
3520 this backup closed away.
3524 Operation is further controlled by a few environment variables:
3530 Used to locate the default home directory.
3534 If set directory used instead of "~/.gnupg".
3536 @item GPG_AGENT_INFO
3537 This variable is obsolete; it was used by GnuPG versions before 2.1.
3539 @item PINENTRY_USER_DATA
3540 @efindex PINENTRY_USER_DATA
3541 This value is passed via gpg-agent to pinentry. It is useful to convey
3542 extra information to a custom pinentry.
3548 Used to size some displays to the full size of the screen.
3552 Apart from its use by GNU, it is used in the W32 version to override the
3553 language selection done through the Registry. If used and set to a
3554 valid and available language name (@var{langid}), the file with the
3555 translation is loaded from
3556 @code{@var{gpgdir}/gnupg.nls/@var{langid}.mo}. Here @var{gpgdir} is the
3557 directory out of which the gpg binary has been loaded. If it can't be
3558 loaded the Registry is tried and as last resort the native Windows
3559 locale system is used.
3564 @c *******************************************
3565 @c *************** ****************
3566 @c *************** EXAMPLES ****************
3567 @c *************** ****************
3568 @c *******************************************
3575 @item gpg -se -r @code{Bob} @code{file}
3576 sign and encrypt for user Bob
3578 @item gpg --clear-sign @code{file}
3579 make a cleartext signature
3581 @item gpg -sb @code{file}
3582 make a detached signature
3584 @item gpg -u 0x12345678 -sb @code{file}
3585 make a detached signature with the key 0x12345678
3587 @item gpg --list-keys @code{user_ID}
3590 @item gpg --fingerprint @code{user_ID}
3593 @item gpg --verify @code{pgpfile}
3594 @itemx gpg --verify @code{sigfile} [@code{datafile}]
3595 Verify the signature of the file but do not output the data unless
3596 requested. The second form is used for detached signatures, where
3597 @code{sigfile} is the detached signature (either ASCII armored or
3598 binary) and @code{datafile} are the signed data; if this is not given, the name of the
3599 file holding the signed data is constructed by cutting off the
3600 extension (".asc" or ".sig") of @code{sigfile} or by asking the user
3601 for the filename. If the option @option{--output} is also used the
3602 signed data is written to the file specified by that option; use
3603 @code{-} to write the signed data to stdout.
3607 @c *******************************************
3608 @c *************** ****************
3609 @c *************** USER ID ****************
3610 @c *************** ****************
3611 @c *******************************************
3612 @mansect how to specify a user id
3614 @include specify-user-id.texi
3617 @mansect filter expressions
3618 @chapheading FILTER EXPRESSIONS
3620 The options @option{--import-filter} and @option{--export-filter} use
3621 expressions with this syntax (square brackets indicate an optional
3622 part and curly braces a repetition, white space between the elements
3627 [lc] @{[@{flag@}] PROPNAME op VALUE [lc]@}
3631 The name of a property (@var{PROPNAME}) may only consist of letters,
3632 digits and underscores. The description for the filter type
3633 describes which properties are defined. If an undefined property is
3634 used it evaluates to the empty string. Unless otherwise noted, the
3635 @var{VALUE} must always be given and may not be the empty string. No
3636 quoting is defined for the value, thus the value may not contain the
3637 strings @code{&&} or @code{||}, which are used as logical connection
3638 operators. The flag @code{--} can be used to remove this restriction.
3640 Numerical values are computed as long int; standard C notation
3641 applies. @var{lc} is the logical connection operator; either
3642 @code{&&} for a conjunction or @code{||} for a disjunction. A
3643 conjunction is assumed at the begin of an expression. Conjunctions
3644 have higher precedence than disjunctions. If @var{VALUE} starts with
3645 one of the characters used in any @var{op} a space after the
3646 @var{op} is required.
3649 The supported operators (@var{op}) are:
3654 Substring must match.
3657 Substring must not match.
3660 The full string must match.
3663 The full string must not match.
3666 The numerical value must match.
3669 The numerical value must not match.
3672 The numerical value of the field must be LE than the value.
3675 The numerical value of the field must be LT than the value.
3678 The numerical value of the field must be GT than the value.
3681 The numerical value of the field must be GE than the value.
3684 The string value of the field must be less or equal than the value.
3687 The string value of the field must be less than the value.
3690 The string value of the field must be greater than the value.
3693 The string value of the field must be greater or equal than the value.
3696 True if value is not empty (no value allowed).
3699 True if value is empty (no value allowed).
3702 Alias for "PROPNAME != 0" (no value allowed).
3705 Alias for "PROPNAME == 0" (no value allowed).
3710 Values for @var{flag} must be space separated. The supported flags
3715 @var{VALUE} spans to the end of the expression.
3717 The string match in this part is done case-sensitive.
3720 The filter options concatenate several specifications for a filter of
3721 the same type. For example the four options in this example:
3725 --import-option keep-uid="uid =~ Alfa"
3726 --import-option keep-uid="&& uid !~ Test"
3727 --import-option keep-uid="|| uid =~ Alpha"
3728 --import-option keep-uid="uid !~ Test"
3733 which is equivalent to
3738 keep-uid="uid =~ Alfa" && uid !~ Test" || uid =~ Alpha" && "uid !~ Test"
3742 imports only the user ids of a key containing the strings "Alfa"
3743 or "Alpha" but not the string "test".
3746 @mansect return value
3747 @chapheading RETURN VALUE
3749 The program returns 0 if everything was fine, 1 if at least
3750 a signature was bad, and other error codes for fatal errors.
3753 @chapheading WARNINGS
3755 Use a *good* password for your user account and a *good* passphrase
3756 to protect your secret key. This passphrase is the weakest part of the
3757 whole system. Programs to do dictionary attacks on your secret keyring
3758 are very easy to write and so you should protect your "~/.gnupg/"
3759 directory very well.
3761 Keep in mind that, if this program is used over a network (telnet), it
3762 is *very* easy to spy out your passphrase!
3764 If you are going to verify detached signatures, make sure that the
3765 program knows about it; either give both filenames on the command line
3766 or use @samp{-} to specify STDIN.
3768 @mansect interoperability
3769 @chapheading INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS
3771 GnuPG tries to be a very flexible implementation of the OpenPGP
3772 standard. In particular, GnuPG implements many of the optional parts
3773 of the standard, such as the SHA-512 hash, and the ZLIB and BZIP2
3774 compression algorithms. It is important to be aware that not all
3775 OpenPGP programs implement these optional algorithms and that by
3776 forcing their use via the @option{--cipher-algo},
3777 @option{--digest-algo}, @option{--cert-digest-algo}, or
3778 @option{--compress-algo} options in GnuPG, it is possible to create a
3779 perfectly valid OpenPGP message, but one that cannot be read by the
3782 There are dozens of variations of OpenPGP programs available, and each
3783 supports a slightly different subset of these optional algorithms.
3784 For example, until recently, no (unhacked) version of PGP supported
3785 the BLOWFISH cipher algorithm. A message using BLOWFISH simply could
3786 not be read by a PGP user. By default, GnuPG uses the standard
3787 OpenPGP preferences system that will always do the right thing and
3788 create messages that are usable by all recipients, regardless of which
3789 OpenPGP program they use. Only override this safe default if you
3790 really know what you are doing.
3792 If you absolutely must override the safe default, or if the preferences
3793 on a given key are invalid for some reason, you are far better off using
3794 the @option{--pgp6}, @option{--pgp7}, or @option{--pgp8} options. These
3795 options are safe as they do not force any particular algorithms in
3796 violation of OpenPGP, but rather reduce the available algorithms to a
3802 On older systems this program should be installed as setuid(root). This
3803 is necessary to lock memory pages. Locking memory pages prevents the
3804 operating system from writing memory pages (which may contain
3805 passphrases or other sensitive material) to disk. If you get no
3806 warning message about insecure memory your operating system supports
3807 locking without being root. The program drops root privileges as soon
3808 as locked memory is allocated.
3810 Note also that some systems (especially laptops) have the ability to
3811 ``suspend to disk'' (also known as ``safe sleep'' or ``hibernate'').
3812 This writes all memory to disk before going into a low power or even
3813 powered off mode. Unless measures are taken in the operating system
3814 to protect the saved memory, passphrases or other sensitive material
3815 may be recoverable from it later.
3817 Before you report a bug you should first search the mailing list
3818 archives for similar problems and second check whether such a bug has
3819 already been reported to our bug tracker at @url{https://bugs.gnupg.org}.
3821 @c *******************************************
3822 @c *************** **************
3823 @c *************** UNATTENDED **************
3824 @c *************** **************
3825 @c *******************************************
3827 @node Unattended Usage of GPG
3828 @section Unattended Usage
3830 @command{@gpgname} is often used as a backend engine by other software. To help
3831 with this a machine interface has been defined to have an unambiguous
3832 way to do this. The options @option{--status-fd} and @option{--batch}
3833 are almost always required for this.
3836 * Programmatic use of GnuPG:: Programmatic use of GnuPG
3837 * Ephemeral home directories:: Ephemeral home directories
3838 * The quick key manipulation interface:: The quick key manipulation interface
3839 * Unattended GPG key generation:: Unattended key generation
3843 @node Programmatic use of GnuPG
3844 @subsection Programmatic use of GnuPG
3846 Please consider using GPGME instead of calling @command{@gpgname}
3847 directly. GPGME offers a stable, backend-independent interface for
3848 many cryptographic operations. It supports OpenPGP and S/MIME, and
3849 also allows interaction with various GnuPG components.
3851 GPGME provides a C-API, and comes with bindings for C++, Qt, and
3852 Python. Bindings for other languages are available.
3854 @node Ephemeral home directories
3855 @subsection Ephemeral home directories
3857 Sometimes you want to contain effects of some operation, for example
3858 you want to import a key to inspect it, but you do not want this key
3859 to be added to your keyring. In earlier versions of GnuPG, it was
3860 possible to specify alternate keyring files for both public and secret
3861 keys. In modern GnuPG versions, however, we changed how secret keys
3862 are stored in order to better protect secret key material, and it was
3863 not possible to preserve this interface.
3865 The preferred way to do this is to use ephemeral home directories.
3866 This technique works across all versions of GnuPG.
3868 Create a temporary directory, create (or copy) a configuration that
3869 meets your needs, make @command{@gpgname} use this directory either
3870 using the environment variable @var{GNUPGHOME}, or the option
3871 @option{--homedir}. GPGME supports this too on a per-context basis,
3872 by modifying the engine info of contexts. Now execute whatever
3873 operation you like, import and export key material as necessary. Once
3874 finished, you can delete the directory. All GnuPG backend services
3875 that were started will detect this and shut down.
3877 @node The quick key manipulation interface
3878 @subsection The quick key manipulation interface
3880 Recent versions of GnuPG have an interface to manipulate keys without
3881 using the interactive command @option{--edit-key}. This interface was
3882 added mainly for the benefit of GPGME (please consider using GPGME,
3883 see the manual subsection ``Programmatic use of GnuPG''). This
3884 interface is described in the subsection ``How to manage your keys''.
3886 @node Unattended GPG key generation
3887 @subsection Unattended key generation
3889 The command @option{--generate-key} may be used along with the option
3890 @option{--batch} for unattended key generation. This is the most
3891 flexible way of generating keys, but it is also the most complex one.
3892 Consider using the quick key manipulation interface described in the
3893 previous subsection ``The quick key manipulation interface''.
3895 The parameters for the key are either read from stdin or given as a
3896 file on the command line. The format of the parameter file is as
3900 @item Text only, line length is limited to about 1000 characters.
3901 @item UTF-8 encoding must be used to specify non-ASCII characters.
3902 @item Empty lines are ignored.
3903 @item Leading and trailing white space is ignored.
3904 @item A hash sign as the first non white space character indicates
3906 @item Control statements are indicated by a leading percent sign, the
3907 arguments are separated by white space from the keyword.
3908 @item Parameters are specified by a keyword, followed by a colon. Arguments
3909 are separated by white space.
3911 The first parameter must be @samp{Key-Type}; control statements may be
3914 The order of the parameters does not matter except for @samp{Key-Type}
3915 which must be the first parameter. The parameters are only used for
3916 the generated keyblock (primary and subkeys); parameters from previous
3917 sets are not used. Some syntactically checks may be performed.
3919 Key generation takes place when either the end of the parameter file
3920 is reached, the next @samp{Key-Type} parameter is encountered or at the
3921 control statement @samp{%commit} is encountered.
3929 @item %echo @var{text}
3930 Print @var{text} as diagnostic.
3933 Suppress actual key generation (useful for syntax checking).
3936 Perform the key generation. Note that an implicit commit is done at
3937 the next @asis{Key-Type} parameter.
3939 @item %pubring @var{filename}
3940 Do not write the key to the default or commandline given keyring but
3941 to @var{filename}. This must be given before the first commit to take
3942 place, duplicate specification of the same filename is ignored, the
3943 last filename before a commit is used. The filename is used until a
3944 new filename is used (at commit points) and all keys are written to
3945 that file. If a new filename is given, this file is created (and
3946 overwrites an existing one).
3948 See the previous subsection ``Ephemeral home directories'' for a more
3949 robust way to contain side-effects.
3951 @item %secring @var{filename}
3952 This option is a no-op for GnuPG 2.1 and later.
3954 See the previous subsection ``Ephemeral home directories''.
3956 @item %ask-passphrase
3957 @itemx %no-ask-passphrase
3958 This option is a no-op for GnuPG 2.1 and later.
3960 @item %no-protection
3961 Using this option allows the creation of keys without any passphrase
3962 protection. This option is mainly intended for regression tests.
3964 @item %transient-key
3965 If given the keys are created using a faster and a somewhat less
3966 secure random number generator. This option may be used for keys
3967 which are only used for a short time and do not require full
3968 cryptographic strength. It takes only effect if used together with
3969 the control statement @samp{%no-protection}.
3978 @item Key-Type: @var{algo}
3979 Starts a new parameter block by giving the type of the primary
3980 key. The algorithm must be capable of signing. This is a required
3981 parameter. @var{algo} may either be an OpenPGP algorithm number or a
3982 string with the algorithm name. The special value @samp{default} may
3983 be used for @var{algo} to create the default key type; in this case a
3984 @samp{Key-Usage} shall not be given and @samp{default} also be used
3985 for @samp{Subkey-Type}.
3987 @item Key-Length: @var{nbits}
3988 The requested length of the generated key in bits. The default is
3989 returned by running the command @samp{@gpgname --gpgconf-list}.
3991 @item Key-Grip: @var{hexstring}
3992 This is optional and used to generate a CSR or certificate for an
3993 already existing key. Key-Length will be ignored when given.
3995 @item Key-Usage: @var{usage-list}
3996 Space or comma delimited list of key usages. Allowed values are
3997 @samp{encrypt}, @samp{sign}, and @samp{auth}. This is used to
3998 generate the key flags. Please make sure that the algorithm is
3999 capable of this usage. Note that OpenPGP requires that all primary
4000 keys are capable of certification, so no matter what usage is given
4001 here, the @samp{cert} flag will be on. If no @samp{Key-Usage} is
4002 specified and the @samp{Key-Type} is not @samp{default}, all allowed
4003 usages for that particular algorithm are used; if it is not given but
4004 @samp{default} is used the usage will be @samp{sign}.
4006 @item Subkey-Type: @var{algo}
4007 This generates a secondary key (subkey). Currently only one subkey
4008 can be handled. See also @samp{Key-Type} above.
4010 @item Subkey-Length: @var{nbits}
4011 Length of the secondary key (subkey) in bits. The default is returned
4012 by running the command @samp{@gpgname --gpgconf-list}.
4014 @item Subkey-Usage: @var{usage-list}
4015 Key usage lists for a subkey; similar to @samp{Key-Usage}.
4017 @item Passphrase: @var{string}
4018 If you want to specify a passphrase for the secret key, enter it here.
4019 Default is to use the Pinentry dialog to ask for a passphrase.
4021 @item Name-Real: @var{name}
4022 @itemx Name-Comment: @var{comment}
4023 @itemx Name-Email: @var{email}
4024 The three parts of a user name. Remember to use UTF-8 encoding here.
4025 If you don't give any of them, no user ID is created.
4027 @item Expire-Date: @var{iso-date}|(@var{number}[d|w|m|y])
4028 Set the expiration date for the key (and the subkey). It may either
4029 be entered in ISO date format (e.g. "20000815T145012") or as number of
4030 days, weeks, month or years after the creation date. The special
4031 notation "seconds=N" is also allowed to specify a number of seconds
4032 since creation. Without a letter days are assumed. Note that there
4033 is no check done on the overflow of the type used by OpenPGP for
4034 timestamps. Thus you better make sure that the given value make
4035 sense. Although OpenPGP works with time intervals, GnuPG uses an
4036 absolute value internally and thus the last year we can represent is
4039 @item Creation-Date: @var{iso-date}
4040 Set the creation date of the key as stored in the key information and
4041 which is also part of the fingerprint calculation. Either a date like
4042 "1986-04-26" or a full timestamp like "19860426T042640" may be used.
4043 The time is considered to be UTC. The special notation "seconds=N"
4044 may be used to directly specify a the number of seconds since Epoch
4045 (Unix time). If it is not given the current time is used.
4047 @item Preferences: @var{string}
4048 Set the cipher, hash, and compression preference values for this key.
4049 This expects the same type of string as the sub-command @samp{setpref}
4050 in the @option{--edit-key} menu.
4052 @item Revoker: @var{algo}:@var{fpr} [sensitive]
4053 Add a designated revoker to the generated key. Algo is the public key
4054 algorithm of the designated revoker (i.e. RSA=1, DSA=17, etc.)
4055 @var{fpr} is the fingerprint of the designated revoker. The optional
4056 @samp{sensitive} flag marks the designated revoker as sensitive
4057 information. Only v4 keys may be designated revokers.
4059 @item Keyserver: @var{string}
4060 This is an optional parameter that specifies the preferred keyserver
4063 @item Handle: @var{string}
4064 This is an optional parameter only used with the status lines
4065 KEY_CREATED and KEY_NOT_CREATED. @var{string} may be up to 100
4066 characters and should not contain spaces. It is useful for batch key
4067 generation to associate a key parameter block with a status line.
4072 Here is an example on how to create a key in an ephemeral home directory:
4074 $ export GNUPGHOME="$(mktemp -d)"
4076 %echo Generating a basic OpenPGP key
4081 Name-Real: Joe Tester
4082 Name-Comment: with stupid passphrase
4083 Name-Email: joe@@foo.bar
4086 # Do a commit here, so that we can later print "done" :-)
4090 $ @gpgname --batch --generate-key foo
4092 $ @gpgname --list-secret-keys
4093 /tmp/tmp.0NQxB74PEf/pubring.kbx
4094 -------------------------------
4095 sec dsa1024 2016-12-16 [SCA]
4096 768E895903FC1C44045C8CB95EEBDB71E9E849D0
4097 uid [ultimate] Joe Tester (with stupid passphrase) <joe@@foo.bar>
4098 ssb elg1024 2016-12-16 [E]
4102 If you want to create a key with the default algorithms you would use
4105 %echo Generating a default key
4107 Subkey-Type: default
4108 Name-Real: Joe Tester
4109 Name-Comment: with stupid passphrase
4110 Name-Email: joe@@foo.bar
4113 # Do a commit here, so that we can later print "done" :-)
4125 @command{gpg-agent}(1)
4127 @include see-also-note.texi