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