chiark / gitweb /
dirmngr: New debug message on correctly initialized libdns.
[gnupg2.git] / doc / gpg.texi
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.
5
6 @include defs.inc
7
8 @node Invoking GPG
9 @chapter Invoking GPG
10 @cindex GPG command options
11 @cindex command options
12 @cindex options, GPG command
13
14
15 @c Begin standard stuff
16 @ifclear gpgtwohack
17 @manpage gpg.1
18 @ifset manverb
19 .B gpg
20 \- OpenPGP encryption and signing tool
21 @end ifset
22
23 @mansect synopsis
24 @ifset manverb
25 .B  gpg
26 .RB [ \-\-homedir
27 .IR dir ]
28 .RB [ \-\-options
29 .IR file ]
30 .RI [ options ]
31 .I command
32 .RI [ args ]
33 @end ifset
34 @end ifclear
35 @c End standard stuff
36
37 @c Begin gpg2 hack stuff
38 @ifset gpgtwohack
39 @manpage gpg2.1
40 @ifset manverb
41 .B gpg2
42 \- OpenPGP encryption and signing tool
43 @end ifset
44
45 @mansect synopsis
46 @ifset manverb
47 .B  gpg2
48 .RB [ \-\-homedir
49 .IR dir ]
50 .RB [ \-\-options
51 .IR file ]
52 .RI [ options ]
53 .I command
54 .RI [ args ]
55 @end ifset
56 @end ifset
57 @c End gpg2 hack stuff
58
59
60 @mansect description
61 @command{@gpgname} is the OpenPGP part of the GNU Privacy Guard (GnuPG). It
62 is a tool to provide digital encryption and signing services using the
63 OpenPGP standard. @command{@gpgname} features complete key management and
64 all the bells and whistles you would expect from a full OpenPGP
65 implementation.
66
67 There are two main versions of GnuPG: GnuPG 1.x and GnuPG 2.x.  GnuPG
68 2.x supports modern encryption algorithms and thus should be preferred
69 over GnuPG 1.x.  You only need to use GnuPG 1.x if your platform
70 doesn't support GnuPG 2.x, or you need support for some features that
71 GnuPG 2.x has deprecated, e.g., decrypting data created with PGP-2
72 keys.
73
74 @ifclear gpgtwohack
75 If you are looking for version 1 of GnuPG, you may find that version
76 installed under the name @command{gpg1}.
77 @end ifclear
78 @ifset gpgtwohack
79 In contrast to the standalone command @command{gpg} from GnuPG 1.x,
80 the 2.x version is commonly installed under the name
81 @command{@gpgname}.
82 @end ifset
83
84 @manpause
85
86 @xref{Option Index}, for an index to @command{@gpgname}'s commands and options.
87 @mancont
88
89 @menu
90 * GPG Commands::            List of all commands.
91 * GPG Options::             List of all options.
92 * GPG Configuration::       Configuration files.
93 * GPG Examples::            Some usage examples.
94
95 Developer information:
96 * Unattended Usage of GPG:: Using @command{gpg} from other programs.
97 @end menu
98
99 @c * GPG Protocol::        The protocol the server mode uses.
100
101
102 @c *******************************************
103 @c ***************            ****************
104 @c ***************  COMMANDS  ****************
105 @c ***************            ****************
106 @c *******************************************
107 @mansect commands
108 @node GPG Commands
109 @section Commands
110
111 Commands are not distinguished from options except for the fact that
112 only one command is allowed.  Generally speaking, irrelevant options
113 are silently ignored, and may not be checked for correctness.
114
115 @command{@gpgname} may be run with no commands. In this case it will
116 perform a reasonable action depending on the type of file it is given
117 as input (an encrypted message is decrypted, a signature is verified,
118 a file containing keys is listed, etc.).
119
120
121 @menu
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.
125 @end menu
126
127
128 @c *******************************************
129 @c **********  GENERAL COMMANDS  *************
130 @c *******************************************
131 @node General GPG Commands
132 @subsection Commands not specific to the function
133
134 @table @gnupgtabopt
135 @item --version
136 @opindex version
137 Print the program version and licensing information.  Note that you
138 cannot abbreviate this command.
139
140 @item --help
141 @itemx -h
142 @opindex help
143 Print a usage message summarizing the most useful command-line options.
144 Note that you cannot abbreviate this command.
145
146 @item --warranty
147 @opindex warranty
148 Print warranty information.
149
150 @item --dump-options
151 @opindex dump-options
152 Print a list of all available options and commands.  Note that you cannot
153 abbreviate this command.
154 @end table
155
156
157 @c *******************************************
158 @c ********  OPERATIONAL COMMANDS  ***********
159 @c *******************************************
160 @node Operational GPG Commands
161 @subsection Commands to select the type of operation
162
163
164 @table @gnupgtabopt
165
166 @item --sign
167 @itemx -s
168 @opindex sign
169 Sign a message. This command may be combined with @option{--encrypt}
170 (to sign and encrypt a message), @option{--symmetric} (to sign and
171 symmetrically encrypt a message), or both @option{--encrypt} and
172 @option{--symmetric} (to sign and encrypt a message that can be
173 decrypted using a secret key or a passphrase).  The signing key is
174 chosen by default or can be set explicitly using the
175 @option{--local-user} and @option{--default-key} options.
176
177 @item --clear-sign
178 @opindex clear-sign
179 @itemx --clearsign
180 @opindex clearsign
181 Make a cleartext signature.  The content in a cleartext signature is
182 readable without any special software. OpenPGP software is only needed
183 to verify the signature.  cleartext signatures may modify end-of-line
184 whitespace for platform independence and are not intended to be
185 reversible.  The signing key is chosen by default or can be set
186 explicitly using the @option{--local-user} and @option{--default-key}
187 options.
188
189
190 @item --detach-sign
191 @itemx -b
192 @opindex detach-sign
193 Make a detached signature.
194
195 @item --encrypt
196 @itemx -e
197 @opindex encrypt
198 Encrypt data. This command may be combined with @option{--sign} (to
199 sign and encrypt a message), @option{--symmetric} (to encrypt a
200 message that can decrypted using a secret key or a passphrase), or
201 @option{--sign} and @option{--symmetric} together (for a signed
202 message that can be decrypted using a secret key or a passphrase).
203
204 @item --symmetric
205 @itemx -c
206 @opindex symmetric
207 Encrypt with a symmetric cipher using a passphrase. The default
208 symmetric cipher used is @value{GPGSYMENCALGO}, but may be chosen with the
209 @option{--cipher-algo} option. This command may be combined with
210 @option{--sign} (for a signed and symmetrically encrypted message),
211 @option{--encrypt} (for a message that may be decrypted via a secret key
212 or a passphrase), or @option{--sign} and @option{--encrypt} together
213 (for a signed message that may be decrypted via a secret key or a
214 passphrase).
215
216 @item --store
217 @opindex store
218 Store only (make a simple literal data packet).
219
220 @item --decrypt
221 @itemx -d
222 @opindex decrypt
223 Decrypt the file given on the command line (or STDIN if no file
224 is specified) and write it to STDOUT (or the file specified with
225 @option{--output}). If the decrypted file is signed, the signature is also
226 verified. This command differs from the default operation, as it never
227 writes to the filename which is included in the file and it rejects
228 files that don't begin with an encrypted message.
229
230 @item --verify
231 @opindex verify
232 Assume that the first argument is a signed file and verify it without
233 generating any output.  With no arguments, the signature packet is
234 read from STDIN.  If only one argument is given, the specified file is
235 expected to include a complete signature.
236
237 With more than one argument, the first argument should specify a file
238 with a detached signature and the remaining files should contain the
239 signed data. To read the signed data from STDIN, use @samp{-} as the
240 second filename.  For security reasons, a detached signature will not
241 read the signed material from STDIN if not explicitly specified.
242
243 Note: If the option @option{--batch} is not used, @command{@gpgname}
244 may assume that a single argument is a file with a detached signature,
245 and it will try to find a matching data file by stripping certain
246 suffixes.  Using this historical feature to verify a detached
247 signature is strongly discouraged; you should always specify the data file
248 explicitly.
249
250 Note: When verifying a cleartext signature, @command{@gpgname} verifies
251 only what makes up the cleartext signed data and not any extra data
252 outside of the cleartext signature or the header lines directly following
253 the dash marker line.  The option @code{--output} may be used to write
254 out the actual signed data, but there are other pitfalls with this
255 format as well.  It is suggested to avoid cleartext signatures in
256 favor of detached signatures.
257
258 @item --multifile
259 @opindex multifile
260 This modifies certain other commands to accept multiple files for
261 processing on the command line or read from STDIN with each filename on
262 a separate line. This allows for many files to be processed at
263 once. @option{--multifile} may currently be used along with
264 @option{--verify}, @option{--encrypt}, and @option{--decrypt}. Note that
265 @option{--multifile --verify} may not be used with detached signatures.
266
267 @item --verify-files
268 @opindex verify-files
269 Identical to @option{--multifile --verify}.
270
271 @item --encrypt-files
272 @opindex encrypt-files
273 Identical to @option{--multifile --encrypt}.
274
275 @item --decrypt-files
276 @opindex decrypt-files
277 Identical to @option{--multifile --decrypt}.
278
279 @item --list-keys
280 @itemx -k
281 @itemx --list-public-keys
282 @opindex list-keys
283 List the specified keys.  If no keys are specified, then all keys from
284 the configured public keyrings are listed.
285
286 Never use the output of this command in scripts or other programs.
287 The output is intended only for humans and its format is likely to
288 change.  The @option{--with-colons} option emits the output in a
289 stable, machine-parseable format, which is intended for use by scripts
290 and other programs.
291
292 @item --list-secret-keys
293 @itemx -K
294 @opindex list-secret-keys
295 List the specified secret keys.  If no keys are specified, then all
296 known secret keys are listed.  A @code{#} after the letters @code{sec}
297 means that the secret key is not usable (for example, if it was
298 exported using @option{--export-secret-subkeys}).  See also
299 @option{--list-keys}.
300
301 @item --list-signatures
302 @opindex list-signatures
303 @itemx --list-sigs
304 @opindex list-sigs
305 Same as @option{--list-keys}, but the signatures are listed too.
306 This command has the same effect as
307 using @option{--list-keys} with @option{--with-sig-list}.
308
309 For each signature listed, there are several flags in between the "sig"
310 tag and keyid. These flags give additional information about each
311 signature. From left to right, they are the numbers 1-3 for certificate
312 check level (see @option{--ask-cert-level}), "L" for a local or
313 non-exportable signature (see @option{--lsign-key}), "R" for a
314 nonRevocable signature (see the @option{--edit-key} command "nrsign"),
315 "P" for a signature that contains a policy URL (see
316 @option{--cert-policy-url}), "N" for a signature that contains a
317 notation (see @option{--cert-notation}), "X" for an eXpired signature
318 (see @option{--ask-cert-expire}), and the numbers 1-9 or "T" for 10 and
319 above to indicate trust signature levels (see the @option{--edit-key}
320 command "tsign").
321
322 @item --check-signatures
323 @opindex check-signatures
324 @itemx --check-sigs
325 @opindex check-sigs
326 Same as @option{--list-signatures}, but the signatures are verified.  Note
327 that for performance reasons the revocation status of a signing key is
328 not shown.
329 This command has the same effect as
330 using @option{--list-keys} with @option{--with-sig-check}.
331
332 The status of the verification is indicated by a flag directly following
333 the "sig" tag (and thus before the flags described above for
334 @option{--list-signatures}).  A "!" indicates that the signature has been
335 successfully verified, a "-" denotes a bad signature and a "%" is used
336 if an error occurred while checking the signature (e.g. a non supported
337 algorithm).
338
339 @item --locate-keys
340 @opindex locate-keys
341 Locate the keys given as arguments.  This command basically uses the
342 same algorithm as used when locating keys for encryption or signing and
343 may thus be used to see what keys @command{@gpgname} might use.  In
344 particular external methods as defined by @option{--auto-key-locate} may
345 be used to locate a key.  Only public keys are listed.
346
347 @item --fingerprint
348 @opindex fingerprint
349 List all keys (or the specified ones) along with their
350 fingerprints. This is the same output as @option{--list-keys} but with
351 the additional output of a line with the fingerprint. May also be
352 combined with @option{--list-signatures} or @option{--check-signatures}.  If this
353 command is given twice, the fingerprints of all secondary keys are
354 listed too.  This command also forces pretty printing of fingerprints
355 if the keyid format has been set to "none".
356
357 @item --list-packets
358 @opindex list-packets
359 List only the sequence of packets.  This command is only useful for
360 debugging.  When used with option @option{--verbose} the actual MPI
361 values are dumped and not only their lengths.  Note that the output of
362 this command may change with new releases.
363
364
365 @item --edit-card
366 @opindex edit-card
367 @itemx --card-edit
368 @opindex card-edit
369 Present a menu to work with a smartcard. The subcommand "help" provides
370 an overview on available commands. For a detailed description, please
371 see the Card HOWTO at
372 https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
373
374 @item --card-status
375 @opindex card-status
376 Show the content of the smart card.
377
378 @item --change-pin
379 @opindex change-pin
380 Present a menu to allow changing the PIN of a smartcard. This
381 functionality is also available as the subcommand "passwd" with the
382 @option{--edit-card} command.
383
384 @item --delete-keys @code{name}
385 @itemx --delete-keys @code{name}
386 Remove key from the public keyring. In batch mode either @option{--yes} is
387 required or the key must be specified by fingerprint. This is a
388 safeguard against accidental deletion of multiple keys.
389
390 @item --delete-secret-keys @code{name}
391 @opindex delete-secret-keys
392 Remove key from the secret keyring. In batch mode the key must be
393 specified by fingerprint.  The option @option{--yes} can be used to
394 advice gpg-agent not to request a confirmation.  This extra
395 pre-caution is done because @command{@gpgname} can't be sure that the
396 secret key (as controlled by gpg-agent) is only used for the given
397 OpenPGP public key.
398
399
400 @item --delete-secret-and-public-key @code{name}
401 @opindex delete-secret-and-public-key
402 Same as @option{--delete-key}, but if a secret key exists, it will be
403 removed first. In batch mode the key must be specified by fingerprint.
404 The option @option{--yes} can be used to advice gpg-agent not to
405 request a confirmation.
406
407 @item --export
408 @opindex export
409 Either export all keys from all keyrings (default keyrings and those
410 registered via option @option{--keyring}), or if at least one name is given,
411 those of the given name. The exported keys are written to STDOUT or to the
412 file given with option @option{--output}.  Use together with
413 @option{--armor} to mail those keys.
414
415 @item --send-keys @code{key IDs}
416 @opindex send-keys
417 Similar to @option{--export} but sends the keys to a keyserver.
418 Fingerprints may be used instead of key IDs. Option @option{--keyserver}
419 must be used to give the name of this keyserver. Don't send your
420 complete keyring to a keyserver --- select only those keys which are new
421 or changed by you.  If no key IDs are given, @command{@gpgname} does nothing.
422
423 @item --export-secret-keys
424 @itemx --export-secret-subkeys
425 @opindex export-secret-keys
426 @opindex export-secret-subkeys
427 Same as @option{--export}, but exports the secret keys instead.  The
428 exported keys are written to STDOUT or to the file given with option
429 @option{--output}.  This command is often used along with the option
430 @option{--armor} to allow for easy printing of the key for paper backup;
431 however the external tool @command{paperkey} does a better job of
432 creating backups on paper.  Note that exporting a secret key can be a
433 security risk if the exported keys are sent over an insecure channel.
434
435 The second form of the command has the special property to render the
436 secret part of the primary key useless; this is a GNU extension to
437 OpenPGP and other implementations can not be expected to successfully
438 import such a key.  Its intended use is in generating a full key with
439 an additional signing subkey on a dedicated machine.  This command
440 then exports the key without the primary key to the main machine.
441
442 GnuPG may ask you to enter the passphrase for the key.  This is
443 required, because the internal protection method of the secret key is
444 different from the one specified by the OpenPGP protocol.
445
446 @item --export-ssh-key
447 @opindex export-ssh-key
448 This command is used to export a key in the OpenSSH public key format.
449 It requires the specification of one key by the usual means and
450 exports the latest valid subkey which has an authentication capability
451 to STDOUT or to the file given with option @option{--output}.  That
452 output can directly be added to ssh's @file{authorized_key} file.
453
454 By specifying the key to export using a key ID or a fingerprint
455 suffixed with an exclamation mark (!), a specific subkey or the
456 primary key can be exported.  This does not even require that the key
457 has the authentication capability flag set.
458
459 @item --import
460 @itemx --fast-import
461 @opindex import
462 Import/merge keys. This adds the given keys to the
463 keyring. The fast version is currently just a synonym.
464
465 There are a few other options which control how this command works.
466 Most notable here is the @option{--import-options merge-only} option
467 which does not insert new keys but does only the merging of new
468 signatures, user-IDs and subkeys.
469
470 @item --receive-keys @code{key IDs}
471 @opindex receive-keys
472 @itemx --recv-keys @code{key IDs}
473 @opindex recv-keys
474 Import the keys with the given key IDs from a keyserver. Option
475 @option{--keyserver} must be used to give the name of this keyserver.
476
477 @item --refresh-keys
478 @opindex refresh-keys
479 Request updates from a keyserver for keys that already exist on the
480 local keyring. This is useful for updating a key with the latest
481 signatures, user IDs, etc. Calling this with no arguments will refresh
482 the entire keyring. Option @option{--keyserver} must be used to give the
483 name of the keyserver for all keys that do not have preferred keyservers
484 set (see @option{--keyserver-options honor-keyserver-url}).
485
486 @item --search-keys @code{names}
487 @opindex search-keys
488 Search the keyserver for the given names. Multiple names given here will
489 be joined together to create the search string for the keyserver.
490 Option @option{--keyserver} must be used to give the name of this
491 keyserver.  Keyservers that support different search methods allow using
492 the syntax specified in "How to specify a user ID" below. Note that
493 different keyserver types support different search methods. Currently
494 only LDAP supports them all.
495
496 @item --fetch-keys @code{URIs}
497 @opindex fetch-keys
498 Retrieve keys located at the specified URIs. Note that different
499 installations of GnuPG may support different protocols (HTTP, FTP,
500 LDAP, etc.).  When using HTTPS the system provided root certificates
501 are used by this command.
502
503 @item --update-trustdb
504 @opindex update-trustdb
505 Do trust database maintenance. This command iterates over all keys and
506 builds the Web of Trust. This is an interactive command because it may
507 have to ask for the "ownertrust" values for keys. The user has to give
508 an estimation of how far she trusts the owner of the displayed key to
509 correctly certify (sign) other keys. GnuPG only asks for the ownertrust
510 value if it has not yet been assigned to a key. Using the
511 @option{--edit-key} menu, the assigned value can be changed at any time.
512
513 @item --check-trustdb
514 @opindex check-trustdb
515 Do trust database maintenance without user interaction. From time to
516 time the trust database must be updated so that expired keys or
517 signatures and the resulting changes in the Web of Trust can be
518 tracked. Normally, GnuPG will calculate when this is required and do it
519 automatically unless @option{--no-auto-check-trustdb} is set. This
520 command can be used to force a trust database check at any time. The
521 processing is identical to that of @option{--update-trustdb} but it
522 skips keys with a not yet defined "ownertrust".
523
524 For use with cron jobs, this command can be used together with
525 @option{--batch} in which case the trust database check is done only if
526 a check is needed. To force a run even in batch mode add the option
527 @option{--yes}.
528
529 @anchor{option --export-ownertrust}
530 @item --export-ownertrust
531 @opindex export-ownertrust
532 Send the ownertrust values to STDOUT. This is useful for backup purposes
533 as these values are the only ones which can't be re-created from a
534 corrupted trustdb.  Example:
535 @c man:.RS
536 @example
537   @gpgname{} --export-ownertrust > otrust.txt
538 @end example
539 @c man:.RE
540
541
542 @item --import-ownertrust
543 @opindex import-ownertrust
544 Update the trustdb with the ownertrust values stored in @code{files} (or
545 STDIN if not given); existing values will be overwritten.  In case of a
546 severely damaged trustdb and if you have a recent backup of the
547 ownertrust values (e.g. in the file @file{otrust.txt}), you may re-create
548 the trustdb using these commands:
549 @c man:.RS
550 @example
551   cd ~/.gnupg
552   rm trustdb.gpg
553   @gpgname{} --import-ownertrust < otrust.txt
554 @end example
555 @c man:.RE
556
557
558 @item --rebuild-keydb-caches
559 @opindex rebuild-keydb-caches
560 When updating from version 1.0.6 to 1.0.7 this command should be used
561 to create signature caches in the keyring. It might be handy in other
562 situations too.
563
564 @item --print-md @code{algo}
565 @itemx --print-mds
566 @opindex print-md
567 Print message digest of algorithm ALGO for all given files or STDIN.
568 With the second form (or a deprecated "*" as algo) digests for all
569 available algorithms are printed.
570
571 @item --gen-random @code{0|1|2} @code{count}
572 @opindex gen-random
573 Emit @var{count} random bytes of the given quality level 0, 1 or 2. If
574 @var{count} is not given or zero, an endless sequence of random bytes
575 will be emitted.  If used with @option{--armor} the output will be
576 base64 encoded.  PLEASE, don't use this command unless you know what
577 you are doing; it may remove precious entropy from the system!
578
579 @item --gen-prime @code{mode}  @code{bits}
580 @opindex gen-prime
581 Use the source, Luke :-). The output format is still subject to change.
582
583
584 @item --enarmor
585 @itemx --dearmor
586 @opindex enarmor
587 @opindex dearmor
588 Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
589 This is a GnuPG extension to OpenPGP and in general not very useful.
590
591 @item --tofu-policy @code{auto|good|unknown|bad|ask}  @code{key...}
592 @opindex tofu-policy
593 Set the TOFU policy for all the bindings associated with the specified
594 keys.  For more information about the meaning of the policies,
595 @pxref{trust-model-tofu}.  The keys may be specified either by their
596 fingerprint (preferred) or their keyid.
597
598 @c @item --server
599 @c @opindex server
600 @c Run gpg in server mode.  This feature is not yet ready for use and
601 @c thus not documented.
602
603 @end table
604
605
606 @c *******************************************
607 @c *******  KEY MANGEMENT COMMANDS  **********
608 @c *******************************************
609 @node OpenPGP Key Management
610 @subsection How to manage your keys
611
612 This section explains the main commands for key management.
613
614 @table @gnupgtabopt
615
616 @item --quick-generate-key @code{user-id} [@code{algo} [@code{usage} [@code{expire}]]]
617 @opindex quick-generate-key
618 This is a simple command to generate a standard key with one user id.
619 In contrast to @option{--generate-key} the key is generated directly
620 without the need to answer a bunch of prompts.  Unless the option
621 @option{--yes} is given, the key creation will be canceled if the
622 given user id already exists in the keyring.
623
624 If invoked directly on the console without any special options an
625 answer to a ``Continue?'' style confirmation prompt is required.  In
626 case the user id already exists in the keyring a second prompt to
627 force the creation of the key will show up.
628
629 If @code{algo} or @code{usage} are given, only the primary key is
630 created and no prompts are shown.  To specify an expiration date but
631 still create a primary and subkey use ``default'' or
632 ``future-default'' for @code{algo} and ``default'' for @code{usage}.
633 For a description of these optional arguments see the command
634 @code{--quick-add-key}.  The @code{usage} accepts also the value
635 ``cert'' which can be used to create a certification only primary key;
636 the default is to a create certification and signing key.
637
638 The @code{expire} argument can be used to specify an expiration date
639 for the key.  Several formats are supported; commonly the ISO
640 YYYY-MM-DD format is used.  The values ``never'', ``none'' can be used
641 for no expiration date.  Not specifying a value, or using ``-''
642 results in a key expiring in a reasonable default interval.
643
644 If this command is used with @option{--batch},
645 @option{--pinentry-mode} has been set to @code{loopback}, and one of
646 the passphrase options (@option{--passphrase},
647 @option{--passphrase-fd}, or @option{passphrase-file}) is used, the
648 supplied passphrase is used for the new key and the agent does not ask
649 for it.  To create a key without any protection @code{--passphrase ''}
650 may be used.
651
652 @item --quick-set-expire @code{fpr} @code{expire}
653 @opindex quick-set-expire
654 Directly set the expiration time of the primary key to @code{expire}.
655 To remove the expiration time @code{0} can be used.
656
657
658 @item --quick-add-key @code{fpr} [@code{algo} [@code{usage} [@code{expire}]]]
659 @opindex quick-add-key
660 Directly add a subkey to the key identified by the fingerprint
661 @code{fpr}.  Without the optional arguments an encryption subkey is
662 added.  If any of the arguments are given a more specific subkey is
663 added.
664
665 @code{algo} may be any of the supported algorithms or curve names
666 given in the format as used by key listings.  To use the default
667 algorithm the string ``default'' or ``-'' can be used.  Supported
668 algorithms are ``rsa'', ``dsa'', ``elg'', ``ed25519'', ``cv25519'',
669 and other ECC curves.  For example the string ``rsa'' adds an RSA key
670 with the default key length; a string ``rsa4096'' requests that the
671 key length is 4096 bits.  The string ``future-default'' is an alias
672 for the algorithm which will likely be used as default algorithm in
673 future versions of gpg.
674
675 Depending on the given @code{algo} the subkey may either be an
676 encryption subkey or a signing subkey.  If an algorithm is capable of
677 signing and encryption and such a subkey is desired, a @code{usage}
678 string must be given.  This string is either ``default'' or ``-'' to
679 keep the default or a comma delimited list of keywords: ``sign'' for a
680 signing subkey, ``auth'' for an authentication subkey, and ``encr''
681 for an encryption subkey (``encrypt'' can be used as alias for
682 ``encr'').  The valid combinations depend on the algorithm.
683
684 The @code{expire} argument can be used to specify an expiration date
685 for the subkey.  Several formats are supported; commonly the ISO
686 YYYY-MM-DD format is used.  The values ``never'', ``none'', or ``-''
687 can be used for no expiration date.
688
689 @item --generate-key
690 @opindex generate-key
691 @itemx --gen-key
692 @opindex gen-key
693 Generate a new key pair using the current default parameters.  This is
694 the standard command to create a new key.  In addition to the key a
695 revocation certificate is created and stored in the
696 @file{openpgp-revocs.d} directory below the GnuPG home directory.
697
698 @item --full-generate-key
699 @opindex full-generate-key
700 @itemx --full-gen-key
701 @opindex full-gen-key
702 Generate a new key pair with dialogs for all options.  This is an
703 extended version of @option{--generate-key}.
704
705 There is also a feature which allows you to create keys in batch
706 mode. See the manual section ``Unattended key generation'' on how
707 to use this.
708
709
710 @item --generate-revocation @code{name}
711 @opindex generate-revocation
712 @itemx --gen-revoke @code{name}
713 @opindex gen-revoke
714 Generate a revocation certificate for the complete key.  To only revoke
715 a subkey or a key signature, use the @option{--edit} command.
716
717 This command merely creates the revocation certificate so that it can
718 be used to revoke the key if that is ever needed.  To actually revoke
719 a key the created revocation certificate needs to be merged with the
720 key to revoke.  This is done by importing the revocation certificate
721 using the @option{--import} command.  Then the revoked key needs to be
722 published, which is best done by sending the key to a keyserver
723 (command @option{--send-key}) and by exporting (@option{--export}) it
724 to a file which is then send to frequent communication partners.
725
726
727 @item --generate-designated-revocation @code{name}
728 @opindex generate-designated-revocation
729 @itemx --desig-revoke @code{name}
730 @opindex desig-revoke
731 Generate a designated revocation certificate for a key. This allows a
732 user (with the permission of the keyholder) to revoke someone else's
733 key.
734
735
736 @item --edit-key
737 @opindex edit-key
738 Present a menu which enables you to do most of the key management
739 related tasks.  It expects the specification of a key on the command
740 line.
741
742 @c ******** Begin Edit-key Options **********
743 @table @asis
744
745   @item uid @code{n}
746   @opindex keyedit:uid
747   Toggle selection of user ID or photographic user ID with index @code{n}.
748   Use @code{*} to select all and @code{0} to deselect all.
749
750   @item key @code{n}
751   @opindex keyedit:key
752   Toggle selection of subkey with index @code{n} or key ID @code{n}.
753   Use @code{*} to select all and @code{0} to deselect all.
754
755   @item sign
756   @opindex keyedit:sign
757   Make a signature on key of user @code{name}. If the key is not yet
758   signed by the default user (or the users given with @option{-u}), the program
759   displays the information of the key again, together with its
760   fingerprint and asks whether it should be signed. This question is
761   repeated for all users specified with
762   @option{-u}.
763
764   @item lsign
765   @opindex keyedit:lsign
766   Same as "sign" but the signature is marked as non-exportable and will
767   therefore never be used by others. This may be used to make keys
768   valid only in the local environment.
769
770   @item nrsign
771   @opindex keyedit:nrsign
772   Same as "sign" but the signature is marked as non-revocable and can
773   therefore never be revoked.
774
775   @item tsign
776   @opindex keyedit:tsign
777   Make a trust signature. This is a signature that combines the notions
778   of certification (like a regular signature), and trust (like the
779   "trust" command). It is generally only useful in distinct communities
780   or groups.  For more information please read the sections
781   ``Trust Signature'' and ``Regular Expression'' in RFC-4880.
782 @end table
783
784 @c man:.RS
785 Note that "l" (for local / non-exportable), "nr" (for non-revocable,
786 and "t" (for trust) may be freely mixed and prefixed to "sign" to
787 create a signature of any type desired.
788 @c man:.RE
789
790 If the option @option{--only-sign-text-ids} is specified, then any
791 non-text based user ids (e.g., photo IDs) will not be selected for
792 signing.
793
794 @table @asis
795
796   @item delsig
797   @opindex keyedit:delsig
798   Delete a signature. Note that it is not possible to retract a signature,
799   once it has been send to the public (i.e. to a keyserver).  In that case
800   you better use @code{revsig}.
801
802   @item revsig
803   @opindex keyedit:revsig
804   Revoke a signature. For every signature which has been generated by
805   one of the secret keys, GnuPG asks whether a revocation certificate
806   should be generated.
807
808   @item check
809   @opindex keyedit:check
810   Check the signatures on all selected user IDs.  With the extra
811   option @code{selfsig} only self-signatures are shown.
812
813   @item adduid
814   @opindex keyedit:adduid
815   Create an additional user ID.
816
817   @item addphoto
818   @opindex keyedit:addphoto
819   Create a photographic user ID. This will prompt for a JPEG file that
820   will be embedded into the user ID. Note that a very large JPEG will make
821   for a very large key. Also note that some programs will display your
822   JPEG unchanged (GnuPG), and some programs will scale it to fit in a
823   dialog box (PGP).
824
825   @item showphoto
826   @opindex keyedit:showphoto
827   Display the selected photographic user ID.
828
829   @item deluid
830   @opindex keyedit:deluid
831   Delete a user ID or photographic user ID.  Note that it is not
832   possible to retract a user id, once it has been send to the public
833   (i.e. to a keyserver).  In that case you better use @code{revuid}.
834
835   @item revuid
836   @opindex keyedit:revuid
837   Revoke a user ID or photographic user ID.
838
839   @item primary
840   @opindex keyedit:primary
841   Flag the current user id as the primary one, removes the primary user
842   id flag from all other user ids and sets the timestamp of all affected
843   self-signatures one second ahead. Note that setting a photo user ID
844   as primary makes it primary over other photo user IDs, and setting a
845   regular user ID as primary makes it primary over other regular user
846   IDs.
847
848   @item keyserver
849   @opindex keyedit:keyserver
850   Set a preferred keyserver for the specified user ID(s). This allows
851   other users to know where you prefer they get your key from. See
852   @option{--keyserver-options honor-keyserver-url} for more on how this
853   works.  Setting a value of "none" removes an existing preferred
854   keyserver.
855
856   @item notation
857   @opindex keyedit:notation
858   Set a name=value notation for the specified user ID(s). See
859   @option{--cert-notation} for more on how this works. Setting a value of
860   "none" removes all notations, setting a notation prefixed with a minus
861   sign (-) removes that notation, and setting a notation name (without the
862   =value) prefixed with a minus sign removes all notations with that name.
863
864   @item pref
865   @opindex keyedit:pref
866   List preferences from the selected user ID. This shows the actual
867   preferences, without including any implied preferences.
868
869   @item showpref
870   @opindex keyedit:showpref
871   More verbose preferences listing for the selected user ID. This shows
872   the preferences in effect by including the implied preferences of 3DES
873   (cipher), SHA-1 (digest), and Uncompressed (compression) if they are
874   not already included in the preference list. In addition, the
875   preferred keyserver and signature notations (if any) are shown.
876
877   @item setpref @code{string}
878   @opindex keyedit:setpref
879   Set the list of user ID preferences to @code{string} for all (or just
880   the selected) user IDs. Calling setpref with no arguments sets the
881   preference list to the default (either built-in or set via
882   @option{--default-preference-list}), and calling setpref with "none"
883   as the argument sets an empty preference list. Use @command{@gpgname
884   --version} to get a list of available algorithms. Note that while you
885   can change the preferences on an attribute user ID (aka "photo ID"),
886   GnuPG does not select keys via attribute user IDs so these preferences
887   will not be used by GnuPG.
888
889   When setting preferences, you should list the algorithms in the order
890   which you'd like to see them used by someone else when encrypting a
891   message to your key.  If you don't include 3DES, it will be
892   automatically added at the end.  Note that there are many factors that
893   go into choosing an algorithm (for example, your key may not be the
894   only recipient), and so the remote OpenPGP application being used to
895   send to you may or may not follow your exact chosen order for a given
896   message.  It will, however, only choose an algorithm that is present
897   on the preference list of every recipient key.  See also the
898   INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
899
900   @item addkey
901   @opindex keyedit:addkey
902   Add a subkey to this key.
903
904   @item addcardkey
905   @opindex keyedit:addcardkey
906   Generate a subkey on a card and add it to this key.
907
908   @item keytocard
909   @opindex keyedit:keytocard
910   Transfer the selected secret subkey (or the primary key if no subkey
911   has been selected) to a smartcard. The secret key in the keyring will
912   be replaced by a stub if the key could be stored successfully on the
913   card and you use the save command later. Only certain key types may be
914   transferred to the card. A sub menu allows you to select on what card
915   to store the key. Note that it is not possible to get that key back
916   from the card - if the card gets broken your secret key will be lost
917   unless you have a backup somewhere.
918
919   @item bkuptocard @code{file}
920   @opindex keyedit:bkuptocard
921   Restore the given file to a card. This command may be used to restore a
922   backup key (as generated during card initialization) to a new card. In
923   almost all cases this will be the encryption key. You should use this
924   command only with the corresponding public key and make sure that the
925   file given as argument is indeed the backup to restore. You should then
926   select 2 to restore as encryption key.  You will first be asked to enter
927   the passphrase of the backup key and then for the Admin PIN of the card.
928
929   @item delkey
930   @opindex keyedit:delkey
931   Remove a subkey (secondary key). Note that it is not possible to retract
932   a subkey, once it has been send to the public (i.e. to a keyserver).  In
933   that case you better use @code{revkey}.  Also note that this only
934   deletes the public part of a key.
935
936   @item revkey
937   @opindex keyedit:revkey
938   Revoke a subkey.
939
940   @item expire
941   @opindex keyedit:expire
942   Change the key or subkey expiration time. If a subkey is selected, the
943   expiration time of this subkey will be changed. With no selection, the
944   key expiration of the primary key is changed.
945
946   @item trust
947   @opindex keyedit:trust
948   Change the owner trust value for the key. This updates the trust-db
949   immediately and no save is required.
950
951   @item disable
952   @itemx enable
953   @opindex keyedit:disable
954   @opindex keyedit:enable
955   Disable or enable an entire key. A disabled key can not normally be
956   used for encryption.
957
958   @item addrevoker
959   @opindex keyedit:addrevoker
960   Add a designated revoker to the key. This takes one optional argument:
961   "sensitive". If a designated revoker is marked as sensitive, it will
962   not be exported by default (see export-options).
963
964   @item passwd
965   @opindex keyedit:passwd
966   Change the passphrase of the secret key.
967
968   @item toggle
969   @opindex keyedit:toggle
970   This is dummy command which exists only for backward compatibility.
971
972   @item clean
973   @opindex keyedit:clean
974   Compact (by removing all signatures except the selfsig) any user ID
975   that is no longer usable (e.g. revoked, or expired). Then, remove any
976   signatures that are not usable by the trust calculations.
977   Specifically, this removes any signature that does not validate, any
978   signature that is superseded by a later signature, revoked signatures,
979   and signatures issued by keys that are not present on the keyring.
980
981   @item minimize
982   @opindex keyedit:minimize
983   Make the key as small as possible. This removes all signatures from
984   each user ID except for the most recent self-signature.
985
986   @item cross-certify
987   @opindex keyedit:cross-certify
988   Add cross-certification signatures to signing subkeys that may not
989   currently have them. Cross-certification signatures protect against a
990   subtle attack against signing subkeys. See
991   @option{--require-cross-certification}.  All new keys generated have
992   this signature by default, so this command is only useful to bring
993   older keys up to date.
994
995   @item save
996   @opindex keyedit:save
997   Save all changes to the keyrings and quit.
998
999   @item quit
1000   @opindex keyedit:quit
1001   Quit the program without updating the
1002   keyrings.
1003 @end table
1004
1005 @c man:.RS
1006 The listing shows you the key with its secondary keys and all user
1007 ids.  The primary user id is indicated by a dot, and selected keys or
1008 user ids are indicated by an asterisk.  The trust
1009 value is displayed with the primary key: the first is the assigned owner
1010 trust and the second is the calculated trust value. Letters are used for
1011 the values:
1012 @c man:.RE
1013
1014 @table @asis
1015
1016   @item -
1017   No ownertrust assigned / not yet calculated.
1018
1019   @item e
1020   Trust
1021   calculation has failed; probably due to an expired key.
1022
1023   @item q
1024   Not enough information for calculation.
1025
1026   @item n
1027   Never trust this key.
1028
1029   @item m
1030   Marginally trusted.
1031
1032   @item f
1033   Fully trusted.
1034
1035   @item u
1036   Ultimately trusted.
1037
1038 @end table
1039 @c ******** End Edit-key Options **********
1040
1041 @item --sign-key @code{name}
1042 @opindex sign-key
1043 Signs a public key with your secret key. This is a shortcut version of
1044 the subcommand "sign" from @option{--edit}.
1045
1046 @item --lsign-key @code{name}
1047 @opindex lsign-key
1048 Signs a public key with your secret key but marks it as
1049 non-exportable. This is a shortcut version of the subcommand "lsign"
1050 from @option{--edit-key}.
1051
1052 @item --quick-sign-key @code{fpr} [@code{names}]
1053 @itemx --quick-lsign-key @code{fpr} [@code{names}]
1054 @opindex quick-sign-key
1055 @opindex quick-lsign-key
1056 Directly sign a key from the passphrase without any further user
1057 interaction.  The @code{fpr} must be the verified primary fingerprint
1058 of a key in the local keyring. If no @code{names} are given, all
1059 useful user ids are signed; with given [@code{names}] only useful user
1060 ids matching one of theses names are signed.  By default, or if a name
1061 is prefixed with a '*', a case insensitive substring match is used.
1062 If a name is prefixed with a '=' a case sensitive exact match is done.
1063
1064 The command @option{--quick-lsign-key} marks the signatures as
1065 non-exportable.  If such a non-exportable signature already exists the
1066 @option{--quick-sign-key} turns it into a exportable signature.
1067
1068 This command uses reasonable defaults and thus does not provide the
1069 full flexibility of the "sign" subcommand from @option{--edit-key}.
1070 Its intended use is to help unattended key signing by utilizing a list
1071 of verified fingerprints.
1072
1073 @item --quick-add-uid  @var{user-id} @var{new-user-id}
1074 @opindex quick-add-uid
1075 This command adds a new user id to an existing key.  In contrast to
1076 the interactive sub-command @code{adduid} of @option{--edit-key} the
1077 @var{new-user-id} is added verbatim with only leading and trailing
1078 white space removed, it is expected to be UTF-8 encoded, and no checks
1079 on its form are applied.
1080
1081 @item --quick-revoke-uid  @var{user-id} @var{user-id-to-revoke}
1082 @opindex quick-revoke-uid
1083 This command revokes a User ID on an existing key.  It cannot be used
1084 to revoke the last User ID on key (some non-revoked User ID must
1085 remain), with revocation reason ``User ID is no longer valid''.  If
1086 you want to specify a different revocation reason, or to supply
1087 supplementary revocation text, you should use the interactive
1088 sub-command @code{revuid} of @option{--edit-key}.
1089
1090 @item --change-passphrase @var{user_id}
1091 @opindex change-passphrase
1092 @itemx --passwd @var{user_id}
1093 @opindex passwd
1094 Change the passphrase of the secret key belonging to the certificate
1095 specified as @var{user_id}.  This is a shortcut for the sub-command
1096 @code{passwd} of the edit key menu.
1097
1098 @end table
1099
1100
1101 @c *******************************************
1102 @c ***************            ****************
1103 @c ***************  OPTIONS   ****************
1104 @c ***************            ****************
1105 @c *******************************************
1106 @mansect options
1107 @node GPG Options
1108 @section Option Summary
1109
1110 @command{@gpgname} features a bunch of options to control the exact
1111 behaviour and to change the default configuration.
1112
1113 @menu
1114 * GPG Configuration Options::   How to change the configuration.
1115 * GPG Key related Options::     Key related options.
1116 * GPG Input and Output::        Input and Output.
1117 * OpenPGP Options::             OpenPGP protocol specific options.
1118 * Compliance Options::          Compliance options.
1119 * GPG Esoteric Options::        Doing things one usually doesn't want to do.
1120 * Deprecated Options::          Deprecated options.
1121 @end menu
1122
1123 Long options can be put in an options file (default
1124 "~/.gnupg/gpg.conf"). Short option names will not work - for example,
1125 "armor" is a valid option for the options file, while "a" is not. Do not
1126 write the 2 dashes, but simply the name of the option and any required
1127 arguments. Lines with a hash ('#') as the first non-white-space
1128 character are ignored. Commands may be put in this file too, but that is
1129 not generally useful as the command will execute automatically with
1130 every execution of gpg.
1131
1132 Please remember that option parsing stops as soon as a non-option is
1133 encountered, you can explicitly stop parsing by using the special option
1134 @option{--}.
1135
1136 @c *******************************************
1137 @c ********  CONFIGURATION OPTIONS  **********
1138 @c *******************************************
1139 @node GPG Configuration Options
1140 @subsection How to change the configuration
1141
1142 These options are used to change the configuration and are usually found
1143 in the option file.
1144
1145 @table @gnupgtabopt
1146
1147 @item --default-key @var{name}
1148 @opindex default-key
1149 Use @var{name} as the default key to sign with. If this option is not
1150 used, the default key is the first key found in the secret keyring.
1151 Note that @option{-u} or @option{--local-user} overrides this option.
1152 This option may be given multiple times.  In this case, the last key
1153 for which a secret key is available is used.  If there is no secret
1154 key available for any of the specified values, GnuPG will not emit an
1155 error message but continue as if this option wasn't given.
1156
1157 @item --default-recipient @var{name}
1158 @opindex default-recipient
1159 Use @var{name} as default recipient if option @option{--recipient} is
1160 not used and don't ask if this is a valid one. @var{name} must be
1161 non-empty.
1162
1163 @item --default-recipient-self
1164 @opindex default-recipient-self
1165 Use the default key as default recipient if option @option{--recipient} is not
1166 used and don't ask if this is a valid one. The default key is the first
1167 one from the secret keyring or the one set with @option{--default-key}.
1168
1169 @item --no-default-recipient
1170 @opindex no-default-recipient
1171 Reset @option{--default-recipient} and @option{--default-recipient-self}.
1172
1173 @item -v, --verbose
1174 @opindex verbose
1175 Give more information during processing. If used
1176 twice, the input data is listed in detail.
1177
1178 @item --no-verbose
1179 @opindex no-verbose
1180 Reset verbose level to 0.
1181
1182 @item -q, --quiet
1183 @opindex quiet
1184 Try to be as quiet as possible.
1185
1186 @item --batch
1187 @itemx --no-batch
1188 @opindex batch
1189 @opindex no-batch
1190 Use batch mode.  Never ask, do not allow interactive commands.
1191 @option{--no-batch} disables this option.  Note that even with a
1192 filename given on the command line, gpg might still need to read from
1193 STDIN (in particular if gpg figures that the input is a
1194 detached signature and no data file has been specified).  Thus if you
1195 do not want to feed data via STDIN, you should connect STDIN to
1196 g@file{/dev/null}.
1197
1198 It is highly recommended to use this option along with the options
1199 @option{--status-fd} and @option{--with-colons} for any unattended of
1200 @command{gpg}.
1201
1202 @item --no-tty
1203 @opindex no-tty
1204 Make sure that the TTY (terminal) is never used for any output.
1205 This option is needed in some cases because GnuPG sometimes prints
1206 warnings to the TTY even if @option{--batch} is used.
1207
1208 @item --yes
1209 @opindex yes
1210 Assume "yes" on most questions.
1211
1212 @item --no
1213 @opindex no
1214 Assume "no" on most questions.
1215
1216
1217 @item --list-options @code{parameters}
1218 @opindex list-options
1219 This is a space or comma delimited string that gives options used when
1220 listing keys and signatures (that is, @option{--list-keys},
1221 @option{--list-signatures}, @option{--list-public-keys},
1222 @option{--list-secret-keys}, and the @option{--edit-key} functions).
1223 Options can be prepended with a @option{no-} (after the two dashes) to
1224 give the opposite meaning.  The options are:
1225
1226 @table @asis
1227
1228   @item show-photos
1229   @opindex list-options:show-photos
1230   Causes @option{--list-keys}, @option{--list-signatures},
1231   @option{--list-public-keys}, and @option{--list-secret-keys} to
1232   display any photo IDs attached to the key.  Defaults to no. See also
1233   @option{--photo-viewer}.  Does not work with @option{--with-colons}:
1234   see @option{--attribute-fd} for the appropriate way to get photo data
1235   for scripts and other frontends.
1236
1237   @item show-usage
1238   @opindex list-options:show-usage
1239   Show usage information for keys and subkeys in the standard key
1240   listing.  This is a list of letters indicating the allowed usage for a
1241   key (@code{E}=encryption, @code{S}=signing, @code{C}=certification,
1242   @code{A}=authentication).  Defaults to yes.
1243
1244   @item show-policy-urls
1245   @opindex list-options:show-policy-urls
1246   Show policy URLs in the @option{--list-signatures} or @option{--check-signatures}
1247   listings.  Defaults to no.
1248
1249   @item show-notations
1250   @itemx show-std-notations
1251   @itemx show-user-notations
1252   @opindex list-options:show-notations
1253   @opindex list-options:show-std-notations
1254   @opindex list-options:show-user-notations
1255   Show all, IETF standard, or user-defined signature notations in the
1256   @option{--list-signatures} or @option{--check-signatures} listings. Defaults to no.
1257
1258   @item show-keyserver-urls
1259   @opindex list-options:show-keyserver-urls
1260   Show any preferred keyserver URL in the @option{--list-signatures} or
1261   @option{--check-signatures} listings. Defaults to no.
1262
1263   @item show-uid-validity
1264   @opindex list-options:show-uid-validity
1265   Display the calculated validity of user IDs during key listings.
1266   Defaults to yes.
1267
1268   @item show-unusable-uids
1269   @opindex list-options:show-unusable-uids
1270   Show revoked and expired user IDs in key listings. Defaults to no.
1271
1272   @item show-unusable-subkeys
1273   @opindex list-options:show-unusable-subkeys
1274   Show revoked and expired subkeys in key listings. Defaults to no.
1275
1276   @item show-keyring
1277   @opindex list-options:show-keyring
1278   Display the keyring name at the head of key listings to show which
1279   keyring a given key resides on. Defaults to no.
1280
1281   @item show-sig-expire
1282   @opindex list-options:show-sig-expire
1283   Show signature expiration dates (if any) during @option{--list-signatures} or
1284   @option{--check-signatures} listings. Defaults to no.
1285
1286   @item show-sig-subpackets
1287   @opindex list-options:show-sig-subpackets
1288   Include signature subpackets in the key listing. This option can take an
1289   optional argument list of the subpackets to list. If no argument is
1290   passed, list all subpackets. Defaults to no. This option is only
1291   meaningful when using @option{--with-colons} along with
1292   @option{--list-signatures} or @option{--check-signatures}.
1293
1294 @end table
1295
1296 @item --verify-options @code{parameters}
1297 @opindex verify-options
1298 This is a space or comma delimited string that gives options used when
1299 verifying signatures. Options can be prepended with a `no-' to give
1300 the opposite meaning. The options are:
1301
1302 @table @asis
1303
1304   @item show-photos
1305   @opindex verify-options:show-photos
1306   Display any photo IDs present on the key that issued the signature.
1307   Defaults to no. See also @option{--photo-viewer}.
1308
1309   @item show-policy-urls
1310   @opindex verify-options:show-policy-urls
1311   Show policy URLs in the signature being verified. Defaults to yes.
1312
1313   @item show-notations
1314   @itemx show-std-notations
1315   @itemx show-user-notations
1316   @opindex verify-options:show-notations
1317   @opindex verify-options:show-std-notations
1318   @opindex verify-options:show-user-notations
1319   Show all, IETF standard, or user-defined signature notations in the
1320   signature being verified. Defaults to IETF standard.
1321
1322   @item show-keyserver-urls
1323   @opindex verify-options:show-keyserver-urls
1324   Show any preferred keyserver URL in the signature being verified.
1325   Defaults to yes.
1326
1327   @item show-uid-validity
1328   @opindex verify-options:show-uid-validity
1329   Display the calculated validity of the user IDs on the key that issued
1330   the signature. Defaults to yes.
1331
1332   @item show-unusable-uids
1333   @opindex verify-options:show-unusable-uids
1334   Show revoked and expired user IDs during signature verification.
1335   Defaults to no.
1336
1337   @item show-primary-uid-only
1338   @opindex verify-options:show-primary-uid-only
1339   Show only the primary user ID during signature verification.  That is
1340   all the AKA lines as well as photo Ids are not shown with the signature
1341   verification status.
1342
1343   @item pka-lookups
1344   @opindex verify-options:pka-lookups
1345   Enable PKA lookups to verify sender addresses. Note that PKA is based
1346   on DNS, and so enabling this option may disclose information on when
1347   and what signatures are verified or to whom data is encrypted. This
1348   is similar to the "web bug" described for the @option{--auto-key-retrieve}
1349   option.
1350
1351   @item pka-trust-increase
1352   @opindex verify-options:pka-trust-increase
1353   Raise the trust in a signature to full if the signature passes PKA
1354   validation. This option is only meaningful if pka-lookups is set.
1355 @end table
1356
1357 @item --enable-large-rsa
1358 @itemx --disable-large-rsa
1359 @opindex enable-large-rsa
1360 @opindex disable-large-rsa
1361 With --generate-key and --batch, enable the creation of RSA secret keys as
1362 large as 8192 bit.  Note: 8192 bit is more than is generally
1363 recommended.  These large keys don't significantly improve security,
1364 but they are more expensive to use, and their signatures and
1365 certifications are larger.  This option is only available if the
1366 binary was build with large-secmem support.
1367
1368 @item --enable-dsa2
1369 @itemx --disable-dsa2
1370 @opindex enable-dsa2
1371 @opindex disable-dsa2
1372 Enable hash truncation for all DSA keys even for old DSA Keys up to
1373 1024 bit.  This is also the default with @option{--openpgp}.  Note
1374 that older versions of GnuPG also required this flag to allow the
1375 generation of DSA larger than 1024 bit.
1376
1377 @item --photo-viewer @code{string}
1378 @opindex photo-viewer
1379 This is the command line that should be run to view a photo ID. "%i"
1380 will be expanded to a filename containing the photo. "%I" does the
1381 same, except the file will not be deleted once the viewer exits.
1382 Other flags are "%k" for the key ID, "%K" for the long key ID, "%f"
1383 for the key fingerprint, "%t" for the extension of the image type
1384 (e.g. "jpg"), "%T" for the MIME type of the image (e.g. "image/jpeg"),
1385 "%v" for the single-character calculated validity of the image being
1386 viewed (e.g. "f"), "%V" for the calculated validity as a string (e.g.
1387 "full"), "%U" for a base32 encoded hash of the user ID,
1388 and "%%" for an actual percent sign. If neither %i or %I are present,
1389 then the photo will be supplied to the viewer on standard input.
1390
1391 The default viewer is "xloadimage -fork -quiet -title 'KeyID 0x%k'
1392 STDIN". Note that if your image viewer program is not secure, then
1393 executing it from GnuPG does not make it secure.
1394
1395 @item --exec-path @code{string}
1396 @opindex exec-path
1397 @efindex PATH
1398 Sets a list of directories to search for photo viewers and keyserver
1399 helpers. If not provided, keyserver helpers use the compiled-in
1400 default directory, and photo viewers use the @code{PATH} environment
1401 variable.
1402 Note, that on W32 system this value is ignored when searching for
1403 keyserver helpers.
1404
1405 @item --keyring @code{file}
1406 @opindex keyring
1407 Add @code{file} to the current list of keyrings. If @code{file} begins
1408 with a tilde and a slash, these are replaced by the $HOME directory. If
1409 the filename does not contain a slash, it is assumed to be in the GnuPG
1410 home directory ("~/.gnupg" if @option{--homedir} or $GNUPGHOME is not
1411 used).
1412
1413 Note that this adds a keyring to the current list. If the intent is to
1414 use the specified keyring alone, use @option{--keyring} along with
1415 @option{--no-default-keyring}.
1416
1417 If the the option @option{--no-keyring} has been used no keyrings will
1418 be used at all.
1419
1420
1421 @item --secret-keyring @code{file}
1422 @opindex secret-keyring
1423 This is an obsolete option and ignored.  All secret keys are stored in
1424 the @file{private-keys-v1.d} directory below the GnuPG home directory.
1425
1426 @item --primary-keyring @code{file}
1427 @opindex primary-keyring
1428 Designate @code{file} as the primary public keyring. This means that
1429 newly imported keys (via @option{--import} or keyserver
1430 @option{--recv-from}) will go to this keyring.
1431
1432 @item --trustdb-name @code{file}
1433 @opindex trustdb-name
1434 Use @code{file} instead of the default trustdb. If @code{file} begins
1435 with a tilde and a slash, these are replaced by the $HOME directory. If
1436 the filename does not contain a slash, it is assumed to be in the GnuPG
1437 home directory (@file{~/.gnupg} if @option{--homedir} or $GNUPGHOME is
1438 not used).
1439
1440 @include opt-homedir.texi
1441
1442
1443 @item --display-charset @code{name}
1444 @opindex display-charset
1445 Set the name of the native character set. This is used to convert
1446 some informational strings like user IDs to the proper UTF-8 encoding.
1447 Note that this has nothing to do with the character set of data to be
1448 encrypted or signed; GnuPG does not recode user-supplied data. If
1449 this option is not used, the default character set is determined from
1450 the current locale. A verbosity level of 3 shows the chosen set.
1451 Valid values for @code{name} are:
1452
1453 @table @asis
1454
1455   @item iso-8859-1
1456   @opindex display-charset:iso-8859-1
1457   This is the Latin 1 set.
1458
1459   @item iso-8859-2
1460   @opindex display-charset:iso-8859-2
1461   The Latin 2 set.
1462
1463   @item iso-8859-15
1464   @opindex display-charset:iso-8859-15
1465   This is currently an alias for
1466   the Latin 1 set.
1467
1468   @item koi8-r
1469   @opindex display-charset:koi8-r
1470   The usual Russian set (RFC-1489).
1471
1472   @item utf-8
1473   @opindex display-charset:utf-8
1474   Bypass all translations and assume
1475   that the OS uses native UTF-8 encoding.
1476 @end table
1477
1478 @item --utf8-strings
1479 @itemx --no-utf8-strings
1480 @opindex utf8-strings
1481 Assume that command line arguments are given as UTF-8 strings. The
1482 default (@option{--no-utf8-strings}) is to assume that arguments are
1483 encoded in the character set as specified by
1484 @option{--display-charset}. These options affect all following
1485 arguments. Both options may be used multiple times.
1486
1487 @anchor{gpg-option --options}
1488 @item --options @code{file}
1489 @opindex options
1490 Read options from @code{file} and do not try to read them from the
1491 default options file in the homedir (see @option{--homedir}). This
1492 option is ignored if used in an options file.
1493
1494 @item --no-options
1495 @opindex no-options
1496 Shortcut for @option{--options /dev/null}. This option is detected
1497 before an attempt to open an option file.  Using this option will also
1498 prevent the creation of a @file{~/.gnupg} homedir.
1499
1500 @item -z @code{n}
1501 @itemx --compress-level @code{n}
1502 @itemx --bzip2-compress-level @code{n}
1503 @opindex compress-level
1504 @opindex bzip2-compress-level
1505 Set compression level to @code{n} for the ZIP and ZLIB compression
1506 algorithms. The default is to use the default compression level of zlib
1507 (normally 6). @option{--bzip2-compress-level} sets the compression level
1508 for the BZIP2 compression algorithm (defaulting to 6 as well). This is a
1509 different option from @option{--compress-level} since BZIP2 uses a
1510 significant amount of memory for each additional compression level.
1511 @option{-z} sets both. A value of 0 for @code{n} disables compression.
1512
1513 @item --bzip2-decompress-lowmem
1514 @opindex bzip2-decompress-lowmem
1515 Use a different decompression method for BZIP2 compressed files. This
1516 alternate method uses a bit more than half the memory, but also runs
1517 at half the speed. This is useful under extreme low memory
1518 circumstances when the file was originally compressed at a high
1519 @option{--bzip2-compress-level}.
1520
1521
1522 @item --mangle-dos-filenames
1523 @itemx --no-mangle-dos-filenames
1524 @opindex mangle-dos-filenames
1525 @opindex no-mangle-dos-filenames
1526 Older version of Windows cannot handle filenames with more than one
1527 dot. @option{--mangle-dos-filenames} causes GnuPG to replace (rather
1528 than add to) the extension of an output filename to avoid this
1529 problem. This option is off by default and has no effect on non-Windows
1530 platforms.
1531
1532 @item --ask-cert-level
1533 @itemx --no-ask-cert-level
1534 @opindex ask-cert-level
1535 When making a key signature, prompt for a certification level. If this
1536 option is not specified, the certification level used is set via
1537 @option{--default-cert-level}. See @option{--default-cert-level} for
1538 information on the specific levels and how they are
1539 used. @option{--no-ask-cert-level} disables this option. This option
1540 defaults to no.
1541
1542 @item --default-cert-level @code{n}
1543 @opindex default-cert-level
1544 The default to use for the check level when signing a key.
1545
1546 0 means you make no particular claim as to how carefully you verified
1547 the key.
1548
1549 1 means you believe the key is owned by the person who claims to own
1550 it but you could not, or did not verify the key at all. This is
1551 useful for a "persona" verification, where you sign the key of a
1552 pseudonymous user.
1553
1554 2 means you did casual verification of the key. For example, this
1555 could mean that you verified the key fingerprint and checked the
1556 user ID on the key against a photo ID.
1557
1558 3 means you did extensive verification of the key. For example, this
1559 could mean that you verified the key fingerprint with the owner of the
1560 key in person, and that you checked, by means of a hard to forge
1561 document with a photo ID (such as a passport) that the name of the key
1562 owner matches the name in the user ID on the key, and finally that you
1563 verified (by exchange of email) that the email address on the key
1564 belongs to the key owner.
1565
1566 Note that the examples given above for levels 2 and 3 are just that:
1567 examples. In the end, it is up to you to decide just what "casual"
1568 and "extensive" mean to you.
1569
1570 This option defaults to 0 (no particular claim).
1571
1572 @item --min-cert-level
1573 @opindex min-cert-level
1574 When building the trust database, treat any signatures with a
1575 certification level below this as invalid. Defaults to 2, which
1576 disregards level 1 signatures. Note that level 0 "no particular
1577 claim" signatures are always accepted.
1578
1579 @item --trusted-key @code{long key ID}
1580 @opindex trusted-key
1581 Assume that the specified key (which must be given
1582 as a full 8 byte key ID) is as trustworthy as one of
1583 your own secret keys. This option is useful if you
1584 don't want to keep your secret keys (or one of them)
1585 online but still want to be able to check the validity of a given
1586 recipient's or signator's key.
1587
1588 @item --trust-model @code{pgp|classic|tofu|tofu+pgp|direct|always|auto}
1589 @opindex trust-model
1590 Set what trust model GnuPG should follow. The models are:
1591
1592 @table @asis
1593
1594   @item pgp
1595   @opindex trust-mode:pgp
1596   This is the Web of Trust combined with trust signatures as used in PGP
1597   5.x and later. This is the default trust model when creating a new
1598   trust database.
1599
1600   @item classic
1601   @opindex trust-mode:classic
1602   This is the standard Web of Trust as introduced by PGP 2.
1603
1604   @item tofu
1605   @opindex trust-mode:tofu
1606   @anchor{trust-model-tofu}
1607   TOFU stands for Trust On First Use.  In this trust model, the first
1608   time a key is seen, it is memorized.  If later another key is seen
1609   with a user id with the same email address, a warning is displayed
1610   indicating that there is a conflict and that the key might be a
1611   forgery and an attempt at a man-in-the-middle attack.
1612
1613   Because a potential attacker is able to control the email address
1614   and thereby circumvent the conflict detection algorithm by using an
1615   email address that is similar in appearance to a trusted email
1616   address, whenever a message is verified, statistics about the number
1617   of messages signed with the key are shown.  In this way, a user can
1618   easily identify attacks using fake keys for regular correspondents.
1619
1620   When compared with the Web of Trust, TOFU offers significantly
1621   weaker security guarantees.  In particular, TOFU only helps ensure
1622   consistency (that is, that the binding between a key and email
1623   address doesn't change).  A major advantage of TOFU is that it
1624   requires little maintenance to use correctly.  To use the web of
1625   trust properly, you need to actively sign keys and mark users as
1626   trusted introducers.  This is a time-consuming process and anecdotal
1627   evidence suggests that even security-conscious users rarely take the
1628   time to do this thoroughly and instead rely on an ad-hoc TOFU
1629   process.
1630
1631   In the TOFU model, policies are associated with bindings between
1632   keys and email addresses (which are extracted from user ids and
1633   normalized).  There are five policies, which can be set manually
1634   using the @option{--tofu-policy} option.  The default policy can be
1635   set using the @option{--tofu-default-policy} option.
1636
1637   The TOFU policies are: @code{auto}, @code{good}, @code{unknown},
1638   @code{bad} and @code{ask}.  The @code{auto} policy is used by
1639   default (unless overridden by @option{--tofu-default-policy}) and
1640   marks a binding as marginally trusted.  The @code{good},
1641   @code{unknown} and @code{bad} policies mark a binding as fully
1642   trusted, as having unknown trust or as having trust never,
1643   respectively.  The @code{unknown} policy is useful for just using
1644   TOFU to detect conflicts, but to never assign positive trust to a
1645   binding.  The final policy, @code{ask} prompts the user to indicate
1646   the binding's trust.  If batch mode is enabled (or input is
1647   inappropriate in the context), then the user is not prompted and the
1648   @code{undefined} trust level is returned.
1649
1650   @item tofu+pgp
1651   @opindex trust-mode:tofu+pgp
1652   This trust model combines TOFU with the Web of Trust.  This is done
1653   by computing the trust level for each model and then taking the
1654   maximum trust level where the trust levels are ordered as follows:
1655   @code{unknown < undefined < marginal < fully < ultimate < expired <
1656   never}.
1657
1658   By setting @option{--tofu-default-policy=unknown}, this model can be
1659   used to implement the web of trust with TOFU's conflict detection
1660   algorithm, but without its assignment of positive trust values,
1661   which some security-conscious users don't like.
1662
1663   @item direct
1664   @opindex trust-mode:direct
1665   Key validity is set directly by the user and not calculated via the
1666   Web of Trust.
1667
1668   @item always
1669   @opindex trust-mode:always
1670   Skip key validation and assume that used keys are always fully
1671   valid. You generally won't use this unless you are using some
1672   external validation scheme. This option also suppresses the
1673   "[uncertain]" tag printed with signature checks when there is no
1674   evidence that the user ID is bound to the key.  Note that this
1675   trust model still does not allow the use of expired, revoked, or
1676   disabled keys.
1677
1678   @item auto
1679   @opindex trust-mode:auto
1680   Select the trust model depending on whatever the internal trust
1681   database says. This is the default model if such a database already
1682   exists.
1683 @end table
1684
1685 @item --auto-key-locate @code{parameters}
1686 @itemx --no-auto-key-locate
1687 @opindex auto-key-locate
1688 GnuPG can automatically locate and retrieve keys as needed using this
1689 option. This happens when encrypting to an email address (in the
1690 "user@@example.com" form), and there are no user@@example.com keys on
1691 the local keyring.  This option takes any number of the following
1692 mechanisms, in the order they are to be tried:
1693
1694 @table @asis
1695
1696   @item cert
1697   Locate a key using DNS CERT, as specified in RFC-4398.
1698
1699   @item pka
1700   Locate a key using DNS PKA.
1701
1702   @item dane
1703   Locate a key using DANE, as specified
1704   in draft-ietf-dane-openpgpkey-05.txt.
1705
1706   @item wkd
1707   Locate a key using the Web Key Directory protocol.
1708   This is an experimental method and semantics may change.
1709
1710   @item ldap
1711   Using DNS Service Discovery, check the domain in question for any LDAP
1712   keyservers to use.  If this fails, attempt to locate the key using the
1713   PGP Universal method of checking @samp{ldap://keys.(thedomain)}.
1714
1715   @item keyserver
1716   Locate a key using whatever keyserver is defined using the
1717   @option{--keyserver} option.
1718
1719   @item keyserver-URL
1720   In addition, a keyserver URL as used in the @option{--keyserver} option
1721   may be used here to query that particular keyserver.
1722
1723   @item local
1724   Locate the key using the local keyrings.  This mechanism allows the user to
1725   select the order a local key lookup is done.  Thus using
1726   @samp{--auto-key-locate local} is identical to
1727   @option{--no-auto-key-locate}.
1728
1729   @item nodefault
1730   This flag disables the standard local key lookup, done before any of the
1731   mechanisms defined by the @option{--auto-key-locate} are tried.  The
1732   position of this mechanism in the list does not matter.  It is not
1733   required if @code{local} is also used.
1734
1735   @item clear
1736   Clear all defined mechanisms.  This is useful to override
1737   mechanisms given in a config file.
1738
1739 @end table
1740
1741 @item --auto-key-retrieve
1742 @itemx --no-auto-key-retrieve
1743 @opindex auto-key-retrieve
1744 @opindex no-auto-key-retrieve
1745 This option enables the automatic retrieving of keys from a keyserver
1746 when verifying signatures made by keys that are not on the local
1747 keyring.
1748
1749 If the method "wkd" is included in the list of methods given to
1750 @option{auto-key-locate}, the Signer's User ID is part of the
1751 signature, and the option @option{--disable-signer-uid} is not used,
1752 the "wkd" method may also be used to retrieve a key.
1753
1754 Note that this option makes a "web bug" like behavior possible.
1755 Keyserver or Web Key Directory operators can see which keys you
1756 request, so by sending you a message signed by a brand new key (which
1757 you naturally will not have on your local keyring), the operator can
1758 tell both your IP address and the time when you verified the
1759 signature.
1760
1761 @item --keyid-format @code{none|short|0xshort|long|0xlong}
1762 @opindex keyid-format
1763 Select how to display key IDs.  "none" does not show the key ID at all
1764 but shows the fingerprint in a separate line.  "short" is the
1765 traditional 8-character key ID.  "long" is the more accurate (but less
1766 convenient) 16-character key ID.  Add an "0x" to either to include an
1767 "0x" at the beginning of the key ID, as in 0x99242560.  Note that this
1768 option is ignored if the option @option{--with-colons} is used.
1769
1770 @item --keyserver @code{name}
1771 @opindex keyserver
1772 This option is deprecated - please use the @option{--keyserver} in
1773 @file{dirmngr.conf} instead.
1774
1775 Use @code{name} as your keyserver. This is the server that
1776 @option{--receive-keys}, @option{--send-keys}, and @option{--search-keys}
1777 will communicate with to receive keys from, send keys to, and search for
1778 keys on. The format of the @code{name} is a URI:
1779 `scheme:[//]keyservername[:port]' The scheme is the type of keyserver:
1780 "hkp" for the HTTP (or compatible) keyservers, "ldap" for the LDAP
1781 keyservers, or "mailto" for the Graff email keyserver. Note that your
1782 particular installation of GnuPG may have other keyserver types
1783 available as well. Keyserver schemes are case-insensitive. After the
1784 keyserver name, optional keyserver configuration options may be
1785 provided. These are the same as the global @option{--keyserver-options}
1786 from below, but apply only to this particular keyserver.
1787
1788 Most keyservers synchronize with each other, so there is generally no
1789 need to send keys to more than one server. The keyserver
1790 @code{hkp://keys.gnupg.net} uses round robin DNS to give a different
1791 keyserver each time you use it.
1792
1793 @item --keyserver-options @code{name=value}
1794 @opindex keyserver-options
1795 This is a space or comma delimited string that gives options for the
1796 keyserver. Options can be prefixed with a `no-' to give the opposite
1797 meaning. Valid import-options or export-options may be used here as
1798 well to apply to importing (@option{--recv-key}) or exporting
1799 (@option{--send-key}) a key from a keyserver. While not all options
1800 are available for all keyserver types, some common options are:
1801
1802 @table @asis
1803
1804   @item include-revoked
1805   When searching for a key with @option{--search-keys}, include keys that
1806   are marked on the keyserver as revoked. Note that not all keyservers
1807   differentiate between revoked and unrevoked keys, and for such
1808   keyservers this option is meaningless. Note also that most keyservers do
1809   not have cryptographic verification of key revocations, and so turning
1810   this option off may result in skipping keys that are incorrectly marked
1811   as revoked.
1812
1813   @item include-disabled
1814   When searching for a key with @option{--search-keys}, include keys that
1815   are marked on the keyserver as disabled. Note that this option is not
1816   used with HKP keyservers.
1817
1818   @item auto-key-retrieve
1819   This is the same as the option @option{auto-key-retrieve}.
1820
1821   @item honor-keyserver-url
1822   When using @option{--refresh-keys}, if the key in question has a preferred
1823   keyserver URL, then use that preferred keyserver to refresh the key
1824   from. In addition, if auto-key-retrieve is set, and the signature
1825   being verified has a preferred keyserver URL, then use that preferred
1826   keyserver to fetch the key from. Note that this option introduces a
1827   "web bug": The creator of the key can see when the keys is
1828   refreshed.  Thus this option is not enabled by default.
1829
1830   @item honor-pka-record
1831   If @option{--auto-key-retrieve} is used, and the signature being
1832   verified has a PKA record, then use the PKA information to fetch
1833   the key. Defaults to "yes".
1834
1835   @item include-subkeys
1836   When receiving a key, include subkeys as potential targets. Note that
1837   this option is not used with HKP keyservers, as they do not support
1838   retrieving keys by subkey id.
1839
1840   @item timeout
1841   Tell the keyserver helper program how long (in seconds) to try and
1842   perform a keyserver action before giving up. Note that performing
1843   multiple actions at the same time uses this timeout value per action.
1844   For example, when retrieving multiple keys via @option{--receive-keys}, the
1845   timeout applies separately to each key retrieval, and not to the
1846   @option{--receive-keys} command as a whole. Defaults to 30 seconds.
1847
1848   @item http-proxy=@code{value}
1849   This option is deprecated.
1850   Set the proxy to use for HTTP and HKP keyservers.
1851   This overrides any proxy defined in @file{dirmngr.conf}.
1852
1853   @item verbose
1854   This option has no more function since GnuPG 2.1.  Use the
1855   @code{dirmngr} configuration options instead.
1856
1857   @item debug
1858   This option has no more function since GnuPG 2.1.  Use the
1859   @code{dirmngr} configuration options instead.
1860
1861   @item check-cert
1862   This option has no more function since GnuPG 2.1.  Use the
1863   @code{dirmngr} configuration options instead.
1864
1865   @item ca-cert-file
1866   This option has no more function since GnuPG 2.1.  Use the
1867   @code{dirmngr} configuration options instead.
1868
1869 @end table
1870
1871 @item --completes-needed @code{n}
1872 @opindex compliant-needed
1873 Number of completely trusted users to introduce a new
1874 key signer (defaults to 1).
1875
1876 @item --marginals-needed @code{n}
1877 @opindex marginals-needed
1878 Number of marginally trusted users to introduce a new
1879 key signer (defaults to 3)
1880
1881 @item --tofu-default-policy @code{auto|good|unknown|bad|ask}
1882 @opindex tofu-default-policy
1883 The default TOFU policy (defaults to @code{auto}).  For more
1884 information about the meaning of this option, @pxref{trust-model-tofu}.
1885
1886 @item --max-cert-depth @code{n}
1887 @opindex max-cert-depth
1888 Maximum depth of a certification chain (default is 5).
1889
1890 @item --no-sig-cache
1891 @opindex no-sig-cache
1892 Do not cache the verification status of key signatures.
1893 Caching gives a much better performance in key listings. However, if
1894 you suspect that your public keyring is not safe against write
1895 modifications, you can use this option to disable the caching. It
1896 probably does not make sense to disable it because all kind of damage
1897 can be done if someone else has write access to your public keyring.
1898
1899 @item --auto-check-trustdb
1900 @itemx --no-auto-check-trustdb
1901 @opindex auto-check-trustdb
1902 If GnuPG feels that its information about the Web of Trust has to be
1903 updated, it automatically runs the @option{--check-trustdb} command
1904 internally.  This may be a time consuming
1905 process. @option{--no-auto-check-trustdb} disables this option.
1906
1907 @item --use-agent
1908 @itemx --no-use-agent
1909 @opindex use-agent
1910 This is dummy option. @command{@gpgname} always requires the agent.
1911
1912 @item --gpg-agent-info
1913 @opindex gpg-agent-info
1914 This is dummy option. It has no effect when used with @command{@gpgname}.
1915
1916
1917 @item --agent-program @var{file}
1918 @opindex agent-program
1919 Specify an agent program to be used for secret key operations.  The
1920 default value is determined by running @command{gpgconf} with the
1921 option @option{--list-dirs}.  Note that the pipe symbol (@code{|}) is
1922 used for a regression test suite hack and may thus not be used in the
1923 file name.
1924
1925 @item --dirmngr-program @var{file}
1926 @opindex dirmngr-program
1927 Specify a dirmngr program to be used for keyserver access.  The
1928 default value is @file{@value{BINDIR}/dirmngr}.
1929
1930 @item --no-autostart
1931 @opindex no-autostart
1932 Do not start the gpg-agent or the dirmngr if it has not yet been
1933 started and its service is required.  This option is mostly useful on
1934 machines where the connection to gpg-agent has been redirected to
1935 another machines.  If dirmngr is required on the remote machine, it
1936 may be started manually using @command{gpgconf --launch dirmngr}.
1937
1938 @item --lock-once
1939 @opindex lock-once
1940 Lock the databases the first time a lock is requested
1941 and do not release the lock until the process
1942 terminates.
1943
1944 @item --lock-multiple
1945 @opindex lock-multiple
1946 Release the locks every time a lock is no longer
1947 needed. Use this to override a previous @option{--lock-once}
1948 from a config file.
1949
1950 @item --lock-never
1951 @opindex lock-never
1952 Disable locking entirely. This option should be used only in very
1953 special environments, where it can be assured that only one process
1954 is accessing those files. A bootable floppy with a stand-alone
1955 encryption system will probably use this. Improper usage of this
1956 option may lead to data and key corruption.
1957
1958 @item --exit-on-status-write-error
1959 @opindex exit-on-status-write-error
1960 This option will cause write errors on the status FD to immediately
1961 terminate the process. That should in fact be the default but it never
1962 worked this way and thus we need an option to enable this, so that the
1963 change won't break applications which close their end of a status fd
1964 connected pipe too early. Using this option along with
1965 @option{--enable-progress-filter} may be used to cleanly cancel long
1966 running gpg operations.
1967
1968 @item --limit-card-insert-tries @code{n}
1969 @opindex limit-card-insert-tries
1970 With @code{n} greater than 0 the number of prompts asking to insert a
1971 smartcard gets limited to N-1. Thus with a value of 1 gpg won't at
1972 all ask to insert a card if none has been inserted at startup. This
1973 option is useful in the configuration file in case an application does
1974 not know about the smartcard support and waits ad infinitum for an
1975 inserted card.
1976
1977 @item --no-random-seed-file
1978 @opindex no-random-seed-file
1979 GnuPG uses a file to store its internal random pool over invocations.
1980 This makes random generation faster; however sometimes write operations
1981 are not desired. This option can be used to achieve that with the cost of
1982 slower random generation.
1983
1984 @item --no-greeting
1985 @opindex no-greeting
1986 Suppress the initial copyright message.
1987
1988 @item --no-secmem-warning
1989 @opindex no-secmem-warning
1990 Suppress the warning about "using insecure memory".
1991
1992 @item --no-permission-warning
1993 @opindex permission-warning
1994 Suppress the warning about unsafe file and home directory (@option{--homedir})
1995 permissions. Note that the permission checks that GnuPG performs are
1996 not intended to be authoritative, but rather they simply warn about
1997 certain common permission problems. Do not assume that the lack of a
1998 warning means that your system is secure.
1999
2000 Note that the warning for unsafe @option{--homedir} permissions cannot be
2001 suppressed in the gpg.conf file, as this would allow an attacker to
2002 place an unsafe gpg.conf file in place, and use this file to suppress
2003 warnings about itself. The @option{--homedir} permissions warning may only be
2004 suppressed on the command line.
2005
2006 @item --no-mdc-warning
2007 @opindex no-mdc-warning
2008 Suppress the warning about missing MDC integrity protection.
2009
2010 @item --require-secmem
2011 @itemx --no-require-secmem
2012 @opindex require-secmem
2013 Refuse to run if GnuPG cannot get secure memory. Defaults to no
2014 (i.e. run, but give a warning).
2015
2016
2017 @item --require-cross-certification
2018 @itemx --no-require-cross-certification
2019 @opindex require-cross-certification
2020 When verifying a signature made from a subkey, ensure that the cross
2021 certification "back signature" on the subkey is present and valid.  This
2022 protects against a subtle attack against subkeys that can sign.
2023 Defaults to @option{--require-cross-certification} for
2024 @command{@gpgname}.
2025
2026 @item --expert
2027 @itemx --no-expert
2028 @opindex expert
2029 Allow the user to do certain nonsensical or "silly" things like
2030 signing an expired or revoked key, or certain potentially incompatible
2031 things like generating unusual key types. This also disables certain
2032 warning messages about potentially incompatible actions. As the name
2033 implies, this option is for experts only. If you don't fully
2034 understand the implications of what it allows you to do, leave this
2035 off. @option{--no-expert} disables this option.
2036
2037 @end table
2038
2039
2040 @c *******************************************
2041 @c ********  KEY RELATED OPTIONS  ************
2042 @c *******************************************
2043 @node GPG Key related Options
2044 @subsection Key related options
2045
2046 @table @gnupgtabopt
2047
2048 @item --recipient @var{name}
2049 @itemx -r
2050 @opindex recipient
2051 Encrypt for user id @var{name}. If this option or
2052 @option{--hidden-recipient} is not specified, GnuPG asks for the user-id
2053 unless @option{--default-recipient} is given.
2054
2055 @item --hidden-recipient @var{name}
2056 @itemx -R
2057 @opindex hidden-recipient
2058 Encrypt for user ID @var{name}, but hide the key ID of this user's
2059 key. This option helps to hide the receiver of the message and is a
2060 limited countermeasure against traffic analysis. If this option or
2061 @option{--recipient} is not specified, GnuPG asks for the user ID unless
2062 @option{--default-recipient} is given.
2063
2064 @item --recipient-file @var{file}
2065 @itemx -f
2066 @opindex recipient-file
2067 This option is similar to @option{--recipient} except that it
2068 encrypts to a key stored in the given file.  @var{file} must be the
2069 name of a file containing exactly one key.  @command{@gpgname} assumes that
2070 the key in this file is fully valid.
2071
2072 @item --hidden-recipient-file @var{file}
2073 @itemx -F
2074 @opindex hidden-recipient-file
2075 This option is similar to @option{--hidden-recipient} except that it
2076 encrypts to a key stored in the given file.  @var{file} must be the
2077 name of a file containing exactly one key.  @command{@gpgname} assumes that
2078 the key in this file is fully valid.
2079
2080 @item --encrypt-to @code{name}
2081 @opindex encrypt-to
2082 Same as @option{--recipient} but this one is intended for use in the
2083 options file and may be used with your own user-id as an
2084 "encrypt-to-self". These keys are only used when there are other
2085 recipients given either by use of @option{--recipient} or by the asked
2086 user id.  No trust checking is performed for these user ids and even
2087 disabled keys can be used.
2088
2089 @item --hidden-encrypt-to @code{name}
2090 @opindex hidden-encrypt-to
2091 Same as @option{--hidden-recipient} but this one is intended for use in the
2092 options file and may be used with your own user-id as a hidden
2093 "encrypt-to-self". These keys are only used when there are other
2094 recipients given either by use of @option{--recipient} or by the asked user id.
2095 No trust checking is performed for these user ids and even disabled
2096 keys can be used.
2097
2098 @item --no-encrypt-to
2099 @opindex no-encrypt-to
2100 Disable the use of all @option{--encrypt-to} and
2101 @option{--hidden-encrypt-to} keys.
2102
2103 @item --group @code{name=value}
2104 @opindex group
2105 Sets up a named group, which is similar to aliases in email programs.
2106 Any time the group name is a recipient (@option{-r} or
2107 @option{--recipient}), it will be expanded to the values
2108 specified. Multiple groups with the same name are automatically merged
2109 into a single group.
2110
2111 The values are @code{key IDs} or fingerprints, but any key description
2112 is accepted. Note that a value with spaces in it will be treated as
2113 two different values. Note also there is only one level of expansion
2114 --- you cannot make an group that points to another group. When used
2115 from the command line, it may be necessary to quote the argument to
2116 this option to prevent the shell from treating it as multiple
2117 arguments.
2118
2119 @item --ungroup @code{name}
2120 @opindex ungroup
2121 Remove a given entry from the @option{--group} list.
2122
2123 @item --no-groups
2124 @opindex no-groups
2125 Remove all entries from the @option{--group} list.
2126
2127 @item --local-user @var{name}
2128 @itemx -u
2129 @opindex local-user
2130 Use @var{name} as the key to sign with. Note that this option overrides
2131 @option{--default-key}.
2132
2133 @item --sender @var{mbox}
2134 @opindex sender
2135 This option has two purposes.  @var{mbox} must either be a complete
2136 user id with a proper mail address or just a mail address.  When
2137 creating a signature this option tells gpg the user id of a key used
2138 to make a signature if the key was not directly specified by a user
2139 id.  When verifying a signature the @var{mbox} is used to restrict the
2140 information printed by the TOFU code to matching user ids.
2141
2142 @item --try-secret-key @var{name}
2143 @opindex try-secret-key
2144 For hidden recipients GPG needs to know the keys to use for trial
2145 decryption.  The key set with @option{--default-key} is always tried
2146 first, but this is often not sufficient.  This option allows setting more
2147 keys to be used for trial decryption.  Although any valid user-id
2148 specification may be used for @var{name} it makes sense to use at least
2149 the long keyid to avoid ambiguities.  Note that gpg-agent might pop up a
2150 pinentry for a lot keys to do the trial decryption.  If you want to stop
2151 all further trial decryption you may use close-window button instead of
2152 the cancel button.
2153
2154 @item --try-all-secrets
2155 @opindex try-all-secrets
2156 Don't look at the key ID as stored in the message but try all secret
2157 keys in turn to find the right decryption key. This option forces the
2158 behaviour as used by anonymous recipients (created by using
2159 @option{--throw-keyids} or @option{--hidden-recipient}) and might come
2160 handy in case where an encrypted message contains a bogus key ID.
2161
2162 @item --skip-hidden-recipients
2163 @itemx --no-skip-hidden-recipients
2164 @opindex skip-hidden-recipients
2165 @opindex no-skip-hidden-recipients
2166 During decryption skip all anonymous recipients.  This option helps in
2167 the case that people use the hidden recipients feature to hide there
2168 own encrypt-to key from others.  If oneself has many secret keys this
2169 may lead to a major annoyance because all keys are tried in turn to
2170 decrypt something which was not really intended for it.  The drawback
2171 of this option is that it is currently not possible to decrypt a
2172 message which includes real anonymous recipients.
2173
2174
2175 @end table
2176
2177 @c *******************************************
2178 @c ********  INPUT AND OUTPUT  ***************
2179 @c *******************************************
2180 @node GPG Input and Output
2181 @subsection Input and Output
2182
2183 @table @gnupgtabopt
2184
2185 @item --armor
2186 @itemx -a
2187 @opindex armor
2188 Create ASCII armored output.  The default is to create the binary
2189 OpenPGP format.
2190
2191 @item --no-armor
2192 @opindex no-armor
2193 Assume the input data is not in ASCII armored format.
2194
2195 @item --output @var{file}
2196 @itemx -o @var{file}
2197 @opindex output
2198 Write output to @var{file}.  To write to stdout use @code{-} as the
2199 filename.
2200
2201 @item --max-output @code{n}
2202 @opindex max-output
2203 This option sets a limit on the number of bytes that will be generated
2204 when processing a file. Since OpenPGP supports various levels of
2205 compression, it is possible that the plaintext of a given message may be
2206 significantly larger than the original OpenPGP message. While GnuPG
2207 works properly with such messages, there is often a desire to set a
2208 maximum file size that will be generated before processing is forced to
2209 stop by the OS limits. Defaults to 0, which means "no limit".
2210
2211 @item --input-size-hint @var{n}
2212 @opindex input-size-hint
2213 This option can be used to tell GPG the size of the input data in
2214 bytes.  @var{n} must be a positive base-10 number.  This option is
2215 only useful if the input is not taken from a file.  GPG may use this
2216 hint to optimize its buffer allocation strategy.  It is also used by
2217 the @option{--status-fd} line ``PROGRESS'' to provide a value for
2218 ``total'' if that is not available by other means.
2219
2220 @item --import-options @code{parameters}
2221 @opindex import-options
2222 This is a space or comma delimited string that gives options for
2223 importing keys. Options can be prepended with a `no-' to give the
2224 opposite meaning. The options are:
2225
2226 @table @asis
2227
2228   @item import-local-sigs
2229   Allow importing key signatures marked as "local". This is not
2230   generally useful unless a shared keyring scheme is being used.
2231   Defaults to no.
2232
2233   @item keep-ownertrust
2234   Normally possible still existing ownertrust values of a key are
2235   cleared if a key is imported.  This is in general desirable so that
2236   a formerly deleted key does not automatically gain an ownertrust
2237   values merely due to import.  On the other hand it is sometimes
2238   necessary to re-import a trusted set of keys again but keeping
2239   already assigned ownertrust values.  This can be achieved by using
2240   this option.
2241
2242   @item repair-pks-subkey-bug
2243   During import, attempt to repair the damage caused by the PKS keyserver
2244   bug (pre version 0.9.6) that mangles keys with multiple subkeys. Note
2245   that this cannot completely repair the damaged key as some crucial data
2246   is removed by the keyserver, but it does at least give you back one
2247   subkey. Defaults to no for regular @option{--import} and to yes for
2248   keyserver @option{--receive-keys}.
2249
2250   @item import-show
2251   Show a listing of the key as imported right before it is stored.
2252   This can be combined with the option @option{--dry-run} to only look
2253   at keys.
2254
2255   @item import-export
2256   Run the entire import code but instead of storing the key to the
2257   local keyring write it to the output.  The export options
2258   @option{export-pka} and @option{export-dane} affect the output.  This
2259   option can be used to remove all invalid parts from a key without the
2260   need to store it.
2261
2262   @item merge-only
2263   During import, allow key updates to existing keys, but do not allow
2264   any new keys to be imported. Defaults to no.
2265
2266   @item import-clean
2267   After import, compact (remove all signatures except the
2268   self-signature) any user IDs from the new key that are not usable.
2269   Then, remove any signatures from the new key that are not usable.
2270   This includes signatures that were issued by keys that are not present
2271   on the keyring. This option is the same as running the @option{--edit-key}
2272   command "clean" after import. Defaults to no.
2273
2274   @item import-minimal
2275   Import the smallest key possible. This removes all signatures except
2276   the most recent self-signature on each user ID. This option is the
2277   same as running the @option{--edit-key} command "minimize" after import.
2278   Defaults to no.
2279 @end table
2280
2281 @item --import-filter @code{@var{name}=@var{expr}}
2282 @itemx --export-filter @code{@var{name}=@var{expr}}
2283 @opindex import-filter
2284 @opindex export-filter
2285 These options define an import/export filter which are applied to the
2286 imported/exported keyblock right before it will be stored/written.
2287 @var{name} defines the type of filter to use, @var{expr} the
2288 expression to evaluate.  The option can be used several times which
2289 then appends more expression to the same @var{name}.
2290
2291 @noindent
2292 The available filter types are:
2293
2294 @table @asis
2295
2296   @item keep-uid
2297   This filter will keep a user id packet and its dependent packets in
2298   the keyblock if the expression evaluates to true.
2299
2300   @item drop-subkey
2301   This filter drops the selected subkeys.
2302   Currently only implemented for --export-filter.
2303
2304   @item drop-sig
2305   This filter drops the selected key signatures on user ids.
2306   Self-signatures are not considered.
2307   Currently only implemented for --import-filter.
2308
2309 @end table
2310
2311 For the syntax of the expression see the chapter "FILTER EXPRESSIONS".
2312 The property names for the expressions depend on the actual filter
2313 type and are indicated in the following table.
2314
2315 The available properties are:
2316
2317 @table @asis
2318
2319   @item uid
2320   A string with the user id.  (keep-uid)
2321
2322   @item mbox
2323   The addr-spec part of a user id with mailbox or the empty string.
2324   (keep-uid)
2325
2326   @item key_algo
2327   A number with the public key algorithm of a key or subkey packet.
2328   (drop-subkey)
2329
2330   @item key_created
2331   @itemx key_created_d
2332   The first is the timestamp a public key or subkey packet was
2333   created.  The second is the same but given as an ISO string,
2334   e.g. "2016-08-17". (drop-subkey)
2335
2336   @item primary
2337   Boolean indicating whether the user id is the primary one.  (keep-uid)
2338
2339   @item secret
2340   Boolean indicating whether a key or subkey is a secret one.
2341   drop-subkey)
2342
2343   @item sig_created
2344   @itemx sig_created_d
2345   The first is the timestamp a signature packet was created.  The
2346   second is the same but given as an ISO string,
2347   e.g. "2016-08-17". (drop-sig)
2348
2349   @item sig_algo
2350   A number with the public key algorithm of a signature packet. (drop-sig)
2351
2352   @item sig_digest_algo
2353   A number with the digest algorithm of a signature packet. (drop-sig)
2354
2355 @end table
2356
2357 @item --export-options @code{parameters}
2358 @opindex export-options
2359 This is a space or comma delimited string that gives options for
2360 exporting keys. Options can be prepended with a `no-' to give the
2361 opposite meaning. The options are:
2362
2363 @table @asis
2364
2365   @item export-local-sigs
2366   Allow exporting key signatures marked as "local". This is not
2367   generally useful unless a shared keyring scheme is being used.
2368   Defaults to no.
2369
2370   @item export-attributes
2371   Include attribute user IDs (photo IDs) while exporting. This is
2372   useful to export keys if they are going to be used by an OpenPGP
2373   program that does not accept attribute user IDs. Defaults to yes.
2374
2375   @item export-sensitive-revkeys
2376   Include designated revoker information that was marked as
2377   "sensitive". Defaults to no.
2378
2379   @c Since GnuPG 2.1 gpg-agent manages the secret key and thus the
2380   @c export-reset-subkey-passwd hack is not anymore justified.  Such use
2381   @c cases may be implemented using a specialized secret key export
2382   @c tool.
2383   @c @item export-reset-subkey-passwd
2384   @c When using the @option{--export-secret-subkeys} command, this option resets
2385   @c the passphrases for all exported subkeys to empty. This is useful
2386   @c when the exported subkey is to be used on an unattended machine where
2387   @c a passphrase doesn't necessarily make sense. Defaults to no.
2388
2389   @item export-clean
2390   Compact (remove all signatures from) user IDs on the key being
2391   exported if the user IDs are not usable. Also, do not export any
2392   signatures that are not usable. This includes signatures that were
2393   issued by keys that are not present on the keyring. This option is
2394   the same as running the @option{--edit-key} command "clean" before export
2395   except that the local copy of the key is not modified. Defaults to
2396   no.
2397
2398   @item export-minimal
2399   Export the smallest key possible. This removes all signatures except the
2400   most recent self-signature on each user ID. This option is the same as
2401   running the @option{--edit-key} command "minimize" before export except
2402   that the local copy of the key is not modified. Defaults to no.
2403
2404   @item export-pka
2405   Instead of outputting the key material output PKA records suitable
2406   to put into DNS zone files.  An ORIGIN line is printed before each
2407   record to allow diverting the records to the corresponding zone file.
2408
2409   @item export-dane
2410   Instead of outputting the key material output OpenPGP DANE records
2411   suitable to put into DNS zone files.  An ORIGIN line is printed before
2412   each record to allow diverting the records to the corresponding zone
2413   file.
2414
2415 @end table
2416
2417 @item --with-colons
2418 @opindex with-colons
2419 Print key listings delimited by colons. Note that the output will be
2420 encoded in UTF-8 regardless of any @option{--display-charset} setting. This
2421 format is useful when GnuPG is called from scripts and other programs
2422 as it is easily machine parsed. The details of this format are
2423 documented in the file @file{doc/DETAILS}, which is included in the GnuPG
2424 source distribution.
2425
2426 @item --fixed-list-mode
2427 @opindex fixed-list-mode
2428 Do not merge primary user ID and primary key in @option{--with-colon}
2429 listing mode and print all timestamps as seconds since 1970-01-01.
2430 Since GnuPG 2.0.10, this mode is always used and thus this option is
2431 obsolete; it does not harm to use it though.
2432
2433 @item --legacy-list-mode
2434 @opindex legacy-list-mode
2435 Revert to the pre-2.1 public key list mode.  This only affects the
2436 human readable output and not the machine interface
2437 (i.e. @code{--with-colons}).  Note that the legacy format does not
2438 convey suitable information for elliptic curves.
2439
2440 @item --with-fingerprint
2441 @opindex with-fingerprint
2442 Same as the command @option{--fingerprint} but changes only the format
2443 of the output and may be used together with another command.
2444
2445 @item --with-subkey-fingerprint
2446 @opindex with-subkey-fingerprint
2447 If a fingerprint is printed for the primary key, this option forces
2448 printing of the fingerprint for all subkeys.  This could also be
2449 achieved by using the @option{--with-fingerprint} twice but by using
2450 this option along with keyid-format "none" a compact fingerprint is
2451 printed.
2452
2453 @item --with-icao-spelling
2454 @opindex with-icao-spelling
2455 Print the ICAO spelling of the fingerprint in addition to the hex digits.
2456
2457 @item --with-keygrip
2458 @opindex with-keygrip
2459 Include the keygrip in the key listings.  In @code{--with-colons} mode
2460 this is implicitly enable for secret keys.
2461
2462 @item --with-wkd-hash
2463 @opindex with-wkd-hash
2464 Print a Web Key Directory identifier along with each user ID in key
2465 listings.  This is an experimental feature and semantics may change.
2466
2467 @item --with-secret
2468 @opindex with-secret
2469 Include info about the presence of a secret key in public key listings
2470 done with @code{--with-colons}.
2471
2472 @end table
2473
2474 @c *******************************************
2475 @c ********  OPENPGP OPTIONS  ****************
2476 @c *******************************************
2477 @node OpenPGP Options
2478 @subsection OpenPGP protocol specific options
2479
2480 @table @gnupgtabopt
2481
2482 @item -t, --textmode
2483 @itemx --no-textmode
2484 @opindex textmode
2485 Treat input files as text and store them in the OpenPGP canonical text
2486 form with standard "CRLF" line endings. This also sets the necessary
2487 flags to inform the recipient that the encrypted or signed data is text
2488 and may need its line endings converted back to whatever the local
2489 system uses. This option is useful when communicating between two
2490 platforms that have different line ending conventions (UNIX-like to Mac,
2491 Mac to Windows, etc). @option{--no-textmode} disables this option, and
2492 is the default.
2493
2494 @item --force-v3-sigs
2495 @itemx --no-force-v3-sigs
2496 @item --force-v4-certs
2497 @itemx --no-force-v4-certs
2498 These options are obsolete and have no effect since GnuPG 2.1.
2499
2500 @item --force-mdc
2501 @opindex force-mdc
2502 Force the use of encryption with a modification detection code. This
2503 is always used with the newer ciphers (those with a blocksize greater
2504 than 64 bits), or if all of the recipient keys indicate MDC support in
2505 their feature flags.
2506
2507 @item --disable-mdc
2508 @opindex disable-mdc
2509 Disable the use of the modification detection code. Note that by
2510 using this option, the encrypted message becomes vulnerable to a
2511 message modification attack.
2512
2513 @item --disable-signer-uid
2514 @opindex disable-signer-uid
2515 By default the user ID of the signing key is embedded in the data
2516 signature.  As of now this is only done if the signing key has been
2517 specified with @option{local-user} using a mail address.  This
2518 information can be helpful for verifier to locate the key; see
2519 option @option{--auto-key-retrieve}.
2520
2521 @item --personal-cipher-preferences @code{string}
2522 @opindex personal-cipher-preferences
2523 Set the list of personal cipher preferences to @code{string}.  Use
2524 @command{@gpgname --version} to get a list of available algorithms,
2525 and use @code{none} to set no preference at all.  This allows the user
2526 to safely override the algorithm chosen by the recipient key
2527 preferences, as GPG will only select an algorithm that is usable by
2528 all recipients.  The most highly ranked cipher in this list is also
2529 used for the @option{--symmetric} encryption command.
2530
2531 @item --personal-digest-preferences @code{string}
2532 @opindex personal-digest-preferences
2533 Set the list of personal digest preferences to @code{string}.  Use
2534 @command{@gpgname --version} to get a list of available algorithms,
2535 and use @code{none} to set no preference at all.  This allows the user
2536 to safely override the algorithm chosen by the recipient key
2537 preferences, as GPG will only select an algorithm that is usable by
2538 all recipients.  The most highly ranked digest algorithm in this list
2539 is also used when signing without encryption
2540 (e.g. @option{--clear-sign} or @option{--sign}).
2541
2542 @item --personal-compress-preferences @code{string}
2543 @opindex personal-compress-preferences
2544 Set the list of personal compression preferences to @code{string}.
2545 Use @command{@gpgname --version} to get a list of available
2546 algorithms, and use @code{none} to set no preference at all.  This
2547 allows the user to safely override the algorithm chosen by the
2548 recipient key preferences, as GPG will only select an algorithm that
2549 is usable by all recipients.  The most highly ranked compression
2550 algorithm in this list is also used when there are no recipient keys
2551 to consider (e.g. @option{--symmetric}).
2552
2553 @item --s2k-cipher-algo @code{name}
2554 @opindex s2k-cipher-algo
2555 Use @code{name} as the cipher algorithm for symmetric encryption with
2556 a passphrase if @option{--personal-cipher-preferences} and
2557 @option{--cipher-algo} are not given.  The default is @value{GPGSYMENCALGO}.
2558
2559 @item --s2k-digest-algo @code{name}
2560 @opindex s2k-digest-algo
2561 Use @code{name} as the digest algorithm used to mangle the passphrases
2562 for symmetric encryption.  The default is SHA-1.
2563
2564 @item --s2k-mode @code{n}
2565 @opindex s2k-mode
2566 Selects how passphrases for symmetric encryption are mangled. If
2567 @code{n} is 0 a plain passphrase (which is in general not recommended)
2568 will be used, a 1 adds a salt (which should not be used) to the
2569 passphrase and a 3 (the default) iterates the whole process a number
2570 of times (see @option{--s2k-count}).
2571
2572 @item --s2k-count @code{n}
2573 @opindex s2k-count
2574 Specify how many times the passphrases mangling for symmetric
2575 encryption is repeated.  This value may range between 1024 and
2576 65011712 inclusive.  The default is inquired from gpg-agent.  Note
2577 that not all values in the 1024-65011712 range are legal and if an
2578 illegal value is selected, GnuPG will round up to the nearest legal
2579 value.  This option is only meaningful if @option{--s2k-mode} is set
2580 to the default of 3.
2581
2582
2583 @end table
2584
2585 @c ***************************
2586 @c ******* Compliance ********
2587 @c ***************************
2588 @node Compliance Options
2589 @subsection Compliance options
2590
2591 These options control what GnuPG is compliant to. Only one of these
2592 options may be active at a time. Note that the default setting of
2593 this is nearly always the correct one. See the INTEROPERABILITY WITH
2594 OTHER OPENPGP PROGRAMS section below before using one of these
2595 options.
2596
2597 @table @gnupgtabopt
2598
2599 @item --gnupg
2600 @opindex gnupg
2601 Use standard GnuPG behavior. This is essentially OpenPGP behavior
2602 (see @option{--openpgp}), but with some additional workarounds for common
2603 compatibility problems in different versions of PGP. This is the
2604 default option, so it is not generally needed, but it may be useful to
2605 override a different compliance option in the gpg.conf file.
2606
2607 @item --openpgp
2608 @opindex openpgp
2609 Reset all packet, cipher and digest options to strict OpenPGP
2610 behavior. Use this option to reset all previous options like
2611 @option{--s2k-*}, @option{--cipher-algo}, @option{--digest-algo} and
2612 @option{--compress-algo} to OpenPGP compliant values. All PGP
2613 workarounds are disabled.
2614
2615 @item --rfc4880
2616 @opindex rfc4880
2617 Reset all packet, cipher and digest options to strict RFC-4880
2618 behavior. Note that this is currently the same thing as
2619 @option{--openpgp}.
2620
2621 @item --rfc4880bis
2622 @opindex rfc4880bis
2623 Enable experimental features from proposed updates to RFC-4880.  This
2624 option can be used in addition to the other compliance options.
2625 Warning: The behavior may change with any GnuPG release and created
2626 keys or data may not be usable with future GnuPG versions.
2627
2628 @item --rfc2440
2629 @opindex rfc2440
2630 Reset all packet, cipher and digest options to strict RFC-2440
2631 behavior.
2632
2633 @item --pgp6
2634 @opindex pgp6
2635 Set up all options to be as PGP 6 compliant as possible. This
2636 restricts you to the ciphers IDEA (if the IDEA plugin is installed),
2637 3DES, and CAST5, the hashes MD5, SHA1 and RIPEMD160, and the
2638 compression algorithms none and ZIP. This also disables
2639 @option{--throw-keyids}, and making signatures with signing subkeys as PGP 6
2640 does not understand signatures made by signing subkeys.
2641
2642 This option implies @option{--disable-mdc --escape-from-lines}.
2643
2644 @item --pgp7
2645 @opindex pgp7
2646 Set up all options to be as PGP 7 compliant as possible. This is
2647 identical to @option{--pgp6} except that MDCs are not disabled, and the
2648 list of allowable ciphers is expanded to add AES128, AES192, AES256, and
2649 TWOFISH.
2650
2651 @item --pgp8
2652 @opindex pgp8
2653 Set up all options to be as PGP 8 compliant as possible. PGP 8 is a lot
2654 closer to the OpenPGP standard than previous versions of PGP, so all
2655 this does is disable @option{--throw-keyids} and set
2656 @option{--escape-from-lines}.  All algorithms are allowed except for the
2657 SHA224, SHA384, and SHA512 digests.
2658
2659 @item --compliance @var{string}
2660 @opindex compliance
2661 This option can be used instead of one of the options above.  Valid
2662 values for @var{string} are the above option names (without the double
2663 dash) and possibly others as shown when using "help" for @var{value}.
2664
2665 @end table
2666
2667
2668 @c *******************************************
2669 @c ********  ESOTERIC OPTIONS  ***************
2670 @c *******************************************
2671 @node GPG Esoteric Options
2672 @subsection Doing things one usually doesn't want to do
2673
2674 @table @gnupgtabopt
2675
2676 @item -n
2677 @itemx --dry-run
2678 @opindex dry-run
2679 Don't make any changes (this is not completely implemented).
2680
2681 @item --list-only
2682 @opindex list-only
2683 Changes the behaviour of some commands. This is like @option{--dry-run} but
2684 different in some cases. The semantic of this option may be extended in
2685 the future. Currently it only skips the actual decryption pass and
2686 therefore enables a fast listing of the encryption keys.
2687
2688 @item -i
2689 @itemx --interactive
2690 @opindex interactive
2691 Prompt before overwriting any files.
2692
2693 @item --debug-level @var{level}
2694 @opindex debug-level
2695 Select the debug level for investigating problems. @var{level} may be
2696 a numeric value or by a keyword:
2697
2698 @table @code
2699   @item none
2700   No debugging at all.  A value of less than 1 may be used instead of
2701   the keyword.
2702   @item basic
2703   Some basic debug messages.  A value between 1 and 2 may be used
2704   instead of the keyword.
2705   @item advanced
2706   More verbose debug messages.  A value between 3 and 5 may be used
2707   instead of the keyword.
2708   @item expert
2709   Even more detailed messages.  A value between 6 and 8 may be used
2710   instead of the keyword.
2711   @item guru
2712   All of the debug messages you can get. A value greater than 8 may be
2713   used instead of the keyword.  The creation of hash tracing files is
2714   only enabled if the keyword is used.
2715 @end table
2716
2717 How these messages are mapped to the actual debugging flags is not
2718 specified and may change with newer releases of this program. They are
2719 however carefully selected to best aid in debugging.
2720
2721 @item --debug @var{flags}
2722 @opindex debug
2723 Set debugging flags. All flags are or-ed and @var{flags} may be given
2724 in C syntax (e.g. 0x0042) or as a comma separated list of flag names.
2725 To get a list of all supported flags the single word "help" can be
2726 used.
2727
2728 @item --debug-all
2729 @opindex debug-all
2730 Set all useful debugging flags.
2731
2732 @item --debug-iolbf
2733 @opindex debug-iolbf
2734 Set stdout into line buffered mode.  This option is only honored when
2735 given on the command line.
2736
2737 @item --faked-system-time @var{epoch}
2738 @opindex faked-system-time
2739 This option is only useful for testing; it sets the system time back or
2740 forth to @var{epoch} which is the number of seconds elapsed since the year
2741 1970.  Alternatively @var{epoch} may be given as a full ISO time string
2742 (e.g. "20070924T154812").
2743
2744 @item --enable-progress-filter
2745 @opindex enable-progress-filter
2746 Enable certain PROGRESS status outputs. This option allows frontends
2747 to display a progress indicator while gpg is processing larger files.
2748 There is a slight performance overhead using it.
2749
2750 @item --status-fd @code{n}
2751 @opindex status-fd
2752 Write special status strings to the file descriptor @code{n}.
2753 See the file DETAILS in the documentation for a listing of them.
2754
2755 @item --status-file @code{file}
2756 @opindex status-file
2757 Same as @option{--status-fd}, except the status data is written to file
2758 @code{file}.
2759
2760 @item --logger-fd @code{n}
2761 @opindex logger-fd
2762 Write log output to file descriptor @code{n} and not to STDERR.
2763
2764 @item --log-file @code{file}
2765 @itemx --logger-file @code{file}
2766 @opindex log-file
2767 Same as @option{--logger-fd}, except the logger data is written to
2768 file @code{file}.  Use @file{socket://} to log to socket.
2769
2770 @item --attribute-fd @code{n}
2771 @opindex attribute-fd
2772 Write attribute subpackets to the file descriptor @code{n}. This is most
2773 useful for use with @option{--status-fd}, since the status messages are
2774 needed to separate out the various subpackets from the stream delivered
2775 to the file descriptor.
2776
2777 @item --attribute-file @code{file}
2778 @opindex attribute-file
2779 Same as @option{--attribute-fd}, except the attribute data is written to
2780 file @code{file}.
2781
2782 @item --comment @code{string}
2783 @itemx --no-comments
2784 @opindex comment
2785 Use @code{string} as a comment string in cleartext signatures and ASCII
2786 armored messages or keys (see @option{--armor}). The default behavior is
2787 not to use a comment string. @option{--comment} may be repeated multiple
2788 times to get multiple comment strings. @option{--no-comments} removes
2789 all comments.  It is a good idea to keep the length of a single comment
2790 below 60 characters to avoid problems with mail programs wrapping such
2791 lines.  Note that comment lines, like all other header lines, are not
2792 protected by the signature.
2793
2794 @item --emit-version
2795 @itemx --no-emit-version
2796 @opindex emit-version
2797 Force inclusion of the version string in ASCII armored output.  If
2798 given once only the name of the program and the major number is
2799 emitted, given twice the minor is also emitted, given thrice
2800 the micro is added, and given four times an operating system identification
2801 is also emitted.  @option{--no-emit-version} (default) disables the version
2802 line.
2803
2804 @item --sig-notation @code{name=value}
2805 @itemx --cert-notation @code{name=value}
2806 @itemx -N, --set-notation @code{name=value}
2807 @opindex sig-notation
2808 @opindex cert-notation
2809 @opindex set-notation
2810 Put the name value pair into the signature as notation data.
2811 @code{name} must consist only of printable characters or spaces, and
2812 must contain a '@@' character in the form keyname@@domain.example.com
2813 (substituting the appropriate keyname and domain name, of course).  This
2814 is to help prevent pollution of the IETF reserved notation
2815 namespace. The @option{--expert} flag overrides the '@@'
2816 check. @code{value} may be any printable string; it will be encoded in
2817 UTF-8, so you should check that your @option{--display-charset} is set
2818 correctly. If you prefix @code{name} with an exclamation mark (!), the
2819 notation data will be flagged as critical
2820 (rfc4880:5.2.3.16). @option{--sig-notation} sets a notation for data
2821 signatures. @option{--cert-notation} sets a notation for key signatures
2822 (certifications). @option{--set-notation} sets both.
2823
2824 There are special codes that may be used in notation names. "%k" will
2825 be expanded into the key ID of the key being signed, "%K" into the
2826 long key ID of the key being signed, "%f" into the fingerprint of the
2827 key being signed, "%s" into the key ID of the key making the
2828 signature, "%S" into the long key ID of the key making the signature,
2829 "%g" into the fingerprint of the key making the signature (which might
2830 be a subkey), "%p" into the fingerprint of the primary key of the key
2831 making the signature, "%c" into the signature count from the OpenPGP
2832 smartcard, and "%%" results in a single "%". %k, %K, and %f are only
2833 meaningful when making a key signature (certification), and %c is only
2834 meaningful when using the OpenPGP smartcard.
2835
2836 @item --sig-policy-url @code{string}
2837 @itemx --cert-policy-url @code{string}
2838 @itemx --set-policy-url @code{string}
2839 @opindex sig-policy-url
2840 @opindex cert-policy-url
2841 @opindex set-policy-url
2842 Use @code{string} as a Policy URL for signatures (rfc4880:5.2.3.20).  If
2843 you prefix it with an exclamation mark (!), the policy URL packet will
2844 be flagged as critical. @option{--sig-policy-url} sets a policy url for
2845 data signatures. @option{--cert-policy-url} sets a policy url for key
2846 signatures (certifications). @option{--set-policy-url} sets both.
2847
2848 The same %-expandos used for notation data are available here as well.
2849
2850 @item --sig-keyserver-url @code{string}
2851 @opindex sig-keyserver-url
2852 Use @code{string} as a preferred keyserver URL for data signatures. If
2853 you prefix it with an exclamation mark (!), the keyserver URL packet
2854 will be flagged as critical.
2855
2856 The same %-expandos used for notation data are available here as well.
2857
2858 @item --set-filename @code{string}
2859 @opindex set-filename
2860 Use @code{string} as the filename which is stored inside messages.
2861 This overrides the default, which is to use the actual filename of the
2862 file being encrypted.  Using the empty string for @code{string}
2863 effectively removes the filename from the output.
2864
2865 @item --for-your-eyes-only
2866 @itemx --no-for-your-eyes-only
2867 @opindex for-your-eyes-only
2868 Set the `for your eyes only' flag in the message. This causes GnuPG to
2869 refuse to save the file unless the @option{--output} option is given,
2870 and PGP to use a "secure viewer" with a claimed Tempest-resistant font
2871 to display the message. This option overrides @option{--set-filename}.
2872 @option{--no-for-your-eyes-only} disables this option.
2873
2874 @item --use-embedded-filename
2875 @itemx --no-use-embedded-filename
2876 @opindex use-embedded-filename
2877 Try to create a file with a name as embedded in the data. This can be
2878 a dangerous option as it enables overwriting files. Defaults to no.
2879
2880 @item --cipher-algo @code{name}
2881 @opindex cipher-algo
2882 Use @code{name} as cipher algorithm. Running the program with the
2883 command @option{--version} yields a list of supported algorithms. If
2884 this is not used the cipher algorithm is selected from the preferences
2885 stored with the key. In general, you do not want to use this option as
2886 it allows you to violate the OpenPGP standard.
2887 @option{--personal-cipher-preferences} is the safe way to accomplish the
2888 same thing.
2889
2890 @item --digest-algo @code{name}
2891 @opindex digest-algo
2892 Use @code{name} as the message digest algorithm. Running the program
2893 with the command @option{--version} yields a list of supported algorithms. In
2894 general, you do not want to use this option as it allows you to
2895 violate the OpenPGP standard. @option{--personal-digest-preferences} is the
2896 safe way to accomplish the same thing.
2897
2898 @item --compress-algo @code{name}
2899 @opindex compress-algo
2900 Use compression algorithm @code{name}. "zlib" is RFC-1950 ZLIB
2901 compression. "zip" is RFC-1951 ZIP compression which is used by PGP.
2902 "bzip2" is a more modern compression scheme that can compress some
2903 things better than zip or zlib, but at the cost of more memory used
2904 during compression and decompression. "uncompressed" or "none"
2905 disables compression. If this option is not used, the default
2906 behavior is to examine the recipient key preferences to see which
2907 algorithms the recipient supports. If all else fails, ZIP is used for
2908 maximum compatibility.
2909
2910 ZLIB may give better compression results than ZIP, as the compression
2911 window size is not limited to 8k. BZIP2 may give even better
2912 compression results than that, but will use a significantly larger
2913 amount of memory while compressing and decompressing. This may be
2914 significant in low memory situations. Note, however, that PGP (all
2915 versions) only supports ZIP compression. Using any algorithm other
2916 than ZIP or "none" will make the message unreadable with PGP. In
2917 general, you do not want to use this option as it allows you to
2918 violate the OpenPGP standard. @option{--personal-compress-preferences} is the
2919 safe way to accomplish the same thing.
2920
2921 @item --cert-digest-algo @code{name}
2922 @opindex cert-digest-algo
2923 Use @code{name} as the message digest algorithm used when signing a
2924 key. Running the program with the command @option{--version} yields a
2925 list of supported algorithms. Be aware that if you choose an algorithm
2926 that GnuPG supports but other OpenPGP implementations do not, then some
2927 users will not be able to use the key signatures you make, or quite
2928 possibly your entire key.
2929
2930 @item --disable-cipher-algo @code{name}
2931 @opindex disable-cipher-algo
2932 Never allow the use of @code{name} as cipher algorithm.
2933 The given name will not be checked so that a later loaded algorithm
2934 will still get disabled.
2935
2936 @item --disable-pubkey-algo @code{name}
2937 @opindex disable-pubkey-algo
2938 Never allow the use of @code{name} as public key algorithm.
2939 The given name will not be checked so that a later loaded algorithm
2940 will still get disabled.
2941
2942 @item --throw-keyids
2943 @itemx --no-throw-keyids
2944 @opindex throw-keyids
2945 Do not put the recipient key IDs into encrypted messages. This helps to
2946 hide the receivers of the message and is a limited countermeasure
2947 against traffic analysis.@footnote{Using a little social engineering
2948 anyone who is able to decrypt the message can check whether one of the
2949 other recipients is the one he suspects.}  On the receiving side, it may
2950 slow down the decryption process because all available secret keys must
2951 be tried.  @option{--no-throw-keyids} disables this option. This option
2952 is essentially the same as using @option{--hidden-recipient} for all
2953 recipients.
2954
2955 @item --not-dash-escaped
2956 @opindex not-dash-escaped
2957 This option changes the behavior of cleartext signatures
2958 so that they can be used for patch files. You should not
2959 send such an armored file via email because all spaces
2960 and line endings are hashed too. You can not use this
2961 option for data which has 5 dashes at the beginning of a
2962 line, patch files don't have this. A special armor header
2963 line tells GnuPG about this cleartext signature option.
2964
2965 @item --escape-from-lines
2966 @itemx --no-escape-from-lines
2967 @opindex escape-from-lines
2968 Because some mailers change lines starting with "From " to ">From " it
2969 is good to handle such lines in a special way when creating cleartext
2970 signatures to prevent the mail system from breaking the signature. Note
2971 that all other PGP versions do it this way too.  Enabled by
2972 default. @option{--no-escape-from-lines} disables this option.
2973
2974 @item --passphrase-repeat @code{n}
2975 @opindex passphrase-repeat
2976 Specify how many times @command{@gpgname} will request a new
2977 passphrase be repeated.  This is useful for helping memorize a
2978 passphrase.  Defaults to 1 repetition.
2979
2980 @item --passphrase-fd @code{n}
2981 @opindex passphrase-fd
2982 Read the passphrase from file descriptor @code{n}. Only the first line
2983 will be read from file descriptor @code{n}. If you use 0 for @code{n},
2984 the passphrase will be read from STDIN. This can only be used if only
2985 one passphrase is supplied.
2986
2987 Note that this passphrase is only used if the option @option{--batch}
2988 has also been given.  This is different from GnuPG version 1.x.
2989
2990 @item --passphrase-file @code{file}
2991 @opindex passphrase-file
2992 Read the passphrase from file @code{file}. Only the first line will
2993 be read from file @code{file}. This can only be used if only one
2994 passphrase is supplied. Obviously, a passphrase stored in a file is
2995 of questionable security if other users can read this file. Don't use
2996 this option if you can avoid it.
2997 Note that this passphrase is only used if the option @option{--batch}
2998 has also been given.  This is different from GnuPG version 1.x.
2999
3000 @item --passphrase @code{string}
3001 @opindex passphrase
3002 Use @code{string} as the passphrase. This can only be used if only one
3003 passphrase is supplied. Obviously, this is of very questionable
3004 security on a multi-user system. Don't use this option if you can
3005 avoid it.
3006 Note that this passphrase is only used if the option @option{--batch}
3007 has also been given.  This is different from GnuPG version 1.x.
3008
3009 @item --pinentry-mode @code{mode}
3010 @opindex pinentry-mode
3011 Set the pinentry mode to @code{mode}.  Allowed values for @code{mode}
3012 are:
3013 @table @asis
3014   @item default
3015   Use the default of the agent, which is @code{ask}.
3016   @item ask
3017   Force the use of the Pinentry.
3018   @item cancel
3019   Emulate use of Pinentry's cancel button.
3020   @item error
3021   Return a Pinentry error (``No Pinentry'').
3022   @item loopback
3023   Redirect Pinentry queries to the caller.  Note that in contrast to
3024   Pinentry the user is not prompted again if he enters a bad password.
3025 @end table
3026
3027 @item --command-fd @code{n}
3028 @opindex command-fd
3029 This is a replacement for the deprecated shared-memory IPC mode.
3030 If this option is enabled, user input on questions is not expected
3031 from the TTY but from the given file descriptor. It should be used
3032 together with @option{--status-fd}. See the file doc/DETAILS in the source
3033 distribution for details on how to use it.
3034
3035 @item --command-file @code{file}
3036 @opindex command-file
3037 Same as @option{--command-fd}, except the commands are read out of file
3038 @code{file}
3039
3040 @item --allow-non-selfsigned-uid
3041 @itemx --no-allow-non-selfsigned-uid
3042 @opindex allow-non-selfsigned-uid
3043 Allow the import and use of keys with user IDs which are not
3044 self-signed. This is not recommended, as a non self-signed user ID is
3045 trivial to forge. @option{--no-allow-non-selfsigned-uid} disables.
3046
3047 @item --allow-freeform-uid
3048 @opindex allow-freeform-uid
3049 Disable all checks on the form of the user ID while generating a new
3050 one. This option should only be used in very special environments as
3051 it does not ensure the de-facto standard format of user IDs.
3052
3053 @item --ignore-time-conflict
3054 @opindex ignore-time-conflict
3055 GnuPG normally checks that the timestamps associated with keys and
3056 signatures have plausible values. However, sometimes a signature
3057 seems to be older than the key due to clock problems. This option
3058 makes these checks just a warning. See also @option{--ignore-valid-from} for
3059 timestamp issues on subkeys.
3060
3061 @item --ignore-valid-from
3062 @opindex ignore-valid-from
3063 GnuPG normally does not select and use subkeys created in the future.
3064 This option allows the use of such keys and thus exhibits the
3065 pre-1.0.7 behaviour. You should not use this option unless there
3066 is some clock problem. See also @option{--ignore-time-conflict} for timestamp
3067 issues with signatures.
3068
3069 @item --ignore-crc-error
3070 @opindex ignore-crc-error
3071 The ASCII armor used by OpenPGP is protected by a CRC checksum against
3072 transmission errors. Occasionally the CRC gets mangled somewhere on
3073 the transmission channel but the actual content (which is protected by
3074 the OpenPGP protocol anyway) is still okay. This option allows GnuPG
3075 to ignore CRC errors.
3076
3077 @item --ignore-mdc-error
3078 @opindex ignore-mdc-error
3079 This option changes a MDC integrity protection failure into a warning.
3080 This can be useful if a message is partially corrupt, but it is
3081 necessary to get as much data as possible out of the corrupt message.
3082 However, be aware that a MDC protection failure may also mean that the
3083 message was tampered with intentionally by an attacker.
3084
3085 @item --allow-weak-digest-algos
3086 @opindex allow-weak-digest-algos
3087 Signatures made with known-weak digest algorithms are normally
3088 rejected with an ``invalid digest algorithm'' message.  This option
3089 allows the verification of signatures made with such weak algorithms.
3090 MD5 is the only digest algorithm considered weak by default.  See also
3091 @option{--weak-digest} to reject other digest algorithms.
3092
3093 @item --weak-digest @code{name}
3094 @opindex weak-digest
3095 Treat the specified digest algorithm as weak.  Signatures made over
3096 weak digests algorithms are normally rejected. This option can be
3097 supplied multiple times if multiple algorithms should be considered
3098 weak.  See also @option{--allow-weak-digest-algos} to disable
3099 rejection of weak digests.  MD5 is always considered weak, and does
3100 not need to be listed explicitly.
3101
3102 @item --no-default-keyring
3103 @opindex no-default-keyring
3104 Do not add the default keyrings to the list of keyrings. Note that
3105 GnuPG will not operate without any keyrings, so if you use this option
3106 and do not provide alternate keyrings via @option{--keyring} or
3107 @option{--secret-keyring}, then GnuPG will still use the default public or
3108 secret keyrings.
3109
3110 @item --no-keyring
3111 @opindex no-keyring
3112 Do not add use any keyrings even if specified as options.
3113
3114 @item --skip-verify
3115 @opindex skip-verify
3116 Skip the signature verification step. This may be
3117 used to make the decryption faster if the signature
3118 verification is not needed.
3119
3120 @item --with-key-data
3121 @opindex with-key-data
3122 Print key listings delimited by colons (like @option{--with-colons}) and
3123 print the public key data.
3124
3125 @item --fast-list-mode
3126 @opindex fast-list-mode
3127 Changes the output of the list commands to work faster; this is achieved
3128 by leaving some parts empty. Some applications don't need the user ID
3129 and the trust information given in the listings. By using this options
3130 they can get a faster listing. The exact behaviour of this option may
3131 change in future versions.  If you are missing some information, don't
3132 use this option.
3133
3134 @item --no-literal
3135 @opindex no-literal
3136 This is not for normal use. Use the source to see for what it might be useful.
3137
3138 @item --set-filesize
3139 @opindex set-filesize
3140 This is not for normal use. Use the source to see for what it might be useful.
3141
3142 @item --show-session-key
3143 @opindex show-session-key
3144 Display the session key used for one message. See
3145 @option{--override-session-key} for the counterpart of this option.
3146
3147 We think that Key Escrow is a Bad Thing; however the user should have
3148 the freedom to decide whether to go to prison or to reveal the content
3149 of one specific message without compromising all messages ever
3150 encrypted for one secret key.
3151
3152 You can also use this option if you receive an encrypted message which
3153 is abusive or offensive, to prove to the administrators of the
3154 messaging system that the ciphertext transmitted corresponds to an
3155 inappropriate plaintext so they can take action against the offending
3156 user.
3157
3158 @item --override-session-key @code{string}
3159 @itemx --override-session-key-fd @code{fd}
3160 @opindex override-session-key
3161 Don't use the public key but the session key @code{string} respective
3162 the session key taken from the first line read from file descriptor
3163 @code{fd}.  The format of this string is the same as the one printed
3164 by @option{--show-session-key}. This option is normally not used but
3165 comes handy in case someone forces you to reveal the content of an
3166 encrypted message; using this option you can do this without handing
3167 out the secret key.  Note that using @option{--override-session-key}
3168 may reveal the session key to all local users via the global process
3169 table.
3170
3171 @item --ask-sig-expire
3172 @itemx --no-ask-sig-expire
3173 @opindex ask-sig-expire
3174 When making a data signature, prompt for an expiration time. If this
3175 option is not specified, the expiration time set via
3176 @option{--default-sig-expire} is used. @option{--no-ask-sig-expire}
3177 disables this option.
3178
3179 @item --default-sig-expire
3180 @opindex default-sig-expire
3181 The default expiration time to use for signature expiration. Valid
3182 values are "0" for no expiration, a number followed by the letter d
3183 (for days), w (for weeks), m (for months), or y (for years) (for
3184 example "2m" for two months, or "5y" for five years), or an absolute
3185 date in the form YYYY-MM-DD. Defaults to "0".
3186
3187 @item --ask-cert-expire
3188 @itemx --no-ask-cert-expire
3189 @opindex ask-cert-expire
3190 When making a key signature, prompt for an expiration time. If this
3191 option is not specified, the expiration time set via
3192 @option{--default-cert-expire} is used. @option{--no-ask-cert-expire}
3193 disables this option.
3194
3195 @item --default-cert-expire
3196 @opindex default-cert-expire
3197 The default expiration time to use for key signature expiration.
3198 Valid values are "0" for no expiration, a number followed by the
3199 letter d (for days), w (for weeks), m (for months), or y (for years)
3200 (for example "2m" for two months, or "5y" for five years), or an
3201 absolute date in the form YYYY-MM-DD. Defaults to "0".
3202
3203 @item --default-new-key-algo @var{string}
3204 @opindex default-new-key-algo @var{string}
3205 This option can be used to change the default algorithms for key
3206 generation.  Note that the advanced key generation commands can always
3207 be used to specify a key algorithm directly.  Please consult the
3208 source code to learn the syntax of @var{string}.
3209
3210 @item --allow-secret-key-import
3211 @opindex allow-secret-key-import
3212 This is an obsolete option and is not used anywhere.
3213
3214 @item --allow-multiple-messages
3215 @item --no-allow-multiple-messages
3216 @opindex allow-multiple-messages
3217 Allow processing of multiple OpenPGP messages contained in a single file
3218 or stream.  Some programs that call GPG are not prepared to deal with
3219 multiple messages being processed together, so this option defaults to
3220 no.  Note that versions of GPG prior to 1.4.7 always allowed multiple
3221 messages.
3222
3223 Warning: Do not use this option unless you need it as a temporary
3224 workaround!
3225
3226
3227 @item --enable-special-filenames
3228 @opindex enable-special-filenames
3229 This option enables a mode in which filenames of the form
3230 @file{-&n}, where n is a non-negative decimal number,
3231 refer to the file descriptor n and not to a file with that name.
3232
3233 @item --no-expensive-trust-checks
3234 @opindex no-expensive-trust-checks
3235 Experimental use only.
3236
3237 @item --preserve-permissions
3238 @opindex preserve-permissions
3239 Don't change the permissions of a secret keyring back to user
3240 read/write only. Use this option only if you really know what you are doing.
3241
3242 @item --default-preference-list @code{string}
3243 @opindex default-preference-list
3244 Set the list of default preferences to @code{string}. This preference
3245 list is used for new keys and becomes the default for "setpref" in the
3246 edit menu.
3247
3248 @item --default-keyserver-url @code{name}
3249 @opindex default-keyserver-url
3250 Set the default keyserver URL to @code{name}. This keyserver will be
3251 used as the keyserver URL when writing a new self-signature on a key,
3252 which includes key generation and changing preferences.
3253
3254 @item --list-config
3255 @opindex list-config
3256 Display various internal configuration parameters of GnuPG. This option
3257 is intended for external programs that call GnuPG to perform tasks, and
3258 is thus not generally useful. See the file @file{doc/DETAILS} in the
3259 source distribution for the details of which configuration items may be
3260 listed. @option{--list-config} is only usable with
3261 @option{--with-colons} set.
3262
3263 @item --list-gcrypt-config
3264 @opindex list-gcrypt-config
3265 Display various internal configuration parameters of Libgcrypt.
3266
3267 @item --gpgconf-list
3268 @opindex gpgconf-list
3269 This command is similar to @option{--list-config} but in general only
3270 internally used by the @command{gpgconf} tool.
3271
3272 @item --gpgconf-test
3273 @opindex gpgconf-test
3274 This is more or less dummy action.  However it parses the configuration
3275 file and returns with failure if the configuration file would prevent
3276 @command{@gpgname} from startup.  Thus it may be used to run a syntax check
3277 on the configuration file.
3278
3279 @end table
3280
3281 @c *******************************
3282 @c ******* Deprecated ************
3283 @c *******************************
3284 @node Deprecated Options
3285 @subsection Deprecated options
3286
3287 @table @gnupgtabopt
3288
3289 @item --show-photos
3290 @itemx --no-show-photos
3291 @opindex show-photos
3292 Causes @option{--list-keys}, @option{--list-signatures},
3293 @option{--list-public-keys}, @option{--list-secret-keys}, and verifying
3294 a signature to also display the photo ID attached to the key, if
3295 any. See also @option{--photo-viewer}. These options are deprecated. Use
3296 @option{--list-options [no-]show-photos} and/or @option{--verify-options
3297 [no-]show-photos} instead.
3298
3299 @item --show-keyring
3300 @opindex show-keyring
3301 Display the keyring name at the head of key listings to show which
3302 keyring a given key resides on. This option is deprecated: use
3303 @option{--list-options [no-]show-keyring} instead.
3304
3305 @item --always-trust
3306 @opindex always-trust
3307 Identical to @option{--trust-model always}. This option is deprecated.
3308
3309 @item --show-notation
3310 @itemx --no-show-notation
3311 @opindex show-notation
3312 Show signature notations in the @option{--list-signatures} or @option{--check-signatures} listings
3313 as well as when verifying a signature with a notation in it. These
3314 options are deprecated. Use @option{--list-options [no-]show-notation}
3315 and/or @option{--verify-options [no-]show-notation} instead.
3316
3317 @item --show-policy-url
3318 @itemx --no-show-policy-url
3319 @opindex show-policy-url
3320 Show policy URLs in the @option{--list-signatures} or @option{--check-signatures}
3321 listings as well as when verifying a signature with a policy URL in
3322 it. These options are deprecated. Use @option{--list-options
3323 [no-]show-policy-url} and/or @option{--verify-options
3324 [no-]show-policy-url} instead.
3325
3326
3327 @end table
3328
3329
3330 @c *******************************************
3331 @c ***************            ****************
3332 @c ***************   FILES    ****************
3333 @c ***************            ****************
3334 @c *******************************************
3335 @mansect files
3336 @node GPG Configuration
3337 @section Configuration files
3338
3339 There are a few configuration files to control certain aspects of
3340 @command{@gpgname}'s operation. Unless noted, they are expected in the
3341 current home directory (@pxref{option --homedir}).
3342
3343 @table @file
3344
3345   @item gpg.conf
3346   @efindex gpg.conf
3347   This is the standard configuration file read by @command{@gpgname} on
3348   startup.  It may contain any valid long option; the leading two dashes
3349   may not be entered and the option may not be abbreviated.  This default
3350   name may be changed on the command line (@pxref{gpg-option --options}).
3351   You should backup this file.
3352
3353 @end table
3354
3355 Note that on larger installations, it is useful to put predefined files
3356 into the directory @file{@value{SYSCONFSKELDIR}} so that
3357 newly created users start up with a working configuration.
3358 For existing users a small
3359 helper script is provided to create these files (@pxref{addgnupghome}).
3360
3361 For internal purposes @command{@gpgname} creates and maintains a few other
3362 files; They all live in in the current home directory (@pxref{option
3363 --homedir}).  Only the @command{@gpgname} program may modify these files.
3364
3365
3366 @table @file
3367   @item ~/.gnupg
3368   @efindex ~/.gnupg
3369   This is the default home directory which is used if neither the
3370   environment variable @code{GNUPGHOME} nor the option
3371   @option{--homedir} is given.
3372
3373   @item ~/.gnupg/pubring.gpg
3374   @efindex pubring.gpg
3375   The public keyring.  You should backup this file.
3376
3377   @item ~/.gnupg/pubring.gpg.lock
3378   The lock file for the public keyring.
3379
3380   @item ~/.gnupg/pubring.kbx
3381   @efindex pubring.kbx
3382   The public keyring using a different format.  This file is shared
3383   with @command{gpgsm}.  You should backup this file.
3384
3385   @item ~/.gnupg/pubring.kbx.lock
3386   The lock file for @file{pubring.kbx}.
3387
3388   @item ~/.gnupg/secring.gpg
3389   @efindex secring.gpg
3390   A secret keyring as used by GnuPG versions before 2.1.  It is not
3391   used by GnuPG 2.1 and later.
3392
3393   @item ~/.gnupg/secring.gpg.lock
3394   The lock file for the secret keyring.
3395
3396   @item ~/.gnupg/.gpg-v21-migrated
3397   @efindex .gpg-v21-migrated
3398   File indicating that a migration to GnuPG 2.1 has been done.
3399
3400   @item ~/.gnupg/trustdb.gpg
3401   @efindex trustdb.gpg
3402   The trust database.  There is no need to backup this file; it is better
3403   to backup the ownertrust values (@pxref{option --export-ownertrust}).
3404
3405   @item ~/.gnupg/trustdb.gpg.lock
3406   The lock file for the trust database.
3407
3408   @item ~/.gnupg/random_seed
3409   @efindex random_seed
3410   A file used to preserve the state of the internal random pool.
3411
3412   @item ~/.gnupg/openpgp-revocs.d/
3413   @efindex openpgp-revocs.d
3414   This is the directory where gpg stores pre-generated revocation
3415   certificates.  The file name corresponds to the OpenPGP fingerprint of
3416   the respective key.  It is suggested to backup those certificates and
3417   if the primary private key is not stored on the disk to move them to
3418   an external storage device.  Anyone who can access theses files is
3419   able to revoke the corresponding key.  You may want to print them out.
3420   You should backup all files in this directory and take care to keep
3421   this backup closed away.
3422
3423   @item @value{DATADIR}/options.skel
3424   @efindex options.skel
3425   The skeleton options file.
3426
3427 @end table
3428
3429 Operation is further controlled by a few environment variables:
3430
3431 @table @asis
3432
3433   @item HOME
3434   @efindex HOME
3435   Used to locate the default home directory.
3436
3437   @item GNUPGHOME
3438   @efindex GNUPGHOME
3439   If set directory used instead of "~/.gnupg".
3440
3441   @item GPG_AGENT_INFO
3442   This variable is obsolete; it was used by GnuPG versions before 2.1.
3443
3444   @item PINENTRY_USER_DATA
3445   @efindex PINENTRY_USER_DATA
3446   This value is passed via gpg-agent to pinentry.  It is useful to convey
3447   extra information to a custom pinentry.
3448
3449   @item COLUMNS
3450   @itemx LINES
3451   @efindex COLUMNS
3452   @efindex LINES
3453   Used to size some displays to the full size of the screen.
3454
3455   @item LANGUAGE
3456   @efindex LANGUAGE
3457   Apart from its use by GNU, it is used in the W32 version to override the
3458   language selection done through the Registry.  If used and set to a
3459   valid and available language name (@var{langid}), the file with the
3460   translation is loaded from
3461   @code{@var{gpgdir}/gnupg.nls/@var{langid}.mo}.  Here @var{gpgdir} is the
3462   directory out of which the gpg binary has been loaded.  If it can't be
3463   loaded the Registry is tried and as last resort the native Windows
3464   locale system is used.
3465
3466 @end table
3467
3468
3469 @c *******************************************
3470 @c ***************            ****************
3471 @c ***************  EXAMPLES  ****************
3472 @c ***************            ****************
3473 @c *******************************************
3474 @mansect examples
3475 @node GPG Examples
3476 @section Examples
3477
3478 @table @asis
3479
3480 @item gpg -se -r @code{Bob} @code{file}
3481 sign and encrypt for user Bob
3482
3483 @item gpg --clear-sign @code{file}
3484 make a cleartext signature
3485
3486 @item gpg -sb @code{file}
3487 make a detached signature
3488
3489 @item gpg -u 0x12345678 -sb @code{file}
3490 make a detached signature with the key 0x12345678
3491
3492 @item gpg --list-keys @code{user_ID}
3493 show keys
3494
3495 @item gpg --fingerprint @code{user_ID}
3496 show fingerprint
3497
3498 @item gpg --verify @code{pgpfile}
3499 @itemx gpg --verify @code{sigfile} [@code{datafile}]
3500 Verify the signature of the file but do not output the data unless
3501 requested.  The second form is used for detached signatures, where
3502 @code{sigfile} is the detached signature (either ASCII armored or
3503 binary) and @code{datafile} are the signed data; if this is not given, the name of the
3504 file holding the signed data is constructed by cutting off the
3505 extension (".asc" or ".sig") of @code{sigfile} or by asking the user
3506 for the filename.  If the option @option{--output} is also used the
3507 signed data is written to the file specified by that option; use
3508 @code{-} to write the signed data to stdout.
3509 @end table
3510
3511
3512 @c *******************************************
3513 @c ***************            ****************
3514 @c ***************  USER ID   ****************
3515 @c ***************            ****************
3516 @c *******************************************
3517 @mansect how to specify a user id
3518 @ifset isman
3519 @include specify-user-id.texi
3520 @end ifset
3521
3522 @mansect filter expressions
3523 @chapheading FILTER EXPRESSIONS
3524
3525 The options @option{--import-filter} and @option{--export-filter} use
3526 expressions with this syntax (square brackets indicate an optional
3527 part and curly braces a repetition, white space between the elements
3528 are allowed):
3529
3530 @c man:.RS
3531 @example
3532   [lc] @{[@{flag@}] PROPNAME op VALUE [lc]@}
3533 @end example
3534 @c man:.RE
3535
3536 The name of a property (@var{PROPNAME}) may only consist of letters,
3537 digits and underscores.  The description for the filter type
3538 describes which properties are defined.  If an undefined property is
3539 used it evaluates to the empty string.  Unless otherwise noted, the
3540 @var{VALUE} must always be given and may not be the empty string.  No
3541 quoting is defined for the value, thus the value may not contain the
3542 strings @code{&&} or @code{||}, which are used as logical connection
3543 operators.  The flag @code{--} can be used to remove this restriction.
3544
3545 Numerical values are computed as long int; standard C notation
3546 applies.  @var{lc} is the logical connection operator; either
3547 @code{&&} for a conjunction or @code{||} for a disjunction.  A
3548 conjunction is assumed at the begin of an expression.  Conjunctions
3549 have higher precedence than disjunctions.  If @var{VALUE} starts with
3550 one of the characters used in any @var{op} a space after the
3551 @var{op} is required.
3552
3553 @noindent
3554 The supported operators (@var{op}) are:
3555
3556 @table @asis
3557
3558   @item =~
3559   Substring must match.
3560
3561   @item  !~
3562   Substring must not match.
3563
3564   @item  =
3565   The full string must match.
3566
3567   @item  <>
3568   The full string must not match.
3569
3570   @item  ==
3571   The numerical value must match.
3572
3573   @item  !=
3574   The numerical value must not match.
3575
3576   @item  <=
3577   The numerical value of the field must be LE than the value.
3578
3579   @item  <
3580   The numerical value of the field must be LT than the value.
3581
3582   @item  >
3583   The numerical value of the field must be GT than the value.
3584
3585   @item  >=
3586   The numerical value of the field must be GE than the value.
3587
3588   @item  -le
3589   The string value of the field must be less or equal than the value.
3590
3591   @item  -lt
3592   The string value of the field must be less than the value.
3593
3594   @item  -gt
3595   The string value of the field must be greater than the value.
3596
3597   @item  -ge
3598   The string value of the field must be greater or equal than the value.
3599
3600   @item  -n
3601   True if value is not empty (no value allowed).
3602
3603   @item  -z
3604   True if value is empty (no value allowed).
3605
3606   @item  -t
3607   Alias for "PROPNAME != 0" (no value allowed).
3608
3609   @item  -f
3610   Alias for "PROPNAME == 0" (no value allowed).
3611
3612 @end table
3613
3614 @noindent
3615 Values for @var{flag} must be space separated.  The supported flags
3616 are:
3617
3618 @table @asis
3619   @item --
3620   @var{VALUE} spans to the end of the expression.
3621   @item -c
3622   The string match in this part is done case-sensitive.
3623 @end table
3624
3625 The filter options concatenate several specifications for a filter of
3626 the same type.  For example the four options in this example:
3627
3628 @c man:.RS
3629 @example
3630  --import-option keep-uid="uid =~ Alfa"
3631  --import-option keep-uid="&& uid !~ Test"
3632  --import-option keep-uid="|| uid =~ Alpha"
3633  --import-option keep-uid="uid !~ Test"
3634 @end example
3635 @c man:.RE
3636
3637 @noindent
3638 which is equivalent to
3639
3640 @c man:.RS
3641 @example
3642  --import-option \
3643   keep-uid="uid =~ Alfa" && uid !~ Test" || uid =~ Alpha" && "uid !~ Test"
3644 @end example
3645 @c man:.RE
3646
3647 imports only the user ids of a key containing the strings "Alfa"
3648 or "Alpha" but not the string "test".
3649
3650
3651 @mansect return value
3652 @chapheading RETURN VALUE
3653
3654 The program returns 0 if everything was fine, 1 if at least
3655 a signature was bad, and other error codes for fatal errors.
3656
3657 @mansect warnings
3658 @chapheading WARNINGS
3659
3660 Use a *good* password for your user account and a *good* passphrase
3661 to protect your secret key. This passphrase is the weakest part of the
3662 whole system. Programs to do dictionary attacks on your secret keyring
3663 are very easy to write and so you should protect your "~/.gnupg/"
3664 directory very well.
3665
3666 Keep in mind that, if this program is used over a network (telnet), it
3667 is *very* easy to spy out your passphrase!
3668
3669 If you are going to verify detached signatures, make sure that the
3670 program knows about it; either give both filenames on the command line
3671 or use @samp{-} to specify STDIN.
3672
3673 @mansect interoperability
3674 @chapheading INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS
3675
3676 GnuPG tries to be a very flexible implementation of the OpenPGP
3677 standard. In particular, GnuPG implements many of the optional parts
3678 of the standard, such as the SHA-512 hash, and the ZLIB and BZIP2
3679 compression algorithms. It is important to be aware that not all
3680 OpenPGP programs implement these optional algorithms and that by
3681 forcing their use via the @option{--cipher-algo},
3682 @option{--digest-algo}, @option{--cert-digest-algo}, or
3683 @option{--compress-algo} options in GnuPG, it is possible to create a
3684 perfectly valid OpenPGP message, but one that cannot be read by the
3685 intended recipient.
3686
3687 There are dozens of variations of OpenPGP programs available, and each
3688 supports a slightly different subset of these optional algorithms.
3689 For example, until recently, no (unhacked) version of PGP supported
3690 the BLOWFISH cipher algorithm. A message using BLOWFISH simply could
3691 not be read by a PGP user. By default, GnuPG uses the standard
3692 OpenPGP preferences system that will always do the right thing and
3693 create messages that are usable by all recipients, regardless of which
3694 OpenPGP program they use. Only override this safe default if you
3695 really know what you are doing.
3696
3697 If you absolutely must override the safe default, or if the preferences
3698 on a given key are invalid for some reason, you are far better off using
3699 the @option{--pgp6}, @option{--pgp7}, or @option{--pgp8} options. These
3700 options are safe as they do not force any particular algorithms in
3701 violation of OpenPGP, but rather reduce the available algorithms to a
3702 "PGP-safe" list.
3703
3704 @mansect bugs
3705 @chapheading BUGS
3706
3707 On older systems this program should be installed as setuid(root). This
3708 is necessary to lock memory pages. Locking memory pages prevents the
3709 operating system from writing memory pages (which may contain
3710 passphrases or other sensitive material) to disk. If you get no
3711 warning message about insecure memory your operating system supports
3712 locking without being root. The program drops root privileges as soon
3713 as locked memory is allocated.
3714
3715 Note also that some systems (especially laptops) have the ability to
3716 ``suspend to disk'' (also known as ``safe sleep'' or ``hibernate'').
3717 This writes all memory to disk before going into a low power or even
3718 powered off mode.  Unless measures are taken in the operating system
3719 to protect the saved memory, passphrases or other sensitive material
3720 may be recoverable from it later.
3721
3722 Before you report a bug you should first search the mailing list
3723 archives for similar problems and second check whether such a bug has
3724 already been reported to our bug tracker at http://bugs.gnupg.org .
3725
3726 @c *******************************************
3727 @c ***************              **************
3728 @c ***************  UNATTENDED  **************
3729 @c ***************              **************
3730 @c *******************************************
3731 @manpause
3732 @node Unattended Usage of GPG
3733 @section Unattended Usage
3734
3735 @command{@gpgname} is often used as a backend engine by other software.  To help
3736 with this a machine interface has been defined to have an unambiguous
3737 way to do this.  The options @option{--status-fd} and @option{--batch}
3738 are almost always required for this.
3739
3740 @menu
3741 * Programmatic use of GnuPG:: Programmatic use of GnuPG
3742 * Ephemeral home directories:: Ephemeral home directories
3743 * The quick key manipulation interface:: The quick key manipulation interface
3744 * Unattended GPG key generation::  Unattended key generation
3745 @end menu
3746
3747
3748 @node Programmatic use of GnuPG
3749 @subsection Programmatic use of GnuPG
3750
3751 Please consider using GPGME instead of calling @command{@gpgname}
3752 directly.  GPGME offers a stable, backend-independent interface for
3753 many cryptographic operations.  It supports OpenPGP and S/MIME, and
3754 also allows interaction with various GnuPG components.
3755
3756 GPGME provides a C-API, and comes with bindings for C++, Qt, and
3757 Python.  Bindings for other languages are available.
3758
3759 @node Ephemeral home directories
3760 @subsection Ephemeral home directories
3761
3762 Sometimes you want to contain effects of some operation, for example
3763 you want to import a key to inspect it, but you do not want this key
3764 to be added to your keyring.  In earlier versions of GnuPG, it was
3765 possible to specify alternate keyring files for both public and secret
3766 keys.  In modern GnuPG versions, however, we changed how secret keys
3767 are stored in order to better protect secret key material, and it was
3768 not possible to preserve this interface.
3769
3770 The preferred way to do this is to use ephemeral home directories.
3771 This technique works across all versions of GnuPG.
3772
3773 Create a temporary directory, create (or copy) a configuration that
3774 meets your needs, make @command{@gpgname} use this directory either
3775 using the environment variable @var{GNUPGHOME}, or the option
3776 @option{--homedir}.  GPGME supports this too on a per-context basis,
3777 by modifying the engine info of contexts.  Now execute whatever
3778 operation you like, import and export key material as necessary.  Once
3779 finished, you can delete the directory.  All GnuPG backend services
3780 that were started will detect this and shut down.
3781
3782 @node The quick key manipulation interface
3783 @subsection The quick key manipulation interface
3784
3785 Recent versions of GnuPG have an interface to manipulate keys without
3786 using the interactive command @option{--edit-key}.  This interface was
3787 added mainly for the benefit of GPGME (please consider using GPGME,
3788 see the manual subsection ``Programmatic use of GnuPG'').  This
3789 interface is described in the subsection ``How to manage your keys''.
3790
3791 @node Unattended GPG key generation
3792 @subsection Unattended key generation
3793
3794 The command @option{--generate-key} may be used along with the option
3795 @option{--batch} for unattended key generation.  This is the most
3796 flexible way of generating keys, but it is also the most complex one.
3797 Consider using the quick key manipulation interface described in the
3798 previous subsection ``The quick key manipulation interface''.
3799
3800 The parameters for the key are either read from stdin or given as a
3801 file on the command line.  The format of the parameter file is as
3802 follows:
3803
3804 @itemize @bullet
3805   @item Text only, line length is limited to about 1000 characters.
3806   @item UTF-8 encoding must be used to specify non-ASCII characters.
3807   @item Empty lines are ignored.
3808   @item Leading and trailing while space is ignored.
3809   @item A hash sign as the first non white space character indicates
3810   a comment line.
3811   @item Control statements are indicated by a leading percent sign, the
3812   arguments are separated by white space from the keyword.
3813   @item Parameters are specified by a keyword, followed by a colon.  Arguments
3814   are separated by white space.
3815   @item
3816   The first parameter must be @samp{Key-Type}; control statements may be
3817   placed anywhere.
3818   @item
3819   The order of the parameters does not matter except for @samp{Key-Type}
3820   which must be the first parameter.  The parameters are only used for
3821   the generated keyblock (primary and subkeys); parameters from previous
3822   sets are not used.  Some syntactically checks may be performed.
3823   @item
3824   Key generation takes place when either the end of the parameter file
3825   is reached, the next @samp{Key-Type} parameter is encountered or at the
3826   control statement @samp{%commit} is encountered.
3827 @end itemize
3828
3829 @noindent
3830 Control statements:
3831
3832 @table @asis
3833
3834 @item %echo @var{text}
3835 Print @var{text} as diagnostic.
3836
3837 @item %dry-run
3838 Suppress actual key generation (useful for syntax checking).
3839
3840 @item %commit
3841 Perform the key generation.  Note that an implicit commit is done at
3842 the next @asis{Key-Type} parameter.
3843
3844 @item %pubring @var{filename}
3845 Do not write the key to the default or commandline given keyring but
3846 to @var{filename}.  This must be given before the first commit to take
3847 place, duplicate specification of the same filename is ignored, the
3848 last filename before a commit is used.  The filename is used until a
3849 new filename is used (at commit points) and all keys are written to
3850 that file. If a new filename is given, this file is created (and
3851 overwrites an existing one).
3852
3853 See the previous subsection ``Ephemeral home directories'' for a more
3854 robust way to contain side-effects.
3855
3856 @item %secring @var{filename}
3857 This option is a no-op for GnuPG 2.1 and later.
3858
3859 See the previous subsection ``Ephemeral home directories''.
3860
3861 @item %ask-passphrase
3862 @itemx %no-ask-passphrase
3863 This option is a no-op for GnuPG 2.1 and later.
3864
3865 @item %no-protection
3866 Using this option allows the creation of keys without any passphrase
3867 protection.  This option is mainly intended for regression tests.
3868
3869 @item %transient-key
3870 If given the keys are created using a faster and a somewhat less
3871 secure random number generator.  This option may be used for keys
3872 which are only used for a short time and do not require full
3873 cryptographic strength.  It takes only effect if used together with
3874 the control statement @samp{%no-protection}.
3875
3876 @end table
3877
3878 @noindent
3879 General Parameters:
3880
3881 @table @asis
3882
3883 @item Key-Type: @var{algo}
3884 Starts a new parameter block by giving the type of the primary
3885 key. The algorithm must be capable of signing.  This is a required
3886 parameter.  @var{algo} may either be an OpenPGP algorithm number or a
3887 string with the algorithm name.  The special value @samp{default} may
3888 be used for @var{algo} to create the default key type; in this case a
3889 @samp{Key-Usage} shall not be given and @samp{default} also be used
3890 for @samp{Subkey-Type}.
3891
3892 @item Key-Length: @var{nbits}
3893 The requested length of the generated key in bits.  The default is
3894 returned by running the command @samp{@gpgname --gpgconf-list}.
3895
3896 @item Key-Grip: @var{hexstring}
3897 This is optional and used to generate a CSR or certificate for an
3898 already existing key.  Key-Length will be ignored when given.
3899
3900 @item Key-Usage: @var{usage-list}
3901 Space or comma delimited list of key usages.  Allowed values are
3902 @samp{encrypt}, @samp{sign}, and @samp{auth}.  This is used to
3903 generate the key flags.  Please make sure that the algorithm is
3904 capable of this usage.  Note that OpenPGP requires that all primary
3905 keys are capable of certification, so no matter what usage is given
3906 here, the @samp{cert} flag will be on.  If no @samp{Key-Usage} is
3907 specified and the @samp{Key-Type} is not @samp{default}, all allowed
3908 usages for that particular algorithm are used; if it is not given but
3909 @samp{default} is used the usage will be @samp{sign}.
3910
3911 @item Subkey-Type: @var{algo}
3912 This generates a secondary key (subkey).  Currently only one subkey
3913 can be handled.  See also @samp{Key-Type} above.
3914
3915 @item Subkey-Length: @var{nbits}
3916 Length of the secondary key (subkey) in bits.  The default is returned
3917 by running the command @samp{@gpgname --gpgconf-list}.
3918
3919 @item Subkey-Usage: @var{usage-list}
3920 Key usage lists for a subkey; similar to @samp{Key-Usage}.
3921
3922 @item Passphrase: @var{string}
3923 If you want to specify a passphrase for the secret key, enter it here.
3924 Default is to use the Pinentry dialog to ask for a passphrase.
3925
3926 @item Name-Real: @var{name}
3927 @itemx Name-Comment: @var{comment}
3928 @itemx Name-Email: @var{email}
3929 The three parts of a user name.  Remember to use UTF-8 encoding here.
3930 If you don't give any of them, no user ID is created.
3931
3932 @item Expire-Date: @var{iso-date}|(@var{number}[d|w|m|y])
3933 Set the expiration date for the key (and the subkey).  It may either
3934 be entered in ISO date format (e.g. "20000815T145012") or as number of
3935 days, weeks, month or years after the creation date.  The special
3936 notation "seconds=N" is also allowed to specify a number of seconds
3937 since creation.  Without a letter days are assumed.  Note that there
3938 is no check done on the overflow of the type used by OpenPGP for
3939 timestamps.  Thus you better make sure that the given value make
3940 sense.  Although OpenPGP works with time intervals, GnuPG uses an
3941 absolute value internally and thus the last year we can represent is
3942 2105.
3943
3944 @item  Creation-Date: @var{iso-date}
3945 Set the creation date of the key as stored in the key information and
3946 which is also part of the fingerprint calculation.  Either a date like
3947 "1986-04-26" or a full timestamp like "19860426T042640" may be used.
3948 The time is considered to be UTC.  The special notation "seconds=N"
3949 may be used to directly specify a the number of seconds since Epoch
3950 (Unix time).  If it is not given the current time is used.
3951
3952 @item Preferences: @var{string}
3953 Set the cipher, hash, and compression preference values for this key.
3954 This expects the same type of string as the sub-command @samp{setpref}
3955 in the @option{--edit-key} menu.
3956
3957 @item  Revoker: @var{algo}:@var{fpr} [sensitive]
3958 Add a designated revoker to the generated key.  Algo is the public key
3959 algorithm of the designated revoker (i.e. RSA=1, DSA=17, etc.)
3960 @var{fpr} is the fingerprint of the designated revoker.  The optional
3961 @samp{sensitive} flag marks the designated revoker as sensitive
3962 information.  Only v4 keys may be designated revokers.
3963
3964 @item Keyserver: @var{string}
3965 This is an optional parameter that specifies the preferred keyserver
3966 URL for the key.
3967
3968 @item Handle: @var{string}
3969 This is an optional parameter only used with the status lines
3970 KEY_CREATED and KEY_NOT_CREATED.  @var{string} may be up to 100
3971 characters and should not contain spaces.  It is useful for batch key
3972 generation to associate a key parameter block with a status line.
3973
3974 @end table
3975
3976 @noindent
3977 Here is an example on how to create a key in an ephemeral home directory:
3978 @smallexample
3979 $ export GNUPGHOME="$(mktemp -d)"
3980 $ cat >foo <<EOF
3981      %echo Generating a basic OpenPGP key
3982      Key-Type: DSA
3983      Key-Length: 1024
3984      Subkey-Type: ELG-E
3985      Subkey-Length: 1024
3986      Name-Real: Joe Tester
3987      Name-Comment: with stupid passphrase
3988      Name-Email: joe@@foo.bar
3989      Expire-Date: 0
3990      Passphrase: abc
3991      # Do a commit here, so that we can later print "done" :-)
3992      %commit
3993      %echo done
3994 EOF
3995 $ @gpgname --batch --generate-key foo
3996  [...]
3997 $ @gpgname --list-secret-keys
3998 /tmp/tmp.0NQxB74PEf/pubring.kbx
3999 -------------------------------
4000 sec   dsa1024 2016-12-16 [SCA]
4001       768E895903FC1C44045C8CB95EEBDB71E9E849D0
4002 uid           [ultimate] Joe Tester (with stupid passphrase) <joe@@foo.bar>
4003 ssb   elg1024 2016-12-16 [E]
4004 @end smallexample
4005
4006 @noindent
4007 If you want to create a key with the default algorithms you would use
4008 these parameters:
4009 @smallexample
4010      %echo Generating a default key
4011      Key-Type: default
4012      Subkey-Type: default
4013      Name-Real: Joe Tester
4014      Name-Comment: with stupid passphrase
4015      Name-Email: joe@@foo.bar
4016      Expire-Date: 0
4017      Passphrase: abc
4018      # Do a commit here, so that we can later print "done" :-)
4019      %commit
4020      %echo done
4021 @end smallexample
4022
4023
4024
4025
4026 @mansect see also
4027 @ifset isman
4028 @command{gpgv}(1),
4029 @command{gpgsm}(1),
4030 @command{gpg-agent}(1)
4031 @end ifset
4032 @include see-also-note.texi