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