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