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 abbreviate this command.
148 Print warranty information.
151 @opindex dump-options
152 Print a list of all available options and commands. Note that you cannot
153 abbreviate this command.
157 @c *******************************************
158 @c ******** OPERATIONAL COMMANDS ***********
159 @c *******************************************
160 @node Operational GPG Commands
161 @subsection Commands to select the type of operation
169 Sign a message. This command may be combined with @option{--encrypt}
170 (to sign and encrypt a message), @option{--symmetric} (to sign and
171 symmetrically encrypt a message), or both @option{--encrypt} and
172 @option{--symmetric} (to sign and encrypt a message that can be
173 decrypted using a secret key or a passphrase). The signing key is
174 chosen by default or can be set explicitly using the
175 @option{--local-user} and @option{--default-key} options.
181 Make a cleartext signature. The content in a cleartext signature is
182 readable without any special software. OpenPGP software is only needed
183 to verify the signature. cleartext signatures may modify end-of-line
184 whitespace for platform independence and are not intended to be
185 reversible. The signing key is chosen by default or can be set
186 explicitly using the @option{--local-user} and @option{--default-key}
193 Make a detached signature.
198 Encrypt data. This command may be combined with @option{--sign} (to
199 sign and encrypt a message), @option{--symmetric} (to encrypt a
200 message that can decrypted using a secret key or a passphrase), or
201 @option{--sign} and @option{--symmetric} together (for a signed
202 message that can be decrypted using a secret key or a passphrase).
207 Encrypt with a symmetric cipher using a passphrase. The default
208 symmetric cipher used is @value{GPGSYMENCALGO}, but may be chosen with the
209 @option{--cipher-algo} option. This command may be combined with
210 @option{--sign} (for a signed and symmetrically encrypted message),
211 @option{--encrypt} (for a message that may be decrypted via a secret key
212 or a passphrase), or @option{--sign} and @option{--encrypt} together
213 (for a signed message that may be decrypted via a secret key or a
218 Store only (make a simple literal data packet).
223 Decrypt the file given on the command line (or STDIN if no file
224 is specified) and write it to STDOUT (or the file specified with
225 @option{--output}). If the decrypted file is signed, the signature is also
226 verified. This command differs from the default operation, as it never
227 writes to the filename which is included in the file and it rejects
228 files that don't begin with an encrypted message.
232 Assume that the first argument is a signed file and verify it without
233 generating any output. With no arguments, the signature packet is
234 read from STDIN. If only one argument is given, the specified file is
235 expected to include a complete signature.
237 With more than one argument, the first argument should specify a file
238 with a detached signature and the remaining files should contain the
239 signed data. To read the signed data from STDIN, use @samp{-} as the
240 second filename. For security reasons, a detached signature will not
241 read the signed material from STDIN if not explicitly specified.
243 Note: If the option @option{--batch} is not used, @command{@gpgname}
244 may assume that a single argument is a file with a detached signature,
245 and it will try to find a matching data file by stripping certain
246 suffixes. Using this historical feature to verify a detached
247 signature is strongly discouraged; you should always specify the data file
250 Note: When verifying a cleartext signature, @command{@gpgname} verifies
251 only what makes up the cleartext signed data and not any extra data
252 outside of the cleartext signature or the header lines directly following
253 the dash marker line. The option @code{--output} may be used to write
254 out the actual signed data, but there are other pitfalls with this
255 format as well. It is suggested to avoid cleartext signatures in
256 favor of detached signatures.
258 Note: Sometimes the use of the @command{gpgv} tool is easier than
259 using the full-fledged @command{gpg} with this option. @command{gpgv}
260 is designed to compare signed data against a list of trusted keys and
261 returns with success only for a good signature. It has its own manual
267 This modifies certain other commands to accept multiple files for
268 processing on the command line or read from STDIN with each filename on
269 a separate line. This allows for many files to be processed at
270 once. @option{--multifile} may currently be used along with
271 @option{--verify}, @option{--encrypt}, and @option{--decrypt}. Note that
272 @option{--multifile --verify} may not be used with detached signatures.
275 @opindex verify-files
276 Identical to @option{--multifile --verify}.
278 @item --encrypt-files
279 @opindex encrypt-files
280 Identical to @option{--multifile --encrypt}.
282 @item --decrypt-files
283 @opindex decrypt-files
284 Identical to @option{--multifile --decrypt}.
288 @itemx --list-public-keys
290 List the specified keys. If no keys are specified, then all keys from
291 the configured public keyrings are listed.
293 Never use the output of this command in scripts or other programs.
294 The output is intended only for humans and its format is likely to
295 change. The @option{--with-colons} option emits the output in a
296 stable, machine-parseable format, which is intended for use by scripts
299 @item --list-secret-keys
301 @opindex list-secret-keys
302 List the specified secret keys. If no keys are specified, then all
303 known secret keys are listed. A @code{#} after the letters @code{sec}
304 means that the secret key is not usable (for example, if it was
305 exported using @option{--export-secret-subkeys}). See also
306 @option{--list-keys}.
308 @item --list-signatures
309 @opindex list-signatures
312 Same as @option{--list-keys}, but the signatures are listed too.
313 This command has the same effect as
314 using @option{--list-keys} with @option{--with-sig-list}.
316 For each signature listed, there are several flags in between the "sig"
317 tag and keyid. These flags give additional information about each
318 signature. From left to right, they are the numbers 1-3 for certificate
319 check level (see @option{--ask-cert-level}), "L" for a local or
320 non-exportable signature (see @option{--lsign-key}), "R" for a
321 nonRevocable signature (see the @option{--edit-key} command "nrsign"),
322 "P" for a signature that contains a policy URL (see
323 @option{--cert-policy-url}), "N" for a signature that contains a
324 notation (see @option{--cert-notation}), "X" for an eXpired signature
325 (see @option{--ask-cert-expire}), and the numbers 1-9 or "T" for 10 and
326 above to indicate trust signature levels (see the @option{--edit-key}
329 @item --check-signatures
330 @opindex check-signatures
333 Same as @option{--list-signatures}, but the signatures are verified. Note
334 that for performance reasons the revocation status of a signing key is
336 This command has the same effect as
337 using @option{--list-keys} with @option{--with-sig-check}.
339 The status of the verification is indicated by a flag directly following
340 the "sig" tag (and thus before the flags described above for
341 @option{--list-signatures}). A "!" indicates that the signature has been
342 successfully verified, a "-" denotes a bad signature and a "%" is used
343 if an error occurred while checking the signature (e.g. a non supported
348 Locate the keys given as arguments. This command basically uses the
349 same algorithm as used when locating keys for encryption or signing and
350 may thus be used to see what keys @command{@gpgname} might use. In
351 particular external methods as defined by @option{--auto-key-locate} may
352 be used to locate a key. Only public keys are listed.
356 List all keys (or the specified ones) along with their
357 fingerprints. This is the same output as @option{--list-keys} but with
358 the additional output of a line with the fingerprint. May also be
359 combined with @option{--list-signatures} or @option{--check-signatures}. If this
360 command is given twice, the fingerprints of all secondary keys are
361 listed too. This command also forces pretty printing of fingerprints
362 if the keyid format has been set to "none".
365 @opindex list-packets
366 List only the sequence of packets. This command is only useful for
367 debugging. When used with option @option{--verbose} the actual MPI
368 values are dumped and not only their lengths. Note that the output of
369 this command may change with new releases.
376 Present a menu to work with a smartcard. The subcommand "help" provides
377 an overview on available commands. For a detailed description, please
378 see the Card HOWTO at
379 https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
383 Show the content of the smart card.
387 Present a menu to allow changing the PIN of a smartcard. This
388 functionality is also available as the subcommand "passwd" with the
389 @option{--edit-card} command.
391 @item --delete-keys @code{name}
392 @itemx --delete-keys @code{name}
393 Remove key from the public keyring. In batch mode either @option{--yes} is
394 required or the key must be specified by fingerprint. This is a
395 safeguard against accidental deletion of multiple keys.
397 @item --delete-secret-keys @code{name}
398 @opindex delete-secret-keys
399 Remove key from the secret keyring. In batch mode the key must be
400 specified by fingerprint. The option @option{--yes} can be used to
401 advice gpg-agent not to request a confirmation. This extra
402 pre-caution is done because @command{@gpgname} can't be sure that the
403 secret key (as controlled by gpg-agent) is only used for the given
407 @item --delete-secret-and-public-key @code{name}
408 @opindex delete-secret-and-public-key
409 Same as @option{--delete-key}, but if a secret key exists, it will be
410 removed first. In batch mode the key must be specified by fingerprint.
411 The option @option{--yes} can be used to advice gpg-agent not to
412 request a confirmation.
416 Either export all keys from all keyrings (default keyrings and those
417 registered via option @option{--keyring}), or if at least one name is given,
418 those of the given name. The exported keys are written to STDOUT or to the
419 file given with option @option{--output}. Use together with
420 @option{--armor} to mail those keys.
422 @item --send-keys @code{key IDs}
424 Similar to @option{--export} but sends the keys to a keyserver.
425 Fingerprints may be used instead of key IDs. Option @option{--keyserver}
426 must be used to give the name of this keyserver. Don't send your
427 complete keyring to a keyserver --- select only those keys which are new
428 or changed by you. If no key IDs are given, @command{@gpgname} does nothing.
430 @item --export-secret-keys
431 @itemx --export-secret-subkeys
432 @opindex export-secret-keys
433 @opindex export-secret-subkeys
434 Same as @option{--export}, but exports the secret keys instead. The
435 exported keys are written to STDOUT or to the file given with option
436 @option{--output}. This command is often used along with the option
437 @option{--armor} to allow for easy printing of the key for paper backup;
438 however the external tool @command{paperkey} does a better job of
439 creating backups on paper. Note that exporting a secret key can be a
440 security risk if the exported keys are sent over an insecure channel.
442 The second form of the command has the special property to render the
443 secret part of the primary key useless; this is a GNU extension to
444 OpenPGP and other implementations can not be expected to successfully
445 import such a key. Its intended use is in generating a full key with
446 an additional signing subkey on a dedicated machine. This command
447 then exports the key without the primary key to the main machine.
449 GnuPG may ask you to enter the passphrase for the key. This is
450 required, because the internal protection method of the secret key is
451 different from the one specified by the OpenPGP protocol.
453 @item --export-ssh-key
454 @opindex export-ssh-key
455 This command is used to export a key in the OpenSSH public key format.
456 It requires the specification of one key by the usual means and
457 exports the latest valid subkey which has an authentication capability
458 to STDOUT or to the file given with option @option{--output}. That
459 output can directly be added to ssh's @file{authorized_key} file.
461 By specifying the key to export using a key ID or a fingerprint
462 suffixed with an exclamation mark (!), a specific subkey or the
463 primary key can be exported. This does not even require that the key
464 has the authentication capability flag set.
469 Import/merge keys. This adds the given keys to the
470 keyring. The fast version is currently just a synonym.
472 There are a few other options which control how this command works.
473 Most notable here is the @option{--import-options merge-only} option
474 which does not insert new keys but does only the merging of new
475 signatures, user-IDs and subkeys.
477 @item --receive-keys @code{key IDs}
478 @opindex receive-keys
479 @itemx --recv-keys @code{key IDs}
481 Import the keys with the given key IDs from a keyserver. Option
482 @option{--keyserver} must be used to give the name of this keyserver.
485 @opindex refresh-keys
486 Request updates from a keyserver for keys that already exist on the
487 local keyring. This is useful for updating a key with the latest
488 signatures, user IDs, etc. Calling this with no arguments will refresh
489 the entire keyring. Option @option{--keyserver} must be used to give the
490 name of the keyserver for all keys that do not have preferred keyservers
491 set (see @option{--keyserver-options honor-keyserver-url}).
493 @item --search-keys @code{names}
495 Search the keyserver for the given names. Multiple names given here will
496 be joined together to create the search string for the keyserver.
497 Option @option{--keyserver} must be used to give the name of this
498 keyserver. Keyservers that support different search methods allow using
499 the syntax specified in "How to specify a user ID" below. Note that
500 different keyserver types support different search methods. Currently
501 only LDAP supports them all.
503 @item --fetch-keys @code{URIs}
505 Retrieve keys located at the specified URIs. Note that different
506 installations of GnuPG may support different protocols (HTTP, FTP,
507 LDAP, etc.). When using HTTPS the system provided root certificates
508 are used by this command.
510 @item --update-trustdb
511 @opindex update-trustdb
512 Do trust database maintenance. This command iterates over all keys and
513 builds the Web of Trust. This is an interactive command because it may
514 have to ask for the "ownertrust" values for keys. The user has to give
515 an estimation of how far she trusts the owner of the displayed key to
516 correctly certify (sign) other keys. GnuPG only asks for the ownertrust
517 value if it has not yet been assigned to a key. Using the
518 @option{--edit-key} menu, the assigned value can be changed at any time.
520 @item --check-trustdb
521 @opindex check-trustdb
522 Do trust database maintenance without user interaction. From time to
523 time the trust database must be updated so that expired keys or
524 signatures and the resulting changes in the Web of Trust can be
525 tracked. Normally, GnuPG will calculate when this is required and do it
526 automatically unless @option{--no-auto-check-trustdb} is set. This
527 command can be used to force a trust database check at any time. The
528 processing is identical to that of @option{--update-trustdb} but it
529 skips keys with a not yet defined "ownertrust".
531 For use with cron jobs, this command can be used together with
532 @option{--batch} in which case the trust database check is done only if
533 a check is needed. To force a run even in batch mode add the option
536 @anchor{option --export-ownertrust}
537 @item --export-ownertrust
538 @opindex export-ownertrust
539 Send the ownertrust values to STDOUT. This is useful for backup purposes
540 as these values are the only ones which can't be re-created from a
541 corrupted trustdb. Example:
544 @gpgname{} --export-ownertrust > otrust.txt
549 @item --import-ownertrust
550 @opindex import-ownertrust
551 Update the trustdb with the ownertrust values stored in @code{files} (or
552 STDIN if not given); existing values will be overwritten. In case of a
553 severely damaged trustdb and if you have a recent backup of the
554 ownertrust values (e.g. in the file @file{otrust.txt}), you may re-create
555 the trustdb using these commands:
560 @gpgname{} --import-ownertrust < otrust.txt
565 @item --rebuild-keydb-caches
566 @opindex rebuild-keydb-caches
567 When updating from version 1.0.6 to 1.0.7 this command should be used
568 to create signature caches in the keyring. It might be handy in other
571 @item --print-md @code{algo}
574 Print message digest of algorithm ALGO for all given files or STDIN.
575 With the second form (or a deprecated "*" as algo) digests for all
576 available algorithms are printed.
578 @item --gen-random @code{0|1|2} @code{count}
580 Emit @var{count} random bytes of the given quality level 0, 1 or 2. If
581 @var{count} is not given or zero, an endless sequence of random bytes
582 will be emitted. If used with @option{--armor} the output will be
583 base64 encoded. PLEASE, don't use this command unless you know what
584 you are doing; it may remove precious entropy from the system!
586 @item --gen-prime @code{mode} @code{bits}
588 Use the source, Luke :-). The output format is still subject to change.
595 Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
596 This is a GnuPG extension to OpenPGP and in general not very useful.
598 @item --tofu-policy @code{auto|good|unknown|bad|ask} @code{key...}
600 Set the TOFU policy for all the bindings associated with the specified
601 keys. For more information about the meaning of the policies,
602 @pxref{trust-model-tofu}. The keys may be specified either by their
603 fingerprint (preferred) or their keyid.
607 @c Run gpg in server mode. This feature is not yet ready for use and
608 @c thus not documented.
613 @c *******************************************
614 @c ******* KEY MANGEMENT COMMANDS **********
615 @c *******************************************
616 @node OpenPGP Key Management
617 @subsection How to manage your keys
619 This section explains the main commands for key management.
623 @item --quick-generate-key @code{user-id} [@code{algo} [@code{usage} [@code{expire}]]]
624 @opindex quick-generate-key
625 This is a simple command to generate a standard key with one user id.
626 In contrast to @option{--generate-key} the key is generated directly
627 without the need to answer a bunch of prompts. Unless the option
628 @option{--yes} is given, the key creation will be canceled if the
629 given user id already exists in the keyring.
631 If invoked directly on the console without any special options an
632 answer to a ``Continue?'' style confirmation prompt is required. In
633 case the user id already exists in the keyring a second prompt to
634 force the creation of the key will show up.
636 If @code{algo} or @code{usage} are given, only the primary key is
637 created and no prompts are shown. To specify an expiration date but
638 still create a primary and subkey use ``default'' or
639 ``future-default'' for @code{algo} and ``default'' for @code{usage}.
640 For a description of these optional arguments see the command
641 @code{--quick-add-key}. The @code{usage} accepts also the value
642 ``cert'' which can be used to create a certification only primary key;
643 the default is to a create certification and signing key.
645 The @code{expire} argument can be used to specify an expiration date
646 for the key. Several formats are supported; commonly the ISO
647 YYYY-MM-DD format is used. The values ``never'', ``none'' can be used
648 for no expiration date. Not specifying a value, or using ``-''
649 results in a key expiring in a reasonable default interval.
651 If this command is used with @option{--batch},
652 @option{--pinentry-mode} has been set to @code{loopback}, and one of
653 the passphrase options (@option{--passphrase},
654 @option{--passphrase-fd}, or @option{passphrase-file}) is used, the
655 supplied passphrase is used for the new key and the agent does not ask
656 for it. To create a key without any protection @code{--passphrase ''}
659 @item --quick-set-expire @code{fpr} @code{expire}
660 @opindex quick-set-expire
661 Directly set the expiration time of the primary key to @code{expire}.
662 To remove the expiration time @code{0} can be used.
665 @item --quick-add-key @code{fpr} [@code{algo} [@code{usage} [@code{expire}]]]
666 @opindex quick-add-key
667 Directly add a subkey to the key identified by the fingerprint
668 @code{fpr}. Without the optional arguments an encryption subkey is
669 added. If any of the arguments are given a more specific subkey is
672 @code{algo} may be any of the supported algorithms or curve names
673 given in the format as used by key listings. To use the default
674 algorithm the string ``default'' or ``-'' can be used. Supported
675 algorithms are ``rsa'', ``dsa'', ``elg'', ``ed25519'', ``cv25519'',
676 and other ECC curves. For example the string ``rsa'' adds an RSA key
677 with the default key length; a string ``rsa4096'' requests that the
678 key length is 4096 bits. The string ``future-default'' is an alias
679 for the algorithm which will likely be used as default algorithm in
680 future versions of gpg.
682 Depending on the given @code{algo} the subkey may either be an
683 encryption subkey or a signing subkey. If an algorithm is capable of
684 signing and encryption and such a subkey is desired, a @code{usage}
685 string must be given. This string is either ``default'' or ``-'' to
686 keep the default or a comma delimited list of keywords: ``sign'' for a
687 signing subkey, ``auth'' for an authentication subkey, and ``encr''
688 for an encryption subkey (``encrypt'' can be used as alias for
689 ``encr''). The valid combinations depend on the algorithm.
691 The @code{expire} argument can be used to specify an expiration date
692 for the subkey. Several formats are supported; commonly the ISO
693 YYYY-MM-DD format is used. The values ``never'', ``none'', or ``-''
694 can be used for no expiration date.
697 @opindex generate-key
700 Generate a new key pair using the current default parameters. This is
701 the standard command to create a new key. In addition to the key a
702 revocation certificate is created and stored in the
703 @file{openpgp-revocs.d} directory below the GnuPG home directory.
705 @item --full-generate-key
706 @opindex full-generate-key
707 @itemx --full-gen-key
708 @opindex full-gen-key
709 Generate a new key pair with dialogs for all options. This is an
710 extended version of @option{--generate-key}.
712 There is also a feature which allows you to create keys in batch
713 mode. See the manual section ``Unattended key generation'' on how
717 @item --generate-revocation @code{name}
718 @opindex generate-revocation
719 @itemx --gen-revoke @code{name}
721 Generate a revocation certificate for the complete key. To only revoke
722 a subkey or a key signature, use the @option{--edit} command.
724 This command merely creates the revocation certificate so that it can
725 be used to revoke the key if that is ever needed. To actually revoke
726 a key the created revocation certificate needs to be merged with the
727 key to revoke. This is done by importing the revocation certificate
728 using the @option{--import} command. Then the revoked key needs to be
729 published, which is best done by sending the key to a keyserver
730 (command @option{--send-key}) and by exporting (@option{--export}) it
731 to a file which is then send to frequent communication partners.
734 @item --generate-designated-revocation @code{name}
735 @opindex generate-designated-revocation
736 @itemx --desig-revoke @code{name}
737 @opindex desig-revoke
738 Generate a designated revocation certificate for a key. This allows a
739 user (with the permission of the keyholder) to revoke someone else's
745 Present a menu which enables you to do most of the key management
746 related tasks. It expects the specification of a key on the command
749 @c ******** Begin Edit-key Options **********
754 Toggle selection of user ID or photographic user ID with index @code{n}.
755 Use @code{*} to select all and @code{0} to deselect all.
759 Toggle selection of subkey with index @code{n} or key ID @code{n}.
760 Use @code{*} to select all and @code{0} to deselect all.
763 @opindex keyedit:sign
764 Make a signature on key of user @code{name}. If the key is not yet
765 signed by the default user (or the users given with @option{-u}), the program
766 displays the information of the key again, together with its
767 fingerprint and asks whether it should be signed. This question is
768 repeated for all users specified with
772 @opindex keyedit:lsign
773 Same as "sign" but the signature is marked as non-exportable and will
774 therefore never be used by others. This may be used to make keys
775 valid only in the local environment.
778 @opindex keyedit:nrsign
779 Same as "sign" but the signature is marked as non-revocable and can
780 therefore never be revoked.
783 @opindex keyedit:tsign
784 Make a trust signature. This is a signature that combines the notions
785 of certification (like a regular signature), and trust (like the
786 "trust" command). It is generally only useful in distinct communities
787 or groups. For more information please read the sections
788 ``Trust Signature'' and ``Regular Expression'' in RFC-4880.
792 Note that "l" (for local / non-exportable), "nr" (for non-revocable,
793 and "t" (for trust) may be freely mixed and prefixed to "sign" to
794 create a signature of any type desired.
797 If the option @option{--only-sign-text-ids} is specified, then any
798 non-text based user ids (e.g., photo IDs) will not be selected for
804 @opindex keyedit:delsig
805 Delete a signature. Note that it is not possible to retract a signature,
806 once it has been send to the public (i.e. to a keyserver). In that case
807 you better use @code{revsig}.
810 @opindex keyedit:revsig
811 Revoke a signature. For every signature which has been generated by
812 one of the secret keys, GnuPG asks whether a revocation certificate
816 @opindex keyedit:check
817 Check the signatures on all selected user IDs. With the extra
818 option @code{selfsig} only self-signatures are shown.
821 @opindex keyedit:adduid
822 Create an additional user ID.
825 @opindex keyedit:addphoto
826 Create a photographic user ID. This will prompt for a JPEG file that
827 will be embedded into the user ID. Note that a very large JPEG will make
828 for a very large key. Also note that some programs will display your
829 JPEG unchanged (GnuPG), and some programs will scale it to fit in a
833 @opindex keyedit:showphoto
834 Display the selected photographic user ID.
837 @opindex keyedit:deluid
838 Delete a user ID or photographic user ID. Note that it is not
839 possible to retract a user id, once it has been send to the public
840 (i.e. to a keyserver). In that case you better use @code{revuid}.
843 @opindex keyedit:revuid
844 Revoke a user ID or photographic user ID.
847 @opindex keyedit:primary
848 Flag the current user id as the primary one, removes the primary user
849 id flag from all other user ids and sets the timestamp of all affected
850 self-signatures one second ahead. Note that setting a photo user ID
851 as primary makes it primary over other photo user IDs, and setting a
852 regular user ID as primary makes it primary over other regular user
856 @opindex keyedit:keyserver
857 Set a preferred keyserver for the specified user ID(s). This allows
858 other users to know where you prefer they get your key from. See
859 @option{--keyserver-options honor-keyserver-url} for more on how this
860 works. Setting a value of "none" removes an existing preferred
864 @opindex keyedit:notation
865 Set a name=value notation for the specified user ID(s). See
866 @option{--cert-notation} for more on how this works. Setting a value of
867 "none" removes all notations, setting a notation prefixed with a minus
868 sign (-) removes that notation, and setting a notation name (without the
869 =value) prefixed with a minus sign removes all notations with that name.
872 @opindex keyedit:pref
873 List preferences from the selected user ID. This shows the actual
874 preferences, without including any implied preferences.
877 @opindex keyedit:showpref
878 More verbose preferences listing for the selected user ID. This shows
879 the preferences in effect by including the implied preferences of 3DES
880 (cipher), SHA-1 (digest), and Uncompressed (compression) if they are
881 not already included in the preference list. In addition, the
882 preferred keyserver and signature notations (if any) are shown.
884 @item setpref @code{string}
885 @opindex keyedit:setpref
886 Set the list of user ID preferences to @code{string} for all (or just
887 the selected) user IDs. Calling setpref with no arguments sets the
888 preference list to the default (either built-in or set via
889 @option{--default-preference-list}), and calling setpref with "none"
890 as the argument sets an empty preference list. Use @command{@gpgname
891 --version} to get a list of available algorithms. Note that while you
892 can change the preferences on an attribute user ID (aka "photo ID"),
893 GnuPG does not select keys via attribute user IDs so these preferences
894 will not be used by GnuPG.
896 When setting preferences, you should list the algorithms in the order
897 which you'd like to see them used by someone else when encrypting a
898 message to your key. If you don't include 3DES, it will be
899 automatically added at the end. Note that there are many factors that
900 go into choosing an algorithm (for example, your key may not be the
901 only recipient), and so the remote OpenPGP application being used to
902 send to you may or may not follow your exact chosen order for a given
903 message. It will, however, only choose an algorithm that is present
904 on the preference list of every recipient key. See also the
905 INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
908 @opindex keyedit:addkey
909 Add a subkey to this key.
912 @opindex keyedit:addcardkey
913 Generate a subkey on a card and add it to this key.
916 @opindex keyedit:keytocard
917 Transfer the selected secret subkey (or the primary key if no subkey
918 has been selected) to a smartcard. The secret key in the keyring will
919 be replaced by a stub if the key could be stored successfully on the
920 card and you use the save command later. Only certain key types may be
921 transferred to the card. A sub menu allows you to select on what card
922 to store the key. Note that it is not possible to get that key back
923 from the card - if the card gets broken your secret key will be lost
924 unless you have a backup somewhere.
926 @item bkuptocard @code{file}
927 @opindex keyedit:bkuptocard
928 Restore the given file to a card. This command may be used to restore a
929 backup key (as generated during card initialization) to a new card. In
930 almost all cases this will be the encryption key. You should use this
931 command only with the corresponding public key and make sure that the
932 file given as argument is indeed the backup to restore. You should then
933 select 2 to restore as encryption key. You will first be asked to enter
934 the passphrase of the backup key and then for the Admin PIN of the card.
937 @opindex keyedit:delkey
938 Remove a subkey (secondary key). Note that it is not possible to retract
939 a subkey, once it has been send to the public (i.e. to a keyserver). In
940 that case you better use @code{revkey}. Also note that this only
941 deletes the public part of a key.
944 @opindex keyedit:revkey
948 @opindex keyedit:expire
949 Change the key or subkey expiration time. If a subkey is selected, the
950 expiration time of this subkey will be changed. With no selection, the
951 key expiration of the primary key is changed.
954 @opindex keyedit:trust
955 Change the owner trust value for the key. This updates the trust-db
956 immediately and no save is required.
960 @opindex keyedit:disable
961 @opindex keyedit:enable
962 Disable or enable an entire key. A disabled key can not normally be
966 @opindex keyedit:addrevoker
967 Add a designated revoker to the key. This takes one optional argument:
968 "sensitive". If a designated revoker is marked as sensitive, it will
969 not be exported by default (see export-options).
972 @opindex keyedit:passwd
973 Change the passphrase of the secret key.
976 @opindex keyedit:toggle
977 This is dummy command which exists only for backward compatibility.
980 @opindex keyedit:clean
981 Compact (by removing all signatures except the selfsig) any user ID
982 that is no longer usable (e.g. revoked, or expired). Then, remove any
983 signatures that are not usable by the trust calculations.
984 Specifically, this removes any signature that does not validate, any
985 signature that is superseded by a later signature, revoked signatures,
986 and signatures issued by keys that are not present on the keyring.
989 @opindex keyedit:minimize
990 Make the key as small as possible. This removes all signatures from
991 each user ID except for the most recent self-signature.
994 @opindex keyedit:cross-certify
995 Add cross-certification signatures to signing subkeys that may not
996 currently have them. Cross-certification signatures protect against a
997 subtle attack against signing subkeys. See
998 @option{--require-cross-certification}. All new keys generated have
999 this signature by default, so this command is only useful to bring
1000 older keys up to date.
1003 @opindex keyedit:save
1004 Save all changes to the keyrings and quit.
1007 @opindex keyedit:quit
1008 Quit the program without updating the
1013 The listing shows you the key with its secondary keys and all user
1014 ids. The primary user id is indicated by a dot, and selected keys or
1015 user ids are indicated by an asterisk. The trust
1016 value is displayed with the primary key: the first is the assigned owner
1017 trust and the second is the calculated trust value. Letters are used for
1024 No ownertrust assigned / not yet calculated.
1028 calculation has failed; probably due to an expired key.
1031 Not enough information for calculation.
1034 Never trust this key.
1046 @c ******** End Edit-key Options **********
1048 @item --sign-key @code{name}
1050 Signs a public key with your secret key. This is a shortcut version of
1051 the subcommand "sign" from @option{--edit}.
1053 @item --lsign-key @code{name}
1055 Signs a public key with your secret key but marks it as
1056 non-exportable. This is a shortcut version of the subcommand "lsign"
1057 from @option{--edit-key}.
1059 @item --quick-sign-key @code{fpr} [@code{names}]
1060 @itemx --quick-lsign-key @code{fpr} [@code{names}]
1061 @opindex quick-sign-key
1062 @opindex quick-lsign-key
1063 Directly sign a key from the passphrase without any further user
1064 interaction. The @code{fpr} must be the verified primary fingerprint
1065 of a key in the local keyring. If no @code{names} are given, all
1066 useful user ids are signed; with given [@code{names}] only useful user
1067 ids matching one of theses names are signed. By default, or if a name
1068 is prefixed with a '*', a case insensitive substring match is used.
1069 If a name is prefixed with a '=' a case sensitive exact match is done.
1071 The command @option{--quick-lsign-key} marks the signatures as
1072 non-exportable. If such a non-exportable signature already exists the
1073 @option{--quick-sign-key} turns it into a exportable signature.
1075 This command uses reasonable defaults and thus does not provide the
1076 full flexibility of the "sign" subcommand from @option{--edit-key}.
1077 Its intended use is to help unattended key signing by utilizing a list
1078 of verified fingerprints.
1080 @item --quick-add-uid @var{user-id} @var{new-user-id}
1081 @opindex quick-add-uid
1082 This command adds a new user id to an existing key. In contrast to
1083 the interactive sub-command @code{adduid} of @option{--edit-key} the
1084 @var{new-user-id} is added verbatim with only leading and trailing
1085 white space removed, it is expected to be UTF-8 encoded, and no checks
1086 on its form are applied.
1088 @item --quick-revoke-uid @var{user-id} @var{user-id-to-revoke}
1089 @opindex quick-revoke-uid
1090 This command revokes a User ID on an existing key. It cannot be used
1091 to revoke the last User ID on key (some non-revoked User ID must
1092 remain), with revocation reason ``User ID is no longer valid''. If
1093 you want to specify a different revocation reason, or to supply
1094 supplementary revocation text, you should use the interactive
1095 sub-command @code{revuid} of @option{--edit-key}.
1097 @item --change-passphrase @var{user_id}
1098 @opindex change-passphrase
1099 @itemx --passwd @var{user_id}
1101 Change the passphrase of the secret key belonging to the certificate
1102 specified as @var{user_id}. This is a shortcut for the sub-command
1103 @code{passwd} of the edit key menu.
1108 @c *******************************************
1109 @c *************** ****************
1110 @c *************** OPTIONS ****************
1111 @c *************** ****************
1112 @c *******************************************
1115 @section Option Summary
1117 @command{@gpgname} features a bunch of options to control the exact
1118 behaviour and to change the default configuration.
1121 * GPG Configuration Options:: How to change the configuration.
1122 * GPG Key related Options:: Key related options.
1123 * GPG Input and Output:: Input and Output.
1124 * OpenPGP Options:: OpenPGP protocol specific options.
1125 * Compliance Options:: Compliance options.
1126 * GPG Esoteric Options:: Doing things one usually doesn't want to do.
1127 * Deprecated Options:: Deprecated options.
1130 Long options can be put in an options file (default
1131 "~/.gnupg/gpg.conf"). Short option names will not work - for example,
1132 "armor" is a valid option for the options file, while "a" is not. Do not
1133 write the 2 dashes, but simply the name of the option and any required
1134 arguments. Lines with a hash ('#') as the first non-white-space
1135 character are ignored. Commands may be put in this file too, but that is
1136 not generally useful as the command will execute automatically with
1137 every execution of gpg.
1139 Please remember that option parsing stops as soon as a non-option is
1140 encountered, you can explicitly stop parsing by using the special option
1143 @c *******************************************
1144 @c ******** CONFIGURATION OPTIONS **********
1145 @c *******************************************
1146 @node GPG Configuration Options
1147 @subsection How to change the configuration
1149 These options are used to change the configuration and are usually found
1154 @item --default-key @var{name}
1155 @opindex default-key
1156 Use @var{name} as the default key to sign with. If this option is not
1157 used, the default key is the first key found in the secret keyring.
1158 Note that @option{-u} or @option{--local-user} overrides this option.
1159 This option may be given multiple times. In this case, the last key
1160 for which a secret key is available is used. If there is no secret
1161 key available for any of the specified values, GnuPG will not emit an
1162 error message but continue as if this option wasn't given.
1164 @item --default-recipient @var{name}
1165 @opindex default-recipient
1166 Use @var{name} as default recipient if option @option{--recipient} is
1167 not used and don't ask if this is a valid one. @var{name} must be
1170 @item --default-recipient-self
1171 @opindex default-recipient-self
1172 Use the default key as default recipient if option @option{--recipient} is not
1173 used and don't ask if this is a valid one. The default key is the first
1174 one from the secret keyring or the one set with @option{--default-key}.
1176 @item --no-default-recipient
1177 @opindex no-default-recipient
1178 Reset @option{--default-recipient} and @option{--default-recipient-self}.
1182 Give more information during processing. If used
1183 twice, the input data is listed in detail.
1187 Reset verbose level to 0.
1191 Try to be as quiet as possible.
1197 Use batch mode. Never ask, do not allow interactive commands.
1198 @option{--no-batch} disables this option. Note that even with a
1199 filename given on the command line, gpg might still need to read from
1200 STDIN (in particular if gpg figures that the input is a
1201 detached signature and no data file has been specified). Thus if you
1202 do not want to feed data via STDIN, you should connect STDIN to
1205 It is highly recommended to use this option along with the options
1206 @option{--status-fd} and @option{--with-colons} for any unattended of
1211 Make sure that the TTY (terminal) is never used for any output.
1212 This option is needed in some cases because GnuPG sometimes prints
1213 warnings to the TTY even if @option{--batch} is used.
1217 Assume "yes" on most questions.
1221 Assume "no" on most questions.
1224 @item --list-options @code{parameters}
1225 @opindex list-options
1226 This is a space or comma delimited string that gives options used when
1227 listing keys and signatures (that is, @option{--list-keys},
1228 @option{--list-signatures}, @option{--list-public-keys},
1229 @option{--list-secret-keys}, and the @option{--edit-key} functions).
1230 Options can be prepended with a @option{no-} (after the two dashes) to
1231 give the opposite meaning. The options are:
1236 @opindex list-options:show-photos
1237 Causes @option{--list-keys}, @option{--list-signatures},
1238 @option{--list-public-keys}, and @option{--list-secret-keys} to
1239 display any photo IDs attached to the key. Defaults to no. See also
1240 @option{--photo-viewer}. Does not work with @option{--with-colons}:
1241 see @option{--attribute-fd} for the appropriate way to get photo data
1242 for scripts and other frontends.
1245 @opindex list-options:show-usage
1246 Show usage information for keys and subkeys in the standard key
1247 listing. This is a list of letters indicating the allowed usage for a
1248 key (@code{E}=encryption, @code{S}=signing, @code{C}=certification,
1249 @code{A}=authentication). Defaults to yes.
1251 @item show-policy-urls
1252 @opindex list-options:show-policy-urls
1253 Show policy URLs in the @option{--list-signatures} or @option{--check-signatures}
1254 listings. Defaults to no.
1256 @item show-notations
1257 @itemx show-std-notations
1258 @itemx show-user-notations
1259 @opindex list-options:show-notations
1260 @opindex list-options:show-std-notations
1261 @opindex list-options:show-user-notations
1262 Show all, IETF standard, or user-defined signature notations in the
1263 @option{--list-signatures} or @option{--check-signatures} listings. Defaults to no.
1265 @item show-keyserver-urls
1266 @opindex list-options:show-keyserver-urls
1267 Show any preferred keyserver URL in the @option{--list-signatures} or
1268 @option{--check-signatures} listings. Defaults to no.
1270 @item show-uid-validity
1271 @opindex list-options:show-uid-validity
1272 Display the calculated validity of user IDs during key listings.
1275 @item show-unusable-uids
1276 @opindex list-options:show-unusable-uids
1277 Show revoked and expired user IDs in key listings. Defaults to no.
1279 @item show-unusable-subkeys
1280 @opindex list-options:show-unusable-subkeys
1281 Show revoked and expired subkeys in key listings. Defaults to no.
1284 @opindex list-options:show-keyring
1285 Display the keyring name at the head of key listings to show which
1286 keyring a given key resides on. Defaults to no.
1288 @item show-sig-expire
1289 @opindex list-options:show-sig-expire
1290 Show signature expiration dates (if any) during @option{--list-signatures} or
1291 @option{--check-signatures} listings. Defaults to no.
1293 @item show-sig-subpackets
1294 @opindex list-options:show-sig-subpackets
1295 Include signature subpackets in the key listing. This option can take an
1296 optional argument list of the subpackets to list. If no argument is
1297 passed, list all subpackets. Defaults to no. This option is only
1298 meaningful when using @option{--with-colons} along with
1299 @option{--list-signatures} or @option{--check-signatures}.
1303 @item --verify-options @code{parameters}
1304 @opindex verify-options
1305 This is a space or comma delimited string that gives options used when
1306 verifying signatures. Options can be prepended with a `no-' to give
1307 the opposite meaning. The options are:
1312 @opindex verify-options:show-photos
1313 Display any photo IDs present on the key that issued the signature.
1314 Defaults to no. See also @option{--photo-viewer}.
1316 @item show-policy-urls
1317 @opindex verify-options:show-policy-urls
1318 Show policy URLs in the signature being verified. Defaults to yes.
1320 @item show-notations
1321 @itemx show-std-notations
1322 @itemx show-user-notations
1323 @opindex verify-options:show-notations
1324 @opindex verify-options:show-std-notations
1325 @opindex verify-options:show-user-notations
1326 Show all, IETF standard, or user-defined signature notations in the
1327 signature being verified. Defaults to IETF standard.
1329 @item show-keyserver-urls
1330 @opindex verify-options:show-keyserver-urls
1331 Show any preferred keyserver URL in the signature being verified.
1334 @item show-uid-validity
1335 @opindex verify-options:show-uid-validity
1336 Display the calculated validity of the user IDs on the key that issued
1337 the signature. Defaults to yes.
1339 @item show-unusable-uids
1340 @opindex verify-options:show-unusable-uids
1341 Show revoked and expired user IDs during signature verification.
1344 @item show-primary-uid-only
1345 @opindex verify-options:show-primary-uid-only
1346 Show only the primary user ID during signature verification. That is
1347 all the AKA lines as well as photo Ids are not shown with the signature
1348 verification status.
1351 @opindex verify-options:pka-lookups
1352 Enable PKA lookups to verify sender addresses. Note that PKA is based
1353 on DNS, and so enabling this option may disclose information on when
1354 and what signatures are verified or to whom data is encrypted. This
1355 is similar to the "web bug" described for the @option{--auto-key-retrieve}
1358 @item pka-trust-increase
1359 @opindex verify-options:pka-trust-increase
1360 Raise the trust in a signature to full if the signature passes PKA
1361 validation. This option is only meaningful if pka-lookups is set.
1364 @item --enable-large-rsa
1365 @itemx --disable-large-rsa
1366 @opindex enable-large-rsa
1367 @opindex disable-large-rsa
1368 With --generate-key and --batch, enable the creation of RSA secret keys as
1369 large as 8192 bit. Note: 8192 bit is more than is generally
1370 recommended. These large keys don't significantly improve security,
1371 but they are more expensive to use, and their signatures and
1372 certifications are larger. This option is only available if the
1373 binary was build with large-secmem support.
1376 @itemx --disable-dsa2
1377 @opindex enable-dsa2
1378 @opindex disable-dsa2
1379 Enable hash truncation for all DSA keys even for old DSA Keys up to
1380 1024 bit. This is also the default with @option{--openpgp}. Note
1381 that older versions of GnuPG also required this flag to allow the
1382 generation of DSA larger than 1024 bit.
1384 @item --photo-viewer @code{string}
1385 @opindex photo-viewer
1386 This is the command line that should be run to view a photo ID. "%i"
1387 will be expanded to a filename containing the photo. "%I" does the
1388 same, except the file will not be deleted once the viewer exits.
1389 Other flags are "%k" for the key ID, "%K" for the long key ID, "%f"
1390 for the key fingerprint, "%t" for the extension of the image type
1391 (e.g. "jpg"), "%T" for the MIME type of the image (e.g. "image/jpeg"),
1392 "%v" for the single-character calculated validity of the image being
1393 viewed (e.g. "f"), "%V" for the calculated validity as a string (e.g.
1394 "full"), "%U" for a base32 encoded hash of the user ID,
1395 and "%%" for an actual percent sign. If neither %i or %I are present,
1396 then the photo will be supplied to the viewer on standard input.
1398 The default viewer is "xloadimage -fork -quiet -title 'KeyID 0x%k'
1399 STDIN". Note that if your image viewer program is not secure, then
1400 executing it from GnuPG does not make it secure.
1402 @item --exec-path @code{string}
1405 Sets a list of directories to search for photo viewers and keyserver
1406 helpers. If not provided, keyserver helpers use the compiled-in
1407 default directory, and photo viewers use the @code{PATH} environment
1409 Note, that on W32 system this value is ignored when searching for
1412 @item --keyring @code{file}
1414 Add @code{file} to the current list of keyrings. If @code{file} begins
1415 with a tilde and a slash, these are replaced by the $HOME directory. If
1416 the filename does not contain a slash, it is assumed to be in the GnuPG
1417 home directory ("~/.gnupg" if @option{--homedir} or $GNUPGHOME is not
1420 Note that this adds a keyring to the current list. If the intent is to
1421 use the specified keyring alone, use @option{--keyring} along with
1422 @option{--no-default-keyring}.
1424 If the the option @option{--no-keyring} has been used no keyrings will
1428 @item --secret-keyring @code{file}
1429 @opindex secret-keyring
1430 This is an obsolete option and ignored. All secret keys are stored in
1431 the @file{private-keys-v1.d} directory below the GnuPG home directory.
1433 @item --primary-keyring @code{file}
1434 @opindex primary-keyring
1435 Designate @code{file} as the primary public keyring. This means that
1436 newly imported keys (via @option{--import} or keyserver
1437 @option{--recv-from}) will go to this keyring.
1439 @item --trustdb-name @code{file}
1440 @opindex trustdb-name
1441 Use @code{file} instead of the default trustdb. If @code{file} begins
1442 with a tilde and a slash, these are replaced by the $HOME directory. If
1443 the filename does not contain a slash, it is assumed to be in the GnuPG
1444 home directory (@file{~/.gnupg} if @option{--homedir} or $GNUPGHOME is
1447 @include opt-homedir.texi
1450 @item --display-charset @code{name}
1451 @opindex display-charset
1452 Set the name of the native character set. This is used to convert
1453 some informational strings like user IDs to the proper UTF-8 encoding.
1454 Note that this has nothing to do with the character set of data to be
1455 encrypted or signed; GnuPG does not recode user-supplied data. If
1456 this option is not used, the default character set is determined from
1457 the current locale. A verbosity level of 3 shows the chosen set.
1458 Valid values for @code{name} are:
1463 @opindex display-charset:iso-8859-1
1464 This is the Latin 1 set.
1467 @opindex display-charset:iso-8859-2
1471 @opindex display-charset:iso-8859-15
1472 This is currently an alias for
1476 @opindex display-charset:koi8-r
1477 The usual Russian set (RFC-1489).
1480 @opindex display-charset:utf-8
1481 Bypass all translations and assume
1482 that the OS uses native UTF-8 encoding.
1485 @item --utf8-strings
1486 @itemx --no-utf8-strings
1487 @opindex utf8-strings
1488 Assume that command line arguments are given as UTF-8 strings. The
1489 default (@option{--no-utf8-strings}) is to assume that arguments are
1490 encoded in the character set as specified by
1491 @option{--display-charset}. These options affect all following
1492 arguments. Both options may be used multiple times.
1494 @anchor{gpg-option --options}
1495 @item --options @code{file}
1497 Read options from @code{file} and do not try to read them from the
1498 default options file in the homedir (see @option{--homedir}). This
1499 option is ignored if used in an options file.
1503 Shortcut for @option{--options /dev/null}. This option is detected
1504 before an attempt to open an option file. Using this option will also
1505 prevent the creation of a @file{~/.gnupg} homedir.
1508 @itemx --compress-level @code{n}
1509 @itemx --bzip2-compress-level @code{n}
1510 @opindex compress-level
1511 @opindex bzip2-compress-level
1512 Set compression level to @code{n} for the ZIP and ZLIB compression
1513 algorithms. The default is to use the default compression level of zlib
1514 (normally 6). @option{--bzip2-compress-level} sets the compression level
1515 for the BZIP2 compression algorithm (defaulting to 6 as well). This is a
1516 different option from @option{--compress-level} since BZIP2 uses a
1517 significant amount of memory for each additional compression level.
1518 @option{-z} sets both. A value of 0 for @code{n} disables compression.
1520 @item --bzip2-decompress-lowmem
1521 @opindex bzip2-decompress-lowmem
1522 Use a different decompression method for BZIP2 compressed files. This
1523 alternate method uses a bit more than half the memory, but also runs
1524 at half the speed. This is useful under extreme low memory
1525 circumstances when the file was originally compressed at a high
1526 @option{--bzip2-compress-level}.
1529 @item --mangle-dos-filenames
1530 @itemx --no-mangle-dos-filenames
1531 @opindex mangle-dos-filenames
1532 @opindex no-mangle-dos-filenames
1533 Older version of Windows cannot handle filenames with more than one
1534 dot. @option{--mangle-dos-filenames} causes GnuPG to replace (rather
1535 than add to) the extension of an output filename to avoid this
1536 problem. This option is off by default and has no effect on non-Windows
1539 @item --ask-cert-level
1540 @itemx --no-ask-cert-level
1541 @opindex ask-cert-level
1542 When making a key signature, prompt for a certification level. If this
1543 option is not specified, the certification level used is set via
1544 @option{--default-cert-level}. See @option{--default-cert-level} for
1545 information on the specific levels and how they are
1546 used. @option{--no-ask-cert-level} disables this option. This option
1549 @item --default-cert-level @code{n}
1550 @opindex default-cert-level
1551 The default to use for the check level when signing a key.
1553 0 means you make no particular claim as to how carefully you verified
1556 1 means you believe the key is owned by the person who claims to own
1557 it but you could not, or did not verify the key at all. This is
1558 useful for a "persona" verification, where you sign the key of a
1561 2 means you did casual verification of the key. For example, this
1562 could mean that you verified the key fingerprint and checked the
1563 user ID on the key against a photo ID.
1565 3 means you did extensive verification of the key. For example, this
1566 could mean that you verified the key fingerprint with the owner of the
1567 key in person, and that you checked, by means of a hard to forge
1568 document with a photo ID (such as a passport) that the name of the key
1569 owner matches the name in the user ID on the key, and finally that you
1570 verified (by exchange of email) that the email address on the key
1571 belongs to the key owner.
1573 Note that the examples given above for levels 2 and 3 are just that:
1574 examples. In the end, it is up to you to decide just what "casual"
1575 and "extensive" mean to you.
1577 This option defaults to 0 (no particular claim).
1579 @item --min-cert-level
1580 @opindex min-cert-level
1581 When building the trust database, treat any signatures with a
1582 certification level below this as invalid. Defaults to 2, which
1583 disregards level 1 signatures. Note that level 0 "no particular
1584 claim" signatures are always accepted.
1586 @item --trusted-key @code{long key ID}
1587 @opindex trusted-key
1588 Assume that the specified key (which must be given
1589 as a full 8 byte key ID) is as trustworthy as one of
1590 your own secret keys. This option is useful if you
1591 don't want to keep your secret keys (or one of them)
1592 online but still want to be able to check the validity of a given
1593 recipient's or signator's key.
1595 @item --trust-model @code{pgp|classic|tofu|tofu+pgp|direct|always|auto}
1596 @opindex trust-model
1597 Set what trust model GnuPG should follow. The models are:
1602 @opindex trust-mode:pgp
1603 This is the Web of Trust combined with trust signatures as used in PGP
1604 5.x and later. This is the default trust model when creating a new
1608 @opindex trust-mode:classic
1609 This is the standard Web of Trust as introduced by PGP 2.
1612 @opindex trust-mode:tofu
1613 @anchor{trust-model-tofu}
1614 TOFU stands for Trust On First Use. In this trust model, the first
1615 time a key is seen, it is memorized. If later another key is seen
1616 with a user id with the same email address, a warning is displayed
1617 indicating that there is a conflict and that the key might be a
1618 forgery and an attempt at a man-in-the-middle attack.
1620 Because a potential attacker is able to control the email address
1621 and thereby circumvent the conflict detection algorithm by using an
1622 email address that is similar in appearance to a trusted email
1623 address, whenever a message is verified, statistics about the number
1624 of messages signed with the key are shown. In this way, a user can
1625 easily identify attacks using fake keys for regular correspondents.
1627 When compared with the Web of Trust, TOFU offers significantly
1628 weaker security guarantees. In particular, TOFU only helps ensure
1629 consistency (that is, that the binding between a key and email
1630 address doesn't change). A major advantage of TOFU is that it
1631 requires little maintenance to use correctly. To use the web of
1632 trust properly, you need to actively sign keys and mark users as
1633 trusted introducers. This is a time-consuming process and anecdotal
1634 evidence suggests that even security-conscious users rarely take the
1635 time to do this thoroughly and instead rely on an ad-hoc TOFU
1638 In the TOFU model, policies are associated with bindings between
1639 keys and email addresses (which are extracted from user ids and
1640 normalized). There are five policies, which can be set manually
1641 using the @option{--tofu-policy} option. The default policy can be
1642 set using the @option{--tofu-default-policy} option.
1644 The TOFU policies are: @code{auto}, @code{good}, @code{unknown},
1645 @code{bad} and @code{ask}. The @code{auto} policy is used by
1646 default (unless overridden by @option{--tofu-default-policy}) and
1647 marks a binding as marginally trusted. The @code{good},
1648 @code{unknown} and @code{bad} policies mark a binding as fully
1649 trusted, as having unknown trust or as having trust never,
1650 respectively. The @code{unknown} policy is useful for just using
1651 TOFU to detect conflicts, but to never assign positive trust to a
1652 binding. The final policy, @code{ask} prompts the user to indicate
1653 the binding's trust. If batch mode is enabled (or input is
1654 inappropriate in the context), then the user is not prompted and the
1655 @code{undefined} trust level is returned.
1658 @opindex trust-mode:tofu+pgp
1659 This trust model combines TOFU with the Web of Trust. This is done
1660 by computing the trust level for each model and then taking the
1661 maximum trust level where the trust levels are ordered as follows:
1662 @code{unknown < undefined < marginal < fully < ultimate < expired <
1665 By setting @option{--tofu-default-policy=unknown}, this model can be
1666 used to implement the web of trust with TOFU's conflict detection
1667 algorithm, but without its assignment of positive trust values,
1668 which some security-conscious users don't like.
1671 @opindex trust-mode:direct
1672 Key validity is set directly by the user and not calculated via the
1676 @opindex trust-mode:always
1677 Skip key validation and assume that used keys are always fully
1678 valid. You generally won't use this unless you are using some
1679 external validation scheme. This option also suppresses the
1680 "[uncertain]" tag printed with signature checks when there is no
1681 evidence that the user ID is bound to the key. Note that this
1682 trust model still does not allow the use of expired, revoked, or
1686 @opindex trust-mode:auto
1687 Select the trust model depending on whatever the internal trust
1688 database says. This is the default model if such a database already
1692 @item --auto-key-locate @code{parameters}
1693 @itemx --no-auto-key-locate
1694 @opindex auto-key-locate
1695 GnuPG can automatically locate and retrieve keys as needed using this
1696 option. This happens when encrypting to an email address (in the
1697 "user@@example.com" form), and there are no user@@example.com keys on
1698 the local keyring. This option takes any number of the following
1699 mechanisms, in the order they are to be tried:
1704 Locate a key using DNS CERT, as specified in RFC-4398.
1707 Locate a key using DNS PKA.
1710 Locate a key using DANE, as specified
1711 in draft-ietf-dane-openpgpkey-05.txt.
1714 Locate a key using the Web Key Directory protocol.
1715 This is an experimental method and semantics may change.
1718 Using DNS Service Discovery, check the domain in question for any LDAP
1719 keyservers to use. If this fails, attempt to locate the key using the
1720 PGP Universal method of checking @samp{ldap://keys.(thedomain)}.
1723 Locate a key using whatever keyserver is defined using the
1724 @option{--keyserver} option.
1727 In addition, a keyserver URL as used in the @option{--keyserver} option
1728 may be used here to query that particular keyserver.
1731 Locate the key using the local keyrings. This mechanism allows the user to
1732 select the order a local key lookup is done. Thus using
1733 @samp{--auto-key-locate local} is identical to
1734 @option{--no-auto-key-locate}.
1737 This flag disables the standard local key lookup, done before any of the
1738 mechanisms defined by the @option{--auto-key-locate} are tried. The
1739 position of this mechanism in the list does not matter. It is not
1740 required if @code{local} is also used.
1743 Clear all defined mechanisms. This is useful to override
1744 mechanisms given in a config file.
1748 @item --auto-key-retrieve
1749 @itemx --no-auto-key-retrieve
1750 @opindex auto-key-retrieve
1751 @opindex no-auto-key-retrieve
1752 This option enables the automatic retrieving of keys from a keyserver
1753 when verifying signatures made by keys that are not on the local
1756 If the method "wkd" is included in the list of methods given to
1757 @option{auto-key-locate}, the Signer's User ID is part of the
1758 signature, and the option @option{--disable-signer-uid} is not used,
1759 the "wkd" method may also be used to retrieve a key.
1761 Note that this option makes a "web bug" like behavior possible.
1762 Keyserver or Web Key Directory operators can see which keys you
1763 request, so by sending you a message signed by a brand new key (which
1764 you naturally will not have on your local keyring), the operator can
1765 tell both your IP address and the time when you verified the
1768 @item --keyid-format @code{none|short|0xshort|long|0xlong}
1769 @opindex keyid-format
1770 Select how to display key IDs. "none" does not show the key ID at all
1771 but shows the fingerprint in a separate line. "short" is the
1772 traditional 8-character key ID. "long" is the more accurate (but less
1773 convenient) 16-character key ID. Add an "0x" to either to include an
1774 "0x" at the beginning of the key ID, as in 0x99242560. Note that this
1775 option is ignored if the option @option{--with-colons} is used.
1777 @item --keyserver @code{name}
1779 This option is deprecated - please use the @option{--keyserver} in
1780 @file{dirmngr.conf} instead.
1782 Use @code{name} as your keyserver. This is the server that
1783 @option{--receive-keys}, @option{--send-keys}, and @option{--search-keys}
1784 will communicate with to receive keys from, send keys to, and search for
1785 keys on. The format of the @code{name} is a URI:
1786 `scheme:[//]keyservername[:port]' The scheme is the type of keyserver:
1787 "hkp" for the HTTP (or compatible) keyservers, "ldap" for the LDAP
1788 keyservers, or "mailto" for the Graff email keyserver. Note that your
1789 particular installation of GnuPG may have other keyserver types
1790 available as well. Keyserver schemes are case-insensitive. After the
1791 keyserver name, optional keyserver configuration options may be
1792 provided. These are the same as the global @option{--keyserver-options}
1793 from below, but apply only to this particular keyserver.
1795 Most keyservers synchronize with each other, so there is generally no
1796 need to send keys to more than one server. The keyserver
1797 @code{hkp://keys.gnupg.net} uses round robin DNS to give a different
1798 keyserver each time you use it.
1800 @item --keyserver-options @code{name=value}
1801 @opindex keyserver-options
1802 This is a space or comma delimited string that gives options for the
1803 keyserver. Options can be prefixed with a `no-' to give the opposite
1804 meaning. Valid import-options or export-options may be used here as
1805 well to apply to importing (@option{--recv-key}) or exporting
1806 (@option{--send-key}) a key from a keyserver. While not all options
1807 are available for all keyserver types, some common options are:
1811 @item include-revoked
1812 When searching for a key with @option{--search-keys}, include keys that
1813 are marked on the keyserver as revoked. Note that not all keyservers
1814 differentiate between revoked and unrevoked keys, and for such
1815 keyservers this option is meaningless. Note also that most keyservers do
1816 not have cryptographic verification of key revocations, and so turning
1817 this option off may result in skipping keys that are incorrectly marked
1820 @item include-disabled
1821 When searching for a key with @option{--search-keys}, include keys that
1822 are marked on the keyserver as disabled. Note that this option is not
1823 used with HKP keyservers.
1825 @item auto-key-retrieve
1826 This is the same as the option @option{auto-key-retrieve}.
1828 @item honor-keyserver-url
1829 When using @option{--refresh-keys}, if the key in question has a preferred
1830 keyserver URL, then use that preferred keyserver to refresh the key
1831 from. In addition, if auto-key-retrieve is set, and the signature
1832 being verified has a preferred keyserver URL, then use that preferred
1833 keyserver to fetch the key from. Note that this option introduces a
1834 "web bug": The creator of the key can see when the keys is
1835 refreshed. Thus this option is not enabled by default.
1837 @item honor-pka-record
1838 If @option{--auto-key-retrieve} is used, and the signature being
1839 verified has a PKA record, then use the PKA information to fetch
1840 the key. Defaults to "yes".
1842 @item include-subkeys
1843 When receiving a key, include subkeys as potential targets. Note that
1844 this option is not used with HKP keyservers, as they do not support
1845 retrieving keys by subkey id.
1848 Tell the keyserver helper program how long (in seconds) to try and
1849 perform a keyserver action before giving up. Note that performing
1850 multiple actions at the same time uses this timeout value per action.
1851 For example, when retrieving multiple keys via @option{--receive-keys}, the
1852 timeout applies separately to each key retrieval, and not to the
1853 @option{--receive-keys} command as a whole. Defaults to 30 seconds.
1855 @item http-proxy=@code{value}
1856 This option is deprecated.
1857 Set the proxy to use for HTTP and HKP keyservers.
1858 This overrides any proxy defined in @file{dirmngr.conf}.
1861 This option has no more function since GnuPG 2.1. Use the
1862 @code{dirmngr} configuration options instead.
1865 This option has no more function since GnuPG 2.1. Use the
1866 @code{dirmngr} configuration options instead.
1869 This option has no more function since GnuPG 2.1. Use the
1870 @code{dirmngr} configuration options instead.
1873 This option has no more function since GnuPG 2.1. Use the
1874 @code{dirmngr} configuration options instead.
1878 @item --completes-needed @code{n}
1879 @opindex compliant-needed
1880 Number of completely trusted users to introduce a new
1881 key signer (defaults to 1).
1883 @item --marginals-needed @code{n}
1884 @opindex marginals-needed
1885 Number of marginally trusted users to introduce a new
1886 key signer (defaults to 3)
1888 @item --tofu-default-policy @code{auto|good|unknown|bad|ask}
1889 @opindex tofu-default-policy
1890 The default TOFU policy (defaults to @code{auto}). For more
1891 information about the meaning of this option, @pxref{trust-model-tofu}.
1893 @item --max-cert-depth @code{n}
1894 @opindex max-cert-depth
1895 Maximum depth of a certification chain (default is 5).
1897 @item --no-sig-cache
1898 @opindex no-sig-cache
1899 Do not cache the verification status of key signatures.
1900 Caching gives a much better performance in key listings. However, if
1901 you suspect that your public keyring is not safe against write
1902 modifications, you can use this option to disable the caching. It
1903 probably does not make sense to disable it because all kind of damage
1904 can be done if someone else has write access to your public keyring.
1906 @item --auto-check-trustdb
1907 @itemx --no-auto-check-trustdb
1908 @opindex auto-check-trustdb
1909 If GnuPG feels that its information about the Web of Trust has to be
1910 updated, it automatically runs the @option{--check-trustdb} command
1911 internally. This may be a time consuming
1912 process. @option{--no-auto-check-trustdb} disables this option.
1915 @itemx --no-use-agent
1917 This is dummy option. @command{@gpgname} always requires the agent.
1919 @item --gpg-agent-info
1920 @opindex gpg-agent-info
1921 This is dummy option. It has no effect when used with @command{@gpgname}.
1924 @item --agent-program @var{file}
1925 @opindex agent-program
1926 Specify an agent program to be used for secret key operations. The
1927 default value is determined by running @command{gpgconf} with the
1928 option @option{--list-dirs}. Note that the pipe symbol (@code{|}) is
1929 used for a regression test suite hack and may thus not be used in the
1932 @item --dirmngr-program @var{file}
1933 @opindex dirmngr-program
1934 Specify a dirmngr program to be used for keyserver access. The
1935 default value is @file{@value{BINDIR}/dirmngr}.
1937 @item --no-autostart
1938 @opindex no-autostart
1939 Do not start the gpg-agent or the dirmngr if it has not yet been
1940 started and its service is required. This option is mostly useful on
1941 machines where the connection to gpg-agent has been redirected to
1942 another machines. If dirmngr is required on the remote machine, it
1943 may be started manually using @command{gpgconf --launch dirmngr}.
1947 Lock the databases the first time a lock is requested
1948 and do not release the lock until the process
1951 @item --lock-multiple
1952 @opindex lock-multiple
1953 Release the locks every time a lock is no longer
1954 needed. Use this to override a previous @option{--lock-once}
1959 Disable locking entirely. This option should be used only in very
1960 special environments, where it can be assured that only one process
1961 is accessing those files. A bootable floppy with a stand-alone
1962 encryption system will probably use this. Improper usage of this
1963 option may lead to data and key corruption.
1965 @item --exit-on-status-write-error
1966 @opindex exit-on-status-write-error
1967 This option will cause write errors on the status FD to immediately
1968 terminate the process. That should in fact be the default but it never
1969 worked this way and thus we need an option to enable this, so that the
1970 change won't break applications which close their end of a status fd
1971 connected pipe too early. Using this option along with
1972 @option{--enable-progress-filter} may be used to cleanly cancel long
1973 running gpg operations.
1975 @item --limit-card-insert-tries @code{n}
1976 @opindex limit-card-insert-tries
1977 With @code{n} greater than 0 the number of prompts asking to insert a
1978 smartcard gets limited to N-1. Thus with a value of 1 gpg won't at
1979 all ask to insert a card if none has been inserted at startup. This
1980 option is useful in the configuration file in case an application does
1981 not know about the smartcard support and waits ad infinitum for an
1984 @item --no-random-seed-file
1985 @opindex no-random-seed-file
1986 GnuPG uses a file to store its internal random pool over invocations.
1987 This makes random generation faster; however sometimes write operations
1988 are not desired. This option can be used to achieve that with the cost of
1989 slower random generation.
1992 @opindex no-greeting
1993 Suppress the initial copyright message.
1995 @item --no-secmem-warning
1996 @opindex no-secmem-warning
1997 Suppress the warning about "using insecure memory".
1999 @item --no-permission-warning
2000 @opindex permission-warning
2001 Suppress the warning about unsafe file and home directory (@option{--homedir})
2002 permissions. Note that the permission checks that GnuPG performs are
2003 not intended to be authoritative, but rather they simply warn about
2004 certain common permission problems. Do not assume that the lack of a
2005 warning means that your system is secure.
2007 Note that the warning for unsafe @option{--homedir} permissions cannot be
2008 suppressed in the gpg.conf file, as this would allow an attacker to
2009 place an unsafe gpg.conf file in place, and use this file to suppress
2010 warnings about itself. The @option{--homedir} permissions warning may only be
2011 suppressed on the command line.
2013 @item --no-mdc-warning
2014 @opindex no-mdc-warning
2015 Suppress the warning about missing MDC integrity protection.
2017 @item --require-secmem
2018 @itemx --no-require-secmem
2019 @opindex require-secmem
2020 Refuse to run if GnuPG cannot get secure memory. Defaults to no
2021 (i.e. run, but give a warning).
2024 @item --require-cross-certification
2025 @itemx --no-require-cross-certification
2026 @opindex require-cross-certification
2027 When verifying a signature made from a subkey, ensure that the cross
2028 certification "back signature" on the subkey is present and valid. This
2029 protects against a subtle attack against subkeys that can sign.
2030 Defaults to @option{--require-cross-certification} for
2036 Allow the user to do certain nonsensical or "silly" things like
2037 signing an expired or revoked key, or certain potentially incompatible
2038 things like generating unusual key types. This also disables certain
2039 warning messages about potentially incompatible actions. As the name
2040 implies, this option is for experts only. If you don't fully
2041 understand the implications of what it allows you to do, leave this
2042 off. @option{--no-expert} disables this option.
2047 @c *******************************************
2048 @c ******** KEY RELATED OPTIONS ************
2049 @c *******************************************
2050 @node GPG Key related Options
2051 @subsection Key related options
2055 @item --recipient @var{name}
2058 Encrypt for user id @var{name}. If this option or
2059 @option{--hidden-recipient} is not specified, GnuPG asks for the user-id
2060 unless @option{--default-recipient} is given.
2062 @item --hidden-recipient @var{name}
2064 @opindex hidden-recipient
2065 Encrypt for user ID @var{name}, but hide the key ID of this user's
2066 key. This option helps to hide the receiver of the message and is a
2067 limited countermeasure against traffic analysis. If this option or
2068 @option{--recipient} is not specified, GnuPG asks for the user ID unless
2069 @option{--default-recipient} is given.
2071 @item --recipient-file @var{file}
2073 @opindex recipient-file
2074 This option is similar to @option{--recipient} except that it
2075 encrypts to a key stored in the given file. @var{file} must be the
2076 name of a file containing exactly one key. @command{@gpgname} assumes that
2077 the key in this file is fully valid.
2079 @item --hidden-recipient-file @var{file}
2081 @opindex hidden-recipient-file
2082 This option is similar to @option{--hidden-recipient} except that it
2083 encrypts to a key stored in the given file. @var{file} must be the
2084 name of a file containing exactly one key. @command{@gpgname} assumes that
2085 the key in this file is fully valid.
2087 @item --encrypt-to @code{name}
2089 Same as @option{--recipient} but this one is intended for use in the
2090 options file and may be used with your own user-id as an
2091 "encrypt-to-self". These keys are only used when there are other
2092 recipients given either by use of @option{--recipient} or by the asked
2093 user id. No trust checking is performed for these user ids and even
2094 disabled keys can be used.
2096 @item --hidden-encrypt-to @code{name}
2097 @opindex hidden-encrypt-to
2098 Same as @option{--hidden-recipient} but this one is intended for use in the
2099 options file and may be used with your own user-id as a hidden
2100 "encrypt-to-self". These keys are only used when there are other
2101 recipients given either by use of @option{--recipient} or by the asked user id.
2102 No trust checking is performed for these user ids and even disabled
2105 @item --no-encrypt-to
2106 @opindex no-encrypt-to
2107 Disable the use of all @option{--encrypt-to} and
2108 @option{--hidden-encrypt-to} keys.
2110 @item --group @code{name=value}
2112 Sets up a named group, which is similar to aliases in email programs.
2113 Any time the group name is a recipient (@option{-r} or
2114 @option{--recipient}), it will be expanded to the values
2115 specified. Multiple groups with the same name are automatically merged
2116 into a single group.
2118 The values are @code{key IDs} or fingerprints, but any key description
2119 is accepted. Note that a value with spaces in it will be treated as
2120 two different values. Note also there is only one level of expansion
2121 --- you cannot make an group that points to another group. When used
2122 from the command line, it may be necessary to quote the argument to
2123 this option to prevent the shell from treating it as multiple
2126 @item --ungroup @code{name}
2128 Remove a given entry from the @option{--group} list.
2132 Remove all entries from the @option{--group} list.
2134 @item --local-user @var{name}
2137 Use @var{name} as the key to sign with. Note that this option overrides
2138 @option{--default-key}.
2140 @item --sender @var{mbox}
2142 This option has two purposes. @var{mbox} must either be a complete
2143 user id with a proper mail address or just a mail address. When
2144 creating a signature this option tells gpg the user id of a key used
2145 to make a signature if the key was not directly specified by a user
2146 id. When verifying a signature the @var{mbox} is used to restrict the
2147 information printed by the TOFU code to matching user ids.
2149 @item --try-secret-key @var{name}
2150 @opindex try-secret-key
2151 For hidden recipients GPG needs to know the keys to use for trial
2152 decryption. The key set with @option{--default-key} is always tried
2153 first, but this is often not sufficient. This option allows setting more
2154 keys to be used for trial decryption. Although any valid user-id
2155 specification may be used for @var{name} it makes sense to use at least
2156 the long keyid to avoid ambiguities. Note that gpg-agent might pop up a
2157 pinentry for a lot keys to do the trial decryption. If you want to stop
2158 all further trial decryption you may use close-window button instead of
2161 @item --try-all-secrets
2162 @opindex try-all-secrets
2163 Don't look at the key ID as stored in the message but try all secret
2164 keys in turn to find the right decryption key. This option forces the
2165 behaviour as used by anonymous recipients (created by using
2166 @option{--throw-keyids} or @option{--hidden-recipient}) and might come
2167 handy in case where an encrypted message contains a bogus key ID.
2169 @item --skip-hidden-recipients
2170 @itemx --no-skip-hidden-recipients
2171 @opindex skip-hidden-recipients
2172 @opindex no-skip-hidden-recipients
2173 During decryption skip all anonymous recipients. This option helps in
2174 the case that people use the hidden recipients feature to hide there
2175 own encrypt-to key from others. If oneself has many secret keys this
2176 may lead to a major annoyance because all keys are tried in turn to
2177 decrypt something which was not really intended for it. The drawback
2178 of this option is that it is currently not possible to decrypt a
2179 message which includes real anonymous recipients.
2184 @c *******************************************
2185 @c ******** INPUT AND OUTPUT ***************
2186 @c *******************************************
2187 @node GPG Input and Output
2188 @subsection Input and Output
2195 Create ASCII armored output. The default is to create the binary
2200 Assume the input data is not in ASCII armored format.
2202 @item --output @var{file}
2203 @itemx -o @var{file}
2205 Write output to @var{file}. To write to stdout use @code{-} as the
2208 @item --max-output @code{n}
2210 This option sets a limit on the number of bytes that will be generated
2211 when processing a file. Since OpenPGP supports various levels of
2212 compression, it is possible that the plaintext of a given message may be
2213 significantly larger than the original OpenPGP message. While GnuPG
2214 works properly with such messages, there is often a desire to set a
2215 maximum file size that will be generated before processing is forced to
2216 stop by the OS limits. Defaults to 0, which means "no limit".
2218 @item --input-size-hint @var{n}
2219 @opindex input-size-hint
2220 This option can be used to tell GPG the size of the input data in
2221 bytes. @var{n} must be a positive base-10 number. This option is
2222 only useful if the input is not taken from a file. GPG may use this
2223 hint to optimize its buffer allocation strategy. It is also used by
2224 the @option{--status-fd} line ``PROGRESS'' to provide a value for
2225 ``total'' if that is not available by other means.
2227 @item --import-options @code{parameters}
2228 @opindex import-options
2229 This is a space or comma delimited string that gives options for
2230 importing keys. Options can be prepended with a `no-' to give the
2231 opposite meaning. The options are:
2235 @item import-local-sigs
2236 Allow importing key signatures marked as "local". This is not
2237 generally useful unless a shared keyring scheme is being used.
2240 @item keep-ownertrust
2241 Normally possible still existing ownertrust values of a key are
2242 cleared if a key is imported. This is in general desirable so that
2243 a formerly deleted key does not automatically gain an ownertrust
2244 values merely due to import. On the other hand it is sometimes
2245 necessary to re-import a trusted set of keys again but keeping
2246 already assigned ownertrust values. This can be achieved by using
2249 @item repair-pks-subkey-bug
2250 During import, attempt to repair the damage caused by the PKS keyserver
2251 bug (pre version 0.9.6) that mangles keys with multiple subkeys. Note
2252 that this cannot completely repair the damaged key as some crucial data
2253 is removed by the keyserver, but it does at least give you back one
2254 subkey. Defaults to no for regular @option{--import} and to yes for
2255 keyserver @option{--receive-keys}.
2258 Show a listing of the key as imported right before it is stored.
2259 This can be combined with the option @option{--dry-run} to only look
2263 Run the entire import code but instead of storing the key to the
2264 local keyring write it to the output. The export options
2265 @option{export-pka} and @option{export-dane} affect the output. This
2266 option can be used to remove all invalid parts from a key without the
2270 During import, allow key updates to existing keys, but do not allow
2271 any new keys to be imported. Defaults to no.
2274 After import, compact (remove all signatures except the
2275 self-signature) any user IDs from the new key that are not usable.
2276 Then, remove any signatures from the new key that are not usable.
2277 This includes signatures that were issued by keys that are not present
2278 on the keyring. This option is the same as running the @option{--edit-key}
2279 command "clean" after import. Defaults to no.
2281 @item import-minimal
2282 Import the smallest key possible. This removes all signatures except
2283 the most recent self-signature on each user ID. This option is the
2284 same as running the @option{--edit-key} command "minimize" after import.
2288 @item --import-filter @code{@var{name}=@var{expr}}
2289 @itemx --export-filter @code{@var{name}=@var{expr}}
2290 @opindex import-filter
2291 @opindex export-filter
2292 These options define an import/export filter which are applied to the
2293 imported/exported keyblock right before it will be stored/written.
2294 @var{name} defines the type of filter to use, @var{expr} the
2295 expression to evaluate. The option can be used several times which
2296 then appends more expression to the same @var{name}.
2299 The available filter types are:
2304 This filter will keep a user id packet and its dependent packets in
2305 the keyblock if the expression evaluates to true.
2308 This filter drops the selected subkeys.
2309 Currently only implemented for --export-filter.
2312 This filter drops the selected key signatures on user ids.
2313 Self-signatures are not considered.
2314 Currently only implemented for --import-filter.
2318 For the syntax of the expression see the chapter "FILTER EXPRESSIONS".
2319 The property names for the expressions depend on the actual filter
2320 type and are indicated in the following table.
2322 The available properties are:
2327 A string with the user id. (keep-uid)
2330 The addr-spec part of a user id with mailbox or the empty string.
2334 A number with the public key algorithm of a key or subkey packet.
2338 @itemx key_created_d
2339 The first is the timestamp a public key or subkey packet was
2340 created. The second is the same but given as an ISO string,
2341 e.g. "2016-08-17". (drop-subkey)
2344 Boolean indicating whether the user id is the primary one. (keep-uid)
2347 Boolean indicating whether a key or subkey is a secret one.
2351 @itemx sig_created_d
2352 The first is the timestamp a signature packet was created. The
2353 second is the same but given as an ISO string,
2354 e.g. "2016-08-17". (drop-sig)
2357 A number with the public key algorithm of a signature packet. (drop-sig)
2359 @item sig_digest_algo
2360 A number with the digest algorithm of a signature packet. (drop-sig)
2364 @item --export-options @code{parameters}
2365 @opindex export-options
2366 This is a space or comma delimited string that gives options for
2367 exporting keys. Options can be prepended with a `no-' to give the
2368 opposite meaning. The options are:
2372 @item export-local-sigs
2373 Allow exporting key signatures marked as "local". This is not
2374 generally useful unless a shared keyring scheme is being used.
2377 @item export-attributes
2378 Include attribute user IDs (photo IDs) while exporting. This is
2379 useful to export keys if they are going to be used by an OpenPGP
2380 program that does not accept attribute user IDs. Defaults to yes.
2382 @item export-sensitive-revkeys
2383 Include designated revoker information that was marked as
2384 "sensitive". Defaults to no.
2386 @c Since GnuPG 2.1 gpg-agent manages the secret key and thus the
2387 @c export-reset-subkey-passwd hack is not anymore justified. Such use
2388 @c cases may be implemented using a specialized secret key export
2390 @c @item export-reset-subkey-passwd
2391 @c When using the @option{--export-secret-subkeys} command, this option resets
2392 @c the passphrases for all exported subkeys to empty. This is useful
2393 @c when the exported subkey is to be used on an unattended machine where
2394 @c a passphrase doesn't necessarily make sense. Defaults to no.
2397 Compact (remove all signatures from) user IDs on the key being
2398 exported if the user IDs are not usable. Also, do not export any
2399 signatures that are not usable. This includes signatures that were
2400 issued by keys that are not present on the keyring. This option is
2401 the same as running the @option{--edit-key} command "clean" before export
2402 except that the local copy of the key is not modified. Defaults to
2405 @item export-minimal
2406 Export the smallest key possible. This removes all signatures except the
2407 most recent self-signature on each user ID. This option is the same as
2408 running the @option{--edit-key} command "minimize" before export except
2409 that the local copy of the key is not modified. Defaults to no.
2412 Instead of outputting the key material output PKA records suitable
2413 to put into DNS zone files. An ORIGIN line is printed before each
2414 record to allow diverting the records to the corresponding zone file.
2417 Instead of outputting the key material output OpenPGP DANE records
2418 suitable to put into DNS zone files. An ORIGIN line is printed before
2419 each record to allow diverting the records to the corresponding zone
2425 @opindex with-colons
2426 Print key listings delimited by colons. Note that the output will be
2427 encoded in UTF-8 regardless of any @option{--display-charset} setting. This
2428 format is useful when GnuPG is called from scripts and other programs
2429 as it is easily machine parsed. The details of this format are
2430 documented in the file @file{doc/DETAILS}, which is included in the GnuPG
2431 source distribution.
2433 @item --fixed-list-mode
2434 @opindex fixed-list-mode
2435 Do not merge primary user ID and primary key in @option{--with-colon}
2436 listing mode and print all timestamps as seconds since 1970-01-01.
2437 Since GnuPG 2.0.10, this mode is always used and thus this option is
2438 obsolete; it does not harm to use it though.
2440 @item --legacy-list-mode
2441 @opindex legacy-list-mode
2442 Revert to the pre-2.1 public key list mode. This only affects the
2443 human readable output and not the machine interface
2444 (i.e. @code{--with-colons}). Note that the legacy format does not
2445 convey suitable information for elliptic curves.
2447 @item --with-fingerprint
2448 @opindex with-fingerprint
2449 Same as the command @option{--fingerprint} but changes only the format
2450 of the output and may be used together with another command.
2452 @item --with-subkey-fingerprint
2453 @opindex with-subkey-fingerprint
2454 If a fingerprint is printed for the primary key, this option forces
2455 printing of the fingerprint for all subkeys. This could also be
2456 achieved by using the @option{--with-fingerprint} twice but by using
2457 this option along with keyid-format "none" a compact fingerprint is
2460 @item --with-icao-spelling
2461 @opindex with-icao-spelling
2462 Print the ICAO spelling of the fingerprint in addition to the hex digits.
2464 @item --with-keygrip
2465 @opindex with-keygrip
2466 Include the keygrip in the key listings. In @code{--with-colons} mode
2467 this is implicitly enable for secret keys.
2469 @item --with-wkd-hash
2470 @opindex with-wkd-hash
2471 Print a Web Key Directory identifier along with each user ID in key
2472 listings. This is an experimental feature and semantics may change.
2475 @opindex with-secret
2476 Include info about the presence of a secret key in public key listings
2477 done with @code{--with-colons}.
2481 @c *******************************************
2482 @c ******** OPENPGP OPTIONS ****************
2483 @c *******************************************
2484 @node OpenPGP Options
2485 @subsection OpenPGP protocol specific options
2489 @item -t, --textmode
2490 @itemx --no-textmode
2492 Treat input files as text and store them in the OpenPGP canonical text
2493 form with standard "CRLF" line endings. This also sets the necessary
2494 flags to inform the recipient that the encrypted or signed data is text
2495 and may need its line endings converted back to whatever the local
2496 system uses. This option is useful when communicating between two
2497 platforms that have different line ending conventions (UNIX-like to Mac,
2498 Mac to Windows, etc). @option{--no-textmode} disables this option, and
2501 @item --force-v3-sigs
2502 @itemx --no-force-v3-sigs
2503 @item --force-v4-certs
2504 @itemx --no-force-v4-certs
2505 These options are obsolete and have no effect since GnuPG 2.1.
2509 Force the use of encryption with a modification detection code. This
2510 is always used with the newer ciphers (those with a blocksize greater
2511 than 64 bits), or if all of the recipient keys indicate MDC support in
2512 their feature flags.
2515 @opindex disable-mdc
2516 Disable the use of the modification detection code. Note that by
2517 using this option, the encrypted message becomes vulnerable to a
2518 message modification attack.
2520 @item --disable-signer-uid
2521 @opindex disable-signer-uid
2522 By default the user ID of the signing key is embedded in the data
2523 signature. As of now this is only done if the signing key has been
2524 specified with @option{local-user} using a mail address. This
2525 information can be helpful for verifier to locate the key; see
2526 option @option{--auto-key-retrieve}.
2528 @item --personal-cipher-preferences @code{string}
2529 @opindex personal-cipher-preferences
2530 Set the list of personal cipher preferences to @code{string}. Use
2531 @command{@gpgname --version} to get a list of available algorithms,
2532 and use @code{none} to set no preference at all. This allows the user
2533 to safely override the algorithm chosen by the recipient key
2534 preferences, as GPG will only select an algorithm that is usable by
2535 all recipients. The most highly ranked cipher in this list is also
2536 used for the @option{--symmetric} encryption command.
2538 @item --personal-digest-preferences @code{string}
2539 @opindex personal-digest-preferences
2540 Set the list of personal digest preferences to @code{string}. Use
2541 @command{@gpgname --version} to get a list of available algorithms,
2542 and use @code{none} to set no preference at all. This allows the user
2543 to safely override the algorithm chosen by the recipient key
2544 preferences, as GPG will only select an algorithm that is usable by
2545 all recipients. The most highly ranked digest algorithm in this list
2546 is also used when signing without encryption
2547 (e.g. @option{--clear-sign} or @option{--sign}).
2549 @item --personal-compress-preferences @code{string}
2550 @opindex personal-compress-preferences
2551 Set the list of personal compression preferences to @code{string}.
2552 Use @command{@gpgname --version} to get a list of available
2553 algorithms, and use @code{none} to set no preference at all. This
2554 allows the user to safely override the algorithm chosen by the
2555 recipient key preferences, as GPG will only select an algorithm that
2556 is usable by all recipients. The most highly ranked compression
2557 algorithm in this list is also used when there are no recipient keys
2558 to consider (e.g. @option{--symmetric}).
2560 @item --s2k-cipher-algo @code{name}
2561 @opindex s2k-cipher-algo
2562 Use @code{name} as the cipher algorithm for symmetric encryption with
2563 a passphrase if @option{--personal-cipher-preferences} and
2564 @option{--cipher-algo} are not given. The default is @value{GPGSYMENCALGO}.
2566 @item --s2k-digest-algo @code{name}
2567 @opindex s2k-digest-algo
2568 Use @code{name} as the digest algorithm used to mangle the passphrases
2569 for symmetric encryption. The default is SHA-1.
2571 @item --s2k-mode @code{n}
2573 Selects how passphrases for symmetric encryption are mangled. If
2574 @code{n} is 0 a plain passphrase (which is in general not recommended)
2575 will be used, a 1 adds a salt (which should not be used) to the
2576 passphrase and a 3 (the default) iterates the whole process a number
2577 of times (see @option{--s2k-count}).
2579 @item --s2k-count @code{n}
2581 Specify how many times the passphrases mangling for symmetric
2582 encryption is repeated. This value may range between 1024 and
2583 65011712 inclusive. The default is inquired from gpg-agent. Note
2584 that not all values in the 1024-65011712 range are legal and if an
2585 illegal value is selected, GnuPG will round up to the nearest legal
2586 value. This option is only meaningful if @option{--s2k-mode} is set
2587 to the default of 3.
2592 @c ***************************
2593 @c ******* Compliance ********
2594 @c ***************************
2595 @node Compliance Options
2596 @subsection Compliance options
2598 These options control what GnuPG is compliant to. Only one of these
2599 options may be active at a time. Note that the default setting of
2600 this is nearly always the correct one. See the INTEROPERABILITY WITH
2601 OTHER OPENPGP PROGRAMS section below before using one of these
2608 Use standard GnuPG behavior. This is essentially OpenPGP behavior
2609 (see @option{--openpgp}), but with some additional workarounds for common
2610 compatibility problems in different versions of PGP. This is the
2611 default option, so it is not generally needed, but it may be useful to
2612 override a different compliance option in the gpg.conf file.
2616 Reset all packet, cipher and digest options to strict OpenPGP
2617 behavior. Use this option to reset all previous options like
2618 @option{--s2k-*}, @option{--cipher-algo}, @option{--digest-algo} and
2619 @option{--compress-algo} to OpenPGP compliant values. All PGP
2620 workarounds are disabled.
2624 Reset all packet, cipher and digest options to strict RFC-4880
2625 behavior. Note that this is currently the same thing as
2630 Enable experimental features from proposed updates to RFC-4880. This
2631 option can be used in addition to the other compliance options.
2632 Warning: The behavior may change with any GnuPG release and created
2633 keys or data may not be usable with future GnuPG versions.
2637 Reset all packet, cipher and digest options to strict RFC-2440
2642 Set up all options to be as PGP 6 compliant as possible. This
2643 restricts you to the ciphers IDEA (if the IDEA plugin is installed),
2644 3DES, and CAST5, the hashes MD5, SHA1 and RIPEMD160, and the
2645 compression algorithms none and ZIP. This also disables
2646 @option{--throw-keyids}, and making signatures with signing subkeys as PGP 6
2647 does not understand signatures made by signing subkeys.
2649 This option implies @option{--disable-mdc --escape-from-lines}.
2653 Set up all options to be as PGP 7 compliant as possible. This is
2654 identical to @option{--pgp6} except that MDCs are not disabled, and the
2655 list of allowable ciphers is expanded to add AES128, AES192, AES256, and
2660 Set up all options to be as PGP 8 compliant as possible. PGP 8 is a lot
2661 closer to the OpenPGP standard than previous versions of PGP, so all
2662 this does is disable @option{--throw-keyids} and set
2663 @option{--escape-from-lines}. All algorithms are allowed except for the
2664 SHA224, SHA384, and SHA512 digests.
2666 @item --compliance @var{string}
2668 This option can be used instead of one of the options above. Valid
2669 values for @var{string} are the above option names (without the double
2670 dash) and possibly others as shown when using "help" for @var{value}.
2675 @c *******************************************
2676 @c ******** ESOTERIC OPTIONS ***************
2677 @c *******************************************
2678 @node GPG Esoteric Options
2679 @subsection Doing things one usually doesn't want to do
2686 Don't make any changes (this is not completely implemented).
2690 Changes the behaviour of some commands. This is like @option{--dry-run} but
2691 different in some cases. The semantic of this option may be extended in
2692 the future. Currently it only skips the actual decryption pass and
2693 therefore enables a fast listing of the encryption keys.
2696 @itemx --interactive
2697 @opindex interactive
2698 Prompt before overwriting any files.
2700 @item --debug-level @var{level}
2701 @opindex debug-level
2702 Select the debug level for investigating problems. @var{level} may be
2703 a numeric value or by a keyword:
2707 No debugging at all. A value of less than 1 may be used instead of
2710 Some basic debug messages. A value between 1 and 2 may be used
2711 instead of the keyword.
2713 More verbose debug messages. A value between 3 and 5 may be used
2714 instead of the keyword.
2716 Even more detailed messages. A value between 6 and 8 may be used
2717 instead of the keyword.
2719 All of the debug messages you can get. A value greater than 8 may be
2720 used instead of the keyword. The creation of hash tracing files is
2721 only enabled if the keyword is used.
2724 How these messages are mapped to the actual debugging flags is not
2725 specified and may change with newer releases of this program. They are
2726 however carefully selected to best aid in debugging.
2728 @item --debug @var{flags}
2730 Set debugging flags. All flags are or-ed and @var{flags} may be given
2731 in C syntax (e.g. 0x0042) or as a comma separated list of flag names.
2732 To get a list of all supported flags the single word "help" can be
2737 Set all useful debugging flags.
2740 @opindex debug-iolbf
2741 Set stdout into line buffered mode. This option is only honored when
2742 given on the command line.
2744 @item --faked-system-time @var{epoch}
2745 @opindex faked-system-time
2746 This option is only useful for testing; it sets the system time back or
2747 forth to @var{epoch} which is the number of seconds elapsed since the year
2748 1970. Alternatively @var{epoch} may be given as a full ISO time string
2749 (e.g. "20070924T154812").
2751 @item --enable-progress-filter
2752 @opindex enable-progress-filter
2753 Enable certain PROGRESS status outputs. This option allows frontends
2754 to display a progress indicator while gpg is processing larger files.
2755 There is a slight performance overhead using it.
2757 @item --status-fd @code{n}
2759 Write special status strings to the file descriptor @code{n}.
2760 See the file DETAILS in the documentation for a listing of them.
2762 @item --status-file @code{file}
2763 @opindex status-file
2764 Same as @option{--status-fd}, except the status data is written to file
2767 @item --logger-fd @code{n}
2769 Write log output to file descriptor @code{n} and not to STDERR.
2771 @item --log-file @code{file}
2772 @itemx --logger-file @code{file}
2774 Same as @option{--logger-fd}, except the logger data is written to
2775 file @code{file}. Use @file{socket://} to log to socket.
2777 @item --attribute-fd @code{n}
2778 @opindex attribute-fd
2779 Write attribute subpackets to the file descriptor @code{n}. This is most
2780 useful for use with @option{--status-fd}, since the status messages are
2781 needed to separate out the various subpackets from the stream delivered
2782 to the file descriptor.
2784 @item --attribute-file @code{file}
2785 @opindex attribute-file
2786 Same as @option{--attribute-fd}, except the attribute data is written to
2789 @item --comment @code{string}
2790 @itemx --no-comments
2792 Use @code{string} as a comment string in cleartext signatures and ASCII
2793 armored messages or keys (see @option{--armor}). The default behavior is
2794 not to use a comment string. @option{--comment} may be repeated multiple
2795 times to get multiple comment strings. @option{--no-comments} removes
2796 all comments. It is a good idea to keep the length of a single comment
2797 below 60 characters to avoid problems with mail programs wrapping such
2798 lines. Note that comment lines, like all other header lines, are not
2799 protected by the signature.
2801 @item --emit-version
2802 @itemx --no-emit-version
2803 @opindex emit-version
2804 Force inclusion of the version string in ASCII armored output. If
2805 given once only the name of the program and the major number is
2806 emitted, given twice the minor is also emitted, given thrice
2807 the micro is added, and given four times an operating system identification
2808 is also emitted. @option{--no-emit-version} (default) disables the version
2811 @item --sig-notation @code{name=value}
2812 @itemx --cert-notation @code{name=value}
2813 @itemx -N, --set-notation @code{name=value}
2814 @opindex sig-notation
2815 @opindex cert-notation
2816 @opindex set-notation
2817 Put the name value pair into the signature as notation data.
2818 @code{name} must consist only of printable characters or spaces, and
2819 must contain a '@@' character in the form keyname@@domain.example.com
2820 (substituting the appropriate keyname and domain name, of course). This
2821 is to help prevent pollution of the IETF reserved notation
2822 namespace. The @option{--expert} flag overrides the '@@'
2823 check. @code{value} may be any printable string; it will be encoded in
2824 UTF-8, so you should check that your @option{--display-charset} is set
2825 correctly. If you prefix @code{name} with an exclamation mark (!), the
2826 notation data will be flagged as critical
2827 (rfc4880:5.2.3.16). @option{--sig-notation} sets a notation for data
2828 signatures. @option{--cert-notation} sets a notation for key signatures
2829 (certifications). @option{--set-notation} sets both.
2831 There are special codes that may be used in notation names. "%k" will
2832 be expanded into the key ID of the key being signed, "%K" into the
2833 long key ID of the key being signed, "%f" into the fingerprint of the
2834 key being signed, "%s" into the key ID of the key making the
2835 signature, "%S" into the long key ID of the key making the signature,
2836 "%g" into the fingerprint of the key making the signature (which might
2837 be a subkey), "%p" into the fingerprint of the primary key of the key
2838 making the signature, "%c" into the signature count from the OpenPGP
2839 smartcard, and "%%" results in a single "%". %k, %K, and %f are only
2840 meaningful when making a key signature (certification), and %c is only
2841 meaningful when using the OpenPGP smartcard.
2843 @item --sig-policy-url @code{string}
2844 @itemx --cert-policy-url @code{string}
2845 @itemx --set-policy-url @code{string}
2846 @opindex sig-policy-url
2847 @opindex cert-policy-url
2848 @opindex set-policy-url
2849 Use @code{string} as a Policy URL for signatures (rfc4880:5.2.3.20). If
2850 you prefix it with an exclamation mark (!), the policy URL packet will
2851 be flagged as critical. @option{--sig-policy-url} sets a policy url for
2852 data signatures. @option{--cert-policy-url} sets a policy url for key
2853 signatures (certifications). @option{--set-policy-url} sets both.
2855 The same %-expandos used for notation data are available here as well.
2857 @item --sig-keyserver-url @code{string}
2858 @opindex sig-keyserver-url
2859 Use @code{string} as a preferred keyserver URL for data signatures. If
2860 you prefix it with an exclamation mark (!), the keyserver URL packet
2861 will be flagged as critical.
2863 The same %-expandos used for notation data are available here as well.
2865 @item --set-filename @code{string}
2866 @opindex set-filename
2867 Use @code{string} as the filename which is stored inside messages.
2868 This overrides the default, which is to use the actual filename of the
2869 file being encrypted. Using the empty string for @code{string}
2870 effectively removes the filename from the output.
2872 @item --for-your-eyes-only
2873 @itemx --no-for-your-eyes-only
2874 @opindex for-your-eyes-only
2875 Set the `for your eyes only' flag in the message. This causes GnuPG to
2876 refuse to save the file unless the @option{--output} option is given,
2877 and PGP to use a "secure viewer" with a claimed Tempest-resistant font
2878 to display the message. This option overrides @option{--set-filename}.
2879 @option{--no-for-your-eyes-only} disables this option.
2881 @item --use-embedded-filename
2882 @itemx --no-use-embedded-filename
2883 @opindex use-embedded-filename
2884 Try to create a file with a name as embedded in the data. This can be
2885 a dangerous option as it enables overwriting files. Defaults to no.
2887 @item --cipher-algo @code{name}
2888 @opindex cipher-algo
2889 Use @code{name} as cipher algorithm. Running the program with the
2890 command @option{--version} yields a list of supported algorithms. If
2891 this is not used the cipher algorithm is selected from the preferences
2892 stored with the key. In general, you do not want to use this option as
2893 it allows you to violate the OpenPGP standard.
2894 @option{--personal-cipher-preferences} is the safe way to accomplish the
2897 @item --digest-algo @code{name}
2898 @opindex digest-algo
2899 Use @code{name} as the message digest algorithm. Running the program
2900 with the command @option{--version} yields a list of supported algorithms. In
2901 general, you do not want to use this option as it allows you to
2902 violate the OpenPGP standard. @option{--personal-digest-preferences} is the
2903 safe way to accomplish the same thing.
2905 @item --compress-algo @code{name}
2906 @opindex compress-algo
2907 Use compression algorithm @code{name}. "zlib" is RFC-1950 ZLIB
2908 compression. "zip" is RFC-1951 ZIP compression which is used by PGP.
2909 "bzip2" is a more modern compression scheme that can compress some
2910 things better than zip or zlib, but at the cost of more memory used
2911 during compression and decompression. "uncompressed" or "none"
2912 disables compression. If this option is not used, the default
2913 behavior is to examine the recipient key preferences to see which
2914 algorithms the recipient supports. If all else fails, ZIP is used for
2915 maximum compatibility.
2917 ZLIB may give better compression results than ZIP, as the compression
2918 window size is not limited to 8k. BZIP2 may give even better
2919 compression results than that, but will use a significantly larger
2920 amount of memory while compressing and decompressing. This may be
2921 significant in low memory situations. Note, however, that PGP (all
2922 versions) only supports ZIP compression. Using any algorithm other
2923 than ZIP or "none" will make the message unreadable with PGP. In
2924 general, you do not want to use this option as it allows you to
2925 violate the OpenPGP standard. @option{--personal-compress-preferences} is the
2926 safe way to accomplish the same thing.
2928 @item --cert-digest-algo @code{name}
2929 @opindex cert-digest-algo
2930 Use @code{name} as the message digest algorithm used when signing a
2931 key. Running the program with the command @option{--version} yields a
2932 list of supported algorithms. Be aware that if you choose an algorithm
2933 that GnuPG supports but other OpenPGP implementations do not, then some
2934 users will not be able to use the key signatures you make, or quite
2935 possibly your entire key.
2937 @item --disable-cipher-algo @code{name}
2938 @opindex disable-cipher-algo
2939 Never allow the use of @code{name} as cipher algorithm.
2940 The given name will not be checked so that a later loaded algorithm
2941 will still get disabled.
2943 @item --disable-pubkey-algo @code{name}
2944 @opindex disable-pubkey-algo
2945 Never allow the use of @code{name} as public key algorithm.
2946 The given name will not be checked so that a later loaded algorithm
2947 will still get disabled.
2949 @item --throw-keyids
2950 @itemx --no-throw-keyids
2951 @opindex throw-keyids
2952 Do not put the recipient key IDs into encrypted messages. This helps to
2953 hide the receivers of the message and is a limited countermeasure
2954 against traffic analysis.@footnote{Using a little social engineering
2955 anyone who is able to decrypt the message can check whether one of the
2956 other recipients is the one he suspects.} On the receiving side, it may
2957 slow down the decryption process because all available secret keys must
2958 be tried. @option{--no-throw-keyids} disables this option. This option
2959 is essentially the same as using @option{--hidden-recipient} for all
2962 @item --not-dash-escaped
2963 @opindex not-dash-escaped
2964 This option changes the behavior of cleartext signatures
2965 so that they can be used for patch files. You should not
2966 send such an armored file via email because all spaces
2967 and line endings are hashed too. You can not use this
2968 option for data which has 5 dashes at the beginning of a
2969 line, patch files don't have this. A special armor header
2970 line tells GnuPG about this cleartext signature option.
2972 @item --escape-from-lines
2973 @itemx --no-escape-from-lines
2974 @opindex escape-from-lines
2975 Because some mailers change lines starting with "From " to ">From " it
2976 is good to handle such lines in a special way when creating cleartext
2977 signatures to prevent the mail system from breaking the signature. Note
2978 that all other PGP versions do it this way too. Enabled by
2979 default. @option{--no-escape-from-lines} disables this option.
2981 @item --passphrase-repeat @code{n}
2982 @opindex passphrase-repeat
2983 Specify how many times @command{@gpgname} will request a new
2984 passphrase be repeated. This is useful for helping memorize a
2985 passphrase. Defaults to 1 repetition.
2987 @item --passphrase-fd @code{n}
2988 @opindex passphrase-fd
2989 Read the passphrase from file descriptor @code{n}. Only the first line
2990 will be read from file descriptor @code{n}. If you use 0 for @code{n},
2991 the passphrase will be read from STDIN. This can only be used if only
2992 one passphrase is supplied.
2994 Note that this passphrase is only used if the option @option{--batch}
2995 has also been given. This is different from GnuPG version 1.x.
2997 @item --passphrase-file @code{file}
2998 @opindex passphrase-file
2999 Read the passphrase from file @code{file}. Only the first line will
3000 be read from file @code{file}. This can only be used if only one
3001 passphrase is supplied. Obviously, a passphrase stored in a file is
3002 of questionable security if other users can read this file. Don't use
3003 this option if you can avoid it.
3004 Note that this passphrase is only used if the option @option{--batch}
3005 has also been given. This is different from GnuPG version 1.x.
3007 @item --passphrase @code{string}
3009 Use @code{string} as the passphrase. This can only be used if only one
3010 passphrase is supplied. Obviously, this is of very questionable
3011 security on a multi-user system. Don't use this option if you can
3013 Note that this passphrase is only used if the option @option{--batch}
3014 has also been given. This is different from GnuPG version 1.x.
3016 @item --pinentry-mode @code{mode}
3017 @opindex pinentry-mode
3018 Set the pinentry mode to @code{mode}. Allowed values for @code{mode}
3022 Use the default of the agent, which is @code{ask}.
3024 Force the use of the Pinentry.
3026 Emulate use of Pinentry's cancel button.
3028 Return a Pinentry error (``No Pinentry'').
3030 Redirect Pinentry queries to the caller. Note that in contrast to
3031 Pinentry the user is not prompted again if he enters a bad password.
3034 @item --command-fd @code{n}
3036 This is a replacement for the deprecated shared-memory IPC mode.
3037 If this option is enabled, user input on questions is not expected
3038 from the TTY but from the given file descriptor. It should be used
3039 together with @option{--status-fd}. See the file doc/DETAILS in the source
3040 distribution for details on how to use it.
3042 @item --command-file @code{file}
3043 @opindex command-file
3044 Same as @option{--command-fd}, except the commands are read out of file
3047 @item --allow-non-selfsigned-uid
3048 @itemx --no-allow-non-selfsigned-uid
3049 @opindex allow-non-selfsigned-uid
3050 Allow the import and use of keys with user IDs which are not
3051 self-signed. This is not recommended, as a non self-signed user ID is
3052 trivial to forge. @option{--no-allow-non-selfsigned-uid} disables.
3054 @item --allow-freeform-uid
3055 @opindex allow-freeform-uid
3056 Disable all checks on the form of the user ID while generating a new
3057 one. This option should only be used in very special environments as
3058 it does not ensure the de-facto standard format of user IDs.
3060 @item --ignore-time-conflict
3061 @opindex ignore-time-conflict
3062 GnuPG normally checks that the timestamps associated with keys and
3063 signatures have plausible values. However, sometimes a signature
3064 seems to be older than the key due to clock problems. This option
3065 makes these checks just a warning. See also @option{--ignore-valid-from} for
3066 timestamp issues on subkeys.
3068 @item --ignore-valid-from
3069 @opindex ignore-valid-from
3070 GnuPG normally does not select and use subkeys created in the future.
3071 This option allows the use of such keys and thus exhibits the
3072 pre-1.0.7 behaviour. You should not use this option unless there
3073 is some clock problem. See also @option{--ignore-time-conflict} for timestamp
3074 issues with signatures.
3076 @item --ignore-crc-error
3077 @opindex ignore-crc-error
3078 The ASCII armor used by OpenPGP is protected by a CRC checksum against
3079 transmission errors. Occasionally the CRC gets mangled somewhere on
3080 the transmission channel but the actual content (which is protected by
3081 the OpenPGP protocol anyway) is still okay. This option allows GnuPG
3082 to ignore CRC errors.
3084 @item --ignore-mdc-error
3085 @opindex ignore-mdc-error
3086 This option changes a MDC integrity protection failure into a warning.
3087 This can be useful if a message is partially corrupt, but it is
3088 necessary to get as much data as possible out of the corrupt message.
3089 However, be aware that a MDC protection failure may also mean that the
3090 message was tampered with intentionally by an attacker.
3092 @item --allow-weak-digest-algos
3093 @opindex allow-weak-digest-algos
3094 Signatures made with known-weak digest algorithms are normally
3095 rejected with an ``invalid digest algorithm'' message. This option
3096 allows the verification of signatures made with such weak algorithms.
3097 MD5 is the only digest algorithm considered weak by default. See also
3098 @option{--weak-digest} to reject other digest algorithms.
3100 @item --weak-digest @code{name}
3101 @opindex weak-digest
3102 Treat the specified digest algorithm as weak. Signatures made over
3103 weak digests algorithms are normally rejected. This option can be
3104 supplied multiple times if multiple algorithms should be considered
3105 weak. See also @option{--allow-weak-digest-algos} to disable
3106 rejection of weak digests. MD5 is always considered weak, and does
3107 not need to be listed explicitly.
3109 @item --no-default-keyring
3110 @opindex no-default-keyring
3111 Do not add the default keyrings to the list of keyrings. Note that
3112 GnuPG will not operate without any keyrings, so if you use this option
3113 and do not provide alternate keyrings via @option{--keyring} or
3114 @option{--secret-keyring}, then GnuPG will still use the default public or
3119 Do not add use any keyrings even if specified as options.
3122 @opindex skip-verify
3123 Skip the signature verification step. This may be
3124 used to make the decryption faster if the signature
3125 verification is not needed.
3127 @item --with-key-data
3128 @opindex with-key-data
3129 Print key listings delimited by colons (like @option{--with-colons}) and
3130 print the public key data.
3132 @item --fast-list-mode
3133 @opindex fast-list-mode
3134 Changes the output of the list commands to work faster; this is achieved
3135 by leaving some parts empty. Some applications don't need the user ID
3136 and the trust information given in the listings. By using this options
3137 they can get a faster listing. The exact behaviour of this option may
3138 change in future versions. If you are missing some information, don't
3143 This is not for normal use. Use the source to see for what it might be useful.
3145 @item --set-filesize
3146 @opindex set-filesize
3147 This is not for normal use. Use the source to see for what it might be useful.
3149 @item --show-session-key
3150 @opindex show-session-key
3151 Display the session key used for one message. See
3152 @option{--override-session-key} for the counterpart of this option.
3154 We think that Key Escrow is a Bad Thing; however the user should have
3155 the freedom to decide whether to go to prison or to reveal the content
3156 of one specific message without compromising all messages ever
3157 encrypted for one secret key.
3159 You can also use this option if you receive an encrypted message which
3160 is abusive or offensive, to prove to the administrators of the
3161 messaging system that the ciphertext transmitted corresponds to an
3162 inappropriate plaintext so they can take action against the offending
3165 @item --override-session-key @code{string}
3166 @itemx --override-session-key-fd @code{fd}
3167 @opindex override-session-key
3168 Don't use the public key but the session key @code{string} respective
3169 the session key taken from the first line read from file descriptor
3170 @code{fd}. The format of this string is the same as the one printed
3171 by @option{--show-session-key}. This option is normally not used but
3172 comes handy in case someone forces you to reveal the content of an
3173 encrypted message; using this option you can do this without handing
3174 out the secret key. Note that using @option{--override-session-key}
3175 may reveal the session key to all local users via the global process
3178 @item --ask-sig-expire
3179 @itemx --no-ask-sig-expire
3180 @opindex ask-sig-expire
3181 When making a data signature, prompt for an expiration time. If this
3182 option is not specified, the expiration time set via
3183 @option{--default-sig-expire} is used. @option{--no-ask-sig-expire}
3184 disables this option.
3186 @item --default-sig-expire
3187 @opindex default-sig-expire
3188 The default expiration time to use for signature expiration. Valid
3189 values are "0" for no expiration, a number followed by the letter d
3190 (for days), w (for weeks), m (for months), or y (for years) (for
3191 example "2m" for two months, or "5y" for five years), or an absolute
3192 date in the form YYYY-MM-DD. Defaults to "0".
3194 @item --ask-cert-expire
3195 @itemx --no-ask-cert-expire
3196 @opindex ask-cert-expire
3197 When making a key signature, prompt for an expiration time. If this
3198 option is not specified, the expiration time set via
3199 @option{--default-cert-expire} is used. @option{--no-ask-cert-expire}
3200 disables this option.
3202 @item --default-cert-expire
3203 @opindex default-cert-expire
3204 The default expiration time to use for key signature expiration.
3205 Valid values are "0" for no expiration, a number followed by the
3206 letter d (for days), w (for weeks), m (for months), or y (for years)
3207 (for example "2m" for two months, or "5y" for five years), or an
3208 absolute date in the form YYYY-MM-DD. Defaults to "0".
3210 @item --default-new-key-algo @var{string}
3211 @opindex default-new-key-algo @var{string}
3212 This option can be used to change the default algorithms for key
3213 generation. Note that the advanced key generation commands can always
3214 be used to specify a key algorithm directly. Please consult the
3215 source code to learn the syntax of @var{string}.
3217 @item --allow-secret-key-import
3218 @opindex allow-secret-key-import
3219 This is an obsolete option and is not used anywhere.
3221 @item --allow-multiple-messages
3222 @item --no-allow-multiple-messages
3223 @opindex allow-multiple-messages
3224 Allow processing of multiple OpenPGP messages contained in a single file
3225 or stream. Some programs that call GPG are not prepared to deal with
3226 multiple messages being processed together, so this option defaults to
3227 no. Note that versions of GPG prior to 1.4.7 always allowed multiple
3230 Warning: Do not use this option unless you need it as a temporary
3234 @item --enable-special-filenames
3235 @opindex enable-special-filenames
3236 This option enables a mode in which filenames of the form
3237 @file{-&n}, where n is a non-negative decimal number,
3238 refer to the file descriptor n and not to a file with that name.
3240 @item --no-expensive-trust-checks
3241 @opindex no-expensive-trust-checks
3242 Experimental use only.
3244 @item --preserve-permissions
3245 @opindex preserve-permissions
3246 Don't change the permissions of a secret keyring back to user
3247 read/write only. Use this option only if you really know what you are doing.
3249 @item --default-preference-list @code{string}
3250 @opindex default-preference-list
3251 Set the list of default preferences to @code{string}. This preference
3252 list is used for new keys and becomes the default for "setpref" in the
3255 @item --default-keyserver-url @code{name}
3256 @opindex default-keyserver-url
3257 Set the default keyserver URL to @code{name}. This keyserver will be
3258 used as the keyserver URL when writing a new self-signature on a key,
3259 which includes key generation and changing preferences.
3262 @opindex list-config
3263 Display various internal configuration parameters of GnuPG. This option
3264 is intended for external programs that call GnuPG to perform tasks, and
3265 is thus not generally useful. See the file @file{doc/DETAILS} in the
3266 source distribution for the details of which configuration items may be
3267 listed. @option{--list-config} is only usable with
3268 @option{--with-colons} set.
3270 @item --list-gcrypt-config
3271 @opindex list-gcrypt-config
3272 Display various internal configuration parameters of Libgcrypt.
3274 @item --gpgconf-list
3275 @opindex gpgconf-list
3276 This command is similar to @option{--list-config} but in general only
3277 internally used by the @command{gpgconf} tool.
3279 @item --gpgconf-test
3280 @opindex gpgconf-test
3281 This is more or less dummy action. However it parses the configuration
3282 file and returns with failure if the configuration file would prevent
3283 @command{@gpgname} from startup. Thus it may be used to run a syntax check
3284 on the configuration file.
3288 @c *******************************
3289 @c ******* Deprecated ************
3290 @c *******************************
3291 @node Deprecated Options
3292 @subsection Deprecated options
3297 @itemx --no-show-photos
3298 @opindex show-photos
3299 Causes @option{--list-keys}, @option{--list-signatures},
3300 @option{--list-public-keys}, @option{--list-secret-keys}, and verifying
3301 a signature to also display the photo ID attached to the key, if
3302 any. See also @option{--photo-viewer}. These options are deprecated. Use
3303 @option{--list-options [no-]show-photos} and/or @option{--verify-options
3304 [no-]show-photos} instead.
3306 @item --show-keyring
3307 @opindex show-keyring
3308 Display the keyring name at the head of key listings to show which
3309 keyring a given key resides on. This option is deprecated: use
3310 @option{--list-options [no-]show-keyring} instead.
3312 @item --always-trust
3313 @opindex always-trust
3314 Identical to @option{--trust-model always}. This option is deprecated.
3316 @item --show-notation
3317 @itemx --no-show-notation
3318 @opindex show-notation
3319 Show signature notations in the @option{--list-signatures} or @option{--check-signatures} listings
3320 as well as when verifying a signature with a notation in it. These
3321 options are deprecated. Use @option{--list-options [no-]show-notation}
3322 and/or @option{--verify-options [no-]show-notation} instead.
3324 @item --show-policy-url
3325 @itemx --no-show-policy-url
3326 @opindex show-policy-url
3327 Show policy URLs in the @option{--list-signatures} or @option{--check-signatures}
3328 listings as well as when verifying a signature with a policy URL in
3329 it. These options are deprecated. Use @option{--list-options
3330 [no-]show-policy-url} and/or @option{--verify-options
3331 [no-]show-policy-url} instead.
3337 @c *******************************************
3338 @c *************** ****************
3339 @c *************** FILES ****************
3340 @c *************** ****************
3341 @c *******************************************
3343 @node GPG Configuration
3344 @section Configuration files
3346 There are a few configuration files to control certain aspects of
3347 @command{@gpgname}'s operation. Unless noted, they are expected in the
3348 current home directory (@pxref{option --homedir}).
3354 This is the standard configuration file read by @command{@gpgname} on
3355 startup. It may contain any valid long option; the leading two dashes
3356 may not be entered and the option may not be abbreviated. This default
3357 name may be changed on the command line (@pxref{gpg-option --options}).
3358 You should backup this file.
3362 Note that on larger installations, it is useful to put predefined files
3363 into the directory @file{@value{SYSCONFSKELDIR}} so that
3364 newly created users start up with a working configuration.
3365 For existing users a small
3366 helper script is provided to create these files (@pxref{addgnupghome}).
3368 For internal purposes @command{@gpgname} creates and maintains a few other
3369 files; They all live in in the current home directory (@pxref{option
3370 --homedir}). Only the @command{@gpgname} program may modify these files.
3376 This is the default home directory which is used if neither the
3377 environment variable @code{GNUPGHOME} nor the option
3378 @option{--homedir} is given.
3380 @item ~/.gnupg/pubring.gpg
3381 @efindex pubring.gpg
3382 The public keyring. You should backup this file.
3384 @item ~/.gnupg/pubring.gpg.lock
3385 The lock file for the public keyring.
3387 @item ~/.gnupg/pubring.kbx
3388 @efindex pubring.kbx
3389 The public keyring using a different format. This file is shared
3390 with @command{gpgsm}. You should backup this file.
3392 @item ~/.gnupg/pubring.kbx.lock
3393 The lock file for @file{pubring.kbx}.
3395 @item ~/.gnupg/secring.gpg
3396 @efindex secring.gpg
3397 A secret keyring as used by GnuPG versions before 2.1. It is not
3398 used by GnuPG 2.1 and later.
3400 @item ~/.gnupg/secring.gpg.lock
3401 The lock file for the secret keyring.
3403 @item ~/.gnupg/.gpg-v21-migrated
3404 @efindex .gpg-v21-migrated
3405 File indicating that a migration to GnuPG 2.1 has been done.
3407 @item ~/.gnupg/trustdb.gpg
3408 @efindex trustdb.gpg
3409 The trust database. There is no need to backup this file; it is better
3410 to backup the ownertrust values (@pxref{option --export-ownertrust}).
3412 @item ~/.gnupg/trustdb.gpg.lock
3413 The lock file for the trust database.
3415 @item ~/.gnupg/random_seed
3416 @efindex random_seed
3417 A file used to preserve the state of the internal random pool.
3419 @item ~/.gnupg/openpgp-revocs.d/
3420 @efindex openpgp-revocs.d
3421 This is the directory where gpg stores pre-generated revocation
3422 certificates. The file name corresponds to the OpenPGP fingerprint of
3423 the respective key. It is suggested to backup those certificates and
3424 if the primary private key is not stored on the disk to move them to
3425 an external storage device. Anyone who can access theses files is
3426 able to revoke the corresponding key. You may want to print them out.
3427 You should backup all files in this directory and take care to keep
3428 this backup closed away.
3430 @item @value{DATADIR}/options.skel
3431 @efindex options.skel
3432 The skeleton options file.
3436 Operation is further controlled by a few environment variables:
3442 Used to locate the default home directory.
3446 If set directory used instead of "~/.gnupg".
3448 @item GPG_AGENT_INFO
3449 This variable is obsolete; it was used by GnuPG versions before 2.1.
3451 @item PINENTRY_USER_DATA
3452 @efindex PINENTRY_USER_DATA
3453 This value is passed via gpg-agent to pinentry. It is useful to convey
3454 extra information to a custom pinentry.
3460 Used to size some displays to the full size of the screen.
3464 Apart from its use by GNU, it is used in the W32 version to override the
3465 language selection done through the Registry. If used and set to a
3466 valid and available language name (@var{langid}), the file with the
3467 translation is loaded from
3468 @code{@var{gpgdir}/gnupg.nls/@var{langid}.mo}. Here @var{gpgdir} is the
3469 directory out of which the gpg binary has been loaded. If it can't be
3470 loaded the Registry is tried and as last resort the native Windows
3471 locale system is used.
3476 @c *******************************************
3477 @c *************** ****************
3478 @c *************** EXAMPLES ****************
3479 @c *************** ****************
3480 @c *******************************************
3487 @item gpg -se -r @code{Bob} @code{file}
3488 sign and encrypt for user Bob
3490 @item gpg --clear-sign @code{file}
3491 make a cleartext signature
3493 @item gpg -sb @code{file}
3494 make a detached signature
3496 @item gpg -u 0x12345678 -sb @code{file}
3497 make a detached signature with the key 0x12345678
3499 @item gpg --list-keys @code{user_ID}
3502 @item gpg --fingerprint @code{user_ID}
3505 @item gpg --verify @code{pgpfile}
3506 @itemx gpg --verify @code{sigfile} [@code{datafile}]
3507 Verify the signature of the file but do not output the data unless
3508 requested. The second form is used for detached signatures, where
3509 @code{sigfile} is the detached signature (either ASCII armored or
3510 binary) and @code{datafile} are the signed data; if this is not given, the name of the
3511 file holding the signed data is constructed by cutting off the
3512 extension (".asc" or ".sig") of @code{sigfile} or by asking the user
3513 for the filename. If the option @option{--output} is also used the
3514 signed data is written to the file specified by that option; use
3515 @code{-} to write the signed data to stdout.
3519 @c *******************************************
3520 @c *************** ****************
3521 @c *************** USER ID ****************
3522 @c *************** ****************
3523 @c *******************************************
3524 @mansect how to specify a user id
3526 @include specify-user-id.texi
3529 @mansect filter expressions
3530 @chapheading FILTER EXPRESSIONS
3532 The options @option{--import-filter} and @option{--export-filter} use
3533 expressions with this syntax (square brackets indicate an optional
3534 part and curly braces a repetition, white space between the elements
3539 [lc] @{[@{flag@}] PROPNAME op VALUE [lc]@}
3543 The name of a property (@var{PROPNAME}) may only consist of letters,
3544 digits and underscores. The description for the filter type
3545 describes which properties are defined. If an undefined property is
3546 used it evaluates to the empty string. Unless otherwise noted, the
3547 @var{VALUE} must always be given and may not be the empty string. No
3548 quoting is defined for the value, thus the value may not contain the
3549 strings @code{&&} or @code{||}, which are used as logical connection
3550 operators. The flag @code{--} can be used to remove this restriction.
3552 Numerical values are computed as long int; standard C notation
3553 applies. @var{lc} is the logical connection operator; either
3554 @code{&&} for a conjunction or @code{||} for a disjunction. A
3555 conjunction is assumed at the begin of an expression. Conjunctions
3556 have higher precedence than disjunctions. If @var{VALUE} starts with
3557 one of the characters used in any @var{op} a space after the
3558 @var{op} is required.
3561 The supported operators (@var{op}) are:
3566 Substring must match.
3569 Substring must not match.
3572 The full string must match.
3575 The full string must not match.
3578 The numerical value must match.
3581 The numerical value must not match.
3584 The numerical value of the field must be LE than the value.
3587 The numerical value of the field must be LT than the value.
3590 The numerical value of the field must be GT than the value.
3593 The numerical value of the field must be GE than the value.
3596 The string value of the field must be less or equal than the value.
3599 The string value of the field must be less than the value.
3602 The string value of the field must be greater than the value.
3605 The string value of the field must be greater or equal than the value.
3608 True if value is not empty (no value allowed).
3611 True if value is empty (no value allowed).
3614 Alias for "PROPNAME != 0" (no value allowed).
3617 Alias for "PROPNAME == 0" (no value allowed).
3622 Values for @var{flag} must be space separated. The supported flags
3627 @var{VALUE} spans to the end of the expression.
3629 The string match in this part is done case-sensitive.
3632 The filter options concatenate several specifications for a filter of
3633 the same type. For example the four options in this example:
3637 --import-option keep-uid="uid =~ Alfa"
3638 --import-option keep-uid="&& uid !~ Test"
3639 --import-option keep-uid="|| uid =~ Alpha"
3640 --import-option keep-uid="uid !~ Test"
3645 which is equivalent to
3650 keep-uid="uid =~ Alfa" && uid !~ Test" || uid =~ Alpha" && "uid !~ Test"
3654 imports only the user ids of a key containing the strings "Alfa"
3655 or "Alpha" but not the string "test".
3658 @mansect return value
3659 @chapheading RETURN VALUE
3661 The program returns 0 if everything was fine, 1 if at least
3662 a signature was bad, and other error codes for fatal errors.
3665 @chapheading WARNINGS
3667 Use a *good* password for your user account and a *good* passphrase
3668 to protect your secret key. This passphrase is the weakest part of the
3669 whole system. Programs to do dictionary attacks on your secret keyring
3670 are very easy to write and so you should protect your "~/.gnupg/"
3671 directory very well.
3673 Keep in mind that, if this program is used over a network (telnet), it
3674 is *very* easy to spy out your passphrase!
3676 If you are going to verify detached signatures, make sure that the
3677 program knows about it; either give both filenames on the command line
3678 or use @samp{-} to specify STDIN.
3680 @mansect interoperability
3681 @chapheading INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS
3683 GnuPG tries to be a very flexible implementation of the OpenPGP
3684 standard. In particular, GnuPG implements many of the optional parts
3685 of the standard, such as the SHA-512 hash, and the ZLIB and BZIP2
3686 compression algorithms. It is important to be aware that not all
3687 OpenPGP programs implement these optional algorithms and that by
3688 forcing their use via the @option{--cipher-algo},
3689 @option{--digest-algo}, @option{--cert-digest-algo}, or
3690 @option{--compress-algo} options in GnuPG, it is possible to create a
3691 perfectly valid OpenPGP message, but one that cannot be read by the
3694 There are dozens of variations of OpenPGP programs available, and each
3695 supports a slightly different subset of these optional algorithms.
3696 For example, until recently, no (unhacked) version of PGP supported
3697 the BLOWFISH cipher algorithm. A message using BLOWFISH simply could
3698 not be read by a PGP user. By default, GnuPG uses the standard
3699 OpenPGP preferences system that will always do the right thing and
3700 create messages that are usable by all recipients, regardless of which
3701 OpenPGP program they use. Only override this safe default if you
3702 really know what you are doing.
3704 If you absolutely must override the safe default, or if the preferences
3705 on a given key are invalid for some reason, you are far better off using
3706 the @option{--pgp6}, @option{--pgp7}, or @option{--pgp8} options. These
3707 options are safe as they do not force any particular algorithms in
3708 violation of OpenPGP, but rather reduce the available algorithms to a
3714 On older systems this program should be installed as setuid(root). This
3715 is necessary to lock memory pages. Locking memory pages prevents the
3716 operating system from writing memory pages (which may contain
3717 passphrases or other sensitive material) to disk. If you get no
3718 warning message about insecure memory your operating system supports
3719 locking without being root. The program drops root privileges as soon
3720 as locked memory is allocated.
3722 Note also that some systems (especially laptops) have the ability to
3723 ``suspend to disk'' (also known as ``safe sleep'' or ``hibernate'').
3724 This writes all memory to disk before going into a low power or even
3725 powered off mode. Unless measures are taken in the operating system
3726 to protect the saved memory, passphrases or other sensitive material
3727 may be recoverable from it later.
3729 Before you report a bug you should first search the mailing list
3730 archives for similar problems and second check whether such a bug has
3731 already been reported to our bug tracker at http://bugs.gnupg.org .
3733 @c *******************************************
3734 @c *************** **************
3735 @c *************** UNATTENDED **************
3736 @c *************** **************
3737 @c *******************************************
3739 @node Unattended Usage of GPG
3740 @section Unattended Usage
3742 @command{@gpgname} is often used as a backend engine by other software. To help
3743 with this a machine interface has been defined to have an unambiguous
3744 way to do this. The options @option{--status-fd} and @option{--batch}
3745 are almost always required for this.
3748 * Programmatic use of GnuPG:: Programmatic use of GnuPG
3749 * Ephemeral home directories:: Ephemeral home directories
3750 * The quick key manipulation interface:: The quick key manipulation interface
3751 * Unattended GPG key generation:: Unattended key generation
3755 @node Programmatic use of GnuPG
3756 @subsection Programmatic use of GnuPG
3758 Please consider using GPGME instead of calling @command{@gpgname}
3759 directly. GPGME offers a stable, backend-independent interface for
3760 many cryptographic operations. It supports OpenPGP and S/MIME, and
3761 also allows interaction with various GnuPG components.
3763 GPGME provides a C-API, and comes with bindings for C++, Qt, and
3764 Python. Bindings for other languages are available.
3766 @node Ephemeral home directories
3767 @subsection Ephemeral home directories
3769 Sometimes you want to contain effects of some operation, for example
3770 you want to import a key to inspect it, but you do not want this key
3771 to be added to your keyring. In earlier versions of GnuPG, it was
3772 possible to specify alternate keyring files for both public and secret
3773 keys. In modern GnuPG versions, however, we changed how secret keys
3774 are stored in order to better protect secret key material, and it was
3775 not possible to preserve this interface.
3777 The preferred way to do this is to use ephemeral home directories.
3778 This technique works across all versions of GnuPG.
3780 Create a temporary directory, create (or copy) a configuration that
3781 meets your needs, make @command{@gpgname} use this directory either
3782 using the environment variable @var{GNUPGHOME}, or the option
3783 @option{--homedir}. GPGME supports this too on a per-context basis,
3784 by modifying the engine info of contexts. Now execute whatever
3785 operation you like, import and export key material as necessary. Once
3786 finished, you can delete the directory. All GnuPG backend services
3787 that were started will detect this and shut down.
3789 @node The quick key manipulation interface
3790 @subsection The quick key manipulation interface
3792 Recent versions of GnuPG have an interface to manipulate keys without
3793 using the interactive command @option{--edit-key}. This interface was
3794 added mainly for the benefit of GPGME (please consider using GPGME,
3795 see the manual subsection ``Programmatic use of GnuPG''). This
3796 interface is described in the subsection ``How to manage your keys''.
3798 @node Unattended GPG key generation
3799 @subsection Unattended key generation
3801 The command @option{--generate-key} may be used along with the option
3802 @option{--batch} for unattended key generation. This is the most
3803 flexible way of generating keys, but it is also the most complex one.
3804 Consider using the quick key manipulation interface described in the
3805 previous subsection ``The quick key manipulation interface''.
3807 The parameters for the key are either read from stdin or given as a
3808 file on the command line. The format of the parameter file is as
3812 @item Text only, line length is limited to about 1000 characters.
3813 @item UTF-8 encoding must be used to specify non-ASCII characters.
3814 @item Empty lines are ignored.
3815 @item Leading and trailing while space is ignored.
3816 @item A hash sign as the first non white space character indicates
3818 @item Control statements are indicated by a leading percent sign, the
3819 arguments are separated by white space from the keyword.
3820 @item Parameters are specified by a keyword, followed by a colon. Arguments
3821 are separated by white space.
3823 The first parameter must be @samp{Key-Type}; control statements may be
3826 The order of the parameters does not matter except for @samp{Key-Type}
3827 which must be the first parameter. The parameters are only used for
3828 the generated keyblock (primary and subkeys); parameters from previous
3829 sets are not used. Some syntactically checks may be performed.
3831 Key generation takes place when either the end of the parameter file
3832 is reached, the next @samp{Key-Type} parameter is encountered or at the
3833 control statement @samp{%commit} is encountered.
3841 @item %echo @var{text}
3842 Print @var{text} as diagnostic.
3845 Suppress actual key generation (useful for syntax checking).
3848 Perform the key generation. Note that an implicit commit is done at
3849 the next @asis{Key-Type} parameter.
3851 @item %pubring @var{filename}
3852 Do not write the key to the default or commandline given keyring but
3853 to @var{filename}. This must be given before the first commit to take
3854 place, duplicate specification of the same filename is ignored, the
3855 last filename before a commit is used. The filename is used until a
3856 new filename is used (at commit points) and all keys are written to
3857 that file. If a new filename is given, this file is created (and
3858 overwrites an existing one).
3860 See the previous subsection ``Ephemeral home directories'' for a more
3861 robust way to contain side-effects.
3863 @item %secring @var{filename}
3864 This option is a no-op for GnuPG 2.1 and later.
3866 See the previous subsection ``Ephemeral home directories''.
3868 @item %ask-passphrase
3869 @itemx %no-ask-passphrase
3870 This option is a no-op for GnuPG 2.1 and later.
3872 @item %no-protection
3873 Using this option allows the creation of keys without any passphrase
3874 protection. This option is mainly intended for regression tests.
3876 @item %transient-key
3877 If given the keys are created using a faster and a somewhat less
3878 secure random number generator. This option may be used for keys
3879 which are only used for a short time and do not require full
3880 cryptographic strength. It takes only effect if used together with
3881 the control statement @samp{%no-protection}.
3890 @item Key-Type: @var{algo}
3891 Starts a new parameter block by giving the type of the primary
3892 key. The algorithm must be capable of signing. This is a required
3893 parameter. @var{algo} may either be an OpenPGP algorithm number or a
3894 string with the algorithm name. The special value @samp{default} may
3895 be used for @var{algo} to create the default key type; in this case a
3896 @samp{Key-Usage} shall not be given and @samp{default} also be used
3897 for @samp{Subkey-Type}.
3899 @item Key-Length: @var{nbits}
3900 The requested length of the generated key in bits. The default is
3901 returned by running the command @samp{@gpgname --gpgconf-list}.
3903 @item Key-Grip: @var{hexstring}
3904 This is optional and used to generate a CSR or certificate for an
3905 already existing key. Key-Length will be ignored when given.
3907 @item Key-Usage: @var{usage-list}
3908 Space or comma delimited list of key usages. Allowed values are
3909 @samp{encrypt}, @samp{sign}, and @samp{auth}. This is used to
3910 generate the key flags. Please make sure that the algorithm is
3911 capable of this usage. Note that OpenPGP requires that all primary
3912 keys are capable of certification, so no matter what usage is given
3913 here, the @samp{cert} flag will be on. If no @samp{Key-Usage} is
3914 specified and the @samp{Key-Type} is not @samp{default}, all allowed
3915 usages for that particular algorithm are used; if it is not given but
3916 @samp{default} is used the usage will be @samp{sign}.
3918 @item Subkey-Type: @var{algo}
3919 This generates a secondary key (subkey). Currently only one subkey
3920 can be handled. See also @samp{Key-Type} above.
3922 @item Subkey-Length: @var{nbits}
3923 Length of the secondary key (subkey) in bits. The default is returned
3924 by running the command @samp{@gpgname --gpgconf-list}.
3926 @item Subkey-Usage: @var{usage-list}
3927 Key usage lists for a subkey; similar to @samp{Key-Usage}.
3929 @item Passphrase: @var{string}
3930 If you want to specify a passphrase for the secret key, enter it here.
3931 Default is to use the Pinentry dialog to ask for a passphrase.
3933 @item Name-Real: @var{name}
3934 @itemx Name-Comment: @var{comment}
3935 @itemx Name-Email: @var{email}
3936 The three parts of a user name. Remember to use UTF-8 encoding here.
3937 If you don't give any of them, no user ID is created.
3939 @item Expire-Date: @var{iso-date}|(@var{number}[d|w|m|y])
3940 Set the expiration date for the key (and the subkey). It may either
3941 be entered in ISO date format (e.g. "20000815T145012") or as number of
3942 days, weeks, month or years after the creation date. The special
3943 notation "seconds=N" is also allowed to specify a number of seconds
3944 since creation. Without a letter days are assumed. Note that there
3945 is no check done on the overflow of the type used by OpenPGP for
3946 timestamps. Thus you better make sure that the given value make
3947 sense. Although OpenPGP works with time intervals, GnuPG uses an
3948 absolute value internally and thus the last year we can represent is
3951 @item Creation-Date: @var{iso-date}
3952 Set the creation date of the key as stored in the key information and
3953 which is also part of the fingerprint calculation. Either a date like
3954 "1986-04-26" or a full timestamp like "19860426T042640" may be used.
3955 The time is considered to be UTC. The special notation "seconds=N"
3956 may be used to directly specify a the number of seconds since Epoch
3957 (Unix time). If it is not given the current time is used.
3959 @item Preferences: @var{string}
3960 Set the cipher, hash, and compression preference values for this key.
3961 This expects the same type of string as the sub-command @samp{setpref}
3962 in the @option{--edit-key} menu.
3964 @item Revoker: @var{algo}:@var{fpr} [sensitive]
3965 Add a designated revoker to the generated key. Algo is the public key
3966 algorithm of the designated revoker (i.e. RSA=1, DSA=17, etc.)
3967 @var{fpr} is the fingerprint of the designated revoker. The optional
3968 @samp{sensitive} flag marks the designated revoker as sensitive
3969 information. Only v4 keys may be designated revokers.
3971 @item Keyserver: @var{string}
3972 This is an optional parameter that specifies the preferred keyserver
3975 @item Handle: @var{string}
3976 This is an optional parameter only used with the status lines
3977 KEY_CREATED and KEY_NOT_CREATED. @var{string} may be up to 100
3978 characters and should not contain spaces. It is useful for batch key
3979 generation to associate a key parameter block with a status line.
3984 Here is an example on how to create a key in an ephemeral home directory:
3986 $ export GNUPGHOME="$(mktemp -d)"
3988 %echo Generating a basic OpenPGP key
3993 Name-Real: Joe Tester
3994 Name-Comment: with stupid passphrase
3995 Name-Email: joe@@foo.bar
3998 # Do a commit here, so that we can later print "done" :-)
4002 $ @gpgname --batch --generate-key foo
4004 $ @gpgname --list-secret-keys
4005 /tmp/tmp.0NQxB74PEf/pubring.kbx
4006 -------------------------------
4007 sec dsa1024 2016-12-16 [SCA]
4008 768E895903FC1C44045C8CB95EEBDB71E9E849D0
4009 uid [ultimate] Joe Tester (with stupid passphrase) <joe@@foo.bar>
4010 ssb elg1024 2016-12-16 [E]
4014 If you want to create a key with the default algorithms you would use
4017 %echo Generating a default key
4019 Subkey-Type: default
4020 Name-Real: Joe Tester
4021 Name-Comment: with stupid passphrase
4022 Name-Email: joe@@foo.bar
4025 # Do a commit here, so that we can later print "done" :-)
4037 @command{gpg-agent}(1)
4039 @include see-also-note.texi