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