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