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 bells and whistles you can expect from a decent OpenPGP
68 Note that this version of GnuPG features all modern algorithms and
69 should thus be preferred over older GnuPG versions. If you are
70 looking for version 1 of GnuPG, you may find that version installed
71 under the name @command{gpg1}.
74 In contrast to the standalone command gpg from GnuPG 1.x, which
75 might be better suited for server and embedded platforms, the 2.x
76 version is commonly installed under the name @command{@gpgname} and
77 targeted to the desktop as it requires several other modules to be
83 @xref{Option Index}, for an index to @command{@gpgname}'s commands and options.
87 * GPG Commands:: List of all commands.
88 * GPG Options:: List of all options.
89 * GPG Configuration:: Configuration files.
90 * GPG Examples:: Some usage examples.
92 Developer information:
93 * Unattended Usage of GPG:: Using @command{gpg} from other programs.
96 @c * GPG Protocol:: The protocol the server mode uses.
99 @c *******************************************
100 @c *************** ****************
101 @c *************** COMMANDS ****************
102 @c *************** ****************
103 @c *******************************************
108 Commands are not distinguished from options except for the fact that
109 only one command is allowed.
111 @command{@gpgname} may be run with no commands, in which case it will
112 perform a reasonable action depending on the type of file it is given
113 as input (an encrypted message is decrypted, a signature is verified,
114 a file containing keys is listed).
116 Please remember that option as well as command parsing stops as soon as
117 a non-option is encountered, you can explicitly stop parsing by
118 using the special option @option{--}.
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 Make a signature. This command may be combined with @option{--encrypt}
170 (for a signed and encrypted message), @option{--symmetric} (for a
171 signed and symmetrically encrypted message), or @option{--encrypt} and
172 @option{--symmetric} together (for a signed message that may be
173 decrypted via a secret key or a passphrase). The key to be used for
174 signing is chosen by default or can be set with the
175 @option{--local-user} and @option{--default-key} options.
179 Make a clear text signature. The content in a clear text signature is
180 readable without any special software. OpenPGP software is only needed
181 to verify the signature. Clear text signatures may modify end-of-line
182 whitespace for platform independence and are not intended to be
183 reversible. The key to be used for signing is chosen by default or
184 can be set with the @option{--local-user} and @option{--default-key}
191 Make a detached signature.
196 Encrypt data. This option may be combined with @option{--sign} (for a
197 signed and encrypted message), @option{--symmetric} (for a message that
198 may be decrypted via a secret key or a passphrase), or @option{--sign}
199 and @option{--symmetric} together (for a signed message that may be
200 decrypted via a secret key or a passphrase).
205 Encrypt with a symmetric cipher using a passphrase. The default
206 symmetric cipher used is @value{GPGSYMENCALGO}, but may be chosen with the
207 @option{--cipher-algo} option. This option may be combined with
208 @option{--sign} (for a signed and symmetrically encrypted message),
209 @option{--encrypt} (for a message that may be decrypted via a secret key
210 or a passphrase), or @option{--sign} and @option{--encrypt} together
211 (for a signed message that may be decrypted via a secret key or a
216 Store only (make a simple literal data packet).
221 Decrypt the file given on the command line (or STDIN if no file
222 is specified) and write it to STDOUT (or the file specified with
223 @option{--output}). If the decrypted file is signed, the signature is also
224 verified. This command differs from the default operation, as it never
225 writes to the filename which is included in the file and it rejects
226 files which don't begin with an encrypted message.
230 Assume that the first argument is a signed file and verify it without
231 generating any output. With no arguments, the signature packet is
232 read from STDIN. If only a one argument is given, it is expected to
233 be a complete signature.
235 With more than 1 argument, the first should be a detached signature
236 and the remaining files make up the the signed data. To read the signed
237 data from STDIN, use @samp{-} as the second filename. For security
238 reasons a detached signature cannot read the signed material from
239 STDIN without denoting it in the above way.
241 Note: If the option @option{--batch} is not used, @command{@gpgname}
242 may assume that a single argument is a file with a detached signature
243 and it will try to find a matching data file by stripping certain
244 suffixes. Using this historical feature to verify a detached
245 signature is strongly discouraged; always specify the data file too.
247 Note: When verifying a cleartext signature, @command{gpg} verifies
248 only what makes up the cleartext signed data and not any extra data
249 outside of the cleartext signature or header lines following directly
250 the dash marker line. The option @code{--output} may be used to write
251 out the actual signed data; but there are other pitfalls with this
252 format as well. It is suggested to avoid cleartext signatures in
253 favor of detached signatures.
257 This modifies certain other commands to accept multiple files for
258 processing on the command line or read from STDIN with each filename on
259 a separate line. This allows for many files to be processed at
260 once. @option{--multifile} may currently be used along with
261 @option{--verify}, @option{--encrypt}, and @option{--decrypt}. Note that
262 @option{--multifile --verify} may not be used with detached signatures.
265 @opindex verify-files
266 Identical to @option{--multifile --verify}.
268 @item --encrypt-files
269 @opindex encrypt-files
270 Identical to @option{--multifile --encrypt}.
272 @item --decrypt-files
273 @opindex decrypt-files
274 Identical to @option{--multifile --decrypt}.
278 @itemx --list-public-keys
280 List all keys from the public keyrings, or just the keys given on the
283 Avoid using the output of this command in scripts or other programs as
284 it is likely to change as GnuPG changes. See @option{--with-colons}
285 for a machine-parseable key listing command that is appropriate for
286 use in scripts and other programs. Never use the regular output for
287 scripts - it is only for human consumption.
289 @item --list-secret-keys
291 @opindex list-secret-keys
292 List all keys from the secret keyrings, or just the ones given on the
293 command line. A @code{#} after the letters @code{sec} means that the
294 secret key is not usable (for example, if it was created via
295 @option{--export-secret-subkeys}). See also @option{--list-keys}.
299 Same as @option{--list-keys}, but the signatures are listed too.
300 This command has the same effect as
301 using @option{--list-keys} with @option{--with-sig-list}.
303 For each signature listed, there are several flags in between the "sig"
304 tag and keyid. These flags give additional information about each
305 signature. From left to right, they are the numbers 1-3 for certificate
306 check level (see @option{--ask-cert-level}), "L" for a local or
307 non-exportable signature (see @option{--lsign-key}), "R" for a
308 nonRevocable signature (see the @option{--edit-key} command "nrsign"),
309 "P" for a signature that contains a policy URL (see
310 @option{--cert-policy-url}), "N" for a signature that contains a
311 notation (see @option{--cert-notation}), "X" for an eXpired signature
312 (see @option{--ask-cert-expire}), and the numbers 1-9 or "T" for 10 and
313 above to indicate trust signature levels (see the @option{--edit-key}
318 Same as @option{--list-sigs}, but the signatures are verified. Note
319 that for performance reasons the revocation status of a signing key is
321 This command has the same effect as
322 using @option{--list-keys} with @option{--with-sig-check}.
324 The status of the verification is indicated by a flag directly following
325 the "sig" tag (and thus before the flags described above for
326 @option{--list-sigs}). A "!" indicates that the signature has been
327 successfully verified, a "-" denotes a bad signature and a "%" is used
328 if an error occurred while checking the signature (e.g. a non supported
333 Locate the keys given as arguments. This command basically uses the
334 same algorithm as used when locating keys for encryption or signing and
335 may thus be used to see what keys @command{@gpgname} might use. In
336 particular external methods as defined by @option{--auto-key-locate} may
337 be used to locate a key. Only public keys are listed.
341 List all keys (or the specified ones) along with their
342 fingerprints. This is the same output as @option{--list-keys} but with
343 the additional output of a line with the fingerprint. May also be
344 combined with @option{--list-sigs} or @option{--check-sigs}. If this
345 command is given twice, the fingerprints of all secondary keys are
346 listed too. This command also forces pretty printing of fingerprints
347 if the keyid format has been set to "none".
350 @opindex list-packets
351 List only the sequence of packets. This is mainly useful for
352 debugging. When used with option @option{--verbose} the actual MPI
353 values are dumped and not only their lengths.
358 Present a menu to work with a smartcard. The subcommand "help" provides
359 an overview on available commands. For a detailed description, please
360 see the Card HOWTO at
361 https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
365 Show the content of the smart card.
369 Present a menu to allow changing the PIN of a smartcard. This
370 functionality is also available as the subcommand "passwd" with the
371 @option{--card-edit} command.
373 @item --delete-keys @code{name}
374 @itemx --delete-keys @code{name}
375 Remove key from the public keyring. In batch mode either @option{--yes} is
376 required or the key must be specified by fingerprint. This is a
377 safeguard against accidental deletion of multiple keys.
379 @item --delete-secret-keys @code{name}
380 @opindex delete-secret-keys
381 gRemove key from the secret keyring. In batch mode the key must be
382 specified by fingerprint. The option @option{--yes} can be used to
383 advice gpg-agent not to request a confirmation. This extra
384 pre-caution is done because @command{gpg} can't be sure that the
385 secret key (as controlled by gpg-agent) is only used for the given
389 @item --delete-secret-and-public-key @code{name}
390 @opindex delete-secret-and-public-key
391 Same as @option{--delete-key}, but if a secret key exists, it will be
392 removed first. In batch mode the key must be specified by fingerprint.
393 The option @option{--yes} can be used to advice gpg-agent not to
394 request a confirmation.
398 Either export all keys from all keyrings (default keyrings and those
399 registered via option @option{--keyring}), or if at least one name is given,
400 those of the given name. The exported keys are written to STDOUT or to the
401 file given with option @option{--output}. Use together with
402 @option{--armor} to mail those keys.
404 @item --send-keys @code{key IDs}
406 Similar to @option{--export} but sends the keys to a keyserver.
407 Fingerprints may be used instead of key IDs. Option @option{--keyserver}
408 must be used to give the name of this keyserver. Don't send your
409 complete keyring to a keyserver --- select only those keys which are new
410 or changed by you. If no key IDs are given, @command{gpg} does nothing.
412 @item --export-secret-keys
413 @itemx --export-secret-subkeys
414 @opindex export-secret-keys
415 @opindex export-secret-subkeys
416 Same as @option{--export}, but exports the secret keys instead. The
417 exported keys are written to STDOUT or to the file given with option
418 @option{--output}. This command is often used along with the option
419 @option{--armor} to allow easy printing of the key for paper backup;
420 however the external tool @command{paperkey} does a better job for
421 creating backups on paper. Note that exporting a secret key can be a
422 security risk if the exported keys are send over an insecure channel.
424 The second form of the command has the special property to render the
425 secret part of the primary key useless; this is a GNU extension to
426 OpenPGP and other implementations can not be expected to successfully
427 import such a key. Its intended use is to generated a full key with
428 an additional signing subkey on a dedicated machine and then using
429 this command to export the key without the primary key to the main
432 GnuPG may ask you to enter the passphrase for the key. This is
433 required because the internal protection method of the secret key is
434 different from the one specified by the OpenPGP protocol.
436 @item --export-ssh-key
437 @opindex export-ssh-key
438 This command is used to export a key in the OpenSSH public key format.
439 It requires the specification of one key by the usual means and
440 exports the latest valid subkey which has an authentication capability
441 to STDOUT or to the file given with option @option{--output}. That
442 output can directly be added to ssh's @file{authorized_key} file.
444 By specifying the key to export using a key ID or a fingerprint
445 suffixed with an exclamation mark (!), a specific subkey or the
446 primary key can be exported. This does not even require that the key
447 has the authentication capability flag set.
452 Import/merge keys. This adds the given keys to the
453 keyring. The fast version is currently just a synonym.
455 There are a few other options which control how this command works.
456 Most notable here is the @option{--import-options merge-only} option
457 which does not insert new keys but does only the merging of new
458 signatures, user-IDs and subkeys.
460 @item --recv-keys @code{key IDs}
462 Import the keys with the given key IDs from a keyserver. Option
463 @option{--keyserver} must be used to give the name of this keyserver.
466 @opindex refresh-keys
467 Request updates from a keyserver for keys that already exist on the
468 local keyring. This is useful for updating a key with the latest
469 signatures, user IDs, etc. Calling this with no arguments will refresh
470 the entire keyring. Option @option{--keyserver} must be used to give the
471 name of the keyserver for all keys that do not have preferred keyservers
472 set (see @option{--keyserver-options honor-keyserver-url}).
474 @item --search-keys @code{names}
476 Search the keyserver for the given names. Multiple names given here will
477 be joined together to create the search string for the keyserver.
478 Option @option{--keyserver} must be used to give the name of this
479 keyserver. Keyservers that support different search methods allow using
480 the syntax specified in "How to specify a user ID" below. Note that
481 different keyserver types support different search methods. Currently
482 only LDAP supports them all.
484 @item --fetch-keys @code{URIs}
486 Retrieve keys located at the specified URIs. Note that different
487 installations of GnuPG may support different protocols (HTTP, FTP,
488 LDAP, etc.). When using HTTPS the system provided root certificates
489 are used by this command.
491 @item --update-trustdb
492 @opindex update-trustdb
493 Do trust database maintenance. This command iterates over all keys and
494 builds the Web of Trust. This is an interactive command because it may
495 have to ask for the "ownertrust" values for keys. The user has to give
496 an estimation of how far she trusts the owner of the displayed key to
497 correctly certify (sign) other keys. GnuPG only asks for the ownertrust
498 value if it has not yet been assigned to a key. Using the
499 @option{--edit-key} menu, the assigned value can be changed at any time.
501 @item --check-trustdb
502 @opindex check-trustdb
503 Do trust database maintenance without user interaction. From time to
504 time the trust database must be updated so that expired keys or
505 signatures and the resulting changes in the Web of Trust can be
506 tracked. Normally, GnuPG will calculate when this is required and do it
507 automatically unless @option{--no-auto-check-trustdb} is set. This
508 command can be used to force a trust database check at any time. The
509 processing is identical to that of @option{--update-trustdb} but it
510 skips keys with a not yet defined "ownertrust".
512 For use with cron jobs, this command can be used together with
513 @option{--batch} in which case the trust database check is done only if
514 a check is needed. To force a run even in batch mode add the option
517 @anchor{option --export-ownertrust}
518 @item --export-ownertrust
519 @opindex export-ownertrust
520 Send the ownertrust values to STDOUT. This is useful for backup purposes
521 as these values are the only ones which can't be re-created from a
522 corrupted trustdb. Example:
525 @gpgname{} --export-ownertrust > otrust.txt
530 @item --import-ownertrust
531 @opindex import-ownertrust
532 Update the trustdb with the ownertrust values stored in @code{files} (or
533 STDIN if not given); existing values will be overwritten. In case of a
534 severely damaged trustdb and if you have a recent backup of the
535 ownertrust values (e.g. in the file @file{otrust.txt}, you may re-create
536 the trustdb using these commands:
541 @gpgname{} --import-ownertrust < otrust.txt
546 @item --rebuild-keydb-caches
547 @opindex rebuild-keydb-caches
548 When updating from version 1.0.6 to 1.0.7 this command should be used
549 to create signature caches in the keyring. It might be handy in other
552 @item --print-md @code{algo}
555 Print message digest of algorithm ALGO for all given files or STDIN.
556 With the second form (or a deprecated "*" as algo) digests for all
557 available algorithms are printed.
559 @item --gen-random @code{0|1|2} @code{count}
561 Emit @var{count} random bytes of the given quality level 0, 1 or 2. If
562 @var{count} is not given or zero, an endless sequence of random bytes
563 will be emitted. If used with @option{--armor} the output will be
564 base64 encoded. PLEASE, don't use this command unless you know what
565 you are doing; it may remove precious entropy from the system!
567 @item --gen-prime @code{mode} @code{bits}
569 Use the source, Luke :-). The output format is still subject to change.
576 Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
577 This is a GnuPG extension to OpenPGP and in general not very useful.
579 @item --tofu-policy @code{auto|good|unknown|bad|ask} @code{key...}
581 Set the TOFU policy for all the bindings associated with the specified
582 keys. For more information about the meaning of the policies,
583 @pxref{trust-model-tofu}. The keys may be specified either by their
584 fingerprint (preferred) or their keyid.
588 @c Run gpg in server mode. This feature is not yet ready for use and
589 @c thus not documented.
594 @c *******************************************
595 @c ******* KEY MANGEMENT COMMANDS **********
596 @c *******************************************
597 @node OpenPGP Key Management
598 @subsection How to manage your keys
600 This section explains the main commands for key management
604 @item --quick-gen-key @code{user-id} [@code{algo} [@code{usage} [@code{expire}]]]
605 @opindex quick-gen-key
606 This is a simple command to generate a standard key with one user id.
607 In contrast to @option{--gen-key} the key is generated directly
608 without the need to answer a bunch of prompts. Unless the option
609 @option{--yes} is given, the key creation will be canceled if the
610 given user id already exists in the key ring.
612 If invoked directly on the console without any special options an
613 answer to a ``Continue?'' style confirmation prompt is required. In
614 case the user id already exists in the key ring a second prompt to
615 force the creation of the key will show up.
617 If any of the optional arguments are given, only the primary key is
618 created and no prompts are shown. For a description of these optional
619 arguments see the command @code{--quick-addkey}. The @code{usage}
620 accepts also the value ``cert'' which can be used to create a
621 certification only primary key; the default is to a create
622 certification and signing key.
624 If this command is used with @option{--batch},
625 @option{--pinentry-mode} has been set to @code{loopback}, and one of
626 the passphrase options (@option{--passphrase},
627 @option{--passphrase-fd}, or @option{passphrase-file}) is used, the
628 supplied passphrase is used for the new key and the agent does not ask
629 for it. To create a key without any protection @code{--passphrase ''}
632 @item --quick-addkey @code{fpr} [@code{algo} [@code{usage} [@code{expire}]]]
633 @opindex quick-addkey
634 Directly add a subkey to the key identified by the fingerprint
635 @code{fpr}. Without the optional arguments an encryption subkey is
636 added. If any of the arguments are given a more specific subkey is
639 @code{algo} may be any of the supported algorithms or curve names given
640 in the format as used by key listings. To use the default algorithm
641 the string ``default'' or ``-'' can be used. Supported algorithms are
642 ``rsa'', ``dsa'', ``elg'', ``ed25519'', ``cv25519'', and other ECC
643 curves. For example the string ``rsa'' adds an RSA key with the
644 default key length; a string ``rsa4096'' requests that the key length
647 Depending on the given @code{algo} the subkey may either be an
648 encryption subkey or a signing subkey. If an algorithm is capable of
649 signing and encryption and such a subkey is desired, a @code{usage}
650 string must be given. This string is either ``default'' or ``-'' to
651 keep the default or a comma delimited list of keywords: ``sign'' for a
652 signing subkey, ``auth'' for an authentication subkey, and ``encr''
653 for an encryption subkey (``encrypt'' can be used as alias for
654 ``encr''). The valid combinations depend on the algorithm.
656 The @code{expire} argument can be used to specify an expiration date
657 for the subkey. Several formats are supported; commonly the ISO
658 YYYY-MM-DD format is used. The values ``never'', ``none'', or ``-''
659 can be used for no expiration date.
663 Generate a new key pair using the current default parameters. This is
664 the standard command to create a new key. In addition to the key a
665 revocation certificate is created and stored in the
666 @file{openpgp-revocs.d} directory below the GnuPG home directory.
670 Generate a new key pair with dialogs for all options. This is an
671 extended version of @option{--gen-key}.
673 There is also a feature which allows you to create keys in batch
674 mode. See the manual section ``Unattended key generation'' on how
678 @item --gen-revoke @code{name}
680 Generate a revocation certificate for the complete key. To only revoke
681 a subkey or a key signature, use the @option{--edit} command.
683 This command merely creates the revocation certificate so that it can
684 be used to revoke the key if that is ever needed. To actually revoke
685 a key the created revocation certificate needs to be merged with the
686 key to revoke. This is done by importing the revocation certificate
687 using the @option{--import} command. Then the revoked key needs to be
688 published, which is best done by sending the key to a keyserver
689 (command @option{--send-key}) and by exporting (@option{--export}) it
690 to a file which is then send to frequent communication partners.
693 @item --desig-revoke @code{name}
694 @opindex desig-revoke
695 Generate a designated revocation certificate for a key. This allows a
696 user (with the permission of the keyholder) to revoke someone else's
702 Present a menu which enables you to do most of the key management
703 related tasks. It expects the specification of a key on the command
706 @c ******** Begin Edit-key Options **********
711 Toggle selection of user ID or photographic user ID with index @code{n}.
712 Use @code{*} to select all and @code{0} to deselect all.
716 Toggle selection of subkey with index @code{n} or key ID @code{n}.
717 Use @code{*} to select all and @code{0} to deselect all.
720 @opindex keyedit:sign
721 Make a signature on key of user @code{name} If the key is not yet
722 signed by the default user (or the users given with -u), the program
723 displays the information of the key again, together with its
724 fingerprint and asks whether it should be signed. This question is
725 repeated for all users specified with
729 @opindex keyedit:lsign
730 Same as "sign" but the signature is marked as non-exportable and will
731 therefore never be used by others. This may be used to make keys
732 valid only in the local environment.
735 @opindex keyedit:nrsign
736 Same as "sign" but the signature is marked as non-revocable and can
737 therefore never be revoked.
740 @opindex keyedit:tsign
741 Make a trust signature. This is a signature that combines the notions
742 of certification (like a regular signature), and trust (like the
743 "trust" command). It is generally only useful in distinct communities
744 or groups. For more information please read the sections
745 ``Trust Signature'' and ``Regular Expression'' in RFC-4880.
749 Note that "l" (for local / non-exportable), "nr" (for non-revocable,
750 and "t" (for trust) may be freely mixed and prefixed to "sign" to
751 create a signature of any type desired.
754 If the option @option{--only-sign-text-ids} is specified, then any
755 non-text based user ids (e.g., photo IDs) will not be selected for
761 @opindex keyedit:delsig
762 Delete a signature. Note that it is not possible to retract a signature,
763 once it has been send to the public (i.e. to a keyserver). In that case
764 you better use @code{revsig}.
767 @opindex keyedit:revsig
768 Revoke a signature. For every signature which has been generated by
769 one of the secret keys, GnuPG asks whether a revocation certificate
773 @opindex keyedit:check
774 Check the signatures on all selected user IDs. With the extra
775 option @code{selfsig} only self-signatures are shown.
778 @opindex keyedit:adduid
779 Create an additional user ID.
782 @opindex keyedit:addphoto
783 Create a photographic user ID. This will prompt for a JPEG file that
784 will be embedded into the user ID. Note that a very large JPEG will make
785 for a very large key. Also note that some programs will display your
786 JPEG unchanged (GnuPG), and some programs will scale it to fit in a
790 @opindex keyedit:showphoto
791 Display the selected photographic user ID.
794 @opindex keyedit:deluid
795 Delete a user ID or photographic user ID. Note that it is not
796 possible to retract a user id, once it has been send to the public
797 (i.e. to a keyserver). In that case you better use @code{revuid}.
800 @opindex keyedit:revuid
801 Revoke a user ID or photographic user ID.
804 @opindex keyedit:primary
805 Flag the current user id as the primary one, removes the primary user
806 id flag from all other user ids and sets the timestamp of all affected
807 self-signatures one second ahead. Note that setting a photo user ID
808 as primary makes it primary over other photo user IDs, and setting a
809 regular user ID as primary makes it primary over other regular user
813 @opindex keyedit:keyserver
814 Set a preferred keyserver for the specified user ID(s). This allows
815 other users to know where you prefer they get your key from. See
816 @option{--keyserver-options honor-keyserver-url} for more on how this
817 works. Setting a value of "none" removes an existing preferred
821 @opindex keyedit:notation
822 Set a name=value notation for the specified user ID(s). See
823 @option{--cert-notation} for more on how this works. Setting a value of
824 "none" removes all notations, setting a notation prefixed with a minus
825 sign (-) removes that notation, and setting a notation name (without the
826 =value) prefixed with a minus sign removes all notations with that name.
829 @opindex keyedit:pref
830 List preferences from the selected user ID. This shows the actual
831 preferences, without including any implied preferences.
834 @opindex keyedit:showpref
835 More verbose preferences listing for the selected user ID. This shows
836 the preferences in effect by including the implied preferences of 3DES
837 (cipher), SHA-1 (digest), and Uncompressed (compression) if they are
838 not already included in the preference list. In addition, the
839 preferred keyserver and signature notations (if any) are shown.
841 @item setpref @code{string}
842 @opindex keyedit:setpref
843 Set the list of user ID preferences to @code{string} for all (or just
844 the selected) user IDs. Calling setpref with no arguments sets the
845 preference list to the default (either built-in or set via
846 @option{--default-preference-list}), and calling setpref with "none"
847 as the argument sets an empty preference list. Use @command{@gpgname
848 --version} to get a list of available algorithms. Note that while you
849 can change the preferences on an attribute user ID (aka "photo ID"),
850 GnuPG does not select keys via attribute user IDs so these preferences
851 will not be used by GnuPG.
853 When setting preferences, you should list the algorithms in the order
854 which you'd like to see them used by someone else when encrypting a
855 message to your key. If you don't include 3DES, it will be
856 automatically added at the end. Note that there are many factors that
857 go into choosing an algorithm (for example, your key may not be the
858 only recipient), and so the remote OpenPGP application being used to
859 send to you may or may not follow your exact chosen order for a given
860 message. It will, however, only choose an algorithm that is present
861 on the preference list of every recipient key. See also the
862 INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
865 @opindex keyedit:addkey
866 Add a subkey to this key.
869 @opindex keyedit:addcardkey
870 Generate a subkey on a card and add it to this key.
873 @opindex keyedit:keytocard
874 Transfer the selected secret subkey (or the primary key if no subkey
875 has been selected) to a smartcard. The secret key in the keyring will
876 be replaced by a stub if the key could be stored successfully on the
877 card and you use the save command later. Only certain key types may be
878 transferred to the card. A sub menu allows you to select on what card
879 to store the key. Note that it is not possible to get that key back
880 from the card - if the card gets broken your secret key will be lost
881 unless you have a backup somewhere.
883 @item bkuptocard @code{file}
884 @opindex keyedit:bkuptocard
885 Restore the given file to a card. This command may be used to restore a
886 backup key (as generated during card initialization) to a new card. In
887 almost all cases this will be the encryption key. You should use this
888 command only with the corresponding public key and make sure that the
889 file given as argument is indeed the backup to restore. You should then
890 select 2 to restore as encryption key. You will first be asked to enter
891 the passphrase of the backup key and then for the Admin PIN of the card.
894 @opindex keyedit:delkey
895 Remove a subkey (secondary key). Note that it is not possible to retract
896 a subkey, once it has been send to the public (i.e. to a keyserver). In
897 that case you better use @code{revkey}.
900 @opindex keyedit:revkey
904 @opindex keyedit:expire
905 Change the key or subkey expiration time. If a subkey is selected, the
906 expiration time of this subkey will be changed. With no selection, the
907 key expiration of the primary key is changed.
910 @opindex keyedit:trust
911 Change the owner trust value for the key. This updates the trust-db
912 immediately and no save is required.
916 @opindex keyedit:disable
917 @opindex keyedit:enable
918 Disable or enable an entire key. A disabled key can not normally be
922 @opindex keyedit:addrevoker
923 Add a designated revoker to the key. This takes one optional argument:
924 "sensitive". If a designated revoker is marked as sensitive, it will
925 not be exported by default (see export-options).
928 @opindex keyedit:passwd
929 Change the passphrase of the secret key.
932 @opindex keyedit:toggle
933 This is dummy command which exists only for backward compatibility.
936 @opindex keyedit:clean
937 Compact (by removing all signatures except the selfsig) any user ID
938 that is no longer usable (e.g. revoked, or expired). Then, remove any
939 signatures that are not usable by the trust calculations.
940 Specifically, this removes any signature that does not validate, any
941 signature that is superseded by a later signature, revoked signatures,
942 and signatures issued by keys that are not present on the keyring.
945 @opindex keyedit:minimize
946 Make the key as small as possible. This removes all signatures from
947 each user ID except for the most recent self-signature.
950 @opindex keyedit:cross-certify
951 Add cross-certification signatures to signing subkeys that may not
952 currently have them. Cross-certification signatures protect against a
953 subtle attack against signing subkeys. See
954 @option{--require-cross-certification}. All new keys generated have
955 this signature by default, so this option is only useful to bring
956 older keys up to date.
959 @opindex keyedit:save
960 Save all changes to the key rings and quit.
963 @opindex keyedit:quit
964 Quit the program without updating the
969 The listing shows you the key with its secondary keys and all user
970 ids. The primary user id is indicated by a dot, and selected keys or
971 user ids are indicated by an asterisk. The trust
972 value is displayed with the primary key: the first is the assigned owner
973 trust and the second is the calculated trust value. Letters are used for
980 No ownertrust assigned / not yet calculated.
984 calculation has failed; probably due to an expired key.
987 Not enough information for calculation.
990 Never trust this key.
1002 @c ******** End Edit-key Options **********
1004 @item --sign-key @code{name}
1006 Signs a public key with your secret key. This is a shortcut version of
1007 the subcommand "sign" from @option{--edit}.
1009 @item --lsign-key @code{name}
1011 Signs a public key with your secret key but marks it as
1012 non-exportable. This is a shortcut version of the subcommand "lsign"
1013 from @option{--edit-key}.
1015 @item --quick-sign-key @code{fpr} [@code{names}]
1016 @itemx --quick-lsign-key @code{fpr} [@code{names}]
1017 @opindex quick-sign-key
1018 @opindex quick-lsign-key
1019 Directly sign a key from the passphrase without any further user
1020 interaction. The @code{fpr} must be the verified primary fingerprint
1021 of a key in the local keyring. If no @code{names} are given, all
1022 useful user ids are signed; with given [@code{names}] only useful user
1023 ids matching one of theses names are signed. By default, or if a name
1024 is prefixed with a '*', a case insensitive substring match is used.
1025 If a name is prefixed with a '=' a case sensitive exact match is done.
1027 The command @option{--quick-lsign-key} marks the signatures as
1028 non-exportable. If such a non-exportable signature already exists the
1029 @option{--quick-sign-key} turns it into a exportable signature.
1031 This command uses reasonable defaults and thus does not provide the
1032 full flexibility of the "sign" subcommand from @option{--edit-key}.
1033 Its intended use is to help unattended key signing by utilizing a list
1034 of verified fingerprints.
1036 @item --quick-adduid @var{user-id} @var{new-user-id}
1037 @opindex quick-adduid
1038 This command adds a new user id to an existing key. In contrast to
1039 the interactive sub-command @code{adduid} of @option{--edit-key} the
1040 @var{new-user-id} is added verbatim with only leading and trailing
1041 white space removed, it is expected to be UTF-8 encoded, and no checks
1042 on its form are applied.
1044 @item --quick-revuid @var{user-id} @var{user-id-to-revoke}
1045 @opindex quick-revuid
1046 This command revokes a User ID on an existing key. It cannot be used
1047 to revoke the last User ID on key (some non-revoked User ID must
1048 remain), with revocation reason ``User ID is no longer valid''. If
1049 you want to specify a different revocation reason, or to supply
1050 supplementary revocation text, you should use the interactive
1051 sub-command @code{revuid} of @option{--edit-key}.
1053 @item --passwd @var{user_id}
1055 Change the passphrase of the secret key belonging to the certificate
1056 specified as @var{user_id}. This is a shortcut for the sub-command
1057 @code{passwd} of the edit key menu.
1062 @c *******************************************
1063 @c *************** ****************
1064 @c *************** OPTIONS ****************
1065 @c *************** ****************
1066 @c *******************************************
1069 @section Option Summary
1071 @command{@gpgname} features a bunch of options to control the exact
1072 behaviour and to change the default configuration.
1075 * GPG Configuration Options:: How to change the configuration.
1076 * GPG Key related Options:: Key related options.
1077 * GPG Input and Output:: Input and Output.
1078 * OpenPGP Options:: OpenPGP protocol specific options.
1079 * Compliance Options:: Compliance options.
1080 * GPG Esoteric Options:: Doing things one usually don't want to do.
1081 * Deprecated Options:: Deprecated options.
1084 Long options can be put in an options file (default
1085 "~/.gnupg/gpg.conf"). Short option names will not work - for example,
1086 "armor" is a valid option for the options file, while "a" is not. Do not
1087 write the 2 dashes, but simply the name of the option and any required
1088 arguments. Lines with a hash ('#') as the first non-white-space
1089 character are ignored. Commands may be put in this file too, but that is
1090 not generally useful as the command will execute automatically with
1091 every execution of gpg.
1093 Please remember that option parsing stops as soon as a non-option is
1094 encountered, you can explicitly stop parsing by using the special option
1097 @c *******************************************
1098 @c ******** CONFIGURATION OPTIONS **********
1099 @c *******************************************
1100 @node GPG Configuration Options
1101 @subsection How to change the configuration
1103 These options are used to change the configuration and are usually found
1108 @item --default-key @var{name}
1109 @opindex default-key
1110 Use @var{name} as the default key to sign with. If this option is not
1111 used, the default key is the first key found in the secret keyring.
1112 Note that @option{-u} or @option{--local-user} overrides this option.
1113 This option may be given multiple times. In this case, the last key
1114 for which a secret key is available is used. If there is no secret
1115 key available for any of the specified values, GnuPG will not emit an
1116 error message but continue as if this option wasn't given.
1118 @item --default-recipient @var{name}
1119 @opindex default-recipient
1120 Use @var{name} as default recipient if option @option{--recipient} is
1121 not used and don't ask if this is a valid one. @var{name} must be
1124 @item --default-recipient-self
1125 @opindex default-recipient-self
1126 Use the default key as default recipient if option @option{--recipient} is not
1127 used and don't ask if this is a valid one. The default key is the first
1128 one from the secret keyring or the one set with @option{--default-key}.
1130 @item --no-default-recipient
1131 @opindex no-default-recipient
1132 Reset @option{--default-recipient} and @option{--default-recipient-self}.
1136 Give more information during processing. If used
1137 twice, the input data is listed in detail.
1141 Reset verbose level to 0.
1145 Try to be as quiet as possible.
1151 Use batch mode. Never ask, do not allow interactive commands.
1152 @option{--no-batch} disables this option. Note that even with a
1153 filename given on the command line, gpg might still need to read from
1154 STDIN (in particular if gpg figures that the input is a
1155 detached signature and no data file has been specified). Thus if you
1156 do not want to feed data via STDIN, you should connect STDIN to
1161 Make sure that the TTY (terminal) is never used for any output.
1162 This option is needed in some cases because GnuPG sometimes prints
1163 warnings to the TTY even if @option{--batch} is used.
1167 Assume "yes" on most questions.
1171 Assume "no" on most questions.
1174 @item --list-options @code{parameters}
1175 @opindex list-options
1176 This is a space or comma delimited string that gives options used when
1177 listing keys and signatures (that is, @option{--list-keys},
1178 @option{--list-sigs}, @option{--list-public-keys},
1179 @option{--list-secret-keys}, and the @option{--edit-key} functions).
1180 Options can be prepended with a @option{no-} (after the two dashes) to
1181 give the opposite meaning. The options are:
1186 @opindex list-options:show-photos
1187 Causes @option{--list-keys}, @option{--list-sigs},
1188 @option{--list-public-keys}, and @option{--list-secret-keys} to
1189 display any photo IDs attached to the key. Defaults to no. See also
1190 @option{--photo-viewer}. Does not work with @option{--with-colons}:
1191 see @option{--attribute-fd} for the appropriate way to get photo data
1192 for scripts and other frontends.
1195 @opindex list-options:show-usage
1196 Show usage information for keys and subkeys in the standard key
1197 listing. This is a list of letters indicating the allowed usage for a
1198 key (@code{E}=encryption, @code{S}=signing, @code{C}=certification,
1199 @code{A}=authentication). Defaults to yes.
1201 @item show-policy-urls
1202 @opindex list-options:show-policy-urls
1203 Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
1204 listings. Defaults to no.
1206 @item show-notations
1207 @itemx show-std-notations
1208 @itemx show-user-notations
1209 @opindex list-options:show-notations
1210 @opindex list-options:show-std-notations
1211 @opindex list-options:show-user-notations
1212 Show all, IETF standard, or user-defined signature notations in the
1213 @option{--list-sigs} or @option{--check-sigs} listings. Defaults to no.
1215 @item show-keyserver-urls
1216 @opindex list-options:show-keyserver-urls
1217 Show any preferred keyserver URL in the @option{--list-sigs} or
1218 @option{--check-sigs} listings. Defaults to no.
1220 @item show-uid-validity
1221 @opindex list-options:show-uid-validity
1222 Display the calculated validity of user IDs during key listings.
1225 @item show-unusable-uids
1226 @opindex list-options:show-unusable-uids
1227 Show revoked and expired user IDs in key listings. Defaults to no.
1229 @item show-unusable-subkeys
1230 @opindex list-options:show-unusable-subkeys
1231 Show revoked and expired subkeys in key listings. Defaults to no.
1234 @opindex list-options:show-keyring
1235 Display the keyring name at the head of key listings to show which
1236 keyring a given key resides on. Defaults to no.
1238 @item show-sig-expire
1239 @opindex list-options:show-sig-expire
1240 Show signature expiration dates (if any) during @option{--list-sigs} or
1241 @option{--check-sigs} listings. Defaults to no.
1243 @item show-sig-subpackets
1244 @opindex list-options:show-sig-subpackets
1245 Include signature subpackets in the key listing. This option can take an
1246 optional argument list of the subpackets to list. If no argument is
1247 passed, list all subpackets. Defaults to no. This option is only
1248 meaningful when using @option{--with-colons} along with
1249 @option{--list-sigs} or @option{--check-sigs}.
1253 @item --verify-options @code{parameters}
1254 @opindex verify-options
1255 This is a space or comma delimited string that gives options used when
1256 verifying signatures. Options can be prepended with a `no-' to give
1257 the opposite meaning. The options are:
1262 @opindex verify-options:show-photos
1263 Display any photo IDs present on the key that issued the signature.
1264 Defaults to no. See also @option{--photo-viewer}.
1266 @item show-policy-urls
1267 @opindex verify-options:show-policy-urls
1268 Show policy URLs in the signature being verified. Defaults to yes.
1270 @item show-notations
1271 @itemx show-std-notations
1272 @itemx show-user-notations
1273 @opindex verify-options:show-notations
1274 @opindex verify-options:show-std-notations
1275 @opindex verify-options:show-user-notations
1276 Show all, IETF standard, or user-defined signature notations in the
1277 signature being verified. Defaults to IETF standard.
1279 @item show-keyserver-urls
1280 @opindex verify-options:show-keyserver-urls
1281 Show any preferred keyserver URL in the signature being verified.
1284 @item show-uid-validity
1285 @opindex verify-options:show-uid-validity
1286 Display the calculated validity of the user IDs on the key that issued
1287 the signature. Defaults to yes.
1289 @item show-unusable-uids
1290 @opindex verify-options:show-unusable-uids
1291 Show revoked and expired user IDs during signature verification.
1294 @item show-primary-uid-only
1295 @opindex verify-options:show-primary-uid-only
1296 Show only the primary user ID during signature verification. That is
1297 all the AKA lines as well as photo Ids are not shown with the signature
1298 verification status.
1301 @opindex verify-options:pka-lookups
1302 Enable PKA lookups to verify sender addresses. Note that PKA is based
1303 on DNS, and so enabling this option may disclose information on when
1304 and what signatures are verified or to whom data is encrypted. This
1305 is similar to the "web bug" described for the @option{--auto-key-retrieve}
1308 @item pka-trust-increase
1309 @opindex verify-options:pka-trust-increase
1310 Raise the trust in a signature to full if the signature passes PKA
1311 validation. This option is only meaningful if pka-lookups is set.
1314 @item --enable-large-rsa
1315 @itemx --disable-large-rsa
1316 @opindex enable-large-rsa
1317 @opindex disable-large-rsa
1318 With --gen-key and --batch, enable the creation of RSA secret keys as
1319 large as 8192 bit. Note: 8192 bit is more than is generally
1320 recommended. These large keys don't significantly improve security,
1321 but they are more expensive to use, and their signatures and
1322 certifications are larger. This option is only available if the
1323 binary was build with large-secmem support.
1326 @itemx --disable-dsa2
1327 @opindex enable-dsa2
1328 @opindex disable-dsa2
1329 Enable hash truncation for all DSA keys even for old DSA Keys up to
1330 1024 bit. This is also the default with @option{--openpgp}. Note
1331 that older versions of GnuPG also required this flag to allow the
1332 generation of DSA larger than 1024 bit.
1334 @item --photo-viewer @code{string}
1335 @opindex photo-viewer
1336 This is the command line that should be run to view a photo ID. "%i"
1337 will be expanded to a filename containing the photo. "%I" does the
1338 same, except the file will not be deleted once the viewer exits.
1339 Other flags are "%k" for the key ID, "%K" for the long key ID, "%f"
1340 for the key fingerprint, "%t" for the extension of the image type
1341 (e.g. "jpg"), "%T" for the MIME type of the image (e.g. "image/jpeg"),
1342 "%v" for the single-character calculated validity of the image being
1343 viewed (e.g. "f"), "%V" for the calculated validity as a string (e.g.
1344 "full"), "%U" for a base32 encoded hash of the user ID,
1345 and "%%" for an actual percent sign. If neither %i or %I are present,
1346 then the photo will be supplied to the viewer on standard input.
1348 The default viewer is "xloadimage -fork -quiet -title 'KeyID 0x%k'
1349 STDIN". Note that if your image viewer program is not secure, then
1350 executing it from GnuPG does not make it secure.
1352 @item --exec-path @code{string}
1355 Sets a list of directories to search for photo viewers and keyserver
1356 helpers. If not provided, keyserver helpers use the compiled-in
1357 default directory, and photo viewers use the @code{PATH} environment
1359 Note, that on W32 system this value is ignored when searching for
1362 @item --keyring @code{file}
1364 Add @code{file} to the current list of keyrings. If @code{file} begins
1365 with a tilde and a slash, these are replaced by the $HOME directory. If
1366 the filename does not contain a slash, it is assumed to be in the GnuPG
1367 home directory ("~/.gnupg" if @option{--homedir} or $GNUPGHOME is not
1370 Note that this adds a keyring to the current list. If the intent is to
1371 use the specified keyring alone, use @option{--keyring} along with
1372 @option{--no-default-keyring}.
1374 If the the option @option{--no-keyring} has been used no keyrings will
1378 @item --secret-keyring @code{file}
1379 @opindex secret-keyring
1380 This is an obsolete option and ignored. All secret keys are stored in
1381 the @file{private-keys-v1.d} directory below the GnuPG home directory.
1383 @item --primary-keyring @code{file}
1384 @opindex primary-keyring
1385 Designate @code{file} as the primary public keyring. This means that
1386 newly imported keys (via @option{--import} or keyserver
1387 @option{--recv-from}) will go to this keyring.
1389 @item --trustdb-name @code{file}
1390 @opindex trustdb-name
1391 Use @code{file} instead of the default trustdb. If @code{file} begins
1392 with a tilde and a slash, these are replaced by the $HOME directory. If
1393 the filename does not contain a slash, it is assumed to be in the GnuPG
1394 home directory (@file{~/.gnupg} if @option{--homedir} or $GNUPGHOME is
1397 @include opt-homedir.texi
1400 @item --display-charset @code{name}
1401 @opindex display-charset
1402 Set the name of the native character set. This is used to convert
1403 some informational strings like user IDs to the proper UTF-8 encoding.
1404 Note that this has nothing to do with the character set of data to be
1405 encrypted or signed; GnuPG does not recode user-supplied data. If
1406 this option is not used, the default character set is determined from
1407 the current locale. A verbosity level of 3 shows the chosen set.
1408 Valid values for @code{name} are:
1413 @opindex display-charset:iso-8859-1
1414 This is the Latin 1 set.
1417 @opindex display-charset:iso-8859-2
1421 @opindex display-charset:iso-8859-15
1422 This is currently an alias for
1426 @opindex display-charset:koi8-r
1427 The usual Russian set (rfc1489).
1430 @opindex display-charset:utf-8
1431 Bypass all translations and assume
1432 that the OS uses native UTF-8 encoding.
1435 @item --utf8-strings
1436 @itemx --no-utf8-strings
1437 @opindex utf8-strings
1438 Assume that command line arguments are given as UTF8 strings. The
1439 default (@option{--no-utf8-strings}) is to assume that arguments are
1440 encoded in the character set as specified by
1441 @option{--display-charset}. These options affect all following
1442 arguments. Both options may be used multiple times.
1444 @anchor{gpg-option --options}
1445 @item --options @code{file}
1447 Read options from @code{file} and do not try to read them from the
1448 default options file in the homedir (see @option{--homedir}). This
1449 option is ignored if used in an options file.
1453 Shortcut for @option{--options /dev/null}. This option is detected
1454 before an attempt to open an option file. Using this option will also
1455 prevent the creation of a @file{~/.gnupg} homedir.
1458 @itemx --compress-level @code{n}
1459 @itemx --bzip2-compress-level @code{n}
1460 @opindex compress-level
1461 @opindex bzip2-compress-level
1462 Set compression level to @code{n} for the ZIP and ZLIB compression
1463 algorithms. The default is to use the default compression level of zlib
1464 (normally 6). @option{--bzip2-compress-level} sets the compression level
1465 for the BZIP2 compression algorithm (defaulting to 6 as well). This is a
1466 different option from @option{--compress-level} since BZIP2 uses a
1467 significant amount of memory for each additional compression level.
1468 @option{-z} sets both. A value of 0 for @code{n} disables compression.
1470 @item --bzip2-decompress-lowmem
1471 @opindex bzip2-decompress-lowmem
1472 Use a different decompression method for BZIP2 compressed files. This
1473 alternate method uses a bit more than half the memory, but also runs
1474 at half the speed. This is useful under extreme low memory
1475 circumstances when the file was originally compressed at a high
1476 @option{--bzip2-compress-level}.
1479 @item --mangle-dos-filenames
1480 @itemx --no-mangle-dos-filenames
1481 @opindex mangle-dos-filenames
1482 @opindex no-mangle-dos-filenames
1483 Older version of Windows cannot handle filenames with more than one
1484 dot. @option{--mangle-dos-filenames} causes GnuPG to replace (rather
1485 than add to) the extension of an output filename to avoid this
1486 problem. This option is off by default and has no effect on non-Windows
1489 @item --ask-cert-level
1490 @itemx --no-ask-cert-level
1491 @opindex ask-cert-level
1492 When making a key signature, prompt for a certification level. If this
1493 option is not specified, the certification level used is set via
1494 @option{--default-cert-level}. See @option{--default-cert-level} for
1495 information on the specific levels and how they are
1496 used. @option{--no-ask-cert-level} disables this option. This option
1499 @item --default-cert-level @code{n}
1500 @opindex default-cert-level
1501 The default to use for the check level when signing a key.
1503 0 means you make no particular claim as to how carefully you verified
1506 1 means you believe the key is owned by the person who claims to own
1507 it but you could not, or did not verify the key at all. This is
1508 useful for a "persona" verification, where you sign the key of a
1511 2 means you did casual verification of the key. For example, this
1512 could mean that you verified the key fingerprint and checked the
1513 user ID on the key against a photo ID.
1515 3 means you did extensive verification of the key. For example, this
1516 could mean that you verified the key fingerprint with the owner of the
1517 key in person, and that you checked, by means of a hard to forge
1518 document with a photo ID (such as a passport) that the name of the key
1519 owner matches the name in the user ID on the key, and finally that you
1520 verified (by exchange of email) that the email address on the key
1521 belongs to the key owner.
1523 Note that the examples given above for levels 2 and 3 are just that:
1524 examples. In the end, it is up to you to decide just what "casual"
1525 and "extensive" mean to you.
1527 This option defaults to 0 (no particular claim).
1529 @item --min-cert-level
1530 @opindex min-cert-level
1531 When building the trust database, treat any signatures with a
1532 certification level below this as invalid. Defaults to 2, which
1533 disregards level 1 signatures. Note that level 0 "no particular
1534 claim" signatures are always accepted.
1536 @item --trusted-key @code{long key ID}
1537 @opindex trusted-key
1538 Assume that the specified key (which must be given
1539 as a full 8 byte key ID) is as trustworthy as one of
1540 your own secret keys. This option is useful if you
1541 don't want to keep your secret keys (or one of them)
1542 online but still want to be able to check the validity of a given
1543 recipient's or signator's key.
1545 @item --trust-model @code{pgp|classic|tofu|tofu+pgp|direct|always|auto}
1546 @opindex trust-model
1547 Set what trust model GnuPG should follow. The models are:
1552 @opindex trust-mode:pgp
1553 This is the Web of Trust combined with trust signatures as used in PGP
1554 5.x and later. This is the default trust model when creating a new
1558 @opindex trust-mode:classic
1559 This is the standard Web of Trust as introduced by PGP 2.
1562 @opindex trust-mode:tofu
1563 @anchor{trust-model-tofu}
1564 TOFU stands for Trust On First Use. In this trust model, the first
1565 time a key is seen, it is memorized. If later another key is seen
1566 with a user id with the same email address, a warning is displayed
1567 indicating that there is a conflict and that the key might be a
1568 forgery and an attempt at a man-in-the-middle attack.
1570 Because a potential attacker is able to control the email address
1571 and thereby circumvent the conflict detection algorithm by using an
1572 email address that is similar in appearance to a trusted email
1573 address, whenever a message is verified, statistics about the number
1574 of messages signed with the key are shown. In this way, a user can
1575 easily identify attacks using fake keys for regular correspondents.
1577 When compared with the Web of Trust, TOFU offers significantly
1578 weaker security guarantees. In particular, TOFU only helps ensure
1579 consistency (that is, that the binding between a key and email
1580 address doesn't change). A major advantage of TOFU is that it
1581 requires little maintenance to use correctly. To use the web of
1582 trust properly, you need to actively sign keys and mark users as
1583 trusted introducers. This is a time-consuming process and anecdotal
1584 evidence suggests that even security-conscious users rarely take the
1585 time to do this thoroughly and instead rely on an ad-hoc TOFU
1588 In the TOFU model, policies are associated with bindings between
1589 keys and email addresses (which are extracted from user ids and
1590 normalized). There are five policies, which can be set manually
1591 using the @option{--tofu-policy} option. The default policy can be
1592 set using the @option{--tofu-default-policy} policy.
1594 The TOFU policies are: @code{auto}, @code{good}, @code{unknown},
1595 @code{bad} and @code{ask}. The @code{auto} policy is used by
1596 default (unless overridden by @option{--tofu-default-policy}) and
1597 marks a binding as marginally trusted. The @code{good},
1598 @code{unknown} and @code{bad} policies mark a binding as fully
1599 trusted, as having unknown trust or as having trust never,
1600 respectively. The @code{unknown} policy is useful for just using
1601 TOFU to detect conflicts, but to never assign positive trust to a
1602 binding. The final policy, @code{ask} prompts the user to indicate
1603 the binding's trust. If batch mode is enabled (or input is
1604 inappropriate in the context), then the user is not prompted and the
1605 @code{undefined} trust level is returned.
1608 @opindex trust-mode:tofu+pgp
1609 This trust model combines TOFU with the Web of Trust. This is done
1610 by computing the trust level for each model and then taking the
1611 maximum trust level where the trust levels are ordered as follows:
1612 @code{unknown < undefined < marginal < fully < ultimate < expired <
1615 By setting @option{--tofu-default-policy=unknown}, this model can be
1616 used to implement the web of trust with TOFU's conflict detection
1617 algorithm, but without its assignment of positive trust values,
1618 which some security-conscious users don't like.
1621 @opindex trust-mode:direct
1622 Key validity is set directly by the user and not calculated via the
1626 @opindex trust-mode:always
1627 Skip key validation and assume that used keys are always fully
1628 valid. You generally won't use this unless you are using some
1629 external validation scheme. This option also suppresses the
1630 "[uncertain]" tag printed with signature checks when there is no
1631 evidence that the user ID is bound to the key. Note that this
1632 trust model still does not allow the use of expired, revoked, or
1636 @opindex trust-mode:auto
1637 Select the trust model depending on whatever the internal trust
1638 database says. This is the default model if such a database already
1642 @item --auto-key-locate @code{parameters}
1643 @itemx --no-auto-key-locate
1644 @opindex auto-key-locate
1645 GnuPG can automatically locate and retrieve keys as needed using this
1646 option. This happens when encrypting to an email address (in the
1647 "user@@example.com" form), and there are no user@@example.com keys on
1648 the local keyring. This option takes any number of the following
1649 mechanisms, in the order they are to be tried:
1654 Locate a key using DNS CERT, as specified in rfc4398.
1657 Locate a key using DNS PKA.
1660 Locate a key using DANE, as specified
1661 in draft-ietf-dane-openpgpkey-05.txt.
1664 Locate a key using the Web Key Directory protocol.
1665 This is an experimental method and semantics may change.
1668 Using DNS Service Discovery, check the domain in question for any LDAP
1669 keyservers to use. If this fails, attempt to locate the key using the
1670 PGP Universal method of checking @samp{ldap://keys.(thedomain)}.
1673 Locate a key using whatever keyserver is defined using the
1674 @option{--keyserver} option.
1677 In addition, a keyserver URL as used in the @option{--keyserver} option
1678 may be used here to query that particular keyserver.
1681 Locate the key using the local keyrings. This mechanism allows the user to
1682 select the order a local key lookup is done. Thus using
1683 @samp{--auto-key-locate local} is identical to
1684 @option{--no-auto-key-locate}.
1687 This flag disables the standard local key lookup, done before any of the
1688 mechanisms defined by the @option{--auto-key-locate} are tried. The
1689 position of this mechanism in the list does not matter. It is not
1690 required if @code{local} is also used.
1693 Clear all defined mechanisms. This is useful to override
1694 mechanisms given in a config file.
1698 @item --auto-key-retrieve
1699 @itemx --no-auto-key-retrieve
1700 @opindex auto-key-retrieve
1701 @opindex no-auto-key-retrieve
1702 This option enables the automatic retrieving of keys from a keyserver
1703 when verifying signatures made by keys that are not on the local
1706 If the method "wkd" is included in the list of methods given to
1707 @option{auto-key-locate}, the Signer's User ID is part of the
1708 signature, and the option @option{--disable-signer-uid} is not used,
1709 the "wkd" method may also be used to retrieve a key.
1711 Note that this option makes a "web bug" like behavior possible.
1712 Keyserver or Web Key Directory operators can see which keys you
1713 request, so by sending you a message signed by a brand new key (which
1714 you naturally will not have on your local keyring), the operator can
1715 tell both your IP address and the time when you verified the
1718 @item --keyid-format @code{none|short|0xshort|long|0xlong}
1719 @opindex keyid-format
1720 Select how to display key IDs. "none" does not show the key ID at all
1721 but shows the fingerprint in a separate line. "short" is the
1722 traditional 8-character key ID. "long" is the more accurate (but less
1723 convenient) 16-character key ID. Add an "0x" to either to include an
1724 "0x" at the beginning of the key ID, as in 0x99242560. Note that this
1725 option is ignored if the option @option{--with-colons} is used.
1727 @item --keyserver @code{name}
1729 This option is deprecated - please use the @option{--keyserver} in
1730 @file{dirmngr.conf} instead.
1732 Use @code{name} as your keyserver. This is the server that
1733 @option{--recv-keys}, @option{--send-keys}, and @option{--search-keys}
1734 will communicate with to receive keys from, send keys to, and search for
1735 keys on. The format of the @code{name} is a URI:
1736 `scheme:[//]keyservername[:port]' The scheme is the type of keyserver:
1737 "hkp" for the HTTP (or compatible) keyservers, "ldap" for the LDAP
1738 keyservers, or "mailto" for the Graff email keyserver. Note that your
1739 particular installation of GnuPG may have other keyserver types
1740 available as well. Keyserver schemes are case-insensitive. After the
1741 keyserver name, optional keyserver configuration options may be
1742 provided. These are the same as the global @option{--keyserver-options}
1743 from below, but apply only to this particular keyserver.
1745 Most keyservers synchronize with each other, so there is generally no
1746 need to send keys to more than one server. The keyserver
1747 @code{hkp://keys.gnupg.net} uses round robin DNS to give a different
1748 keyserver each time you use it.
1750 @item --keyserver-options @code{name=value}
1751 @opindex keyserver-options
1752 This is a space or comma delimited string that gives options for the
1753 keyserver. Options can be prefixed with a `no-' to give the opposite
1754 meaning. Valid import-options or export-options may be used here as
1755 well to apply to importing (@option{--recv-key}) or exporting
1756 (@option{--send-key}) a key from a keyserver. While not all options
1757 are available for all keyserver types, some common options are:
1761 @item include-revoked
1762 When searching for a key with @option{--search-keys}, include keys that
1763 are marked on the keyserver as revoked. Note that not all keyservers
1764 differentiate between revoked and unrevoked keys, and for such
1765 keyservers this option is meaningless. Note also that most keyservers do
1766 not have cryptographic verification of key revocations, and so turning
1767 this option off may result in skipping keys that are incorrectly marked
1770 @item include-disabled
1771 When searching for a key with @option{--search-keys}, include keys that
1772 are marked on the keyserver as disabled. Note that this option is not
1773 used with HKP keyservers.
1775 @item auto-key-retrieve
1776 This is the same as the option @option{auto-key-retrieve}.
1778 @item honor-keyserver-url
1779 When using @option{--refresh-keys}, if the key in question has a preferred
1780 keyserver URL, then use that preferred keyserver to refresh the key
1781 from. In addition, if auto-key-retrieve is set, and the signature
1782 being verified has a preferred keyserver URL, then use that preferred
1783 keyserver to fetch the key from. Note that this option introduces a
1784 "web bug": The creator of the key can see when the keys is
1785 refreshed. Thus this option is not enabled by default.
1787 @item honor-pka-record
1788 If @option{--auto-key-retrieve} is used, and the signature being
1789 verified has a PKA record, then use the PKA information to fetch
1790 the key. Defaults to "yes".
1792 @item include-subkeys
1793 When receiving a key, include subkeys as potential targets. Note that
1794 this option is not used with HKP keyservers, as they do not support
1795 retrieving keys by subkey id.
1798 Tell the keyserver helper program how long (in seconds) to try and
1799 perform a keyserver action before giving up. Note that performing
1800 multiple actions at the same time uses this timeout value per action.
1801 For example, when retrieving multiple keys via @option{--recv-keys}, the
1802 timeout applies separately to each key retrieval, and not to the
1803 @option{--recv-keys} command as a whole. Defaults to 30 seconds.
1805 @item http-proxy=@code{value}
1806 This options is deprecated.
1807 Set the proxy to use for HTTP and HKP keyservers.
1808 This overrides any proxy defined in @file{dirmngr.conf}.
1811 This option has no more function since GnuPG 2.1. Use the
1812 @code{dirmngr} configuration options instead.
1815 This option has no more function since GnuPG 2.1. Use the
1816 @code{dirmngr} configuration options instead.
1819 This option has no more function since GnuPG 2.1. Use the
1820 @code{dirmngr} configuration options instead.
1823 This option has no more function since GnuPG 2.1. Use the
1824 @code{dirmngr} configuration options instead.
1828 @item --completes-needed @code{n}
1829 @opindex compliant-needed
1830 Number of completely trusted users to introduce a new
1831 key signer (defaults to 1).
1833 @item --marginals-needed @code{n}
1834 @opindex marginals-needed
1835 Number of marginally trusted users to introduce a new
1836 key signer (defaults to 3)
1838 @item --tofu-default-policy @code{auto|good|unknown|bad|ask}
1839 @opindex tofu-default-policy
1840 The default TOFU policy (defaults to @code{auto}). For more
1841 information about the meaning of this option, @xref{trust-model-tofu}.
1843 @item --max-cert-depth @code{n}
1844 @opindex max-cert-depth
1845 Maximum depth of a certification chain (default is 5).
1847 @item --no-sig-cache
1848 @opindex no-sig-cache
1849 Do not cache the verification status of key signatures.
1850 Caching gives a much better performance in key listings. However, if
1851 you suspect that your public keyring is not save against write
1852 modifications, you can use this option to disable the caching. It
1853 probably does not make sense to disable it because all kind of damage
1854 can be done if someone else has write access to your public keyring.
1856 @item --auto-check-trustdb
1857 @itemx --no-auto-check-trustdb
1858 @opindex auto-check-trustdb
1859 If GnuPG feels that its information about the Web of Trust has to be
1860 updated, it automatically runs the @option{--check-trustdb} command
1861 internally. This may be a time consuming
1862 process. @option{--no-auto-check-trustdb} disables this option.
1865 @itemx --no-use-agent
1867 This is dummy option. @command{@gpgname} always requires the agent.
1869 @item --gpg-agent-info
1870 @opindex gpg-agent-info
1871 This is dummy option. It has no effect when used with @command{@gpgname}.
1874 @item --agent-program @var{file}
1875 @opindex agent-program
1876 Specify an agent program to be used for secret key operations. The
1877 default value is determined by running @command{gpgconf} with the
1878 option @option{--list-dirs}. Note that the pipe symbol (@code{|}) is
1879 used for a regression test suite hack and may thus not be used in the
1882 @item --dirmngr-program @var{file}
1883 @opindex dirmngr-program
1884 Specify a dirmngr program to be used for keyserver access. The
1885 default value is @file{@value{BINDIR}/dirmngr}.
1887 @item --no-autostart
1888 @opindex no-autostart
1889 Do not start the gpg-agent or the dirmngr if it has not yet been
1890 started and its service is required. This option is mostly useful on
1891 machines where the connection to gpg-agent has been redirected to
1892 another machines. If dirmngr is required on the remote machine, it
1893 may be started manually using @command{gpgconf --launch dirmngr}.
1897 Lock the databases the first time a lock is requested
1898 and do not release the lock until the process
1901 @item --lock-multiple
1902 @opindex lock-multiple
1903 Release the locks every time a lock is no longer
1904 needed. Use this to override a previous @option{--lock-once}
1909 Disable locking entirely. This option should be used only in very
1910 special environments, where it can be assured that only one process
1911 is accessing those files. A bootable floppy with a stand-alone
1912 encryption system will probably use this. Improper usage of this
1913 option may lead to data and key corruption.
1915 @item --exit-on-status-write-error
1916 @opindex exit-on-status-write-error
1917 This option will cause write errors on the status FD to immediately
1918 terminate the process. That should in fact be the default but it never
1919 worked this way and thus we need an option to enable this, so that the
1920 change won't break applications which close their end of a status fd
1921 connected pipe too early. Using this option along with
1922 @option{--enable-progress-filter} may be used to cleanly cancel long
1923 running gpg operations.
1925 @item --limit-card-insert-tries @code{n}
1926 @opindex limit-card-insert-tries
1927 With @code{n} greater than 0 the number of prompts asking to insert a
1928 smartcard gets limited to N-1. Thus with a value of 1 gpg won't at
1929 all ask to insert a card if none has been inserted at startup. This
1930 option is useful in the configuration file in case an application does
1931 not know about the smartcard support and waits ad infinitum for an
1934 @item --no-random-seed-file
1935 @opindex no-random-seed-file
1936 GnuPG uses a file to store its internal random pool over invocations.
1937 This makes random generation faster; however sometimes write operations
1938 are not desired. This option can be used to achieve that with the cost of
1939 slower random generation.
1942 @opindex no-greeting
1943 Suppress the initial copyright message.
1945 @item --no-secmem-warning
1946 @opindex no-secmem-warning
1947 Suppress the warning about "using insecure memory".
1949 @item --no-permission-warning
1950 @opindex permission-warning
1951 Suppress the warning about unsafe file and home directory (@option{--homedir})
1952 permissions. Note that the permission checks that GnuPG performs are
1953 not intended to be authoritative, but rather they simply warn about
1954 certain common permission problems. Do not assume that the lack of a
1955 warning means that your system is secure.
1957 Note that the warning for unsafe @option{--homedir} permissions cannot be
1958 suppressed in the gpg.conf file, as this would allow an attacker to
1959 place an unsafe gpg.conf file in place, and use this file to suppress
1960 warnings about itself. The @option{--homedir} permissions warning may only be
1961 suppressed on the command line.
1963 @item --no-mdc-warning
1964 @opindex no-mdc-warning
1965 Suppress the warning about missing MDC integrity protection.
1967 @item --require-secmem
1968 @itemx --no-require-secmem
1969 @opindex require-secmem
1970 Refuse to run if GnuPG cannot get secure memory. Defaults to no
1971 (i.e. run, but give a warning).
1974 @item --require-cross-certification
1975 @itemx --no-require-cross-certification
1976 @opindex require-cross-certification
1977 When verifying a signature made from a subkey, ensure that the cross
1978 certification "back signature" on the subkey is present and valid. This
1979 protects against a subtle attack against subkeys that can sign.
1980 Defaults to @option{--require-cross-certification} for
1986 Allow the user to do certain nonsensical or "silly" things like
1987 signing an expired or revoked key, or certain potentially incompatible
1988 things like generating unusual key types. This also disables certain
1989 warning messages about potentially incompatible actions. As the name
1990 implies, this option is for experts only. If you don't fully
1991 understand the implications of what it allows you to do, leave this
1992 off. @option{--no-expert} disables this option.
1997 @c *******************************************
1998 @c ******** KEY RELATED OPTIONS ************
1999 @c *******************************************
2000 @node GPG Key related Options
2001 @subsection Key related options
2005 @item --recipient @var{name}
2008 Encrypt for user id @var{name}. If this option or
2009 @option{--hidden-recipient} is not specified, GnuPG asks for the user-id
2010 unless @option{--default-recipient} is given.
2012 @item --hidden-recipient @var{name}
2014 @opindex hidden-recipient
2015 Encrypt for user ID @var{name}, but hide the key ID of this user's
2016 key. This option helps to hide the receiver of the message and is a
2017 limited countermeasure against traffic analysis. If this option or
2018 @option{--recipient} is not specified, GnuPG asks for the user ID unless
2019 @option{--default-recipient} is given.
2021 @item --recipient-file @var{file}
2023 @opindex recipient-file
2024 This option is similar to @option{--recipient} except that it
2025 encrypts to a key stored in the given file. @var{file} must be the
2026 name of a file containing exactly one key. @command{gpg} assumes that
2027 the key in this file is fully valid.
2029 @item --hidden-recipient-file @var{file}
2031 @opindex hidden-recipient-file
2032 This option is similar to @option{--hidden-recipient} except that it
2033 encrypts to a key stored in the given file. @var{file} must be the
2034 name of a file containing exactly one key. @command{gpg} assumes that
2035 the key in this file is fully valid.
2037 @item --encrypt-to @code{name}
2039 Same as @option{--recipient} but this one is intended for use in the
2040 options file and may be used with your own user-id as an
2041 "encrypt-to-self". These keys are only used when there are other
2042 recipients given either by use of @option{--recipient} or by the asked
2043 user id. No trust checking is performed for these user ids and even
2044 disabled keys can be used.
2046 @item --hidden-encrypt-to @code{name}
2047 @opindex hidden-encrypt-to
2048 Same as @option{--hidden-recipient} but this one is intended for use in the
2049 options file and may be used with your own user-id as a hidden
2050 "encrypt-to-self". These keys are only used when there are other
2051 recipients given either by use of @option{--recipient} or by the asked user id.
2052 No trust checking is performed for these user ids and even disabled
2055 @item --no-encrypt-to
2056 @opindex no-encrypt-to
2057 Disable the use of all @option{--encrypt-to} and
2058 @option{--hidden-encrypt-to} keys.
2060 @item --group @code{name=value1 }
2062 Sets up a named group, which is similar to aliases in email programs.
2063 Any time the group name is a recipient (@option{-r} or
2064 @option{--recipient}), it will be expanded to the values
2065 specified. Multiple groups with the same name are automatically merged
2066 into a single group.
2068 The values are @code{key IDs} or fingerprints, but any key description
2069 is accepted. Note that a value with spaces in it will be treated as
2070 two different values. Note also there is only one level of expansion
2071 --- you cannot make an group that points to another group. When used
2072 from the command line, it may be necessary to quote the argument to
2073 this option to prevent the shell from treating it as multiple
2076 @item --ungroup @code{name}
2078 Remove a given entry from the @option{--group} list.
2082 Remove all entries from the @option{--group} list.
2084 @item --local-user @var{name}
2087 Use @var{name} as the key to sign with. Note that this option overrides
2088 @option{--default-key}.
2090 @item --try-secret-key @var{name}
2091 @opindex try-secret-key
2092 For hidden recipients GPG needs to know the keys to use for trial
2093 decryption. The key set with @option{--default-key} is always tried
2094 first, but this is often not sufficient. This option allows setting more
2095 keys to be used for trial decryption. Although any valid user-id
2096 specification may be used for @var{name} it makes sense to use at least
2097 the long keyid to avoid ambiguities. Note that gpg-agent might pop up a
2098 pinentry for a lot keys to do the trial decryption. If you want to stop
2099 all further trial decryption you may use close-window button instead of
2102 @item --try-all-secrets
2103 @opindex try-all-secrets
2104 Don't look at the key ID as stored in the message but try all secret
2105 keys in turn to find the right decryption key. This option forces the
2106 behaviour as used by anonymous recipients (created by using
2107 @option{--throw-keyids} or @option{--hidden-recipient}) and might come
2108 handy in case where an encrypted message contains a bogus key ID.
2110 @item --skip-hidden-recipients
2111 @itemx --no-skip-hidden-recipients
2112 @opindex skip-hidden-recipients
2113 @opindex no-skip-hidden-recipients
2114 During decryption skip all anonymous recipients. This option helps in
2115 the case that people use the hidden recipients feature to hide there
2116 own encrypt-to key from others. If oneself has many secret keys this
2117 may lead to a major annoyance because all keys are tried in turn to
2118 decrypt something which was not really intended for it. The drawback
2119 of this option is that it is currently not possible to decrypt a
2120 message which includes real anonymous recipients.
2125 @c *******************************************
2126 @c ******** INPUT AND OUTPUT ***************
2127 @c *******************************************
2128 @node GPG Input and Output
2129 @subsection Input and Output
2136 Create ASCII armored output. The default is to create the binary
2141 Assume the input data is not in ASCII armored format.
2143 @item --output @var{file}
2144 @itemx -o @var{file}
2146 Write output to @var{file}.
2148 @item --max-output @code{n}
2150 This option sets a limit on the number of bytes that will be generated
2151 when processing a file. Since OpenPGP supports various levels of
2152 compression, it is possible that the plaintext of a given message may be
2153 significantly larger than the original OpenPGP message. While GnuPG
2154 works properly with such messages, there is often a desire to set a
2155 maximum file size that will be generated before processing is forced to
2156 stop by the OS limits. Defaults to 0, which means "no limit".
2158 @item --input-size-hint @var{n}
2159 @opindex input-size-hint
2160 This option can be used to tell GPG the size of the input data in
2161 bytes. @var{n} must be a positive base-10 number. This option is
2162 only useful if the input is not taken from a file. GPG may use thos
2163 hint to optimize its buffer allocation strategy. It is also used by
2164 the @option{--status-fd} line ``PROGRESS'' to provide a value for
2165 ``total'' if that is not available by other means.
2167 @item --import-options @code{parameters}
2168 @opindex import-options
2169 This is a space or comma delimited string that gives options for
2170 importing keys. Options can be prepended with a `no-' to give the
2171 opposite meaning. The options are:
2175 @item import-local-sigs
2176 Allow importing key signatures marked as "local". This is not
2177 generally useful unless a shared keyring scheme is being used.
2180 @item keep-ownertrust
2181 Normally possible still existing ownertrust values of a key are
2182 cleared if a key is imported. This is in general desirable so that
2183 a formerly deleted key does not automatically gain an ownertrust
2184 values merely due to import. On the other hand it is sometimes
2185 necessary to re-import a trusted set of keys again but keeping
2186 already assigned ownertrust values. This can be achived by using
2189 @item repair-pks-subkey-bug
2190 During import, attempt to repair the damage caused by the PKS keyserver
2191 bug (pre version 0.9.6) that mangles keys with multiple subkeys. Note
2192 that this cannot completely repair the damaged key as some crucial data
2193 is removed by the keyserver, but it does at least give you back one
2194 subkey. Defaults to no for regular @option{--import} and to yes for
2195 keyserver @option{--recv-keys}.
2198 Show a listing of the key as imported right before it is stored.
2199 This can be combined with the option @option{--dry-run} to only look
2203 Run the entire import code but instead of storing the key to the
2204 local keyring write it to the output. The export options
2205 @option{export-pka} and @option{export-dane} affect the output. This
2206 option can be used to remove all invalid parts from a key without the
2210 During import, allow key updates to existing keys, but do not allow
2211 any new keys to be imported. Defaults to no.
2214 After import, compact (remove all signatures except the
2215 self-signature) any user IDs from the new key that are not usable.
2216 Then, remove any signatures from the new key that are not usable.
2217 This includes signatures that were issued by keys that are not present
2218 on the keyring. This option is the same as running the @option{--edit-key}
2219 command "clean" after import. Defaults to no.
2221 @item import-minimal
2222 Import the smallest key possible. This removes all signatures except
2223 the most recent self-signature on each user ID. This option is the
2224 same as running the @option{--edit-key} command "minimize" after import.
2228 @item --import-filter @code{@var{name}=@var{expr}}
2229 @itemx --export-filter @code{@var{name}=@var{expr}}
2230 @opindex import-filter
2231 @opindex export-filter
2232 These options define an import/export filter which are applied to the
2233 imported/exported keyblock right before it will be stored/written.
2234 @var{name} defines the type of filter to use, @var{expr} the
2235 expression to evaluate. The option can be used several times which
2236 then appends more expression to the same @var{name}.
2239 The available filter types are:
2244 This filter will keep a user id packet and its dependent packets in
2245 the keyblock if the expression evaluates to true.
2249 For the syntax of the expression see the chapter "FILTER EXPRESSIONS".
2250 The property names for the expressions depend on the actual filter
2251 type and are indicated in the following table.
2253 The available properties are:
2258 A string with the user id. (keep-uid)
2261 The addr-spec part of a user id with mailbox or the empty string.
2265 Boolean indicating whether the user id is the primary one. (keep-uid)
2269 @item --export-options @code{parameters}
2270 @opindex export-options
2271 This is a space or comma delimited string that gives options for
2272 exporting keys. Options can be prepended with a `no-' to give the
2273 opposite meaning. The options are:
2277 @item export-local-sigs
2278 Allow exporting key signatures marked as "local". This is not
2279 generally useful unless a shared keyring scheme is being used.
2282 @item export-attributes
2283 Include attribute user IDs (photo IDs) while exporting. This is
2284 useful to export keys if they are going to be used by an OpenPGP
2285 program that does not accept attribute user IDs. Defaults to yes.
2287 @item export-sensitive-revkeys
2288 Include designated revoker information that was marked as
2289 "sensitive". Defaults to no.
2291 @c Since GnuPG 2.1 gpg-agent manages the secret key and thus the
2292 @c export-reset-subkey-passwd hack is not anymore justified. Such use
2293 @c cases may be implemented using a specialized secret key export
2295 @c @item export-reset-subkey-passwd
2296 @c When using the @option{--export-secret-subkeys} command, this option resets
2297 @c the passphrases for all exported subkeys to empty. This is useful
2298 @c when the exported subkey is to be used on an unattended machine where
2299 @c a passphrase doesn't necessarily make sense. Defaults to no.
2302 Compact (remove all signatures from) user IDs on the key being
2303 exported if the user IDs are not usable. Also, do not export any
2304 signatures that are not usable. This includes signatures that were
2305 issued by keys that are not present on the keyring. This option is
2306 the same as running the @option{--edit-key} command "clean" before export
2307 except that the local copy of the key is not modified. Defaults to
2310 @item export-minimal
2311 Export the smallest key possible. This removes all signatures except the
2312 most recent self-signature on each user ID. This option is the same as
2313 running the @option{--edit-key} command "minimize" before export except
2314 that the local copy of the key is not modified. Defaults to no.
2317 Instead of outputting the key material output PKA records suitable
2318 to put into DNS zone files. An ORIGIN line is printed before each
2319 record to allow diverting the records to the corresponding zone file.
2322 Instead of outputting the key material output OpenPGP DANE records
2323 suitable to put into DNS zone files. An ORIGIN line is printed before
2324 each record to allow diverting the records to the corresponding zone
2330 @opindex with-colons
2331 Print key listings delimited by colons. Note that the output will be
2332 encoded in UTF-8 regardless of any @option{--display-charset} setting. This
2333 format is useful when GnuPG is called from scripts and other programs
2334 as it is easily machine parsed. The details of this format are
2335 documented in the file @file{doc/DETAILS}, which is included in the GnuPG
2336 source distribution.
2338 @item --fixed-list-mode
2339 @opindex fixed-list-mode
2340 Do not merge primary user ID and primary key in @option{--with-colon}
2341 listing mode and print all timestamps as seconds since 1970-01-01.
2342 Since GnuPG 2.0.10, this mode is always used and thus this option is
2343 obsolete; it does not harm to use it though.
2345 @item --legacy-list-mode
2346 @opindex legacy-list-mode
2347 Revert to the pre-2.1 public key list mode. This only affects the
2348 human readable output and not the machine interface
2349 (i.e. @code{--with-colons}). Note that the legacy format does not
2350 convey suitable information for elliptic curves.
2352 @item --with-fingerprint
2353 @opindex with-fingerprint
2354 Same as the command @option{--fingerprint} but changes only the format
2355 of the output and may be used together with another command.
2357 @item --with-subkey-fingerprint
2358 @opindex with-subkey-fingerprint
2359 If a fingerprint is printed for the primary key, this option forces
2360 printing of the fingerprint for all subkeys. This could also be
2361 achieved by using the @option{--with-fingerprint} twice but by using
2362 this option along with keyid-format "none" a compact fingerprint is
2365 @item --with-icao-spelling
2366 @opindex with-icao-spelling
2367 Print the ICAO spelling of the fingerprint in addition to the hex digits.
2369 @item --with-keygrip
2370 @opindex with-keygrip
2371 Include the keygrip in the key listings. In @code{--with-colons} mode
2372 this is implicitly enable for secret keys.
2374 @item --with-wkd-hash
2375 @opindex with-wkd-hash
2376 Print a Web Key Directory indentifier along with each user ID in key
2377 listings. This is an experimental feature and semantics may change.
2380 @opindex with-secret
2381 Include info about the presence of a secret key in public key listings
2382 done with @code{--with-colons}.
2386 @c *******************************************
2387 @c ******** OPENPGP OPTIONS ****************
2388 @c *******************************************
2389 @node OpenPGP Options
2390 @subsection OpenPGP protocol specific options.
2394 @item -t, --textmode
2395 @itemx --no-textmode
2397 Treat input files as text and store them in the OpenPGP canonical text
2398 form with standard "CRLF" line endings. This also sets the necessary
2399 flags to inform the recipient that the encrypted or signed data is text
2400 and may need its line endings converted back to whatever the local
2401 system uses. This option is useful when communicating between two
2402 platforms that have different line ending conventions (UNIX-like to Mac,
2403 Mac to Windows, etc). @option{--no-textmode} disables this option, and
2406 @item --force-v3-sigs
2407 @itemx --no-force-v3-sigs
2408 @item --force-v4-certs
2409 @itemx --no-force-v4-certs
2410 These options are obsolete and have no effect since GnuPG 2.1.
2414 Force the use of encryption with a modification detection code. This
2415 is always used with the newer ciphers (those with a blocksize greater
2416 than 64 bits), or if all of the recipient keys indicate MDC support in
2417 their feature flags.
2420 @opindex disable-mdc
2421 Disable the use of the modification detection code. Note that by
2422 using this option, the encrypted message becomes vulnerable to a
2423 message modification attack.
2425 @item --disable-signer-uid
2426 @opindex disable-signer-uid
2427 By default the user ID of the signing key is embedded in the data
2428 signature. As of now this is only done if the signing key has been
2429 specified with @option{local-user} using a mail address. This
2430 information can be helpful for verifier to locate the key; see
2431 option @option{--auto-key-retrieve}.
2433 @item --personal-cipher-preferences @code{string}
2434 @opindex personal-cipher-preferences
2435 Set the list of personal cipher preferences to @code{string}. Use
2436 @command{@gpgname --version} to get a list of available algorithms,
2437 and use @code{none} to set no preference at all. This allows the user
2438 to safely override the algorithm chosen by the recipient key
2439 preferences, as GPG will only select an algorithm that is usable by
2440 all recipients. The most highly ranked cipher in this list is also
2441 used for the @option{--symmetric} encryption command.
2443 @item --personal-digest-preferences @code{string}
2444 @opindex personal-digest-preferences
2445 Set the list of personal digest preferences to @code{string}. Use
2446 @command{@gpgname --version} to get a list of available algorithms,
2447 and use @code{none} to set no preference at all. This allows the user
2448 to safely override the algorithm chosen by the recipient key
2449 preferences, as GPG will only select an algorithm that is usable by
2450 all recipients. The most highly ranked digest algorithm in this list
2451 is also used when signing without encryption
2452 (e.g. @option{--clearsign} or @option{--sign}).
2454 @item --personal-compress-preferences @code{string}
2455 @opindex personal-compress-preferences
2456 Set the list of personal compression preferences to @code{string}.
2457 Use @command{@gpgname --version} to get a list of available
2458 algorithms, and use @code{none} to set no preference at all. This
2459 allows the user to safely override the algorithm chosen by the
2460 recipient key preferences, as GPG will only select an algorithm that
2461 is usable by all recipients. The most highly ranked compression
2462 algorithm in this list is also used when there are no recipient keys
2463 to consider (e.g. @option{--symmetric}).
2465 @item --s2k-cipher-algo @code{name}
2466 @opindex s2k-cipher-algo
2467 Use @code{name} as the cipher algorithm for symmetric encryption with
2468 a passphrase if @option{--personal-cipher-preferences} and
2469 @option{--cipher-algo} are not given. The default is @value{GPGSYMENCALGO}.
2471 @item --s2k-digest-algo @code{name}
2472 @opindex s2k-digest-algo
2473 Use @code{name} as the digest algorithm used to mangle the passphrases
2474 for symmetric encryption. The default is SHA-1.
2476 @item --s2k-mode @code{n}
2478 Selects how passphrases for symmetric encryption are mangled. If
2479 @code{n} is 0 a plain passphrase (which is in general not recommended)
2480 will be used, a 1 adds a salt (which should not be used) to the
2481 passphrase and a 3 (the default) iterates the whole process a number
2482 of times (see @option{--s2k-count}).
2484 @item --s2k-count @code{n}
2486 Specify how many times the passphrases mangling for symmetric
2487 encryption is repeated. This value may range between 1024 and
2488 65011712 inclusive. The default is inquired from gpg-agent. Note
2489 that not all values in the 1024-65011712 range are legal and if an
2490 illegal value is selected, GnuPG will round up to the nearest legal
2491 value. This option is only meaningful if @option{--s2k-mode} is set
2492 to the default of 3.
2497 @c ***************************
2498 @c ******* Compliance ********
2499 @c ***************************
2500 @node Compliance Options
2501 @subsection Compliance options
2503 These options control what GnuPG is compliant to. Only one of these
2504 options may be active at a time. Note that the default setting of
2505 this is nearly always the correct one. See the INTEROPERABILITY WITH
2506 OTHER OPENPGP PROGRAMS section below before using one of these
2513 Use standard GnuPG behavior. This is essentially OpenPGP behavior
2514 (see @option{--openpgp}), but with some additional workarounds for common
2515 compatibility problems in different versions of PGP. This is the
2516 default option, so it is not generally needed, but it may be useful to
2517 override a different compliance option in the gpg.conf file.
2521 Reset all packet, cipher and digest options to strict OpenPGP
2522 behavior. Use this option to reset all previous options like
2523 @option{--s2k-*}, @option{--cipher-algo}, @option{--digest-algo} and
2524 @option{--compress-algo} to OpenPGP compliant values. All PGP
2525 workarounds are disabled.
2529 Reset all packet, cipher and digest options to strict RFC-4880
2530 behavior. Note that this is currently the same thing as
2535 Enable experimental features from proposed updates to RFC-4880. This
2536 option can be used in addition to the other compliance options.
2537 Warning: The behavior may change with any GnuPG release and created
2538 keys or data may not be usable with future GnuPG versions.
2542 Reset all packet, cipher and digest options to strict RFC-2440
2547 Set up all options to be as PGP 6 compliant as possible. This
2548 restricts you to the ciphers IDEA (if the IDEA plugin is installed),
2549 3DES, and CAST5, the hashes MD5, SHA1 and RIPEMD160, and the
2550 compression algorithms none and ZIP. This also disables
2551 --throw-keyids, and making signatures with signing subkeys as PGP 6
2552 does not understand signatures made by signing subkeys.
2554 This option implies @option{--disable-mdc --escape-from-lines}.
2558 Set up all options to be as PGP 7 compliant as possible. This is
2559 identical to @option{--pgp6} except that MDCs are not disabled, and the
2560 list of allowable ciphers is expanded to add AES128, AES192, AES256, and
2565 Set up all options to be as PGP 8 compliant as possible. PGP 8 is a lot
2566 closer to the OpenPGP standard than previous versions of PGP, so all
2567 this does is disable @option{--throw-keyids} and set
2568 @option{--escape-from-lines}. All algorithms are allowed except for the
2569 SHA224, SHA384, and SHA512 digests.
2574 @c *******************************************
2575 @c ******** ESOTERIC OPTIONS ***************
2576 @c *******************************************
2577 @node GPG Esoteric Options
2578 @subsection Doing things one usually doesn't want to do.
2585 Don't make any changes (this is not completely implemented).
2589 Changes the behaviour of some commands. This is like @option{--dry-run} but
2590 different in some cases. The semantic of this command may be extended in
2591 the future. Currently it only skips the actual decryption pass and
2592 therefore enables a fast listing of the encryption keys.
2595 @itemx --interactive
2596 @opindex interactive
2597 Prompt before overwriting any files.
2599 @item --debug-level @var{level}
2600 @opindex debug-level
2601 Select the debug level for investigating problems. @var{level} may be
2602 a numeric value or by a keyword:
2606 No debugging at all. A value of less than 1 may be used instead of
2609 Some basic debug messages. A value between 1 and 2 may be used
2610 instead of the keyword.
2612 More verbose debug messages. A value between 3 and 5 may be used
2613 instead of the keyword.
2615 Even more detailed messages. A value between 6 and 8 may be used
2616 instead of the keyword.
2618 All of the debug messages you can get. A value greater than 8 may be
2619 used instead of the keyword. The creation of hash tracing files is
2620 only enabled if the keyword is used.
2623 How these messages are mapped to the actual debugging flags is not
2624 specified and may change with newer releases of this program. They are
2625 however carefully selected to best aid in debugging.
2627 @item --debug @var{flags}
2629 Set debugging flags. All flags are or-ed and @var{flags} may be given
2630 in C syntax (e.g. 0x0042) or as a comma separated list of flag names.
2631 To get a list of all supported flags the single word "help" can be
2636 Set all useful debugging flags.
2639 @opindex debug-iolbf
2640 Set stdout into line buffered mode. This option is only honored when
2641 given on the command line.
2643 @item --faked-system-time @var{epoch}
2644 @opindex faked-system-time
2645 This option is only useful for testing; it sets the system time back or
2646 forth to @var{epoch} which is the number of seconds elapsed since the year
2647 1970. Alternatively @var{epoch} may be given as a full ISO time string
2648 (e.g. "20070924T154812").
2650 @item --enable-progress-filter
2651 @opindex enable-progress-filter
2652 Enable certain PROGRESS status outputs. This option allows frontends
2653 to display a progress indicator while gpg is processing larger files.
2654 There is a slight performance overhead using it.
2656 @item --status-fd @code{n}
2658 Write special status strings to the file descriptor @code{n}.
2659 See the file DETAILS in the documentation for a listing of them.
2661 @item --status-file @code{file}
2662 @opindex status-file
2663 Same as @option{--status-fd}, except the status data is written to file
2666 @item --logger-fd @code{n}
2668 Write log output to file descriptor @code{n} and not to STDERR.
2670 @item --log-file @code{file}
2671 @itemx --logger-file @code{file}
2673 Same as @option{--logger-fd}, except the logger data is written to file
2674 @code{file}. Note that @option{--log-file} is only implemented for
2677 @item --attribute-fd @code{n}
2678 @opindex attribute-fd
2679 Write attribute subpackets to the file descriptor @code{n}. This is most
2680 useful for use with @option{--status-fd}, since the status messages are
2681 needed to separate out the various subpackets from the stream delivered
2682 to the file descriptor.
2684 @item --attribute-file @code{file}
2685 @opindex attribute-file
2686 Same as @option{--attribute-fd}, except the attribute data is written to
2689 @item --comment @code{string}
2690 @itemx --no-comments
2692 Use @code{string} as a comment string in clear text signatures and ASCII
2693 armored messages or keys (see @option{--armor}). The default behavior is
2694 not to use a comment string. @option{--comment} may be repeated multiple
2695 times to get multiple comment strings. @option{--no-comments} removes
2696 all comments. It is a good idea to keep the length of a single comment
2697 below 60 characters to avoid problems with mail programs wrapping such
2698 lines. Note that comment lines, like all other header lines, are not
2699 protected by the signature.
2701 @item --emit-version
2702 @itemx --no-emit-version
2703 @opindex emit-version
2704 Force inclusion of the version string in ASCII armored output. If
2705 given once only the name of the program and the major number is
2706 emitted, given twice the minor is also emitted, given triple
2707 the micro is added, and given quad an operating system identification
2708 is also emitted. @option{--no-emit-version} (default) disables the version
2711 @item --sig-notation @code{name=value}
2712 @itemx --cert-notation @code{name=value}
2713 @itemx -N, --set-notation @code{name=value}
2714 @opindex sig-notation
2715 @opindex cert-notation
2716 @opindex set-notation
2717 Put the name value pair into the signature as notation data.
2718 @code{name} must consist only of printable characters or spaces, and
2719 must contain a '@@' character in the form keyname@@domain.example.com
2720 (substituting the appropriate keyname and domain name, of course). This
2721 is to help prevent pollution of the IETF reserved notation
2722 namespace. The @option{--expert} flag overrides the '@@'
2723 check. @code{value} may be any printable string; it will be encoded in
2724 UTF8, so you should check that your @option{--display-charset} is set
2725 correctly. If you prefix @code{name} with an exclamation mark (!), the
2726 notation data will be flagged as critical
2727 (rfc4880:5.2.3.16). @option{--sig-notation} sets a notation for data
2728 signatures. @option{--cert-notation} sets a notation for key signatures
2729 (certifications). @option{--set-notation} sets both.
2731 There are special codes that may be used in notation names. "%k" will
2732 be expanded into the key ID of the key being signed, "%K" into the
2733 long key ID of the key being signed, "%f" into the fingerprint of the
2734 key being signed, "%s" into the key ID of the key making the
2735 signature, "%S" into the long key ID of the key making the signature,
2736 "%g" into the fingerprint of the key making the signature (which might
2737 be a subkey), "%p" into the fingerprint of the primary key of the key
2738 making the signature, "%c" into the signature count from the OpenPGP
2739 smartcard, and "%%" results in a single "%". %k, %K, and %f are only
2740 meaningful when making a key signature (certification), and %c is only
2741 meaningful when using the OpenPGP smartcard.
2743 @item --sig-policy-url @code{string}
2744 @itemx --cert-policy-url @code{string}
2745 @itemx --set-policy-url @code{string}
2746 @opindex sig-policy-url
2747 @opindex cert-policy-url
2748 @opindex set-policy-url
2749 Use @code{string} as a Policy URL for signatures (rfc4880:5.2.3.20). If
2750 you prefix it with an exclamation mark (!), the policy URL packet will
2751 be flagged as critical. @option{--sig-policy-url} sets a policy url for
2752 data signatures. @option{--cert-policy-url} sets a policy url for key
2753 signatures (certifications). @option{--set-policy-url} sets both.
2755 The same %-expandos used for notation data are available here as well.
2757 @item --sig-keyserver-url @code{string}
2758 @opindex sig-keyserver-url
2759 Use @code{string} as a preferred keyserver URL for data signatures. If
2760 you prefix it with an exclamation mark (!), the keyserver URL packet
2761 will be flagged as critical.
2763 The same %-expandos used for notation data are available here as well.
2765 @item --set-filename @code{string}
2766 @opindex set-filename
2767 Use @code{string} as the filename which is stored inside messages.
2768 This overrides the default, which is to use the actual filename of the
2769 file being encrypted. Using the empty string for @var{string}
2770 effectively removes the filename from the output.
2772 @item --for-your-eyes-only
2773 @itemx --no-for-your-eyes-only
2774 @opindex for-your-eyes-only
2775 Set the `for your eyes only' flag in the message. This causes GnuPG to
2776 refuse to save the file unless the @option{--output} option is given,
2777 and PGP to use a "secure viewer" with a claimed Tempest-resistant font
2778 to display the message. This option overrides @option{--set-filename}.
2779 @option{--no-for-your-eyes-only} disables this option.
2781 @item --use-embedded-filename
2782 @itemx --no-use-embedded-filename
2783 @opindex use-embedded-filename
2784 Try to create a file with a name as embedded in the data. This can be
2785 a dangerous option as it enables overwriting files. Defaults to no.
2787 @item --cipher-algo @code{name}
2788 @opindex cipher-algo
2789 Use @code{name} as cipher algorithm. Running the program with the
2790 command @option{--version} yields a list of supported algorithms. If
2791 this is not used the cipher algorithm is selected from the preferences
2792 stored with the key. In general, you do not want to use this option as
2793 it allows you to violate the OpenPGP standard.
2794 @option{--personal-cipher-preferences} is the safe way to accomplish the
2797 @item --digest-algo @code{name}
2798 @opindex digest-algo
2799 Use @code{name} as the message digest algorithm. Running the program
2800 with the command @option{--version} yields a list of supported algorithms. In
2801 general, you do not want to use this option as it allows you to
2802 violate the OpenPGP standard. @option{--personal-digest-preferences} is the
2803 safe way to accomplish the same thing.
2805 @item --compress-algo @code{name}
2806 @opindex compress-algo
2807 Use compression algorithm @code{name}. "zlib" is RFC-1950 ZLIB
2808 compression. "zip" is RFC-1951 ZIP compression which is used by PGP.
2809 "bzip2" is a more modern compression scheme that can compress some
2810 things better than zip or zlib, but at the cost of more memory used
2811 during compression and decompression. "uncompressed" or "none"
2812 disables compression. If this option is not used, the default
2813 behavior is to examine the recipient key preferences to see which
2814 algorithms the recipient supports. If all else fails, ZIP is used for
2815 maximum compatibility.
2817 ZLIB may give better compression results than ZIP, as the compression
2818 window size is not limited to 8k. BZIP2 may give even better
2819 compression results than that, but will use a significantly larger
2820 amount of memory while compressing and decompressing. This may be
2821 significant in low memory situations. Note, however, that PGP (all
2822 versions) only supports ZIP compression. Using any algorithm other
2823 than ZIP or "none" will make the message unreadable with PGP. In
2824 general, you do not want to use this option as it allows you to
2825 violate the OpenPGP standard. @option{--personal-compress-preferences} is the
2826 safe way to accomplish the same thing.
2828 @item --cert-digest-algo @code{name}
2829 @opindex cert-digest-algo
2830 Use @code{name} as the message digest algorithm used when signing a
2831 key. Running the program with the command @option{--version} yields a
2832 list of supported algorithms. Be aware that if you choose an algorithm
2833 that GnuPG supports but other OpenPGP implementations do not, then some
2834 users will not be able to use the key signatures you make, or quite
2835 possibly your entire key.
2837 @item --disable-cipher-algo @code{name}
2838 @opindex disable-cipher-algo
2839 Never allow the use of @code{name} as cipher algorithm.
2840 The given name will not be checked so that a later loaded algorithm
2841 will still get disabled.
2843 @item --disable-pubkey-algo @code{name}
2844 @opindex disable-pubkey-algo
2845 Never allow the use of @code{name} as public key algorithm.
2846 The given name will not be checked so that a later loaded algorithm
2847 will still get disabled.
2849 @item --throw-keyids
2850 @itemx --no-throw-keyids
2851 @opindex throw-keyids
2852 Do not put the recipient key IDs into encrypted messages. This helps to
2853 hide the receivers of the message and is a limited countermeasure
2854 against traffic analysis.@footnote{Using a little social engineering
2855 anyone who is able to decrypt the message can check whether one of the
2856 other recipients is the one he suspects.} On the receiving side, it may
2857 slow down the decryption process because all available secret keys must
2858 be tried. @option{--no-throw-keyids} disables this option. This option
2859 is essentially the same as using @option{--hidden-recipient} for all
2862 @item --not-dash-escaped
2863 @opindex not-dash-escaped
2864 This option changes the behavior of cleartext signatures
2865 so that they can be used for patch files. You should not
2866 send such an armored file via email because all spaces
2867 and line endings are hashed too. You can not use this
2868 option for data which has 5 dashes at the beginning of a
2869 line, patch files don't have this. A special armor header
2870 line tells GnuPG about this cleartext signature option.
2872 @item --escape-from-lines
2873 @itemx --no-escape-from-lines
2874 @opindex escape-from-lines
2875 Because some mailers change lines starting with "From " to ">From " it
2876 is good to handle such lines in a special way when creating cleartext
2877 signatures to prevent the mail system from breaking the signature. Note
2878 that all other PGP versions do it this way too. Enabled by
2879 default. @option{--no-escape-from-lines} disables this option.
2881 @item --passphrase-repeat @code{n}
2882 @opindex passphrase-repeat
2883 Specify how many times @command{@gpgname} will request a new
2884 passphrase be repeated. This is useful for helping memorize a
2885 passphrase. Defaults to 1 repetition.
2887 @item --passphrase-fd @code{n}
2888 @opindex passphrase-fd
2889 Read the passphrase from file descriptor @code{n}. Only the first line
2890 will be read from file descriptor @code{n}. If you use 0 for @code{n},
2891 the passphrase will be read from STDIN. This can only be used if only
2892 one passphrase is supplied.
2894 Note that this passphrase is only used if the option @option{--batch}
2895 has also been given. This is different from GnuPG version 1.x.
2897 @item --passphrase-file @code{file}
2898 @opindex passphrase-file
2899 Read the passphrase from file @code{file}. Only the first line will
2900 be read from file @code{file}. This can only be used if only one
2901 passphrase is supplied. Obviously, a passphrase stored in a file is
2902 of questionable security if other users can read this file. Don't use
2903 this option if you can avoid it.
2904 Note that this passphrase is only used if the option @option{--batch}
2905 has also been given. This is different from GnuPG version 1.x.
2907 @item --passphrase @code{string}
2909 Use @code{string} as the passphrase. This can only be used if only one
2910 passphrase is supplied. Obviously, this is of very questionable
2911 security on a multi-user system. Don't use this option if you can
2913 Note that this passphrase is only used if the option @option{--batch}
2914 has also been given. This is different from GnuPG version 1.x.
2916 @item --pinentry-mode @code{mode}
2917 @opindex pinentry-mode
2918 Set the pinentry mode to @code{mode}. Allowed values for @code{mode}
2922 Use the default of the agent, which is @code{ask}.
2924 Force the use of the Pinentry.
2926 Emulate use of Pinentry's cancel button.
2928 Return a Pinentry error (``No Pinentry'').
2930 Redirect Pinentry queries to the caller. Note that in contrast to
2931 Pinentry the user is not prompted again if he enters a bad password.
2934 @item --command-fd @code{n}
2936 This is a replacement for the deprecated shared-memory IPC mode.
2937 If this option is enabled, user input on questions is not expected
2938 from the TTY but from the given file descriptor. It should be used
2939 together with @option{--status-fd}. See the file doc/DETAILS in the source
2940 distribution for details on how to use it.
2942 @item --command-file @code{file}
2943 @opindex command-file
2944 Same as @option{--command-fd}, except the commands are read out of file
2947 @item --allow-non-selfsigned-uid
2948 @itemx --no-allow-non-selfsigned-uid
2949 @opindex allow-non-selfsigned-uid
2950 Allow the import and use of keys with user IDs which are not
2951 self-signed. This is not recommended, as a non self-signed user ID is
2952 trivial to forge. @option{--no-allow-non-selfsigned-uid} disables.
2954 @item --allow-freeform-uid
2955 @opindex allow-freeform-uid
2956 Disable all checks on the form of the user ID while generating a new
2957 one. This option should only be used in very special environments as
2958 it does not ensure the de-facto standard format of user IDs.
2960 @item --ignore-time-conflict
2961 @opindex ignore-time-conflict
2962 GnuPG normally checks that the timestamps associated with keys and
2963 signatures have plausible values. However, sometimes a signature
2964 seems to be older than the key due to clock problems. This option
2965 makes these checks just a warning. See also @option{--ignore-valid-from} for
2966 timestamp issues on subkeys.
2968 @item --ignore-valid-from
2969 @opindex ignore-valid-from
2970 GnuPG normally does not select and use subkeys created in the future.
2971 This option allows the use of such keys and thus exhibits the
2972 pre-1.0.7 behaviour. You should not use this option unless there
2973 is some clock problem. See also @option{--ignore-time-conflict} for timestamp
2974 issues with signatures.
2976 @item --ignore-crc-error
2977 @opindex ignore-crc-error
2978 The ASCII armor used by OpenPGP is protected by a CRC checksum against
2979 transmission errors. Occasionally the CRC gets mangled somewhere on
2980 the transmission channel but the actual content (which is protected by
2981 the OpenPGP protocol anyway) is still okay. This option allows GnuPG
2982 to ignore CRC errors.
2984 @item --ignore-mdc-error
2985 @opindex ignore-mdc-error
2986 This option changes a MDC integrity protection failure into a warning.
2987 This can be useful if a message is partially corrupt, but it is
2988 necessary to get as much data as possible out of the corrupt message.
2989 However, be aware that a MDC protection failure may also mean that the
2990 message was tampered with intentionally by an attacker.
2992 @item --allow-weak-digest-algos
2993 @opindex allow-weak-digest-algos
2994 Signatures made with known-weak digest algorithms are normally
2995 rejected with an ``invalid digest algorithm'' message. This option
2996 allows the verification of signatures made with such weak algorithms.
2997 MD5 is the only digest algorithm considered weak by default. See also
2998 @option{--weak-digest} to reject other digest algorithms.
3000 @item --weak-digest @code{name}
3001 @opindex weak-digest
3002 Treat the specified digest algorithm as weak. Signatures made over
3003 weak digests algorithms are normally rejected. This option can be
3004 supplied multiple times if multiple algorithms should be considered
3005 weak. See also @option{--allow-weak-digest-algos} to disable
3006 rejection of weak digests. MD5 is always considered weak, and does
3007 not need to be listed explicitly.
3009 @item --no-default-keyring
3010 @opindex no-default-keyring
3011 Do not add the default keyrings to the list of keyrings. Note that
3012 GnuPG will not operate without any keyrings, so if you use this option
3013 and do not provide alternate keyrings via @option{--keyring} or
3014 @option{--secret-keyring}, then GnuPG will still use the default public or
3019 Do not add use any keyrings even if specified as options.
3022 @opindex skip-verify
3023 Skip the signature verification step. This may be
3024 used to make the decryption faster if the signature
3025 verification is not needed.
3027 @item --with-key-data
3028 @opindex with-key-data
3029 Print key listings delimited by colons (like @option{--with-colons}) and
3030 print the public key data.
3032 @item --fast-list-mode
3033 @opindex fast-list-mode
3034 Changes the output of the list commands to work faster; this is achieved
3035 by leaving some parts empty. Some applications don't need the user ID
3036 and the trust information given in the listings. By using this options
3037 they can get a faster listing. The exact behaviour of this option may
3038 change in future versions. If you are missing some information, don't
3043 This is not for normal use. Use the source to see for what it might be useful.
3045 @item --set-filesize
3046 @opindex set-filesize
3047 This is not for normal use. Use the source to see for what it might be useful.
3049 @item --show-session-key
3050 @opindex show-session-key
3051 Display the session key used for one message. See
3052 @option{--override-session-key} for the counterpart of this option.
3054 We think that Key Escrow is a Bad Thing; however the user should have
3055 the freedom to decide whether to go to prison or to reveal the content
3056 of one specific message without compromising all messages ever
3057 encrypted for one secret key.
3059 You can also use this option if you receive an encrypted message which
3060 is abusive or offensive, to prove to the administrators of the
3061 messaging system that the ciphertext transmitted corresponds to an
3062 inappropriate plaintext so they can take action against the offending
3065 @item --override-session-key @code{string}
3066 @opindex override-session-key
3067 Don't use the public key but the session key @code{string}. The format
3068 of this string is the same as the one printed by
3069 @option{--show-session-key}. This option is normally not used but comes
3070 handy in case someone forces you to reveal the content of an encrypted
3071 message; using this option you can do this without handing out the
3074 @item --ask-sig-expire
3075 @itemx --no-ask-sig-expire
3076 @opindex ask-sig-expire
3077 When making a data signature, prompt for an expiration time. If this
3078 option is not specified, the expiration time set via
3079 @option{--default-sig-expire} is used. @option{--no-ask-sig-expire}
3080 disables this option.
3082 @item --default-sig-expire
3083 @opindex default-sig-expire
3084 The default expiration time to use for signature expiration. Valid
3085 values are "0" for no expiration, a number followed by the letter d
3086 (for days), w (for weeks), m (for months), or y (for years) (for
3087 example "2m" for two months, or "5y" for five years), or an absolute
3088 date in the form YYYY-MM-DD. Defaults to "0".
3090 @item --ask-cert-expire
3091 @itemx --no-ask-cert-expire
3092 @opindex ask-cert-expire
3093 When making a key signature, prompt for an expiration time. If this
3094 option is not specified, the expiration time set via
3095 @option{--default-cert-expire} is used. @option{--no-ask-cert-expire}
3096 disables this option.
3098 @item --default-cert-expire
3099 @opindex default-cert-expire
3100 The default expiration time to use for key signature expiration.
3101 Valid values are "0" for no expiration, a number followed by the
3102 letter d (for days), w (for weeks), m (for months), or y (for years)
3103 (for example "2m" for two months, or "5y" for five years), or an
3104 absolute date in the form YYYY-MM-DD. Defaults to "0".
3106 @item --allow-secret-key-import
3107 @opindex allow-secret-key-import
3108 This is an obsolete option and is not used anywhere.
3110 @item --allow-multiple-messages
3111 @item --no-allow-multiple-messages
3112 @opindex allow-multiple-messages
3113 Allow processing of multiple OpenPGP messages contained in a single file
3114 or stream. Some programs that call GPG are not prepared to deal with
3115 multiple messages being processed together, so this option defaults to
3116 no. Note that versions of GPG prior to 1.4.7 always allowed multiple
3119 Warning: Do not use this option unless you need it as a temporary
3123 @item --enable-special-filenames
3124 @opindex enable-special-filenames
3125 This options enables a mode in which filenames of the form
3126 @file{-&n}, where n is a non-negative decimal number,
3127 refer to the file descriptor n and not to a file with that name.
3129 @item --no-expensive-trust-checks
3130 @opindex no-expensive-trust-checks
3131 Experimental use only.
3133 @item --preserve-permissions
3134 @opindex preserve-permissions
3135 Don't change the permissions of a secret keyring back to user
3136 read/write only. Use this option only if you really know what you are doing.
3138 @item --default-preference-list @code{string}
3139 @opindex default-preference-list
3140 Set the list of default preferences to @code{string}. This preference
3141 list is used for new keys and becomes the default for "setpref" in the
3144 @item --default-keyserver-url @code{name}
3145 @opindex default-keyserver-url
3146 Set the default keyserver URL to @code{name}. This keyserver will be
3147 used as the keyserver URL when writing a new self-signature on a key,
3148 which includes key generation and changing preferences.
3151 @opindex list-config
3152 Display various internal configuration parameters of GnuPG. This option
3153 is intended for external programs that call GnuPG to perform tasks, and
3154 is thus not generally useful. See the file @file{doc/DETAILS} in the
3155 source distribution for the details of which configuration items may be
3156 listed. @option{--list-config} is only usable with
3157 @option{--with-colons} set.
3159 @item --list-gcrypt-config
3160 @opindex list-gcrypt-config
3161 Display various internal configuration parameters of Libgcrypt.
3163 @item --gpgconf-list
3164 @opindex gpgconf-list
3165 This command is similar to @option{--list-config} but in general only
3166 internally used by the @command{gpgconf} tool.
3168 @item --gpgconf-test
3169 @opindex gpgconf-test
3170 This is more or less dummy action. However it parses the configuration
3171 file and returns with failure if the configuration file would prevent
3172 @command{gpg} from startup. Thus it may be used to run a syntax check
3173 on the configuration file.
3177 @c *******************************
3178 @c ******* Deprecated ************
3179 @c *******************************
3180 @node Deprecated Options
3181 @subsection Deprecated options
3186 @itemx --no-show-photos
3187 @opindex show-photos
3188 Causes @option{--list-keys}, @option{--list-sigs},
3189 @option{--list-public-keys}, @option{--list-secret-keys}, and verifying
3190 a signature to also display the photo ID attached to the key, if
3191 any. See also @option{--photo-viewer}. These options are deprecated. Use
3192 @option{--list-options [no-]show-photos} and/or @option{--verify-options
3193 [no-]show-photos} instead.
3195 @item --show-keyring
3196 @opindex show-keyring
3197 Display the keyring name at the head of key listings to show which
3198 keyring a given key resides on. This option is deprecated: use
3199 @option{--list-options [no-]show-keyring} instead.
3201 @item --always-trust
3202 @opindex always-trust
3203 Identical to @option{--trust-model always}. This option is deprecated.
3205 @item --show-notation
3206 @itemx --no-show-notation
3207 @opindex show-notation
3208 Show signature notations in the @option{--list-sigs} or @option{--check-sigs} listings
3209 as well as when verifying a signature with a notation in it. These
3210 options are deprecated. Use @option{--list-options [no-]show-notation}
3211 and/or @option{--verify-options [no-]show-notation} instead.
3213 @item --show-policy-url
3214 @itemx --no-show-policy-url
3215 @opindex show-policy-url
3216 Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
3217 listings as well as when verifying a signature with a policy URL in
3218 it. These options are deprecated. Use @option{--list-options
3219 [no-]show-policy-url} and/or @option{--verify-options
3220 [no-]show-policy-url} instead.
3226 @c *******************************************
3227 @c *************** ****************
3228 @c *************** FILES ****************
3229 @c *************** ****************
3230 @c *******************************************
3232 @node GPG Configuration
3233 @section Configuration files
3235 There are a few configuration files to control certain aspects of
3236 @command{@gpgname}'s operation. Unless noted, they are expected in the
3237 current home directory (@pxref{option --homedir}).
3243 This is the standard configuration file read by @command{@gpgname} on
3244 startup. It may contain any valid long option; the leading two dashes
3245 may not be entered and the option may not be abbreviated. This default
3246 name may be changed on the command line (@pxref{gpg-option --options}).
3247 You should backup this file.
3251 Note that on larger installations, it is useful to put predefined files
3252 into the directory @file{@value{SYSCONFSKELDIR}} so that
3253 newly created users start up with a working configuration.
3254 For existing users a small
3255 helper script is provided to create these files (@pxref{addgnupghome}).
3257 For internal purposes @command{@gpgname} creates and maintains a few other
3258 files; They all live in in the current home directory (@pxref{option
3259 --homedir}). Only the @command{@gpgname} program may modify these files.
3265 This is the default home directory which is used if neither the
3266 environment variable @code{GNUPGHOME} nor the option
3267 @option{--homedir} is given.
3269 @item ~/.gnupg/pubring.gpg
3270 @efindex pubring.gpg
3271 The public keyring. You should backup this file.
3273 @item ~/.gnupg/pubring.gpg.lock
3274 The lock file for the public keyring.
3276 @item ~/.gnupg/pubring.kbx
3277 @efindex pubring.kbx
3278 The public keyring using a different format. This file is sharred
3279 with @command{gpgsm}. You should backup this file.
3281 @item ~/.gnupg/pubring.kbx.lock
3282 The lock file for @file{pubring.kbx}.
3284 @item ~/.gnupg/secring.gpg
3285 @efindex secring.gpg
3286 A secret keyring as used by GnuPG versions before 2.1. It is not
3287 used by GnuPG 2.1 and later.
3289 @item ~/.gnupg/secring.gpg.lock
3290 The lock file for the secret keyring.
3292 @item ~/.gnupg/.gpg-v21-migrated
3293 @efindex .gpg-v21-migrated
3294 File indicating that a migration to GnuPG 2.1 has been done.
3296 @item ~/.gnupg/trustdb.gpg
3297 @efindex trustdb.gpg
3298 The trust database. There is no need to backup this file; it is better
3299 to backup the ownertrust values (@pxref{option --export-ownertrust}).
3301 @item ~/.gnupg/trustdb.gpg.lock
3302 The lock file for the trust database.
3304 @item ~/.gnupg/random_seed
3305 @efindex random_seed
3306 A file used to preserve the state of the internal random pool.
3308 @item ~/.gnupg/openpgp-revocs.d/
3309 @efindex openpgp-revocs.d
3310 This is the directory where gpg stores pre-generated revocation
3311 certificates. The file name corresponds to the OpenPGP fingerprint of
3312 the respective key. It is suggested to backup those certificates and
3313 if the primary private key is not stored on the disk to move them to
3314 an external storage device. Anyone who can access theses files is
3315 able to revoke the corresponding key. You may want to print them out.
3316 You should backup all files in this directory and take care to keep
3317 this backup closed away.
3319 @item @value{DATADIR}/options.skel
3320 @efindex options.skel
3321 The skeleton options file.
3325 Operation is further controlled by a few environment variables:
3331 Used to locate the default home directory.
3335 If set directory used instead of "~/.gnupg".
3337 @item GPG_AGENT_INFO
3338 This variable is obsolete; it was used by GnuPG versions before 2.1.
3340 @item PINENTRY_USER_DATA
3341 @efindex PINENTRY_USER_DATA
3342 This value is passed via gpg-agent to pinentry. It is useful to convey
3343 extra information to a custom pinentry.
3349 Used to size some displays to the full size of the screen.
3353 Apart from its use by GNU, it is used in the W32 version to override the
3354 language selection done through the Registry. If used and set to a
3355 valid and available language name (@var{langid}), the file with the
3356 translation is loaded from
3358 @code{@var{gpgdir}/gnupg.nls/@var{langid}.mo}. Here @var{gpgdir} is the
3359 directory out of which the gpg binary has been loaded. If it can't be
3360 loaded the Registry is tried and as last resort the native Windows
3361 locale system is used.
3366 @c *******************************************
3367 @c *************** ****************
3368 @c *************** EXAMPLES ****************
3369 @c *************** ****************
3370 @c *******************************************
3377 @item gpg -se -r @code{Bob} @code{file}
3378 sign and encrypt for user Bob
3380 @item gpg --clearsign @code{file}
3381 make a clear text signature
3383 @item gpg -sb @code{file}
3384 make a detached signature
3386 @item gpg -u 0x12345678 -sb @code{file}
3387 make a detached signature with the key 0x12345678
3389 @item gpg --list-keys @code{user_ID}
3392 @item gpg --fingerprint @code{user_ID}
3395 @item gpg --verify @code{pgpfile}
3396 @itemx gpg --verify @code{sigfile}
3397 Verify the signature of the file but do not output the data. The
3398 second form is used for detached signatures, where @code{sigfile}
3399 is the detached signature (either ASCII armored or binary) and
3400 are the signed data; if this is not given, the name of
3401 the file holding the signed data is constructed by cutting off the
3402 extension (".asc" or ".sig") of @code{sigfile} or by asking the
3403 user for the filename.
3407 @c *******************************************
3408 @c *************** ****************
3409 @c *************** USER ID ****************
3410 @c *************** ****************
3411 @c *******************************************
3412 @mansect how to specify a user id
3414 @include specify-user-id.texi
3417 @mansect filter expressions
3418 @chapheading FILTER EXPRESSIONS
3420 The options @option{--import-filter} and @option{--export-filter} use
3421 expressions with this syntax (square brackets indicate an optional
3422 part and curly braces a repetition, white space between the elements
3427 [lc] @{[@{flag@}] PROPNAME op VALUE [lc]@}
3431 The name of a property (@var{PROPNAME}) may only consist of letters,
3432 digits and underscores. The description for the filter type
3433 describes which properties are defined. If an undefined property is
3434 used it evaluates to the empty string. Unless otherwise noted, the
3435 @var{VALUE} must always be given and may not be the empty string. No
3436 quoting is defined for the value, thus the value may not contain the
3437 strings @code{&&} or @code{||}, which are used as logical connection
3438 operators. The flag @code{--} can be used to remove this restriction.
3440 Numerical values are computed as long int; standard C notation
3441 applies. @var{lc} is the logical connection operator; either
3442 @code{&&} for a conjunction or @code{||} for a disjunction. A
3443 conjunction is assumed at the begin of an expression. Conjunctions
3444 have higher precedence than disjunctions. If @var{VALUE} starts with
3445 one of the characters used in any @var{op} a space after the
3446 @var{op} is required.
3449 The supported operators (@var{op}) are:
3454 Substring must match.
3457 Substring must not match.
3460 The full string must match.
3463 The full string must not match.
3466 The numerical value must match.
3469 The numerical value must not match.
3472 The numerical value of the field must be LE than the value.
3475 The numerical value of the field must be LT than the value.
3478 The numerical value of the field must be GT than the value.
3481 The numerical value of the field must be GE than the value.
3484 True if value is not empty (no value allowed).
3487 True if value is empty (no value allowed).
3490 Alias for "PROPNAME != 0" (no value allowed).
3493 Alias for "PROPNAME == 0" (no value allowed).
3498 Values for @var{flag} must be space separated. The supported flags
3503 @var{VALUE} spans to the end of the expression.
3505 The string match in this part is done case-sensitive.
3508 The filter options concatenate several specifications for a filter of
3509 the same type. For example the four options in this example:
3513 --import-option keep-uid="uid =~ Alfa"
3514 --import-option keep-uid="&& uid !~ Test"
3515 --import-option keep-uid="|| uid =~ Alpha"
3516 --import-option keep-uid="uid !~ Test"
3521 which is equivalent to
3526 keep-uid="uid =~ Alfa" && uid !~ Test" || uid =~ Alpha" && "uid !~ Test"
3530 imports only the user ids of a key containing the strings "Alfa"
3531 or "Alpha" but not the string "test".
3534 @mansect return value
3535 @chapheading RETURN VALUE
3537 The program returns 0 if everything was fine, 1 if at least
3538 a signature was bad, and other error codes for fatal errors.
3541 @chapheading WARNINGS
3543 Use a *good* password for your user account and a *good* passphrase
3544 to protect your secret key. This passphrase is the weakest part of the
3545 whole system. Programs to do dictionary attacks on your secret keyring
3546 are very easy to write and so you should protect your "~/.gnupg/"
3547 directory very well.
3549 Keep in mind that, if this program is used over a network (telnet), it
3550 is *very* easy to spy out your passphrase!
3552 If you are going to verify detached signatures, make sure that the
3553 program knows about it; either give both filenames on the command line
3554 or use @samp{-} to specify STDIN.
3556 @mansect interoperability
3557 @chapheading INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS
3559 GnuPG tries to be a very flexible implementation of the OpenPGP
3560 standard. In particular, GnuPG implements many of the optional parts
3561 of the standard, such as the SHA-512 hash, and the ZLIB and BZIP2
3562 compression algorithms. It is important to be aware that not all
3563 OpenPGP programs implement these optional algorithms and that by
3564 forcing their use via the @option{--cipher-algo},
3565 @option{--digest-algo}, @option{--cert-digest-algo}, or
3566 @option{--compress-algo} options in GnuPG, it is possible to create a
3567 perfectly valid OpenPGP message, but one that cannot be read by the
3570 There are dozens of variations of OpenPGP programs available, and each
3571 supports a slightly different subset of these optional algorithms.
3572 For example, until recently, no (unhacked) version of PGP supported
3573 the BLOWFISH cipher algorithm. A message using BLOWFISH simply could
3574 not be read by a PGP user. By default, GnuPG uses the standard
3575 OpenPGP preferences system that will always do the right thing and
3576 create messages that are usable by all recipients, regardless of which
3577 OpenPGP program they use. Only override this safe default if you
3578 really know what you are doing.
3580 If you absolutely must override the safe default, or if the preferences
3581 on a given key are invalid for some reason, you are far better off using
3582 the @option{--pgp6}, @option{--pgp7}, or @option{--pgp8} options. These
3583 options are safe as they do not force any particular algorithms in
3584 violation of OpenPGP, but rather reduce the available algorithms to a
3590 On older systems this program should be installed as setuid(root). This
3591 is necessary to lock memory pages. Locking memory pages prevents the
3592 operating system from writing memory pages (which may contain
3593 passphrases or other sensitive material) to disk. If you get no
3594 warning message about insecure memory your operating system supports
3595 locking without being root. The program drops root privileges as soon
3596 as locked memory is allocated.
3598 Note also that some systems (especially laptops) have the ability to
3599 ``suspend to disk'' (also known as ``safe sleep'' or ``hibernate'').
3600 This writes all memory to disk before going into a low power or even
3601 powered off mode. Unless measures are taken in the operating system
3602 to protect the saved memory, passphrases or other sensitive material
3603 may be recoverable from it later.
3605 Before you report a bug you should first search the mailing list
3606 archives for similar problems and second check whether such a bug has
3607 already been reported to our bug tracker at http://bugs.gnupg.org .
3609 @c *******************************************
3610 @c *************** **************
3611 @c *************** UNATTENDED **************
3612 @c *************** **************
3613 @c *******************************************
3615 @node Unattended Usage of GPG
3616 @section Unattended Usage
3618 @command{gpg} is often used as a backend engine by other software. To help
3619 with this a machine interface has been defined to have an unambiguous
3620 way to do this. The options @option{--status-fd} and @option{--batch}
3621 are almost always required for this.
3624 * Unattended GPG key generation:: Unattended key generation
3628 @node Unattended GPG key generation
3629 @subsection Unattended key generation
3631 The command @option{--gen-key} may be used along with the option
3632 @option{--batch} for unattended key generation. The parameters are
3633 either read from stdin or given as a file on the command line.
3634 The format of the parameter file is as follows:
3637 @item Text only, line length is limited to about 1000 characters.
3638 @item UTF-8 encoding must be used to specify non-ASCII characters.
3639 @item Empty lines are ignored.
3640 @item Leading and trailing while space is ignored.
3641 @item A hash sign as the first non white space character indicates
3643 @item Control statements are indicated by a leading percent sign, the
3644 arguments are separated by white space from the keyword.
3645 @item Parameters are specified by a keyword, followed by a colon. Arguments
3646 are separated by white space.
3648 The first parameter must be @samp{Key-Type}; control statements may be
3651 The order of the parameters does not matter except for @samp{Key-Type}
3652 which must be the first parameter. The parameters are only used for
3653 the generated keyblock (primary and subkeys); parameters from previous
3654 sets are not used. Some syntactically checks may be performed.
3656 Key generation takes place when either the end of the parameter file
3657 is reached, the next @samp{Key-Type} parameter is encountered or at the
3658 control statement @samp{%commit} is encountered.
3666 @item %echo @var{text}
3667 Print @var{text} as diagnostic.
3670 Suppress actual key generation (useful for syntax checking).
3673 Perform the key generation. Note that an implicit commit is done at
3674 the next @asis{Key-Type} parameter.
3676 @item %pubring @var{filename}
3677 @itemx %secring @var{filename}
3678 Do not write the key to the default or commandline given keyring but
3679 to @var{filename}. This must be given before the first commit to take
3680 place, duplicate specification of the same filename is ignored, the
3681 last filename before a commit is used. The filename is used until a
3682 new filename is used (at commit points) and all keys are written to
3683 that file. If a new filename is given, this file is created (and
3684 overwrites an existing one). For GnuPG versions prior to 2.1, both
3685 control statements must be given. For GnuPG 2.1 and later
3686 @samp{%secring} is a no-op.
3688 @item %ask-passphrase
3689 @itemx %no-ask-passphrase
3690 This option is a no-op for GnuPG 2.1 and later.
3692 @item %no-protection
3693 Using this option allows the creation of keys without any passphrase
3694 protection. This option is mainly intended for regression tests.
3696 @item %transient-key
3697 If given the keys are created using a faster and a somewhat less
3698 secure random number generator. This option may be used for keys
3699 which are only used for a short time and do not require full
3700 cryptographic strength. It takes only effect if used together with
3701 the control statement @samp{%no-protection}.
3710 @item Key-Type: @var{algo}
3711 Starts a new parameter block by giving the type of the primary
3712 key. The algorithm must be capable of signing. This is a required
3713 parameter. @var{algo} may either be an OpenPGP algorithm number or a
3714 string with the algorithm name. The special value @samp{default} may
3715 be used for @var{algo} to create the default key type; in this case a
3716 @samp{Key-Usage} shall not be given and @samp{default} also be used
3717 for @samp{Subkey-Type}.
3719 @item Key-Length: @var{nbits}
3720 The requested length of the generated key in bits. The default is
3721 returned by running the command @samp{@gpgname --gpgconf-list}.
3723 @item Key-Grip: @var{hexstring}
3724 This is optional and used to generate a CSR or certificate for an
3725 already existing key. Key-Length will be ignored when given.
3727 @item Key-Usage: @var{usage-list}
3728 Space or comma delimited list of key usages. Allowed values are
3729 @samp{encrypt}, @samp{sign}, and @samp{auth}. This is used to
3730 generate the key flags. Please make sure that the algorithm is
3731 capable of this usage. Note that OpenPGP requires that all primary
3732 keys are capable of certification, so no matter what usage is given
3733 here, the @samp{cert} flag will be on. If no @samp{Key-Usage} is
3734 specified and the @samp{Key-Type} is not @samp{default}, all allowed
3735 usages for that particular algorithm are used; if it is not given but
3736 @samp{default} is used the usage will be @samp{sign}.
3738 @item Subkey-Type: @var{algo}
3739 This generates a secondary key (subkey). Currently only one subkey
3740 can be handled. See also @samp{Key-Type} above.
3742 @item Subkey-Length: @var{nbits}
3743 Length of the secondary key (subkey) in bits. The default is returned
3744 by running the command @samp{@gpgname --gpgconf-list}".
3746 @item Subkey-Usage: @var{usage-list}
3747 Key usage lists for a subkey; similar to @samp{Key-Usage}.
3749 @item Passphrase: @var{string}
3750 If you want to specify a passphrase for the secret key, enter it here.
3751 Default is to use the Pinentry dialog to ask for a passphrase.
3753 @item Name-Real: @var{name}
3754 @itemx Name-Comment: @var{comment}
3755 @itemx Name-Email: @var{email}
3756 The three parts of a user name. Remember to use UTF-8 encoding here.
3757 If you don't give any of them, no user ID is created.
3759 @item Expire-Date: @var{iso-date}|(@var{number}[d|w|m|y])
3760 Set the expiration date for the key (and the subkey). It may either
3761 be entered in ISO date format (e.g. "20000815T145012") or as number of
3762 days, weeks, month or years after the creation date. The special
3763 notation "seconds=N" is also allowed to specify a number of seconds
3764 since creation. Without a letter days are assumed. Note that there
3765 is no check done on the overflow of the type used by OpenPGP for
3766 timestamps. Thus you better make sure that the given value make
3767 sense. Although OpenPGP works with time intervals, GnuPG uses an
3768 absolute value internally and thus the last year we can represent is
3771 @item Creation-Date: @var{iso-date}
3772 Set the creation date of the key as stored in the key information and
3773 which is also part of the fingerprint calculation. Either a date like
3774 "1986-04-26" or a full timestamp like "19860426T042640" may be used.
3775 The time is considered to be UTC. The special notation "seconds=N"
3776 may be used to directly specify a the number of seconds since Epoch
3777 (Unix time). If it is not given the current time is used.
3779 @item Preferences: @var{string}
3780 Set the cipher, hash, and compression preference values for this key.
3781 This expects the same type of string as the sub-command @samp{setpref}
3782 in the @option{--edit-key} menu.
3784 @item Revoker: @var{algo}:@var{fpr} [sensitive]
3785 Add a designated revoker to the generated key. Algo is the public key
3786 algorithm of the designated revoker (i.e. RSA=1, DSA=17, etc.)
3787 @var{fpr} is the fingerprint of the designated revoker. The optional
3788 @samp{sensitive} flag marks the designated revoker as sensitive
3789 information. Only v4 keys may be designated revokers.
3791 @item Keyserver: @var{string}
3792 This is an optional parameter that specifies the preferred keyserver
3795 @item Handle: @var{string}
3796 This is an optional parameter only used with the status lines
3797 KEY_CREATED and KEY_NOT_CREATED. @var{string} may be up to 100
3798 characters and should not contain spaces. It is useful for batch key
3799 generation to associate a key parameter block with a status line.
3804 Here is an example on how to create a key:
3807 %echo Generating a basic OpenPGP key
3812 Name-Real: Joe Tester
3813 Name-Comment: with stupid passphrase
3814 Name-Email: joe@@foo.bar
3819 # Do a commit here, so that we can later print "done" :-)
3823 $ @gpgname --batch --gen-key foo
3825 $ @gpgname --no-default-keyring --secret-keyring ./foo.sec \
3826 --keyring ./foo.pub --list-secret-keys
3827 /home/wk/work/gnupg-stable/scratch/foo.sec
3828 ------------------------------------------
3829 sec 1024D/915A878D 2000-03-09 Joe Tester (with stupid passphrase) <joe@@foo.bar>
3830 ssb 1024g/8F70E2C0 2000-03-09
3835 If you want to create a key with the default algorithms you would use
3838 %echo Generating a default key
3840 Subkey-Type: default
3841 Name-Real: Joe Tester
3842 Name-Comment: with stupid passphrase
3843 Name-Email: joe@@foo.bar
3848 # Do a commit here, so that we can later print "done" :-)
3860 @command{gpg-agent}(1)
3862 @include see-also-note.texi