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