1 This is gnupg.info, produced by makeinfo version 6.5 from gnupg.texi.
3 This is the 'The GNU Privacy Guard Manual' (version 2.2.33-beta28,
6 (C) 2002, 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
7 (C) 2013, 2014, 2015 Werner Koch.
8 (C) 2015, 2016, 2017 g10 Code GmbH.
10 Permission is granted to copy, distribute and/or modify this
11 document under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 3 of the
13 License, or (at your option) any later version. The text of the
14 license can be found in the section entitled "Copying".
15 INFO-DIR-SECTION GNU Utilities
17 * gpg2: (gnupg). OpenPGP encryption and signing tool.
18 * gpgsm: (gnupg). S/MIME encryption and signing tool.
19 * gpg-agent: (gnupg). The secret key daemon.
20 * dirmngr: (gnupg). X.509 CRL and OCSP server.
21 * dirmngr-client: (gnupg). X.509 CRL and OCSP client.
25 File: gnupg.info, Node: Top, Next: Installation, Up: (dir)
27 Using the GNU Privacy Guard
28 ***************************
30 This is the 'The GNU Privacy Guard Manual' (version 2.2.33-beta28,
33 (C) 2002, 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
34 (C) 2013, 2014, 2015 Werner Koch.
35 (C) 2015, 2016, 2017 g10 Code GmbH.
37 Permission is granted to copy, distribute and/or modify this
38 document under the terms of the GNU General Public License as
39 published by the Free Software Foundation; either version 3 of the
40 License, or (at your option) any later version. The text of the
41 license can be found in the section entitled "Copying".
43 This manual documents how to use the GNU Privacy Guard system as well
44 as the administration and the architecture.
48 * Installation:: A short installation guide.
50 * Invoking GPG-AGENT:: How to launch the secret key daemon.
51 * Invoking DIRMNGR:: How to launch the CRL and OCSP daemon.
52 * Invoking GPG:: Using the OpenPGP protocol.
53 * Invoking GPGSM:: Using the S/MIME protocol.
54 * Invoking SCDAEMON:: How to handle Smartcards.
55 * Specify a User ID:: How to Specify a User Id.
56 * Trust Values:: How GnuPG displays trust values.
58 * Helper Tools:: Description of small helper tools
59 * Web Key Service:: Tools for the Web Key Service
61 * Howtos:: How to do certain things.
62 * System Notes:: Notes pertaining to certain OSes.
63 * Debugging:: How to solve problems
65 * Copying:: GNU General Public License says
66 how you can copy and share GnuPG
67 * Contributors:: People who have contributed to GnuPG.
69 * Glossary:: Short description of terms used.
70 * Option Index:: Index to command line options.
71 * Environment Index:: Index to environment variables and files.
72 * Index:: Index of concepts and symbol names.
75 File: gnupg.info, Node: Installation, Next: Invoking GPG-AGENT, Prev: Top, Up: Top
77 1 A short installation guide
78 ****************************
80 Unfortunately the installation guide has not been finished in time.
81 Instead of delaying the release of GnuPG 2.0 even further, I decided to
82 release without that guide. The chapter on gpg-agent and gpgsm do
83 include brief information on how to set up the whole thing. Please
84 watch the GnuPG website for updates of the documentation. In the
85 meantime you may search the GnuPG mailing list archives or ask on the
86 gnupg-users mailing list for advise on how to solve problems or how to
87 get that whole thing up and running.
89 ** Building the software
91 Building the software is described in the file 'INSTALL'. Given that
92 you are already reading this documentation we can only give some extra
95 To comply with the rules on GNU systems you should have build time
96 configured 'gnupg' using:
98 ./configure --sysconfdir=/etc --localstatedir=/var
100 This is to make sure that system wide configuration files are
101 searched in the directory '/etc' and variable data below '/var'; the
102 default would be to also install them below '/usr/local' where the
103 binaries get installed. If you selected to use the '--prefix=/' you
104 obviously don't need those option as they are the default then.
106 ** Notes on setting a root CA key to trusted
108 X.509 is based on a hierarchical key infrastructure. At the root of
109 the tree a trusted anchor (root certificate) is required. There are
110 usually no other means of verifying whether this root certificate is
111 trustworthy than looking it up in a list. GnuPG uses a file
112 ('trustlist.txt') to keep track of all root certificates it knows about.
113 There are 3 ways to get certificates into this list:
115 * Use the list which comes with GnuPG. However this list only
116 contains a few root certificates. Most installations will need
119 * Let 'gpgsm' ask you whether you want to insert a new root
120 certificate. This feature is enabled by default; you may disable
121 it using the option 'no-allow-mark-trusted' into 'gpg-agent.conf'.
123 * Manually maintain the list of trusted root certificates. For a
124 multi user installation this can be done once for all users on a
125 machine. Specific changes on a per-user base are also possible.
128 File: gnupg.info, Node: Invoking GPG-AGENT, Next: Invoking DIRMNGR, Prev: Installation, Up: Top
133 'gpg-agent' is a daemon to manage secret (private) keys independently
134 from any protocol. It is used as a backend for 'gpg' and 'gpgsm' as
135 well as for a couple of other utilities.
137 The agent is automatically started on demand by 'gpg', 'gpgsm',
138 'gpgconf', or 'gpg-connect-agent'. Thus there is no reason to start it
139 manually. In case you want to use the included Secure Shell Agent you
140 may start the agent using:
142 gpg-connect-agent /bye
144 If you want to manually terminate the currently-running agent, you can
147 gpgconf --kill gpg-agent
149 You should always add the following lines to your '.bashrc' or whatever
150 initialization file is used for all shell invocations:
155 It is important that this environment variable always reflects the
156 output of the 'tty' command. For W32 systems this option is not
159 Please make sure that a proper pinentry program has been installed
160 under the default filename (which is system dependent) or use the option
161 'pinentry-program' to specify the full name of that program. It is
162 often useful to install a symbolic link from the actual used pinentry
163 (e.g. '/usr/local/bin/pinentry-gtk') to the expected one (e.g.
164 '/usr/local/bin/pinentry').
166 *Note Option Index::, for an index to 'GPG-AGENT''s commands and
171 * Agent Commands:: List of all commands.
172 * Agent Options:: List of all options.
173 * Agent Configuration:: Configuration files.
174 * Agent Signals:: Use of some signals.
175 * Agent Examples:: Some usage examples.
176 * Agent Protocol:: The protocol the agent uses.
179 File: gnupg.info, Node: Agent Commands, Next: Agent Options, Up: Invoking GPG-AGENT
184 Commands are not distinguished from options except for the fact that
185 only one command is allowed.
188 Print the program version and licensing information. Note that you
189 cannot abbreviate this command.
193 Print a usage message summarizing the most useful command-line
194 options. Note that you cannot abbreviate this command.
197 Print a list of all available options and commands. Note that you
198 cannot abbreviate this command.
201 Run in server mode and wait for commands on the 'stdin'. The
202 default mode is to create a socket and listen for commands there.
204 '--daemon [COMMAND LINE]'
205 Start the gpg-agent as a daemon; that is, detach it from the
206 console and run it in the background.
208 As an alternative you may create a new process as a child of
209 gpg-agent: 'gpg-agent --daemon /bin/sh'. This way you get a new
210 shell with the environment setup properly; after you exit from this
211 shell, gpg-agent terminates within a few seconds.
214 Run in the foreground, sending logs by default to stderr, and
215 listening on provided file descriptors, which must already be bound
216 to listening sockets. This command is useful when running under
217 systemd or other similar process supervision schemes. This option
218 is not supported on Windows.
220 In -supervised mode, different file descriptors can be provided for
221 use as different socket types (e.g. ssh, extra) as long as they
222 are identified in the environment variable 'LISTEN_FDNAMES' (see
223 sd_listen_fds(3) on some Linux distributions for more information
227 File: gnupg.info, Node: Agent Options, Next: Agent Configuration, Prev: Agent Commands, Up: Invoking GPG-AGENT
232 Options may either be used on the command line or, after stripping off
233 the two leading dashes, in the configuration file.
236 Reads configuration from FILE instead of from the default per-user
237 configuration file. The default configuration file is named
238 'gpg-agent.conf' and expected in the '.gnupg' directory directly
239 below the home directory of the user. This option is ignored if
240 used in an options file.
243 Set the name of the home directory to DIR. If this option is not
244 used, the home directory defaults to '~/.gnupg'. It is only
245 recognized when given on the command line. It also overrides any
246 home directory stated through the environment variable 'GNUPGHOME'
247 or (on Windows systems) by means of the Registry entry
248 HKCU\SOFTWARE\GNU\GNUPG:HOMEDIR.
250 On Windows systems it is possible to install GnuPG as a portable
251 application. In this case only this command line option is
252 considered, all other ways to set a home directory are ignored.
254 To install GnuPG as a portable application under Windows, create an
255 empty file named 'gpgconf.ctl' in the same directory as the tool
256 'gpgconf.exe'. The root of the installation is then that
257 directory; or, if 'gpgconf.exe' has been installed directly below a
258 directory named 'bin', its parent directory. You also need to make
259 sure that the following directories exist and are writable:
260 'ROOT/home' for the GnuPG home and 'ROOT/usr/local/var/cache/gnupg'
261 for internal cache files.
265 Outputs additional information while running. You can increase the
266 verbosity by giving several verbose commands to 'gpg-agent', such
271 Try to be as quiet as possible.
274 Don't invoke a pinentry or do any other thing requiring human
277 '--faked-system-time EPOCH'
278 This option is only useful for testing; it sets the system time
279 back or forth to EPOCH which is the number of seconds elapsed since
282 '--debug-level LEVEL'
283 Select the debug level for investigating problems. LEVEL may be a
284 numeric value or a keyword:
287 No debugging at all. A value of less than 1 may be used
288 instead of the keyword.
290 Some basic debug messages. A value between 1 and 2 may be
291 used instead of the keyword.
293 More verbose debug messages. A value between 3 and 5 may be
294 used instead of the keyword.
296 Even more detailed messages. A value between 6 and 8 may be
297 used instead of the keyword.
299 All of the debug messages you can get. A value greater than 8
300 may be used instead of the keyword. The creation of hash
301 tracing files is only enabled if the keyword is used.
303 How these messages are mapped to the actual debugging flags is not
304 specified and may change with newer releases of this program. They
305 are however carefully selected to best aid in debugging.
308 This option is only useful for debugging and the behavior may
309 change at any time without notice. FLAGS are bit encoded and may
310 be given in usual C-Syntax. The currently defined bits are:
313 X.509 or OpenPGP protocol related data
315 values of big number integers
317 low level crypto operations
323 show memory statistics
325 write hashed data to files named 'dbgmd-000*'
327 trace Assuan protocol
329 bypass all certificate validation
332 Same as '--debug=0xffffffff'
335 When running in server mode, wait N seconds before entering the
336 actual processing loop and print the pid. This gives time to
339 '--debug-quick-random'
340 This option inhibits the use of the very secure random quality
341 level (Libgcrypt’s 'GCRY_VERY_STRONG_RANDOM') and degrades all
342 request down to standard random quality. It is only used for
343 testing and should not be used for any production quality keys.
344 This option is only effective when given on the command line.
346 On GNU/Linux, another way to quickly generate insecure keys is to
347 use 'rngd' to fill the kernel's entropy pool with lower quality
348 random data. 'rngd' is typically provided by the 'rng-tools'
349 package. It can be run as follows: 'sudo rngd -f -r /dev/urandom'.
352 This option enables extra debug information pertaining to the
353 Pinentry. As of now it is only useful when used along with
357 Don't detach the process from the console. This is mainly useful
361 In '--daemon' mode, gpg-agent detects an already running gpg-agent
362 and does not allow to start a new instance. This option can be
363 used to override this check: the new gpg-agent process will try to
364 take over the communication sockets from the already running
365 process and start anyway. This option should in general not be
372 Format the info output in daemon mode for use with the standard
373 Bourne shell or the C-shell respectively. The default is to guess
374 it based on the environment variable 'SHELL' which is correct in
379 Tell the pinentry to grab the keyboard and mouse. This option
380 should be used on X-Servers to avoid X-sniffing attacks. Any use
381 of the option '--grab' overrides an used option '--no-grab'. The
382 default is '--no-grab'.
385 Append all logging output to FILE. This is very helpful in seeing
386 what the agent actually does. Use 'socket://' to log to socket.
387 If neither a log file nor a log file descriptor has been set on a
388 Windows platform, the Registry entry
389 'HKCU\Software\GNU\GnuPG:DefaultLogFile', if set, is used to
390 specify the logging output.
392 '--no-allow-mark-trusted'
393 Do not allow clients to mark keys as trusted, i.e. put them into
394 the 'trustlist.txt' file. This makes it harder for users to
395 inadvertently accept Root-CA keys.
397 '--allow-preset-passphrase'
398 This option allows the use of 'gpg-preset-passphrase' to seed the
399 internal cache of 'gpg-agent' with passphrases.
401 '--no-allow-loopback-pinentry'
402 '--allow-loopback-pinentry'
403 Disallow or allow clients to use the loopback pinentry features;
404 see the option 'pinentry-mode' for details. Allow is the default.
406 The '--force' option of the Assuan command 'DELETE_KEY' is also
407 controlled by this option: The option is ignored if a loopback
408 pinentry is disallowed.
410 '--no-allow-external-cache'
411 Tell Pinentry not to enable features which use an external cache
414 Some desktop environments prefer to unlock all credentials with one
415 master password and may have installed a Pinentry which employs an
416 additional external cache to implement such a policy. By using
417 this option the Pinentry is advised not to make use of such a cache
418 and instead always ask the user for the requested passphrase.
420 '--allow-emacs-pinentry'
421 Tell Pinentry to allow features to divert the passphrase entry to a
422 running Emacs instance. How this is exactly handled depends on the
423 version of the used Pinentry.
425 '--ignore-cache-for-signing'
426 This option will let 'gpg-agent' bypass the passphrase cache for
427 all signing operation. Note that there is also a per-session
428 option to control this behavior but this command line option takes
431 '--default-cache-ttl N'
432 Set the time a cache entry is valid to N seconds. The default is
433 600 seconds. Each time a cache entry is accessed, the entry's
434 timer is reset. To set an entry's maximum lifetime, use
435 'max-cache-ttl'. Note that a cached passphrase may not be evicted
436 immediately from memory if no client requests a cache operation.
437 This is due to an internal housekeeping function which is only run
440 '--default-cache-ttl-ssh N'
441 Set the time a cache entry used for SSH keys is valid to N seconds.
442 The default is 1800 seconds. Each time a cache entry is accessed,
443 the entry's timer is reset. To set an entry's maximum lifetime,
444 use 'max-cache-ttl-ssh'.
447 Set the maximum time a cache entry is valid to N seconds. After
448 this time a cache entry will be expired even if it has been
449 accessed recently or has been set using 'gpg-preset-passphrase'.
450 The default is 2 hours (7200 seconds).
452 '--max-cache-ttl-ssh N'
453 Set the maximum time a cache entry used for SSH keys is valid to N
454 seconds. After this time a cache entry will be expired even if it
455 has been accessed recently or has been set using
456 'gpg-preset-passphrase'. The default is 2 hours (7200 seconds).
458 '--enforce-passphrase-constraints'
459 Enforce the passphrase constraints by not allowing the user to
460 bypass them using the "Take it anyway" button.
462 '--min-passphrase-len N'
463 Set the minimal length of a passphrase. When entering a new
464 passphrase shorter than this value a warning will be displayed.
467 '--min-passphrase-nonalpha N'
468 Set the minimal number of digits or special characters required in
469 a passphrase. When entering a new passphrase with less than this
470 number of digits or special characters a warning will be displayed.
473 '--check-passphrase-pattern FILE'
474 '--check-sym-passphrase-pattern FILE'
475 Check the passphrase against the pattern given in FILE. When
476 entering a new passphrase matching one of these pattern a warning
477 will be displayed. If FILE does not contain any slashes and does
478 not start with "~/" it is searched in the system configuration
479 directory ('/etc/gnupg'). The default is not to use any pattern
480 file. The second version of this option is only used when creating
481 a new symmetric key to allow the use of different patterns for such
484 Security note: It is known that checking a passphrase against a
485 list of pattern or even against a complete dictionary is not very
486 effective to enforce good passphrases. Users will soon figure up
487 ways to bypass such a policy. A better policy is to educate users
488 on good security behavior and optionally to run a passphrase
489 cracker regularly on all users passphrases to catch the very simple
492 '--max-passphrase-days N'
493 Ask the user to change the passphrase if N days have passed since
494 the last change. With '--enforce-passphrase-constraints' set the
495 user may not bypass this check.
497 '--enable-passphrase-history'
498 This option does nothing yet.
500 '--pinentry-invisible-char CHAR'
501 This option asks the Pinentry to use CHAR for displaying hidden
502 characters. CHAR must be one character UTF-8 string. A Pinentry
503 may or may not honor this request.
505 '--pinentry-timeout N'
506 This option asks the Pinentry to timeout after N seconds with no
507 user input. The default value of 0 does not ask the pinentry to
508 timeout, however a Pinentry may use its own default timeout value
509 in this case. A Pinentry may or may not honor this request.
511 '--pinentry-formatted-passphrase'
512 This option asks the Pinentry to enable passphrase formatting when
513 asking the user for a new passphrase and masking of the passphrase
516 If passphrase formatting is enabled, then all non-breaking space
517 characters are stripped from the entered passphrase. Passphrase
518 formatting is mostly useful in combination with passphrases
519 generated with the GENPIN feature of some Pinentries. Note that
520 such a generated passphrase, if not modified by the user, skips all
521 passphrase constraints checking because such constraints would
522 actually weaken the generated passphrase.
524 '--pinentry-program FILENAME'
525 Use program FILENAME as the PIN entry. The default is installation
526 dependent. With the default configuration the name of the default
527 pinentry is 'pinentry'; if that file does not exist but a
528 'pinentry-basic' exist the latter is used.
530 On a Windows platform the default is to use the first existing
531 program from this list: 'bin\pinentry.exe',
532 '..\Gpg4win\bin\pinentry.exe', '..\Gpg4win\pinentry.exe',
533 '..\GNU\GnuPG\pinentry.exe', '..\GNU\bin\pinentry.exe',
534 'bin\pinentry-basic.exe' where the file names are relative to the
535 GnuPG installation directory.
537 '--pinentry-touch-file FILENAME'
538 By default the filename of the socket gpg-agent is listening for
539 requests is passed to Pinentry, so that it can touch that file
540 before exiting (it does this only in curses mode). This option
541 changes the file passed to Pinentry to FILENAME. The special name
542 '/dev/null' may be used to completely disable this feature. Note
543 that Pinentry will not create that file, it will only change the
544 modification and access time.
546 '--scdaemon-program FILENAME'
547 Use program FILENAME as the Smartcard daemon. The default is
548 installation dependent and can be shown with the 'gpgconf' command.
551 Do not make use of the scdaemon tool. This option has the effect
552 of disabling the ability to do smartcard operations. Note, that
553 enabling this option at runtime does not kill an already forked
556 '--disable-check-own-socket'
557 'gpg-agent' employs a periodic self-test to detect a stolen socket.
558 This usually means a second instance of 'gpg-agent' has taken over
559 the socket and 'gpg-agent' will then terminate itself. This option
560 may be used to disable this self-test for debugging purposes.
562 '--use-standard-socket'
563 '--no-use-standard-socket'
564 '--use-standard-socket-p'
565 Since GnuPG 2.1 the standard socket is always used. These options
566 have no more effect. The command 'gpg-agent
567 --use-standard-socket-p' will thus always return success.
573 '--lc-messages STRING'
574 '--xauthority STRING'
575 These options are used with the server mode to pass localization
580 Ignore requests to change the current 'tty' or X window system's
581 'DISPLAY' variable respectively. This is useful to lock the
582 pinentry to pop up at the 'tty' or display you started the agent.
585 Set the size of the queue for pending connections. The default is
588 '--extra-socket NAME'
589 The extra socket is created by default, you may use this option to
590 change the name of the socket. To disable the creation of the
591 socket use "none" or "/dev/null" for NAME.
593 Also listen on native gpg-agent connections on the given socket.
594 The intended use for this extra socket is to setup a Unix domain
595 socket forwarding from a remote machine to this socket on the local
596 machine. A 'gpg' running on the remote machine may then connect to
597 the local gpg-agent and use its private keys. This enables
598 decrypting or signing data on a remote machine without exposing the
599 private keys to the remote machine.
601 '--enable-extended-key-format'
602 '--disable-extended-key-format'
603 Since version 2.2.22 keys are created in the extended private key
604 format by default. Changing the passphrase of a key will also
605 convert the key to that new format. This key format is supported
606 since GnuPG version 2.1.12 and thus there should be no need to
607 disable it. Anyway, the disable option still allows to revert to
608 the old behavior for new keys; be aware that keys are never
609 migrated back to the old format. If the enable option has been
610 used the disable option won't have an effect. The advantage of the
611 extended private key format is that it is text based and can carry
612 additional meta data. In extended key format the OCB mode is used
615 '--enable-ssh-support'
616 '--enable-putty-support'
618 The OpenSSH Agent protocol is always enabled, but 'gpg-agent' will
619 only set the 'SSH_AUTH_SOCK' variable if this flag is given.
621 In this mode of operation, the agent does not only implement the
622 gpg-agent protocol, but also the agent protocol used by OpenSSH
623 (through a separate socket). Consequently, it should be possible
624 to use the gpg-agent as a drop-in replacement for the well known
627 SSH Keys, which are to be used through the agent, need to be added
628 to the gpg-agent initially through the ssh-add utility. When a key
629 is added, ssh-add will ask for the password of the provided key
630 file and send the unprotected key material to the agent; this
631 causes the gpg-agent to ask for a passphrase, which is to be used
632 for encrypting the newly received key and storing it in a gpg-agent
635 Once a key has been added to the gpg-agent this way, the gpg-agent
636 will be ready to use the key.
638 Note: in case the gpg-agent receives a signature request, the user
639 might need to be prompted for a passphrase, which is necessary for
640 decrypting the stored key. Since the ssh-agent protocol does not
641 contain a mechanism for telling the agent on which display/terminal
642 it is running, gpg-agent's ssh-support will use the TTY or X
643 display where gpg-agent has been started. To switch this display
644 to the current one, the following command may be used:
646 gpg-connect-agent updatestartuptty /bye
648 Although all GnuPG components try to start the gpg-agent as needed,
649 this is not possible for the ssh support because ssh does not know
650 about it. Thus if no GnuPG tool which accesses the agent has been
651 run, there is no guarantee that ssh is able to use gpg-agent for
652 authentication. To fix this you may start gpg-agent if needed
653 using this simple command:
655 gpg-connect-agent /bye
657 Adding the '--verbose' shows the progress of starting the agent.
659 The '--enable-putty-support' is only available under Windows and
660 allows the use of gpg-agent with the ssh implementation 'putty'.
661 This is similar to the regular ssh-agent support but makes use of
662 Windows message queue as required by 'putty'.
664 '--ssh-fingerprint-digest'
666 Select the digest algorithm used to compute ssh fingerprints that
667 are communicated to the user, e.g. in pinentry dialogs. OpenSSH
668 has transitioned from using MD5 to the more secure SHA256.
670 '--auto-expand-secmem N'
671 Allow Libgcrypt to expand its secure memory area as required. The
672 optional value N is a non-negative integer with a suggested size in
673 bytes of each additionally allocated secure memory area. The value
674 is rounded up to the next 32 KiB; usual C style prefixes are
675 allowed. For an heavy loaded gpg-agent with many concurrent
676 connection this option avoids sign or decrypt errors due to out of
677 secure memory error returns.
679 '--s2k-calibration MILLISECONDS'
680 Change the default calibration time to MILLISECONDS. The given
681 value is capped at 60 seconds; a value of 0 resets to the
682 compiled-in default. This option is re-read on a SIGHUP (or
683 'gpgconf --reload gpg-agent') and the S2K count is then
687 Specify the iteration count used to protect the passphrase. This
688 option can be used to override the auto-calibration done by
689 default. The auto-calibration computes a count which requires by
690 default 100ms to mangle a given passphrase. See also
693 To view the actually used iteration count and the milliseconds
694 required for an S2K operation use:
696 gpg-connect-agent 'GETINFO s2k_count' /bye
697 gpg-connect-agent 'GETINFO s2k_time' /bye
699 To view the auto-calibrated count use:
701 gpg-connect-agent 'GETINFO s2k_count_cal' /bye
704 File: gnupg.info, Node: Agent Configuration, Next: Agent Signals, Prev: Agent Options, Up: Invoking GPG-AGENT
709 There are a few configuration files needed for the operation of the
710 agent. By default they may all be found in the current home directory
711 (*note option --homedir::).
714 This is the standard configuration file read by 'gpg-agent' on
715 startup. It may contain any valid long option; the leading two
716 dashes may not be entered and the option may not be abbreviated.
717 This file is also read after a 'SIGHUP' however only a few options
718 will actually have an effect. This default name may be changed on
719 the command line (*note option --options::). You should backup
723 This is the list of trusted keys. You should backup this file.
725 Comment lines, indicated by a leading hash mark, as well as empty
726 lines are ignored. To mark a key as trusted you need to enter its
727 fingerprint followed by a space and a capital letter 'S'. Colons
728 may optionally be used to separate the bytes of a fingerprint; this
729 enables cutting and pasting the fingerprint from a key listing
730 output. If the line is prefixed with a '!' the key is explicitly
731 marked as not trusted.
733 Here is an example where two keys are marked as ultimately trusted
734 and one as not trusted:
736 # CN=Wurzel ZS 3,O=Intevation GmbH,C=DE
737 A6935DD34EF3087973C706FC311AA2CCF733765B S
739 # CN=PCA-1-Verwaltung-02/O=PKI-1-Verwaltung/C=DE
740 DC:BD:69:25:48:BD:BB:7E:31:6E:BB:80:D3:00:80:35:D4:F8:A6:CD S
742 # CN=Root-CA/O=Schlapphuete/L=Pullach/C=DE
743 !14:56:98:D3:FE:9C:CA:5A:31:6E:BC:81:D3:11:4E:00:90:A3:44:C2 S
745 Before entering a key into this file, you need to ensure its
746 authenticity. How to do this depends on your organisation; your
747 administrator might have already entered those keys which are
748 deemed trustworthy enough into this file. Places where to look for
749 the fingerprint of a root certificate are letters received from the
750 CA or the website of the CA (after making 100% sure that this is
751 indeed the website of that CA). You may want to consider
752 disallowing interactive updates of this file by using the *note
753 option --no-allow-mark-trusted::. It might even be advisable to
754 change the permissions to read-only so that this file can't be
755 changed inadvertently.
757 As a special feature a line 'include-default' will include a global
758 list of trusted certificates (e.g. '/etc/gnupg/trustlist.txt').
759 This global list is also used if the local list is not available.
761 It is possible to add further flags after the 'S' for use by the
765 Relax checking of some root certificate requirements. As of
766 now this flag allows the use of root certificates with a
767 missing basicConstraints attribute (despite that it is a MUST
768 for CA certificates) and disables CRL checking for the root
772 If validation of a certificate finally issued by a CA with
773 this flag set fails, try again using the chain validation
777 This file is used when support for the secure shell agent protocol
778 has been enabled (*note option --enable-ssh-support::). Only keys
779 present in this file are used in the SSH protocol. You should
782 The 'ssh-add' tool may be used to add new entries to this file; you
783 may also add them manually. Comment lines, indicated by a leading
784 hash mark, as well as empty lines are ignored. An entry starts
785 with optional whitespace, followed by the keygrip of the key given
786 as 40 hex digits, optionally followed by the caching TTL in seconds
787 and another optional field for arbitrary flags. A non-zero TTL
788 overrides the global default as set by '--default-cache-ttl-ssh'.
790 The only flag support is 'confirm'. If this flag is found for a
791 key, each use of the key will pop up a pinentry to confirm the use
792 of that key. The flag is automatically set if a new key was loaded
793 into 'gpg-agent' using the option '-c' of the 'ssh-add' command.
795 The keygrip may be prefixed with a '!' to disable an entry.
797 The following example lists exactly one key. Note that keys
798 available through a OpenPGP smartcard in the active smartcard
799 reader are implicitly added to this list; i.e. there is no need to
802 # Key added on: 2011-07-20 20:38:46
803 # Fingerprint: 5e:8d:c4:ad:e7:af:6e:27:8a:d6:13:e4:79:ad:0b:81
804 34B62F25E277CF13D3C6BCEBFD3F85D08F0A864B 0 confirm
808 This is the directory where gpg-agent stores the private keys.
809 Each key is stored in a file with the name made up of the keygrip
810 and the suffix 'key'. You should backup all files in this
811 directory and take great care to keep this backup closed away.
813 Note that on larger installations, it is useful to put predefined
814 files into the directory '/etc/skel/.gnupg' so that newly created users
815 start up with a working configuration. For existing users the a small
816 helper script is provided to create these files (*note addgnupghome::).
819 File: gnupg.info, Node: Agent Signals, Next: Agent Examples, Prev: Agent Configuration, Up: Invoking GPG-AGENT
821 2.4 Use of some signals
822 =======================
824 A running 'gpg-agent' may be controlled by signals, i.e. using the
825 'kill' command to send a signal to the process.
827 Here is a list of supported signals:
830 This signal flushes all cached passphrases and if the program has
831 been started with a configuration file, the configuration file is
832 read again. Only certain options are honored: 'quiet', 'verbose',
833 'debug', 'debug-all', 'debug-level', 'debug-pinentry', 'no-grab',
834 'pinentry-program', 'pinentry-invisible-char', 'default-cache-ttl',
835 'max-cache-ttl', 'ignore-cache-for-signing', 's2k-count',
836 'no-allow-external-cache', 'allow-emacs-pinentry',
837 'no-allow-mark-trusted', 'disable-scdaemon', and
838 'disable-check-own-socket'. 'scdaemon-program' is also supported
839 but due to the current implementation, which calls the scdaemon
840 only once, it is not of much use unless you manually kill the
844 Shuts down the process but waits until all current requests are
845 fulfilled. If the process has received 3 of these signals and
846 requests are still pending, a shutdown is forced.
849 Shuts down the process immediately.
852 Dump internal information to the log file.
855 This signal is used for internal purposes.
858 File: gnupg.info, Node: Agent Examples, Next: Agent Protocol, Prev: Agent Signals, Up: Invoking GPG-AGENT
863 It is important to set the environment variable 'GPG_TTY' in your login
864 shell, for example in the '~/.bashrc' init script:
866 export GPG_TTY=$(tty)
868 If you enabled the Ssh Agent Support, you also need to tell ssh about
869 it by adding this to your init script:
872 if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
873 export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
877 File: gnupg.info, Node: Agent Protocol, Prev: Agent Examples, Up: Invoking GPG-AGENT
879 2.6 Agent's Assuan Protocol
880 ===========================
882 Note: this section does only document the protocol, which is used by
883 GnuPG components; it does not deal with the ssh-agent protocol. To see
884 the full specification of each command, use
886 gpg-connect-agent 'help COMMAND' /bye
888 or just 'help' to list all available commands.
890 The 'gpg-agent' daemon is started on demand by the GnuPG components.
892 To identify a key we use a thing called keygrip which is the SHA-1
893 hash of an canonical encoded S-Expression of the public key as used in
894 Libgcrypt. For the purpose of this interface the keygrip is given as a
895 hex string. The advantage of using this and not the hash of a
896 certificate is that it will be possible to use the same keypair for
897 different protocols, thereby saving space on the token used to keep the
900 The 'gpg-agent' may send status messages during a command or when
901 returning from a command to inform a client about the progress or result
902 of an operation. For example, the INQUIRE_MAXLEN status message may be
903 sent during a server inquire to inform the client of the maximum usable
904 length of the inquired data (which should not be exceeded).
908 * Agent PKDECRYPT:: Decrypting a session key
909 * Agent PKSIGN:: Signing a Hash
910 * Agent GENKEY:: Generating a Key
911 * Agent IMPORT:: Importing a Secret Key
912 * Agent EXPORT:: Exporting a Secret Key
913 * Agent ISTRUSTED:: Importing a Root Certificate
914 * Agent GET_PASSPHRASE:: Ask for a passphrase
915 * Agent CLEAR_PASSPHRASE:: Expire a cached passphrase
916 * Agent PRESET_PASSPHRASE:: Set a passphrase for a keygrip
917 * Agent GET_CONFIRMATION:: Ask for confirmation
918 * Agent HAVEKEY:: Check whether a key is available
919 * Agent LEARN:: Register a smartcard
920 * Agent PASSWD:: Change a Passphrase
921 * Agent UPDATESTARTUPTTY:: Change the Standard Display
922 * Agent GETEVENTCOUNTER:: Get the Event Counters
923 * Agent GETINFO:: Return information about the process
924 * Agent OPTION:: Set options for the session
927 File: gnupg.info, Node: Agent PKDECRYPT, Next: Agent PKSIGN, Up: Agent Protocol
929 2.6.1 Decrypting a session key
930 ------------------------------
932 The client asks the server to decrypt a session key. The encrypted
933 session key should have all information needed to select the appropriate
934 secret key or to delegate it to a smartcard.
938 Tell the server about the key to be used for decryption. If this is
939 not used, 'gpg-agent' may try to figure out the key by trying to decrypt
940 the message with each key available.
944 The agent checks whether this command is allowed and then does an
945 INQUIRY to get the ciphertext the client should then send the cipher
948 S: INQUIRE CIPHERTEXT
953 Please note that the server may send status info lines while reading
954 the data lines from the client. The data send is a SPKI like S-Exp with
959 (<param_name1> <mpi>)
961 (<param_namen> <mpi>)))
963 Where algo is a string with the name of the algorithm; see the
964 libgcrypt documentation for a list of valid algorithms. The number and
965 names of the parameters depend on the algorithm. The agent does return
966 an error if there is an inconsistency.
968 If the decryption was successful the decrypted data is returned by
971 Here is an example session:
973 S: INQUIRE CIPHERTEXT
974 C: D (enc-val elg (a 349324324)
975 C: D (b 3F444677CA)))
977 S: # session key follows
979 S: D (value 1234567890ABCDEF0)
980 S: OK decryption successful
982 The “PADDING” status line is only send if gpg-agent can tell what
983 kind of padding is used. As of now only the value 0 is used to indicate
984 that the padding has been removed.
987 File: gnupg.info, Node: Agent PKSIGN, Next: Agent GENKEY, Prev: Agent PKDECRYPT, Up: Agent Protocol
992 The client asks the agent to sign a given hash value. A default key
993 will be chosen if no key has been set. To set a key a client first
998 This can be used multiple times to create multiple signature, the
999 list of keys is reset with the next PKSIGN command or a RESET. The
1000 server tests whether the key is a valid key to sign something and
1003 SETHASH --hash=<name>|<algo> <hexstring>
1005 The client can use this command to tell the server about the data
1006 <hexstring> (which usually is a hash) to be signed. <algo> is the
1007 decimal encoded hash algorithm number as used by Libgcrypt. Either
1008 <algo> or -hash=<name> must be given. Valid names for <name> are:
1011 The SHA-1 hash algorithm
1013 The SHA-256 hash algorithm
1015 The RIPE-MD160 hash algorithm
1017 The old and broken MD5 hash algorithm
1019 A combined hash algorithm as used by the TLS protocol.
1021 The actual signing is done using
1025 Options are not yet defined, but may later be used to choose among
1026 different algorithms. The agent does then some checks, asks for the
1027 passphrase and as a result the server returns the signature as an SPKI
1028 like S-expression in "D" lines:
1032 (<param_name1> <mpi>)
1034 (<param_namen> <mpi>)))
1036 The operation is affected by the option
1038 OPTION use-cache-for-signing=0|1
1040 The default of '1' uses the cache. Setting this option to '0' will
1041 lead 'gpg-agent' to ignore the passphrase cache. Note, that there is
1042 also a global command line option for 'gpg-agent' to globally disable
1045 Here is an example session:
1051 S: # I did ask the user whether he really wants to sign
1052 S: # I did ask the user for the passphrase
1054 C: D ABCDEF012345678901234
1056 S: # signature follows
1057 S: D (sig-val rsa (s 45435453654612121212))
1061 File: gnupg.info, Node: Agent GENKEY, Next: Agent IMPORT, Prev: Agent PKSIGN, Up: Agent Protocol
1063 2.6.3 Generating a Key
1064 ----------------------
1066 This is used to create a new keypair and store the secret key inside the
1067 active PSE -- which is in most cases a Soft-PSE. A not-yet-defined
1068 option allows choosing the storage location. To get the secret key out
1069 of the PSE, a special export tool has to be used.
1071 GENKEY [--no-protection] [--preset] [<cache_nonce>]
1073 Invokes the key generation process and the server will then inquire
1074 on the generation parameters, like:
1077 C: D (genkey (rsa (nbits 1024)))
1080 The format of the key parameters which depends on the algorithm is of
1085 (parameter_name_1 ....)
1087 (parameter_name_n ....)))
1089 If everything succeeds, the server returns the *public key* in a SPKI
1090 like S-Expression like this:
1097 Here is an example session:
1100 C: D (genkey (rsa (nbits 1024)))
1103 S: D (rsa (n 326487324683264) (e 10001)))
1106 The '--no-protection' option may be used to prevent prompting for a
1107 passphrase to protect the secret key while leaving the secret key
1108 unprotected. The '--preset' option may be used to add the passphrase to
1109 the cache using the default cache parameters.
1111 The '--inq-passwd' option may be used to create the key with a
1112 supplied passphrase. When used the agent does an inquiry with the
1113 keyword 'NEWPASSWD' to retrieve that passphrase. This option takes
1114 precedence over '--no-protection'; however if the client sends a empty
1115 (zero-length) passphrase, this is identical to '--no-protection'.
1118 File: gnupg.info, Node: Agent IMPORT, Next: Agent EXPORT, Prev: Agent GENKEY, Up: Agent Protocol
1120 2.6.4 Importing a Secret Key
1121 ----------------------------
1123 This operation is not yet supported by GpgAgent. Specialized tools are
1124 to be used for this.
1126 There is no actual need because we can expect that secret keys
1127 created by a 3rd party are stored on a smartcard. If we have generated
1128 the key ourselves, we do not need to import it.
1131 File: gnupg.info, Node: Agent EXPORT, Next: Agent ISTRUSTED, Prev: Agent IMPORT, Up: Agent Protocol
1133 2.6.5 Export a Secret Key
1134 -------------------------
1138 Should be done by an extra tool.
1141 File: gnupg.info, Node: Agent ISTRUSTED, Next: Agent GET_PASSPHRASE, Prev: Agent EXPORT, Up: Agent Protocol
1143 2.6.6 Importing a Root Certificate
1144 ----------------------------------
1146 Actually we do not import a Root Cert but provide a way to validate any
1147 piece of data by storing its Hash along with a description and an
1148 identifier in the PSE. Here is the interface description:
1150 ISTRUSTED <fingerprint>
1152 Check whether the OpenPGP primary key or the X.509 certificate with
1153 the given fingerprint is an ultimately trusted key or a trusted Root CA
1154 certificate. The fingerprint should be given as a hexstring (without
1155 any blanks or colons or whatever in between) and may be left padded with
1156 00 in case of an MD5 fingerprint. GPGAgent will answer with:
1160 The key is in the table of trusted keys.
1162 ERR 304 (Not Trusted)
1164 The key is not in this table.
1166 Gpg needs the entire list of trusted keys to maintain the web of
1167 trust; the following command is therefore quite helpful:
1171 GpgAgent returns a list of trusted keys line by line:
1173 S: D 000000001234454556565656677878AF2F1ECCFF P
1174 S: D 340387563485634856435645634856438576457A P
1175 S: D FEDC6532453745367FD83474357495743757435D S
1178 The first item on a line is the hexified fingerprint where MD5
1179 fingerprints are '00' padded to the left and the second item is a flag
1180 to indicate the type of key (so that gpg is able to only take care of
1181 PGP keys). P = OpenPGP, S = S/MIME. A client should ignore the rest of
1182 the line, so that we can extend the format in the future.
1184 Finally a client should be able to mark a key as trusted:
1186 MARKTRUSTED FINGERPRINT "P"|"S"
1188 The server will then pop up a window to ask the user whether she
1189 really trusts this key. For this it will probably ask for a text to be
1190 displayed like this:
1192 S: INQUIRE TRUSTDESC
1193 C: D Do you trust the key with the fingerprint @FPR@
1194 C: D bla fasel blurb.
1198 Known sequences with the pattern @foo@ are replaced according to this
1202 Format the fingerprint according to gpg rules for a v3 keys.
1204 Format the fingerprint according to gpg rules for a v4 keys.
1206 Choose an appropriate format to format the fingerprint.
1208 Replaced by a single '@'.
1211 File: gnupg.info, Node: Agent GET_PASSPHRASE, Next: Agent CLEAR_PASSPHRASE, Prev: Agent ISTRUSTED, Up: Agent Protocol
1213 2.6.7 Ask for a passphrase
1214 --------------------------
1216 This function is usually used to ask for a passphrase to be used for
1217 symmetric encryption, but may also be used by programs which need
1218 special handling of passphrases. This command uses a syntax which helps
1219 clients to use the agent with minimum effort.
1221 GET_PASSPHRASE [--data] [--check] [--no-ask] [--repeat[=N]] \
1222 [--qualitybar] CACHE_ID \
1223 [ERROR_MESSAGE PROMPT DESCRIPTION]
1225 CACHE_ID is expected to be a string used to identify a cached
1226 passphrase. Use a 'X' to bypass the cache. With no other arguments the
1227 agent returns a cached passphrase or an error. By convention either the
1228 hexified fingerprint of the key shall be used for CACHE_ID or an
1229 arbitrary string prefixed with the name of the calling application and a
1230 colon: Like 'gpg:somestring'.
1232 ERROR_MESSAGE is either a single 'X' for no error message or a string
1233 to be shown as an error message like (e.g. "invalid passphrase").
1234 Blanks must be percent escaped or replaced by '+''.
1236 PROMPT is either a single 'X' for a default prompt or the text to be
1237 shown as the prompt. Blanks must be percent escaped or replaced by '+'.
1239 DESCRIPTION is a text shown above the entry field. Blanks must be
1240 percent escaped or replaced by '+'.
1242 The agent either returns with an error or with a OK followed by the
1243 hex encoded passphrase. Note that the length of the strings is
1244 implicitly limited by the maximum length of a command. If the option
1245 '--data' is used, the passphrase is not returned on the OK line but by
1246 regular data lines; this is the preferred method.
1248 If the option '--check' is used, the standard passphrase constraints
1249 checks are applied. A check is not done if the passphrase has been
1252 If the option '--no-ask' is used and the passphrase is not in the
1253 cache the user will not be asked to enter a passphrase but the error
1254 code 'GPG_ERR_NO_DATA' is returned.
1256 If the option '--qualitybar' is used and a minimum passphrase length
1257 has been configured, a visual indication of the entered passphrase
1260 CLEAR_PASSPHRASE CACHE_ID
1262 may be used to invalidate the cache entry for a passphrase. The
1263 function returns with OK even when there is no cached passphrase.
1266 File: gnupg.info, Node: Agent CLEAR_PASSPHRASE, Next: Agent PRESET_PASSPHRASE, Prev: Agent GET_PASSPHRASE, Up: Agent Protocol
1268 2.6.8 Remove a cached passphrase
1269 --------------------------------
1271 Use this command to remove a cached passphrase.
1273 CLEAR_PASSPHRASE [--mode=normal] <cache_id>
1275 The '--mode=normal' option can be used to clear a CACHE_ID that was
1279 File: gnupg.info, Node: Agent PRESET_PASSPHRASE, Next: Agent GET_CONFIRMATION, Prev: Agent CLEAR_PASSPHRASE, Up: Agent Protocol
1281 2.6.9 Set a passphrase for a keygrip
1282 ------------------------------------
1284 This command adds a passphrase to the cache for the specified KEYGRIP.
1286 PRESET_PASSPHRASE [--inquire] <string_or_keygrip> <timeout> [<hexstring>]
1288 The passphrase is a hexadecimal string when specified. When not
1289 specified, the passphrase will be retrieved from the pinentry module
1290 unless the '--inquire' option was specified in which case the passphrase
1291 will be retrieved from the client.
1293 The TIMEOUT parameter keeps the passphrase cached for the specified
1294 number of seconds. A value of '-1' means infinite while '0' means the
1295 default (currently only a timeout of -1 is allowed, which means to never
1299 File: gnupg.info, Node: Agent GET_CONFIRMATION, Next: Agent HAVEKEY, Prev: Agent PRESET_PASSPHRASE, Up: Agent Protocol
1301 2.6.10 Ask for confirmation
1302 ---------------------------
1304 This command may be used to ask for a simple confirmation by presenting
1305 a text and 2 buttons: Okay and Cancel.
1307 GET_CONFIRMATION DESCRIPTION
1309 DESCRIPTIONis displayed along with a Okay and Cancel button. Blanks
1310 must be percent escaped or replaced by '+'. A 'X' may be used to
1311 display confirmation dialog with a default text.
1313 The agent either returns with an error or with a OK. Note, that the
1314 length of DESCRIPTION is implicitly limited by the maximum length of a
1318 File: gnupg.info, Node: Agent HAVEKEY, Next: Agent LEARN, Prev: Agent GET_CONFIRMATION, Up: Agent Protocol
1320 2.6.11 Check whether a key is available
1321 ---------------------------------------
1323 This can be used to see whether a secret key is available. It does not
1324 return any information on whether the key is somehow protected.
1328 The agent answers either with OK or 'No_Secret_Key' (208). The
1329 caller may want to check for other error codes as well. More than one
1330 keygrip may be given. In this case the command returns success if at
1331 least one of the keygrips corresponds to an available secret key.
1334 File: gnupg.info, Node: Agent LEARN, Next: Agent PASSWD, Prev: Agent HAVEKEY, Up: Agent Protocol
1336 2.6.12 Register a smartcard
1337 ---------------------------
1341 This command is used to register a smartcard. With the '--send'
1342 option given the certificates are sent back.
1345 File: gnupg.info, Node: Agent PASSWD, Next: Agent UPDATESTARTUPTTY, Prev: Agent LEARN, Up: Agent Protocol
1347 2.6.13 Change a Passphrase
1348 --------------------------
1350 PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] [--preset] KEYGRIP
1352 This command is used to interactively change the passphrase of the
1353 key identified by the hex string KEYGRIP. The '--preset' option may be
1354 used to add the new passphrase to the cache using the default cache
1358 File: gnupg.info, Node: Agent UPDATESTARTUPTTY, Next: Agent GETEVENTCOUNTER, Prev: Agent PASSWD, Up: Agent Protocol
1360 2.6.14 Change the standard display
1361 ----------------------------------
1365 Set the startup TTY and X-DISPLAY variables to the values of this
1366 session. This command is useful to direct future pinentry invocations
1367 to another screen. It is only required because there is no way in the
1368 ssh-agent protocol to convey this information.
1371 File: gnupg.info, Node: Agent GETEVENTCOUNTER, Next: Agent GETINFO, Prev: Agent UPDATESTARTUPTTY, Up: Agent Protocol
1373 2.6.15 Get the Event Counters
1374 -----------------------------
1378 This function return one status line with the current values of the
1379 event counters. The event counters are useful to avoid polling by
1380 delaying a poll until something has changed. The values are decimal
1381 numbers in the range '0' to 'UINT_MAX' and wrapping around to 0. The
1382 actual values should not be relied upon; they shall only be used to
1385 The currently defined counters are:
1387 Incremented with any change of any of the other counters.
1389 Incremented for added or removed private keys.
1391 Incremented for changes of the card readers stati.
1394 File: gnupg.info, Node: Agent GETINFO, Next: Agent OPTION, Prev: Agent GETEVENTCOUNTER, Up: Agent Protocol
1396 2.6.16 Return information about the process
1397 -------------------------------------------
1399 This is a multipurpose function to return a variety of information.
1403 The value of WHAT specifies the kind of information returned:
1405 Return the version of the program.
1407 Return the process id of the process.
1409 Return the name of the socket used to connect the agent.
1411 Return the name of the socket used for SSH connections. If SSH
1412 support has not been enabled the error 'GPG_ERR_NO_DATA' will be
1416 File: gnupg.info, Node: Agent OPTION, Prev: Agent GETINFO, Up: Agent Protocol
1418 2.6.17 Set options for the session
1419 ----------------------------------
1421 Here is a list of session options which are not yet described with other
1422 commands. The general syntax for an Assuan option is:
1429 This may be used to tell gpg-agent of which gpg-agent version the
1430 client is aware of. gpg-agent uses this information to enable
1431 features which might break older clients.
1434 Change the session's environment to be used for the Pinentry.
1440 Set envvar NAME to the empty string
1442 Set envvar NAME to the string VALUE.
1444 'use-cache-for-signing'
1445 See Assuan command 'PKSIGN'.
1447 'allow-pinentry-notify'
1448 This does not need any value. It is used to enable the
1449 PINENTRY_LAUNCHED inquiry.
1452 This option is used to change the operation mode of the pinentry.
1453 The following values are defined:
1456 This is the default mode which pops up a pinentry as needed.
1459 Instead of popping up a pinentry, return the error code
1463 Instead of popping up a pinentry, return the error code
1464 'GPG_ERR_NO_PIN_ENTRY'.
1467 Use a loopback pinentry. This fakes a pinentry by using
1468 inquiries back to the caller to ask for a passphrase. This
1469 option may only be set if the agent has been configured for
1470 that. To disable this feature use *note option
1471 --no-allow-loopback-pinentry::.
1473 'cache-ttl-opt-preset'
1474 This option sets the cache TTL for new entries created by GENKEY
1475 and PASSWD commands when using the '--preset' option. It is not
1476 used a default value is used.
1479 Instead of using the standard S2K count (which is computed on the
1480 fly), the given S2K count is used for new keys or when changing the
1481 passphrase of a key. Values below 65536 are considered to be 0.
1482 This option is valid for the entire session or until reset to 0.
1483 This option is useful if the key is later used on boxes which are
1484 either much slower or faster than the actual box.
1486 'pretend-request-origin'
1487 This option switches the connection into a restricted mode which
1488 handles all further commands in the same way as they would be
1489 handled when originating from the extra or browser socket. Note
1490 that this option is not available in the restricted mode. Valid
1491 values for this option are:
1495 This is a NOP and leaves the connection in the standard way.
1498 Pretend to come from a remote origin in the same way as
1499 connections from the '--extra-socket'.
1502 Pretend to come from a local web browser in the same way as
1503 connections from the '--browser-socket'.
1506 File: gnupg.info, Node: Invoking DIRMNGR, Next: Invoking GPG, Prev: Invoking GPG-AGENT, Up: Top
1511 Since version 2.1 of GnuPG, 'dirmngr' takes care of accessing the
1512 OpenPGP keyservers. As with previous versions it is also used as a
1513 server for managing and downloading certificate revocation lists (CRLs)
1514 for X.509 certificates, downloading X.509 certificates, and providing
1515 access to OCSP providers. Dirmngr is invoked internally by 'gpg',
1516 'gpgsm', or via the 'gpg-connect-agent' tool.
1518 *Note Option Index::,for an index to 'DIRMNGR''s commands and options.
1522 * Dirmngr Commands:: List of all commands.
1523 * Dirmngr Options:: List of all options.
1524 * Dirmngr Configuration:: Configuration files.
1525 * Dirmngr Signals:: Use of signals.
1526 * Dirmngr Examples:: Some usage examples.
1527 * Dirmngr Protocol:: The protocol dirmngr uses.
1530 File: gnupg.info, Node: Dirmngr Commands, Next: Dirmngr Options, Up: Invoking DIRMNGR
1535 Commands are not distinguished from options except for the fact that
1536 only one command is allowed.
1539 Print the program version and licensing information. Note that you
1540 cannot abbreviate this command.
1543 Print a usage message summarizing the most useful command-line
1544 options. Note that you cannot abbreviate this command.
1547 Print a list of all available options and commands. Note that you
1548 cannot abbreviate this command.
1551 Run in server mode and wait for commands on the 'stdin'. The
1552 default mode is to create a socket and listen for commands there.
1553 This is only used for testing.
1556 Run in background daemon mode and listen for commands on a socket.
1557 This is the way 'dirmngr' is started on demand by the other GnuPG
1558 components. To force starting 'dirmngr' it is in general best to
1559 use 'gpgconf --launch dirmngr'.
1562 Run in the foreground, sending logs to stderr, and listening on
1563 file descriptor 3, which must already be bound to a listening
1564 socket. This is useful when running under systemd or other similar
1565 process supervision schemes. This option is not supported on
1569 List the contents of the CRL cache on 'stdout'. This is probably
1570 only useful for debugging purposes.
1573 This command requires a filename as additional argument, and it
1574 will make Dirmngr try to import the CRL in FILE into it's cache.
1575 Note, that this is only possible if Dirmngr is able to retrieve the
1576 CA's certificate directly by its own means. In general it is
1577 better to use 'gpgsm''s '--call-dirmngr loadcrl filename' command
1578 so that 'gpgsm' can help dirmngr.
1581 This command requires an URL as additional argument, and it will
1582 make dirmngr try to retrieve and import the CRL from that URL into
1583 it's cache. This is mainly useful for debugging purposes. The
1584 'dirmngr-client' provides the same feature for a running dirmngr.
1587 This commands shuts down an running instance of Dirmngr. This
1588 command has currently no effect.
1591 This command removes all CRLs from Dirmngr's cache. Client
1592 requests will thus trigger reading of fresh CRLs.
1595 File: gnupg.info, Node: Dirmngr Options, Next: Dirmngr Configuration, Prev: Dirmngr Commands, Up: Invoking DIRMNGR
1600 Note that all long options with the exception of '--options' and
1601 '--homedir' may also be given in the configuration file after stripping
1602 off the two leading dashes.
1605 Reads configuration from FILE instead of from the default per-user
1606 configuration file. The default configuration file is named
1607 'dirmngr.conf' and expected in the home directory.
1610 Set the name of the home directory to DIR. This option is only
1611 effective when used on the command line. The default is the
1612 directory named '.gnupg' directly below the home directory of the
1613 user unless the environment variable 'GNUPGHOME' has been set in
1614 which case its value will be used. Many kinds of data are stored
1615 within this directory.
1619 Outputs additional information while running. You can increase the
1620 verbosity by giving several verbose commands to DIRMNGR, such as
1624 Append all logging output to FILE. This is very helpful in seeing
1625 what the agent actually does. Use 'socket://' to log to socket.
1627 '--debug-level LEVEL'
1628 Select the debug level for investigating problems. LEVEL may be a
1629 numeric value or by a keyword:
1632 No debugging at all. A value of less than 1 may be used
1633 instead of the keyword.
1635 Some basic debug messages. A value between 1 and 2 may be
1636 used instead of the keyword.
1638 More verbose debug messages. A value between 3 and 5 may be
1639 used instead of the keyword.
1641 Even more detailed messages. A value between 6 and 8 may be
1642 used instead of the keyword.
1644 All of the debug messages you can get. A value greater than 8
1645 may be used instead of the keyword. The creation of hash
1646 tracing files is only enabled if the keyword is used.
1648 How these messages are mapped to the actual debugging flags is not
1649 specified and may change with newer releases of this program. They
1650 are however carefully selected to best aid in debugging.
1653 Set debugging flags. This option is only useful for debugging and
1654 its behavior may change with a new release. All flags are or-ed
1655 and may be given in C syntax (e.g. 0x0042) or as a comma separated
1656 list of flag names. To get a list of all supported flags the
1657 single word "help" can be used.
1660 Same as '--debug=0xffffffff'
1663 Enable debugging of the TLS layer at LEVEL. The details of the
1664 debug level depend on the used TLS library and are not set in
1668 When running in server mode, wait N seconds before entering the
1669 actual processing loop and print the pid. This gives time to
1672 '--disable-check-own-socket'
1673 On some platforms 'dirmngr' is able to detect the removal of its
1674 socket file and shutdown itself. This option disable this
1675 self-test for debugging purposes.
1681 Format the info output in daemon mode for use with the standard
1682 Bourne shell respective the C-shell. The default is to guess it
1683 based on the environment variable 'SHELL' which is in almost all
1687 Enabling this option forces loading of expired CRLs; this is only
1688 useful for debugging.
1692 The option '--use-tor' switches Dirmngr and thus GnuPG into "Tor
1693 mode" to route all network access via Tor (an anonymity network).
1694 Certain other features are disabled in this mode. The effect of
1695 '--use-tor' cannot be overridden by any other command or even by
1696 reloading dirmngr. The use of '--no-use-tor' disables the use of
1697 Tor. The default is to use Tor if it is available on startup or
1698 after reloading dirmngr. The test on the available of Tor is done
1699 by trying to connects to a SOCKS proxy at either port 9050 or
1700 9150); if another type of proxy is listening on one of these ports,
1701 you should use '--no-use-tor'.
1703 '--standard-resolver'
1704 This option forces the use of the system's standard DNS resolver
1705 code. This is mainly used for debugging. Note that on Windows a
1706 standard resolver is not used and all DNS access will return the
1707 error "Not Implemented" if this option is used. Using this
1708 together with enabled Tor mode returns the error "Not Enabled".
1710 '--recursive-resolver'
1711 When possible use a recursive resolver instead of a stub resolver.
1713 '--resolver-timeout N'
1714 Set the timeout for the DNS resolver to N seconds. The default are
1717 '--connect-timeout N'
1718 '--connect-quick-timeout N'
1719 Set the timeout for HTTP and generic TCP connection attempts to N
1720 seconds. The value set with the quick variant is used when the
1721 -quick option has been given to certain Assuan commands. The quick
1722 value is capped at the value of the regular connect timeout. The
1723 default values are 15 and 2 seconds. Note that the timeout values
1724 are for each connection attempt; the connection code will attempt
1725 to connect all addresses listed for a server.
1727 '--listen-backlog N'
1728 Set the size of the queue for pending connections. The default is
1731 '--allow-version-check'
1732 Allow Dirmngr to connect to 'https://versions.gnupg.org' to get the
1733 list of current software versions. If this option is enabled the
1734 list is retrieved in case the local copy does not exist or is older
1735 than 5 to 7 days. See the option '--query-swdb' of the command
1736 'gpgconf' for more details. Note, that regardless of this option a
1737 version check can always be triggered using this command:
1739 gpg-connect-agent --dirmngr 'loadswdb --force' /bye
1742 Use NAME as your keyserver. This is the server that 'gpg'
1743 communicates with to receive keys, send keys, and search for keys.
1744 The format of the NAME is a URI: 'scheme:[//]keyservername[:port]'
1745 The scheme is the type of keyserver: "hkp" for the HTTP (or
1746 compatible) keyservers, "ldap" for the LDAP keyservers, or "mailto"
1747 for the Graff email keyserver. Note that your particular
1748 installation of GnuPG may have other keyserver types available as
1749 well. Keyserver schemes are case-insensitive. After the keyserver
1750 name, optional keyserver configuration options may be provided.
1751 These are the same as the '--keyserver-options' of 'gpg', but apply
1752 only to this particular keyserver.
1754 Most keyservers synchronize with each other, so there is generally
1755 no need to send keys to more than one server. Somes keyservers use
1756 round robin DNS to give a different keyserver each time you use it.
1758 If exactly two keyservers are configured and only one is a Tor
1759 hidden service (.onion), Dirmngr selects the keyserver to use
1760 depending on whether Tor is locally running or not. The check for
1761 a running Tor is done for each new connection.
1763 If no keyserver is explicitly configured, dirmngr will use the
1764 built-in default of 'https://keyserver.ubuntu.com'.
1766 Windows users with a keyserver running on their Active Directory
1767 may use the short form 'ldap:///' for NAME to access this
1770 For accessing anonymous LDAP keyservers NAME is in general just a
1771 'ldaps://ldap.example.com'. A BaseDN parameter should never be
1772 specified. If authentication is required things are more
1773 complicated and two methods are available:
1775 The modern method (since version 2.2.28) is to use the very same
1776 syntax as used with the option '--ldapserver'. Please see over
1777 there for details; here is an example:
1779 keyserver ldap:ldap.example.com::uid=USERNAME,ou=GnuPG Users,
1780 dc=example,dc=com:PASSWORD::starttls
1782 The other method is to use a full URL for NAME; for example:
1784 keyserver ldaps://ldap.example.com/????bindname=uid=USERNAME
1785 %2Cou=GnuPG%20Users%2Cdc=example%2Cdc=com,password=PASSWORD
1787 Put this all on one line without any spaces and keep the '%2C' as
1788 given. Replace USERNAME, PASSWORD, and the 'dc' parts according to
1789 the instructions received from your LDAP administrator. Note that
1790 only simple authentication (i.e. cleartext passwords) is supported
1791 and thus using ldaps is strongly suggested (since 2.2.28 "ldaps"
1792 defaults to port 389 and uses STARTTLS). On Windows authentication
1793 via AD can be requested by adding 'gpgNtds=1' after the fourth
1794 question mark instead of the bindname and password parameter.
1796 '--nameserver IPADDR'
1797 In "Tor mode" Dirmngr uses a public resolver via Tor to resolve DNS
1798 names. If the default public resolver, which is '8.8.8.8', shall
1799 not be used a different one can be given using this option. Note
1800 that a numerical IP address must be given (IPv6 or IPv4) and that
1801 no error checking is done for IPADDR.
1805 Disable the use of all IPv4 or IPv6 addresses.
1808 Entirely disables the use of LDAP.
1811 Entirely disables the use of HTTP.
1814 When looking for the location of a CRL, the to be tested
1815 certificate usually contains so called "CRL Distribution Point"
1816 (DP) entries which are URLs describing the way to access the CRL.
1817 The first found DP entry is used. With this option all entries
1818 using the HTTP scheme are ignored when looking for a suitable DP.
1821 This is similar to '--ignore-http-dp' but ignores entries using the
1822 LDAP scheme. Both options may be combined resulting in ignoring
1825 '--ignore-ocsp-service-url'
1826 Ignore all OCSP URLs contained in the certificate. The effect is
1827 to force the use of the default responder.
1829 '--honor-http-proxy'
1830 If the environment variable 'http_proxy' has been set, use its
1831 value to access HTTP servers.
1833 '--http-proxy [http://]HOST[:PORT]'
1834 Use HOST and PORT to access HTTP servers. The use of this option
1835 overrides the environment variable 'http_proxy' regardless whether
1836 '--honor-http-proxy' has been set.
1838 '--ldap-proxy HOST[:PORT]'
1839 Use HOST and PORT to connect to LDAP servers. If PORT is omitted,
1840 port 389 (standard LDAP port) is used. This overrides any
1841 specified host and port part in a LDAP URL and will also be used if
1842 host and port have been omitted from the URL.
1845 Never use anything else but the LDAP "proxy" as configured with
1846 '--ldap-proxy'. Usually 'dirmngr' tries to use other configured
1847 LDAP server if the connection using the "proxy" failed.
1849 '--ldapserverlist-file FILE'
1850 Read the list of LDAP servers to consult for CRLs and X.509
1851 certificates from file instead of the default per-user ldap server
1852 list file. The default value for FILE is
1853 'dirmngr_ldapservers.conf'.
1855 This server list file contains one LDAP server per line in the
1858 HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN:FLAGS
1860 Lines starting with a '#' are comments.
1862 Note that as usual all strings entered are expected to be UTF-8
1863 encoded. Obviously this will lead to problems if the password has
1864 originally been encoded as Latin-1. There is no other solution
1865 here than to put such a password in the binary encoding into the
1866 file (i.e. non-ascii characters won't show up readable).(1)
1869 This is an alternative way to specify LDAP servers for CRL and
1870 X.509 certificate retrieval. If this option is used the servers
1871 configured in 'dirmngr_ldapservers.conf' (or the file given by
1872 '--ldapserverlist-file') are cleared. Note that
1873 'dirmngr_ldapservers.conf' is not read again by a reload signal.
1874 However, '--ldapserver' options are read again.
1876 SPEC is either a proper LDAP URL or a colon delimited list of the
1879 HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN:FLAGS:
1881 with an optional prefix of 'ldap:' (but without the two slashes
1882 which would turn this into a proper LDAP URL). FLAGS is a list of
1883 one or more comma delimited keywords:
1885 The default: Do not use a TLS secured connection at all; the
1886 default port is 389.
1888 Use STARTTLS to secure the connection; the default port is
1891 Tunnel LDAP through a TLS connection; the default port is 636.
1893 On Windows authenticate the LDAP connection using the Active
1894 Directory with the current user.
1896 Note that in an URL style specification the scheme 'ldaps://'
1897 refers to STARTTLS and _not_ to LDAP-over-TLS.
1899 '--ldaptimeout SECS'
1900 Specify the number of seconds to wait for an LDAP query before
1901 timing out. The default are 15 seconds. 0 will never timeout.
1904 This option makes dirmngr add any servers it discovers when
1905 validating certificates against CRLs to the internal list of
1906 servers to consult for certificates and CRLs.
1908 This option is useful when trying to validate a certificate that
1909 has a CRL distribution point that points to a server that is not
1910 already listed in the ldapserverlist. Dirmngr will always go to
1911 this server and try to download the CRL, but chances are high that
1912 the certificate used to sign the CRL is located on the same server.
1913 So if dirmngr doesn't add that new server to list, it will often
1914 not be able to verify the signature of the CRL unless the
1915 '--add-servers' option is used.
1917 Note: The current version of dirmngr has this option disabled by
1921 This option enables OCSP support if requested by the client.
1923 OCSP requests are rejected by default because they may violate the
1924 privacy of the user; for example it is possible to track the time
1925 when a user is reading a mail.
1927 '--ocsp-responder URL'
1928 Use URL as the default OCSP Responder if the certificate does not
1929 contain information about an assigned responder. Note, that
1930 '--ocsp-signer' must also be set to a valid certificate.
1932 '--ocsp-signer FPR|FILE'
1933 Use the certificate with the fingerprint FPR to check the responses
1934 of the default OCSP Responder. Alternatively a filename can be
1935 given in which case the response is expected to be signed by one of
1936 the certificates described in that file. Any argument which
1937 contains a slash, dot or tilde is considered a filename. Usual
1938 filename expansion takes place: A tilde at the start followed by a
1939 slash is replaced by the content of 'HOME', no slash at start
1940 describes a relative filename which will be searched at the home
1941 directory. To make sure that the FILE is searched in the home
1942 directory, either prepend the name with "./" or use a name which
1945 If a response has been signed by a certificate described by these
1946 fingerprints no further check upon the validity of this certificate
1949 The format of the FILE is a list of SHA-1 fingerprint, one per line
1950 with optional colons between the bytes. Empty lines and lines
1951 prefix with a hash mark are ignored.
1953 '--ocsp-max-clock-skew N'
1954 The number of seconds a skew between the OCSP responder and them
1955 local clock is accepted. Default is 600 (10 minutes).
1957 '--ocsp-max-period N'
1958 Seconds a response is at maximum considered valid after the time
1959 given in the thisUpdate field. Default is 7776000 (90 days).
1961 '--ocsp-current-period N'
1962 The number of seconds an OCSP response is considered valid after
1963 the time given in the NEXT_UPDATE datum. Default is 10800 (3
1967 Do not return more that N items in one query. The default is 10.
1969 '--ignore-cert-extension OID'
1970 Add OID to the list of ignored certificate extensions. The OID is
1971 expected to be in dotted decimal form, like '2.5.29.3'. This
1972 option may be used more than once. Critical flagged certificate
1973 extensions matching one of the OIDs in the list are treated as if
1974 they are actually handled and thus the certificate won't be
1975 rejected due to an unknown critical extension. Use this option
1976 with care because extensions are usually flagged as critical for a
1979 '--ignore-cert FPR|FILE'
1980 Entirely ignore certificates with the fingerprint FPR. As an
1981 alternative to the fingerprint a filename can be given in which
1982 case all certificates described in that file are ignored. Any
1983 argument which contains a slash, dot or tilde is considered a
1984 filename. Usual filename expansion takes place: A tilde at the
1985 start followed by a slash is replaced by the content of 'HOME', no
1986 slash at start describes a relative filename which will be searched
1987 at the home directory. To make sure that the FILE is searched in
1988 the home directory, either prepend the name with "./" or use a name
1989 which contains a dot. The format of such a file is a list of SHA-1
1990 fingerprint, one per line with optional colons between the bytes.
1991 Empty lines and lines prefixed with a hash mark are ignored.
1993 This option is useful as a quick workaround to exclude certain
1994 certificates from the system store.
1997 Use the root certificates in FILE for verification of the TLS
1998 certificates used with 'hkps' (keyserver access over TLS). If the
1999 file is in PEM format a suffix of '.pem' is expected for FILE.
2000 This option may be given multiple times to add more root
2001 certificates. Tilde expansion is supported.
2003 If no 'hkp-cacert' directive is present, dirmngr will use the
2006 ---------- Footnotes ----------
2008 (1) The 'gpgconf' tool might be helpful for frontends as it enables
2009 editing this configuration file using percent-escaped strings.
2012 File: gnupg.info, Node: Dirmngr Configuration, Next: Dirmngr Signals, Prev: Dirmngr Options, Up: Invoking DIRMNGR
2017 Dirmngr makes use of several directories when running in daemon mode:
2018 There are a few configuration files whih control the operation of
2019 dirmngr. By default they may all be found in the current home directory
2020 (*note option --homedir::).
2023 This is the standard configuration file read by 'dirmngr' on
2024 startup. It may contain any valid long option; the leading two
2025 dashes may not be entered and the option may not be abbreviated.
2026 This file is also read after a 'SIGHUP' however not all options
2027 will actually have an effect. This default name may be changed on
2028 the command line (*note option --options::). You should backup
2031 '/etc/gnupg/trusted-certs'
2032 This directory should be filled with certificates of Root CAs you
2033 are trusting in checking the CRLs and signing OCSP Responses.
2035 Usually these are the same certificates you use with the
2036 applications making use of dirmngr. It is expected that each of
2037 these certificate files contain exactly one DER encoded certificate
2038 in a file with the suffix '.crt' or '.der'. 'dirmngr' reads those
2039 certificates on startup and when given a SIGHUP. Certificates which
2040 are not readable or do not make up a proper X.509 certificate are
2041 ignored; see the log file for details.
2043 Applications using dirmngr (e.g. gpgsm) can request these
2044 certificates to complete a trust chain in the same way as with the
2045 extra-certs directory (see below).
2047 Note that for OCSP responses the certificate specified using the
2048 option '--ocsp-signer' is always considered valid to sign OCSP
2051 '/etc/gnupg/extra-certs'
2052 This directory may contain extra certificates which are preloaded
2053 into the internal cache on startup. Applications using dirmngr
2054 (e.g. gpgsm) can request cached certificates to complete a trust
2055 chain. This is convenient in cases you have a couple intermediate
2056 CA certificates or certificates usually used to sign OCSP
2057 responses. These certificates are first tried before going out to
2058 the net to look for them. These certificates must also be DER
2059 encoded and suffixed with '.crt' or '.der'.
2062 This directory is used to store cached CRLs. The 'crls.d' part
2063 will be created by dirmngr if it does not exists but you need to
2064 make sure that the upper directory exists.
2066 To be able to see what's going on you should create the configure
2067 file '~/gnupg/dirmngr.conf' with at least one line:
2069 log-file ~/dirmngr.log
2071 To be able to perform OCSP requests you probably want to add the
2076 To make sure that new options are read and that after the
2077 installation of a new GnuPG versions the installed dirmngr is running,
2078 you may want to kill an existing dirmngr first:
2080 gpgconf --kill dirmngr
2082 You may check the log file to see whether all desired root
2083 certificates have been loaded correctly.
2086 File: gnupg.info, Node: Dirmngr Signals, Next: Dirmngr Examples, Prev: Dirmngr Configuration, Up: Invoking DIRMNGR
2091 A running 'dirmngr' may be controlled by signals, i.e. using the 'kill'
2092 command to send a signal to the process.
2094 Here is a list of supported signals:
2097 This signal flushes all internally cached CRLs as well as any
2098 cached certificates. Then the certificate cache is reinitialized
2099 as on startup. Options are re-read from the configuration file.
2100 Instead of sending this signal it is better to use
2101 gpgconf --reload dirmngr
2104 Shuts down the process but waits until all current requests are
2105 fulfilled. If the process has received 3 of these signals and
2106 requests are still pending, a shutdown is forced. You may also use
2107 gpgconf --kill dirmngr
2108 instead of this signal
2111 Shuts down the process immediately.
2114 This prints some caching statistics to the log file.
2117 File: gnupg.info, Node: Dirmngr Examples, Next: Dirmngr Protocol, Prev: Dirmngr Signals, Up: Invoking DIRMNGR
2122 Here is an example on how to show dirmngr's internal table of OpenPGP
2123 keyserver addresses. The output is intended for debugging purposes and
2124 not part of a defined API.
2126 gpg-connect-agent --dirmngr 'keyserver --hosttable' /bye
2128 To inhibit the use of a particular host you have noticed in one of
2129 the keyserver pools, you may use
2131 gpg-connect-agent --dirmngr 'keyserver --dead pgpkeys.bnd.de' /bye
2133 The description of the 'keyserver' command can be printed using
2135 gpg-connect-agent --dirmngr 'help keyserver' /bye
2138 File: gnupg.info, Node: Dirmngr Protocol, Prev: Dirmngr Examples, Up: Invoking DIRMNGR
2140 3.6 Dirmngr's Assuan Protocol
2141 =============================
2143 Assuan is the IPC protocol used to access dirmngr. This is a
2144 description of the commands implemented by dirmngr.
2148 * Dirmngr LOOKUP:: Look up a certificate via LDAP
2149 * Dirmngr ISVALID:: Validate a certificate using a CRL or OCSP.
2150 * Dirmngr CHECKCRL:: Validate a certificate using a CRL.
2151 * Dirmngr CHECKOCSP:: Validate a certificate using OCSP.
2152 * Dirmngr CACHECERT:: Put a certificate into the internal cache.
2153 * Dirmngr VALIDATE:: Validate a certificate for debugging.
2156 File: gnupg.info, Node: Dirmngr LOOKUP, Next: Dirmngr ISVALID, Up: Dirmngr Protocol
2158 3.6.1 Return the certificate(s) found
2159 -------------------------------------
2161 Lookup certificate. To allow multiple patterns (which are ORed) quoting
2162 is required: Spaces are to be translated into "+" or into "%20";
2163 obviously this requires that the usual escape quoting rules are applied.
2164 The server responds with:
2166 S: D <DER encoded certificate>
2168 S: D <second DER encoded certificate>
2172 In this example 2 certificates are returned. The server may return
2173 any number of certificates; OK will also be returned when no
2174 certificates were found. The dirmngr might return a status line
2178 To indicate that the output was truncated to N items due to a
2179 limitation of the server or by an arbitrary set limit.
2181 The option '--url' may be used if instead of a search pattern a
2182 complete URL to the certificate is known:
2184 C: LOOKUP --url CN%3DWerner%20Koch,o%3DIntevation%20GmbH,c%3DDE?userCertificate
2186 If the option '--cache-only' is given, no external lookup is done so
2187 that only certificates from the cache are returned.
2189 With the option '--single', the first and only the first match will
2190 be returned. Unless option '--cache-only' is also used, no local lookup
2191 will be done in this case.
2194 File: gnupg.info, Node: Dirmngr ISVALID, Next: Dirmngr CHECKCRL, Prev: Dirmngr LOOKUP, Up: Dirmngr Protocol
2196 3.6.2 Validate a certificate using a CRL or OCSP
2197 ------------------------------------------------
2199 ISVALID [--only-ocsp] [--force-default-responder] CERTID|CERTFPR
2201 Check whether the certificate described by the CERTID has been
2202 revoked. Due to caching, the Dirmngr is able to answer immediately in
2205 The CERTID is a hex encoded string consisting of two parts, delimited
2206 by a single dot. The first part is the SHA-1 hash of the issuer name
2207 and the second part the serial number.
2209 Alternatively the certificate's SHA-1 fingerprint CERTFPR may be
2210 given in which case an OCSP request is done before consulting the CRL.
2211 If the option '--only-ocsp' is given, no fallback to a CRL check will be
2212 used. If the option '--force-default-responder' is given, only the
2213 default OCSP responder will be used and any other methods of obtaining
2214 an OCSP responder URL won't be used.
2216 Common return values are:
2218 'GPG_ERR_NO_ERROR (0)'
2219 This is the positive answer: The certificate is not revoked and we
2220 have an up-to-date revocation list for that certificate. If OCSP
2221 was used the responder confirmed that the certificate has not been
2224 'GPG_ERR_CERT_REVOKED'
2225 This is the negative answer: The certificate has been revoked.
2226 Either it is in a CRL and that list is up to date or an OCSP
2227 responder informed us that it has been revoked.
2229 'GPG_ERR_NO_CRL_KNOWN'
2230 No CRL is known for this certificate or the CRL is not valid or out
2234 The OCSP responder returned an "unknown" status. This means that
2235 it is not aware of the certificate's status.
2237 'GPG_ERR_NOT_SUPPORTED'
2238 This is commonly seen if OCSP support has not been enabled in the
2241 If DirMngr has not enough information about the given certificate
2242 (which is the case for not yet cached certificates), it will inquire the
2245 S: INQUIRE SENDCERT <CertID>
2246 C: D <DER encoded certificate>
2249 A client should be aware that DirMngr may ask for more than one
2252 If Dirmngr has a certificate but the signature of the certificate
2253 could not been validated because the root certificate is not known to
2254 dirmngr as trusted, it may ask back to see whether the client trusts
2255 this the root certificate:
2257 S: INQUIRE ISTRUSTED <CertHexfpr>
2261 Only this answer will let Dirmngr consider the certificate as valid.
2264 File: gnupg.info, Node: Dirmngr CHECKCRL, Next: Dirmngr CHECKOCSP, Prev: Dirmngr ISVALID, Up: Dirmngr Protocol
2266 3.6.3 Validate a certificate using a CRL
2267 ----------------------------------------
2269 Check whether the certificate with FINGERPRINT (SHA-1 hash of the entire
2270 X.509 certificate blob) is valid or not by consulting the CRL
2271 responsible for this certificate. If the fingerprint has not been given
2272 or the certificate is not known, the function inquires the certificate
2275 S: INQUIRE TARGETCERT
2276 C: D <DER encoded certificate>
2279 Thus the caller is expected to return the certificate for the request
2280 (which should match FINGERPRINT) as a binary blob. Processing then
2281 takes place without further interaction; in particular dirmngr tries to
2282 locate other required certificate by its own mechanism which includes a
2283 local certificate store as well as a list of trusted root certificates.
2285 The return code is 0 for success; i.e. the certificate has not been
2286 revoked or one of the usual error codes from libgpg-error.
2289 File: gnupg.info, Node: Dirmngr CHECKOCSP, Next: Dirmngr CACHECERT, Prev: Dirmngr CHECKCRL, Up: Dirmngr Protocol
2291 3.6.4 Validate a certificate using OCSP
2292 ---------------------------------------
2294 CHECKOCSP [--force-default-responder] [FINGERPRINT]
2296 Check whether the certificate with FINGERPRINT (the SHA-1 hash of the
2297 entire X.509 certificate blob) is valid by consulting the appropriate
2298 OCSP responder. If the fingerprint has not been given or the
2299 certificate is not known by Dirmngr, the function inquires the
2302 S: INQUIRE TARGETCERT
2303 C: D <DER encoded certificate>
2306 Thus the caller is expected to return the certificate for the request
2307 (which should match FINGERPRINT) as a binary blob. Processing then
2308 takes place without further interaction; in particular dirmngr tries to
2309 locate other required certificates by its own mechanism which includes a
2310 local certificate store as well as a list of trusted root certificates.
2312 If the option '--force-default-responder' is given, only the default
2313 OCSP responder is used. This option is the per-command variant of the
2314 global option '--ignore-ocsp-service-url'.
2316 The return code is 0 for success; i.e. the certificate has not been
2317 revoked or one of the usual error codes from libgpg-error.
2320 File: gnupg.info, Node: Dirmngr CACHECERT, Next: Dirmngr VALIDATE, Prev: Dirmngr CHECKOCSP, Up: Dirmngr Protocol
2322 3.6.5 Put a certificate into the internal cache
2323 -----------------------------------------------
2325 Put a certificate into the internal cache. This command might be useful
2326 if a client knows in advance certificates required for a test and wants
2327 to make sure they get added to the internal cache. It is also helpful
2328 for debugging. To get the actual certificate, this command immediately
2331 S: INQUIRE TARGETCERT
2332 C: D <DER encoded certificate>
2335 Thus the caller is expected to return the certificate for the request
2338 The return code is 0 for success; i.e. the certificate has not been
2339 successfully cached or one of the usual error codes from libgpg-error.
2342 File: gnupg.info, Node: Dirmngr VALIDATE, Prev: Dirmngr CACHECERT, Up: Dirmngr Protocol
2344 3.6.6 Validate a certificate for debugging
2345 ------------------------------------------
2347 Validate a certificate using the certificate validation function used
2348 internally by dirmngr. This command is only useful for debugging. To
2349 get the actual certificate, this command immediately inquires it using
2351 S: INQUIRE TARGETCERT
2352 C: D <DER encoded certificate>
2355 Thus the caller is expected to return the certificate for the request
2359 File: gnupg.info, Node: Invoking GPG, Next: Invoking GPGSM, Prev: Invoking DIRMNGR, Up: Top
2364 'gpg' is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool
2365 to provide digital encryption and signing services using the OpenPGP
2366 standard. 'gpg' features complete key management and all the bells and
2367 whistles you would expect from a full OpenPGP implementation.
2369 There are two main versions of GnuPG: GnuPG 1.x and GnuPG 2.x. GnuPG
2370 2.x supports modern encryption algorithms and thus should be preferred
2371 over GnuPG 1.x. You only need to use GnuPG 1.x if your platform doesn't
2372 support GnuPG 2.x, or you need support for some features that GnuPG 2.x
2373 has deprecated, e.g., decrypting data created with PGP-2 keys.
2375 If you are looking for version 1 of GnuPG, you may find that version
2376 installed under the name 'gpg1'.
2378 *Note Option Index::, for an index to 'gpg''s commands and options.
2382 * GPG Commands:: List of all commands.
2383 * GPG Options:: List of all options.
2384 * GPG Configuration:: Configuration files.
2385 * GPG Examples:: Some usage examples.
2387 Developer information:
2388 * Unattended Usage of GPG:: Using 'gpg' from other programs.
2391 File: gnupg.info, Node: GPG Commands, Next: GPG Options, Up: Invoking GPG
2396 Commands are not distinguished from options except for the fact that
2397 only one command is allowed. Generally speaking, irrelevant options are
2398 silently ignored, and may not be checked for correctness.
2400 'gpg' may be run with no commands. In this case it will print a
2401 warning perform a reasonable action depending on the type of file it is
2402 given as input (an encrypted message is decrypted, a signature is
2403 verified, a file containing keys is listed, etc.).
2405 If you run into any problems, please add the option '--verbose' to
2406 the invocation to see more diagnostics.
2410 * General GPG Commands:: Commands not specific to the functionality.
2411 * Operational GPG Commands:: Commands to select the type of operation.
2412 * OpenPGP Key Management:: How to manage your keys.
2415 File: gnupg.info, Node: General GPG Commands, Next: Operational GPG Commands, Up: GPG Commands
2417 4.1.1 Commands not specific to the function
2418 -------------------------------------------
2421 Print the program version and licensing information. Note that you
2422 cannot abbreviate this command.
2426 Print a usage message summarizing the most useful command-line
2427 options. Note that you cannot arbitrarily abbreviate this command
2428 (though you can use its short form '-h').
2431 Print warranty information.
2434 Print a list of all available options and commands. Note that you
2435 cannot abbreviate this command.
2438 File: gnupg.info, Node: Operational GPG Commands, Next: OpenPGP Key Management, Prev: General GPG Commands, Up: GPG Commands
2440 4.1.2 Commands to select the type of operation
2441 ----------------------------------------------
2445 Sign a message. This command may be combined with '--encrypt' (to
2446 sign and encrypt a message), '--symmetric' (to sign and
2447 symmetrically encrypt a message), or both '--encrypt' and
2448 '--symmetric' (to sign and encrypt a message that can be decrypted
2449 using a secret key or a passphrase). The signing key is chosen by
2450 default or can be set explicitly using the '--local-user' and
2451 '--default-key' options.
2455 Make a cleartext signature. The content in a cleartext signature
2456 is readable without any special software. OpenPGP software is only
2457 needed to verify the signature. cleartext signatures may modify
2458 end-of-line whitespace for platform independence and are not
2459 intended to be reversible. The signing key is chosen by default or
2460 can be set explicitly using the '--local-user' and '--default-key'
2465 Make a detached signature.
2469 Encrypt data to one or more public keys. This command may be
2470 combined with '--sign' (to sign and encrypt a message),
2471 '--symmetric' (to encrypt a message that can be decrypted using a
2472 secret key or a passphrase), or '--sign' and '--symmetric' together
2473 (for a signed message that can be decrypted using a secret key or a
2474 passphrase). '--recipient' and related options specify which
2475 public keys to use for encryption.
2479 Encrypt with a symmetric cipher using a passphrase. The default
2480 symmetric cipher used is AES-128, but may be chosen with the
2481 '--cipher-algo' option. This command may be combined with '--sign'
2482 (for a signed and symmetrically encrypted message), '--encrypt'
2483 (for a message that may be decrypted via a secret key or a
2484 passphrase), or '--sign' and '--encrypt' together (for a signed
2485 message that may be decrypted via a secret key or a passphrase).
2486 'gpg' caches the passphrase used for symmetric encryption so that a
2487 decrypt operation may not require that the user needs to enter the
2488 passphrase. The option '--no-symkey-cache' can be used to disable
2492 Store only (make a simple literal data packet).
2496 Decrypt the file given on the command line (or STDIN if no file is
2497 specified) and write it to STDOUT (or the file specified with
2498 '--output'). If the decrypted file is signed, the signature is
2499 also verified. This command differs from the default operation, as
2500 it never writes to the filename which is included in the file and
2501 it rejects files that don't begin with an encrypted message.
2504 Assume that the first argument is a signed file and verify it
2505 without generating any output. With no arguments, the signature
2506 packet is read from STDIN. If only one argument is given, the
2507 specified file is expected to include a complete signature.
2509 With more than one argument, the first argument should specify a
2510 file with a detached signature and the remaining files should
2511 contain the signed data. To read the signed data from STDIN, use
2512 '-' as the second filename. For security reasons, a detached
2513 signature will not read the signed material from STDIN if not
2514 explicitly specified.
2516 Note: If the option '--batch' is not used, 'gpg' may assume that a
2517 single argument is a file with a detached signature, and it will
2518 try to find a matching data file by stripping certain suffixes.
2519 Using this historical feature to verify a detached signature is
2520 strongly discouraged; you should always specify the data file
2523 Note: When verifying a cleartext signature, 'gpg' verifies only
2524 what makes up the cleartext signed data and not any extra data
2525 outside of the cleartext signature or the header lines directly
2526 following the dash marker line. The option '--output' may be used
2527 to write out the actual signed data, but there are other pitfalls
2528 with this format as well. It is suggested to avoid cleartext
2529 signatures in favor of detached signatures.
2531 Note: Sometimes the use of the 'gpgv' tool is easier than using the
2532 full-fledged 'gpg' with this option. 'gpgv' is designed to compare
2533 signed data against a list of trusted keys and returns with success
2534 only for a good signature. It has its own manual page.
2537 This modifies certain other commands to accept multiple files for
2538 processing on the command line or read from STDIN with each
2539 filename on a separate line. This allows for many files to be
2540 processed at once. '--multifile' may currently be used along with
2541 '--verify', '--encrypt', and '--decrypt'. Note that '--multifile
2542 --verify' may not be used with detached signatures.
2545 Identical to '--multifile --verify'.
2548 Identical to '--multifile --encrypt'.
2551 Identical to '--multifile --decrypt'.
2555 '--list-public-keys'
2556 List the specified keys. If no keys are specified, then all keys
2557 from the configured public keyrings are listed.
2559 Never use the output of this command in scripts or other programs.
2560 The output is intended only for humans and its format is likely to
2561 change. The '--with-colons' option emits the output in a stable,
2562 machine-parseable format, which is intended for use by scripts and
2565 '--list-secret-keys'
2567 List the specified secret keys. If no keys are specified, then all
2568 known secret keys are listed. A '#' after the initial tags 'sec'
2569 or 'ssb' means that the secret key or subkey is currently not
2570 usable. We also say that this key has been taken offline (for
2571 example, a primary key can be taken offline by exporting the key
2572 using the command '--export-secret-subkeys'). A '>' after these
2573 tags indicate that the key is stored on a smartcard. See also
2576 '--check-signatures'
2578 Same as '--list-keys', but the key signatures are verified and
2579 listed too. Note that for performance reasons the revocation
2580 status of a signing key is not shown. This command has the same
2581 effect as using '--list-keys' with '--with-sig-check'.
2583 The status of the verification is indicated by a flag directly
2584 following the "sig" tag (and thus before the flags described below.
2585 A "!" indicates that the signature has been successfully verified,
2586 a "-" denotes a bad signature and a "%" is used if an error
2587 occurred while checking the signature (e.g. a non supported
2588 algorithm). Signatures where the public key is not available are
2589 not listed; to see their keyids the command '--list-sigs' can be
2592 For each signature listed, there are several flags in between the
2593 signature status flag and keyid. These flags give additional
2594 information about each key signature. From left to right, they are
2595 the numbers 1-3 for certificate check level (see
2596 '--ask-cert-level'), "L" for a local or non-exportable signature
2597 (see '--lsign-key'), "R" for a nonRevocable signature (see the
2598 '--edit-key' command "nrsign"), "P" for a signature that contains a
2599 policy URL (see '--cert-policy-url'), "N" for a signature that
2600 contains a notation (see '--cert-notation'), "X" for an eXpired
2601 signature (see '--ask-cert-expire'), and the numbers 1-9 or "T" for
2602 10 and above to indicate trust signature levels (see the
2603 '--edit-key' command "tsign").
2606 '--locate-external-keys'
2607 Locate the keys given as arguments. This command basically uses
2608 the same algorithm as used when locating keys for encryption and
2609 may thus be used to see what keys 'gpg' might use. In particular
2610 external methods as defined by '--auto-key-locate' are used to
2611 locate a key if the arguments comain valid mail addresses. Only
2612 public keys are listed.
2614 The variant '--locate-external-keys' does not consider a locally
2615 existing key and can thus be used to force the refresh of a key via
2616 the defined external methods. If a fingerprint is given and and
2617 the methods defined by -auto-key-locate define LDAP servers, the
2618 key is fetched from these resources; defined non-LDAP keyservers
2622 This commands takes OpenPGP keys as input and prints information
2623 about them in the same way the command '--list-keys' does for
2624 locally stored key. In addition the list options
2625 'show-unusable-uids', 'show-unusable-subkeys', 'show-notations' and
2626 'show-policy-urls' are also enabled. As usual for automated
2627 processing, this command should be combined with the option
2631 List all keys (or the specified ones) along with their
2632 fingerprints. This is the same output as '--list-keys' but with
2633 the additional output of a line with the fingerprint. May also be
2634 combined with '--check-signatures'. If this command is given
2635 twice, the fingerprints of all secondary keys are listed too. This
2636 command also forces pretty printing of fingerprints if the keyid
2637 format has been set to "none".
2640 List only the sequence of packets. This command is only useful for
2641 debugging. When used with option '--verbose' the actual MPI values
2642 are dumped and not only their lengths. Note that the output of
2643 this command may change with new releases.
2647 Present a menu to work with a smartcard. The subcommand "help"
2648 provides an overview on available commands. For a detailed
2649 description, please see the Card HOWTO at
2650 https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
2653 Show the content of the smart card.
2656 Present a menu to allow changing the PIN of a smartcard. This
2657 functionality is also available as the subcommand "passwd" with the
2658 '--edit-card' command.
2660 '--delete-keys NAME'
2661 Remove key from the public keyring. In batch mode either '--yes'
2662 is required or the key must be specified by fingerprint. This is a
2663 safeguard against accidental deletion of multiple keys. If the
2664 exclamation mark syntax is used with the fingerprint of a subkey
2665 only that subkey is deleted; if the exclamation mark is used with
2666 the fingerprint of the primary key the entire public key is
2669 '--delete-secret-keys NAME'
2670 Remove key from the secret keyring. In batch mode the key must be
2671 specified by fingerprint. The option '--yes' can be used to advise
2672 gpg-agent not to request a confirmation. This extra pre-caution is
2673 done because 'gpg' can't be sure that the secret key (as controlled
2674 by gpg-agent) is only used for the given OpenPGP public key. If
2675 the exclamation mark syntax is used with the fingerprint of a
2676 subkey only the secret part of that subkey is deleted; if the
2677 exclamation mark is used with the fingerprint of the primary key
2678 only the secret part of the primary key is deleted.
2680 '--delete-secret-and-public-key NAME'
2681 Same as '--delete-key', but if a secret key exists, it will be
2682 removed first. In batch mode the key must be specified by
2683 fingerprint. The option '--yes' can be used to advise gpg-agent
2684 not to request a confirmation.
2687 Either export all keys from all keyrings (default keyring and those
2688 registered via option '--keyring'), or if at least one name is
2689 given, those of the given name. The exported keys are written to
2690 STDOUT or to the file given with option '--output'. Use together
2691 with '--armor' to mail those keys.
2693 '--send-keys KEYIDS'
2694 Similar to '--export' but sends the keys to a keyserver.
2695 Fingerprints may be used instead of key IDs. Don't send your
2696 complete keyring to a keyserver -- select only those keys which are
2697 new or changed by you. If no KEYIDS are given, 'gpg' does nothing.
2699 Take care: Keyservers are by design write only systems and thus it
2700 is not possible to ever delete keys once they have been send to a
2703 '--export-secret-keys'
2704 '--export-secret-subkeys'
2705 Same as '--export', but exports the secret keys instead. The
2706 exported keys are written to STDOUT or to the file given with
2707 option '--output'. This command is often used along with the
2708 option '--armor' to allow for easy printing of the key for paper
2709 backup; however the external tool 'paperkey' does a better job of
2710 creating backups on paper. Note that exporting a secret key can be
2711 a security risk if the exported keys are sent over an insecure
2714 The second form of the command has the special property to render
2715 the secret part of the primary key useless; this is a GNU extension
2716 to OpenPGP and other implementations can not be expected to
2717 successfully import such a key. Its intended use is in generating
2718 a full key with an additional signing subkey on a dedicated
2719 machine. This command then exports the key without the primary key
2720 to the main machine.
2722 GnuPG may ask you to enter the passphrase for the key. This is
2723 required, because the internal protection method of the secret key
2724 is different from the one specified by the OpenPGP protocol.
2727 This command is used to export a key in the OpenSSH public key
2728 format. It requires the specification of one key by the usual
2729 means and exports the latest valid subkey which has an
2730 authentication capability to STDOUT or to the file given with
2731 option '--output'. That output can directly be added to ssh's
2732 'authorized_key' file.
2734 By specifying the key to export using a key ID or a fingerprint
2735 suffixed with an exclamation mark (!), a specific subkey or the
2736 primary key can be exported. This does not even require that the
2737 key has the authentication capability flag set.
2741 Import/merge keys. This adds the given keys to the keyring. The
2742 fast version is currently just a synonym.
2744 There are a few other options which control how this command works.
2745 Most notable here is the '--import-options merge-only' option which
2746 does not insert new keys but does only the merging of new
2747 signatures, user-IDs and subkeys.
2749 '--receive-keys KEYIDS'
2750 '--recv-keys KEYIDS'
2751 Import the keys with the given KEYIDS from a keyserver.
2754 Request updates from a keyserver for keys that already exist on the
2755 local keyring. This is useful for updating a key with the latest
2756 signatures, user IDs, etc. Calling this with no arguments will
2757 refresh the entire keyring.
2759 '--search-keys NAMES'
2760 Search the keyserver for the given NAMES. Multiple names given
2761 here will be joined together to create the search string for the
2762 keyserver. Note that keyservers search for NAMES in a different
2763 and simpler way than gpg does. The best choice is to use a mail
2764 address. Due to data privacy reasons keyservers may even not even
2765 allow searching by user id or mail address and thus may only return
2766 results when being used with the '--recv-key' command to search by
2767 key fingerprint or keyid.
2770 Retrieve keys located at the specified URIS. Note that different
2771 installations of GnuPG may support different protocols (HTTP, FTP,
2772 LDAP, etc.). When using HTTPS the system provided root
2773 certificates are used by this command.
2776 Do trust database maintenance. This command iterates over all keys
2777 and builds the Web of Trust. This is an interactive command
2778 because it may have to ask for the "ownertrust" values for keys.
2779 The user has to give an estimation of how far she trusts the owner
2780 of the displayed key to correctly certify (sign) other keys. GnuPG
2781 only asks for the ownertrust value if it has not yet been assigned
2782 to a key. Using the '--edit-key' menu, the assigned value can be
2783 changed at any time.
2786 Do trust database maintenance without user interaction. From time
2787 to time the trust database must be updated so that expired keys or
2788 signatures and the resulting changes in the Web of Trust can be
2789 tracked. Normally, GnuPG will calculate when this is required and
2790 do it automatically unless '--no-auto-check-trustdb' is set. This
2791 command can be used to force a trust database check at any time.
2792 The processing is identical to that of '--update-trustdb' but it
2793 skips keys with a not yet defined "ownertrust".
2795 For use with cron jobs, this command can be used together with
2796 '--batch' in which case the trust database check is done only if a
2797 check is needed. To force a run even in batch mode add the option
2800 '--export-ownertrust'
2801 Send the ownertrust values to STDOUT. This is useful for backup
2802 purposes as these values are the only ones which can't be
2803 re-created from a corrupted trustdb. Example:
2804 gpg --export-ownertrust > otrust.txt
2806 '--import-ownertrust'
2807 Update the trustdb with the ownertrust values stored in 'files' (or
2808 STDIN if not given); existing values will be overwritten. In case
2809 of a severely damaged trustdb and if you have a recent backup of
2810 the ownertrust values (e.g. in the file 'otrust.txt'), you may
2811 re-create the trustdb using these commands:
2814 gpg --import-ownertrust < otrust.txt
2816 '--rebuild-keydb-caches'
2817 When updating from version 1.0.6 to 1.0.7 this command should be
2818 used to create signature caches in the keyring. It might be handy
2819 in other situations too.
2823 Print message digest of algorithm ALGO for all given files or
2824 STDIN. With the second form (or a deprecated "*" for ALGO) digests
2825 for all available algorithms are printed.
2827 '--gen-random 0|1|2 COUNT'
2828 Emit COUNT random bytes of the given quality level 0, 1 or 2. If
2829 COUNT is not given or zero, an endless sequence of random bytes
2830 will be emitted. If used with '--armor' the output will be base64
2831 encoded. PLEASE, don't use this command unless you know what you
2832 are doing; it may remove precious entropy from the system!
2834 '--gen-prime MODE BITS'
2835 Use the source, Luke :-). The output format is subject to change
2840 Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
2841 This is a GnuPG extension to OpenPGP and in general not very
2844 '--tofu-policy {auto|good|unknown|bad|ask} KEYS'
2845 Set the TOFU policy for all the bindings associated with the
2846 specified KEYS. For more information about the meaning of the
2847 policies, *note trust-model-tofu::. The KEYS may be specified
2848 either by their fingerprint (preferred) or their keyid.
2851 File: gnupg.info, Node: OpenPGP Key Management, Prev: Operational GPG Commands, Up: GPG Commands
2853 4.1.3 How to manage your keys
2854 -----------------------------
2856 This section explains the main commands for key management.
2858 '--quick-generate-key USER-ID [ALGO [USAGE [EXPIRE]]]'
2860 This is a simple command to generate a standard key with one user
2861 id. In contrast to '--generate-key' the key is generated directly
2862 without the need to answer a bunch of prompts. Unless the option
2863 '--yes' is given, the key creation will be canceled if the given
2864 user id already exists in the keyring.
2866 If invoked directly on the console without any special options an
2867 answer to a "Continue?" style confirmation prompt is required. In
2868 case the user id already exists in the keyring a second prompt to
2869 force the creation of the key will show up.
2871 If ALGO or USAGE are given, only the primary key is created and no
2872 prompts are shown. To specify an expiration date but still create
2873 a primary and subkey use "default" or "future-default" for ALGO and
2874 "default" for USAGE. For a description of these optional arguments
2875 see the command '--quick-add-key'. The USAGE accepts also the
2876 value "cert" which can be used to create a certification only
2877 primary key; the default is to a create certification and signing
2880 The EXPIRE argument can be used to specify an expiration date for
2881 the key. Several formats are supported; commonly the ISO formats
2882 "YYYY-MM-DD" or "YYYYMMDDThhmmss" are used. To make the key expire
2883 in N seconds, N days, N weeks, N months, or N years use
2884 "seconds=N", "Nd", "Nw", "Nm", or "Ny" respectively. Not
2885 specifying a value, or using "-" results in a key expiring in a
2886 reasonable default interval. The values "never", "none" can be
2887 used for no expiration date.
2889 If this command is used with '--batch', '--pinentry-mode' has been
2890 set to 'loopback', and one of the passphrase options
2891 ('--passphrase', '--passphrase-fd', or '--passphrase-file') is
2892 used, the supplied passphrase is used for the new key and the agent
2893 does not ask for it. To create a key without any protection
2894 '--passphrase ''' may be used.
2896 To create an OpenPGP key from the keys available on the currently
2897 inserted smartcard, the special string "card" can be used for ALGO.
2898 If the card features an encryption and a signing key, gpg will
2899 figure them out and creates an OpenPGP key consisting of the usual
2900 primary key and one subkey. This works only with certain
2901 smartcards. Note that the interactive '--full-gen-key' command
2902 allows to do the same but with greater flexibility in the selection
2903 of the smartcard keys.
2905 Note that it is possible to create a primary key and a subkey using
2906 non-default algorithms by using "default" and changing the default
2907 parameters using the option '--default-new-key-algo'.
2909 '--quick-set-expire FPR EXPIRE [*|SUBFPRS]'
2910 With two arguments given, directly set the expiration time of the
2911 primary key identified by FPR to EXPIRE. To remove the expiration
2912 time '0' can be used. With three arguments and the third given as
2913 an asterisk, the expiration time of all non-revoked and not yet
2914 expired subkeys are set to EXPIRE. With more than two arguments
2915 and a list of fingerprints given for SUBFPRS, all non-revoked
2916 subkeys matching these fingerprints are set to EXPIRE.
2918 '--quick-add-key FPR [ALGO [USAGE [EXPIRE]]]'
2919 Directly add a subkey to the key identified by the fingerprint FPR.
2920 Without the optional arguments an encryption subkey is added. If
2921 any of the arguments are given a more specific subkey is added.
2923 ALGO may be any of the supported algorithms or curve names given in
2924 the format as used by key listings. To use the default algorithm
2925 the string "default" or "-" can be used. Supported algorithms are
2926 "rsa", "dsa", "elg", "ed25519", "cv25519", and other ECC curves.
2927 For example the string "rsa" adds an RSA key with the default key
2928 length; a string "rsa4096" requests that the key length is 4096
2929 bits. The string "future-default" is an alias for the algorithm
2930 which will likely be used as default algorithm in future versions
2931 of gpg. To list the supported ECC curves the command 'gpg
2932 --with-colons --list-config curve' can be used.
2934 Depending on the given ALGO the subkey may either be an encryption
2935 subkey or a signing subkey. If an algorithm is capable of signing
2936 and encryption and such a subkey is desired, a USAGE string must be
2937 given. This string is either "default" or "-" to keep the default
2938 or a comma delimited list (or space delimited list) of keywords:
2939 "sign" for a signing subkey, "auth" for an authentication subkey,
2940 and "encr" for an encryption subkey ("encrypt" can be used as alias
2941 for "encr"). The valid combinations depend on the algorithm.
2943 The EXPIRE argument can be used to specify an expiration date for
2944 the key. Several formats are supported; commonly the ISO formats
2945 "YYYY-MM-DD" or "YYYYMMDDThhmmss" are used. To make the key expire
2946 in N seconds, N days, N weeks, N months, or N years use
2947 "seconds=N", "Nd", "Nw", "Nm", or "Ny" respectively. Not
2948 specifying a value, or using "-" results in a key expiring in a
2949 reasonable default interval. The values "never", "none" can be
2950 used for no expiration date.
2954 Generate a new key pair using the current default parameters. This
2955 is the standard command to create a new key. In addition to the
2956 key a revocation certificate is created and stored in the
2957 'openpgp-revocs.d' directory below the GnuPG home directory.
2959 '--full-generate-key'
2961 Generate a new key pair with dialogs for all options. This is an
2962 extended version of '--generate-key'.
2964 There is also a feature which allows you to create keys in batch
2965 mode. See the manual section "Unattended key generation" on how to
2968 '--generate-revocation NAME'
2970 Generate a revocation certificate for the complete key. To only
2971 revoke a subkey or a key signature, use the '--edit' command.
2973 This command merely creates the revocation certificate so that it
2974 can be used to revoke the key if that is ever needed. To actually
2975 revoke a key the created revocation certificate needs to be merged
2976 with the key to revoke. This is done by importing the revocation
2977 certificate using the '--import' command. Then the revoked key
2978 needs to be published, which is best done by sending the key to a
2979 keyserver (command '--send-key') and by exporting ('--export') it
2980 to a file which is then send to frequent communication partners.
2982 '--generate-designated-revocation NAME'
2983 '--desig-revoke NAME'
2984 Generate a designated revocation certificate for a key. This
2985 allows a user (with the permission of the keyholder) to revoke
2989 Present a menu which enables you to do most of the key management
2990 related tasks. It expects the specification of a key on the
2994 Toggle selection of user ID or photographic user ID with index
2995 N. Use '*' to select all and '0' to deselect all.
2998 Toggle selection of subkey with index N or key ID N. Use '*'
2999 to select all and '0' to deselect all.
3002 Make a signature on key of user 'name'. If the key is not yet
3003 signed by the default user (or the users given with '-u'), the
3004 program displays the information of the key again, together
3005 with its fingerprint and asks whether it should be signed.
3006 This question is repeated for all users specified with '-u'.
3009 Same as "sign" but the signature is marked as non-exportable
3010 and will therefore never be used by others. This may be used
3011 to make keys valid only in the local environment.
3014 Same as "sign" but the signature is marked as non-revocable
3015 and can therefore never be revoked.
3018 Make a trust signature. This is a signature that combines the
3019 notions of certification (like a regular signature), and trust
3020 (like the "trust" command). It is generally only useful in
3021 distinct communities or groups. For more information please
3022 read the sections "Trust Signature" and "Regular Expression"
3025 Note that "l" (for local / non-exportable), "nr" (for
3026 non-revocable, and "t" (for trust) may be freely mixed and prefixed
3027 to "sign" to create a signature of any type desired.
3029 If the option '--only-sign-text-ids' is specified, then any
3030 non-text based user ids (e.g., photo IDs) will not be selected for
3034 Delete a signature. Note that it is not possible to retract a
3035 signature, once it has been send to the public (i.e. to a
3036 keyserver). In that case you better use 'revsig'.
3039 Revoke a signature. For every signature which has been
3040 generated by one of the secret keys, GnuPG asks whether a
3041 revocation certificate should be generated.
3044 Check the signatures on all selected user IDs. With the extra
3045 option 'selfsig' only self-signatures are shown.
3048 Create an additional user ID.
3051 Create a photographic user ID. This will prompt for a JPEG
3052 file that will be embedded into the user ID. Note that a very
3053 large JPEG will make for a very large key. Also note that
3054 some programs will display your JPEG unchanged (GnuPG), and
3055 some programs will scale it to fit in a dialog box (PGP).
3058 Display the selected photographic user ID.
3061 Delete a user ID or photographic user ID. Note that it is not
3062 possible to retract a user id, once it has been send to the
3063 public (i.e. to a keyserver). In that case you better use
3067 Revoke a user ID or photographic user ID.
3070 Flag the current user id as the primary one, removes the
3071 primary user id flag from all other user ids and sets the
3072 timestamp of all affected self-signatures one second ahead.
3073 Note that setting a photo user ID as primary makes it primary
3074 over other photo user IDs, and setting a regular user ID as
3075 primary makes it primary over other regular user IDs.
3078 Set a preferred keyserver for the specified user ID(s). This
3079 allows other users to know where you prefer they get your key
3080 from. See '--keyserver-options honor-keyserver-url' for more
3081 on how this works. Setting a value of "none" removes an
3082 existing preferred keyserver.
3085 Set a name=value notation for the specified user ID(s). See
3086 '--cert-notation' for more on how this works. Setting a value
3087 of "none" removes all notations, setting a notation prefixed
3088 with a minus sign (-) removes that notation, and setting a
3089 notation name (without the =value) prefixed with a minus sign
3090 removes all notations with that name.
3093 List preferences from the selected user ID. This shows the
3094 actual preferences, without including any implied preferences.
3097 More verbose preferences listing for the selected user ID.
3098 This shows the preferences in effect by including the implied
3099 preferences of 3DES (cipher), SHA-1 (digest), and Uncompressed
3100 (compression) if they are not already included in the
3101 preference list. In addition, the preferred keyserver and
3102 signature notations (if any) are shown.
3105 Set the list of user ID preferences to STRING for all (or just
3106 the selected) user IDs. Calling setpref with no arguments
3107 sets the preference list to the default (either built-in or
3108 set via '--default-preference-list'), and calling setpref with
3109 "none" as the argument sets an empty preference list. Use
3110 'gpg --version' to get a list of available algorithms. Note
3111 that while you can change the preferences on an attribute user
3112 ID (aka "photo ID"), GnuPG does not select keys via attribute
3113 user IDs so these preferences will not be used by GnuPG.
3115 When setting preferences, you should list the algorithms in
3116 the order which you'd like to see them used by someone else
3117 when encrypting a message to your key. If you don't include
3118 3DES, it will be automatically added at the end. Note that
3119 there are many factors that go into choosing an algorithm (for
3120 example, your key may not be the only recipient), and so the
3121 remote OpenPGP application being used to send to you may or
3122 may not follow your exact chosen order for a given message.
3123 It will, however, only choose an algorithm that is present on
3124 the preference list of every recipient key. See also the
3125 INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
3128 Add a subkey to this key.
3131 Generate a subkey on a card and add it to this key.
3134 Transfer the selected secret subkey (or the primary key if no
3135 subkey has been selected) to a smartcard. The secret key in
3136 the keyring will be replaced by a stub if the key could be
3137 stored successfully on the card and you use the save command
3138 later. Only certain key types may be transferred to the card.
3139 A sub menu allows you to select on what card to store the key.
3140 Note that it is not possible to get that key back from the
3141 card - if the card gets broken your secret key will be lost
3142 unless you have a backup somewhere.
3145 Restore the given FILE to a card. This command may be used to
3146 restore a backup key (as generated during card initialization)
3147 to a new card. In almost all cases this will be the
3148 encryption key. You should use this command only with the
3149 corresponding public key and make sure that the file given as
3150 argument is indeed the backup to restore. You should then
3151 select 2 to restore as encryption key. You will first be
3152 asked to enter the passphrase of the backup key and then for
3153 the Admin PIN of the card.
3156 Remove a subkey (secondary key). Note that it is not possible
3157 to retract a subkey, once it has been send to the public (i.e.
3158 to a keyserver). In that case you better use 'revkey'. Also
3159 note that this only deletes the public part of a key.
3165 Change the key or subkey expiration time. If a subkey is
3166 selected, the expiration time of this subkey will be changed.
3167 With no selection, the key expiration of the primary key is
3171 Change the owner trust value for the key. This updates the
3172 trust-db immediately and no save is required.
3176 Disable or enable an entire key. A disabled key can not
3177 normally be used for encryption.
3180 Add a designated revoker to the key. This takes one optional
3181 argument: "sensitive". If a designated revoker is marked as
3182 sensitive, it will not be exported by default (see
3186 Change the passphrase of the secret key.
3189 This is dummy command which exists only for backward
3193 Compact (by removing all signatures except the selfsig) any
3194 user ID that is no longer usable (e.g. revoked, or expired).
3195 Then, remove any signatures that are not usable by the trust
3196 calculations. Specifically, this removes any signature that
3197 does not validate, any signature that is superseded by a later
3198 signature, revoked signatures, and signatures issued by keys
3199 that are not present on the keyring.
3202 Make the key as small as possible. This removes all
3203 signatures from each user ID except for the most recent
3207 Change the usage flags (capabilities) of the primary key or of
3208 subkeys. These usage flags (e.g. Certify, Sign,
3209 Authenticate, Encrypt) are set during key creation. Sometimes
3210 it is useful to have the opportunity to change them (for
3211 example to add Authenticate) after they have been created.
3212 Please take care when doing this; the allowed usage flags
3213 depend on the key algorithm.
3216 Add cross-certification signatures to signing subkeys that may
3217 not currently have them. Cross-certification signatures
3218 protect against a subtle attack against signing subkeys. See
3219 '--require-cross-certification'. All new keys generated have
3220 this signature by default, so this command is only useful to
3221 bring older keys up to date.
3224 Save all changes to the keyring and quit.
3227 Quit the program without updating the keyring.
3229 The listing shows you the key with its secondary keys and all user
3230 IDs. The primary user ID is indicated by a dot, and selected keys
3231 or user IDs are indicated by an asterisk. The trust value is
3232 displayed with the primary key: "trust" is the assigned owner trust
3233 and "validity" is the calculated validity of the key. Validity
3234 values are also displayed for all user IDs. For possible values of
3235 trust, *note trust-values::.
3238 Signs a public key with your secret key. This is a shortcut
3239 version of the subcommand "sign" from '--edit'.
3242 Signs a public key with your secret key but marks it as
3243 non-exportable. This is a shortcut version of the subcommand
3244 "lsign" from '--edit-key'.
3246 '--quick-sign-key FPR [NAMES]'
3247 '--quick-lsign-key FPR [NAMES]'
3248 Directly sign a key from the passphrase without any further user
3249 interaction. The FPR must be the verified primary fingerprint of a
3250 key in the local keyring. If no NAMES are given, all useful user
3251 ids are signed; with given [NAMES] only useful user ids matching
3252 one of theses names are signed. By default, or if a name is
3253 prefixed with a '*', a case insensitive substring match is used.
3254 If a name is prefixed with a '=' a case sensitive exact match is
3257 The command '--quick-lsign-key' marks the signatures as
3258 non-exportable. If such a non-exportable signature already exists
3259 the '--quick-sign-key' turns it into a exportable signature. If
3260 you need to update an existing signature, for example to add or
3261 change notation data, you need to use the option
3264 This command uses reasonable defaults and thus does not provide the
3265 full flexibility of the "sign" subcommand from '--edit-key'. Its
3266 intended use is to help unattended key signing by utilizing a list
3267 of verified fingerprints.
3269 '--quick-add-uid USER-ID NEW-USER-ID'
3270 This command adds a new user id to an existing key. In contrast to
3271 the interactive sub-command 'adduid' of '--edit-key' the
3272 NEW-USER-ID is added verbatim with only leading and trailing white
3273 space removed, it is expected to be UTF-8 encoded, and no checks on
3274 its form are applied.
3276 '--quick-revoke-uid USER-ID USER-ID-TO-REVOKE'
3277 This command revokes a user ID on an existing key. It cannot be
3278 used to revoke the last user ID on key (some non-revoked user ID
3279 must remain), with revocation reason "User ID is no longer valid".
3280 If you want to specify a different revocation reason, or to supply
3281 supplementary revocation text, you should use the interactive
3282 sub-command 'revuid' of '--edit-key'.
3284 '--quick-revoke-sig FPR SIGNING-FPR [NAMES]'
3285 This command revokes the key signatures made by SIGNING-FPR from
3286 the key specified by the fingerprint FPR. With NAMES given only
3287 the signatures on user ids of the key matching any of the given
3288 names are affected (see '--quick-sign-key'). If a revocation
3289 already exists a notice is printed instead of creating a new
3290 revocation; no error is returned in this case. Note that key
3291 signature revocations may be superseded by a newer key signature
3292 and in turn again revoked.
3294 '--quick-set-primary-uid USER-ID PRIMARY-USER-ID'
3295 This command sets or updates the primary user ID flag on an
3296 existing key. USER-ID specifies the key and PRIMARY-USER-ID the
3297 user ID which shall be flagged as the primary user ID. The primary
3298 user ID flag is removed from all other user ids and the timestamp
3299 of all affected self-signatures is set one second ahead.
3301 '--change-passphrase USER-ID'
3303 Change the passphrase of the secret key belonging to the
3304 certificate specified as USER-ID. This is a shortcut for the
3305 sub-command 'passwd' of the edit key menu. When using together
3306 with the option '--dry-run' this will not actually change the
3307 passphrase but check that the current passphrase is correct.
3310 File: gnupg.info, Node: GPG Options, Next: GPG Configuration, Prev: GPG Commands, Up: Invoking GPG
3315 'gpg' features a bunch of options to control the exact behaviour and to
3316 change the default configuration.
3320 * GPG Configuration Options:: How to change the configuration.
3321 * GPG Key related Options:: Key related options.
3322 * GPG Input and Output:: Input and Output.
3323 * OpenPGP Options:: OpenPGP protocol specific options.
3324 * Compliance Options:: Compliance options.
3325 * GPG Esoteric Options:: Doing things one usually doesn't want to do.
3326 * Deprecated Options:: Deprecated options.
3328 Long options can be put in an options file (default
3329 "~/.gnupg/gpg.conf"). Short option names will not work - for example,
3330 "armor" is a valid option for the options file, while "a" is not. Do
3331 not write the 2 dashes, but simply the name of the option and any
3332 required arguments. Lines with a hash ('#') as the first
3333 non-white-space character are ignored. Commands may be put in this file
3334 too, but that is not generally useful as the command will execute
3335 automatically with every execution of gpg.
3337 Please remember that option parsing stops as soon as a non-option is
3338 encountered, you can explicitly stop parsing by using the special option
3342 File: gnupg.info, Node: GPG Configuration Options, Next: GPG Key related Options, Up: GPG Options
3344 4.2.1 How to change the configuration
3345 -------------------------------------
3347 These options are used to change the configuration and most of them are
3348 usually found in the option file.
3350 '--default-key NAME'
3351 Use NAME as the default key to sign with. If this option is not
3352 used, the default key is the first key found in the secret keyring.
3353 Note that '-u' or '--local-user' overrides this option. This
3354 option may be given multiple times. In this case, the last key for
3355 which a secret key is available is used. If there is no secret key
3356 available for any of the specified values, GnuPG will not emit an
3357 error message but continue as if this option wasn't given.
3359 '--default-recipient NAME'
3360 Use NAME as default recipient if option '--recipient' is not used
3361 and don't ask if this is a valid one. NAME must be non-empty.
3363 '--default-recipient-self'
3364 Use the default key as default recipient if option '--recipient' is
3365 not used and don't ask if this is a valid one. The default key is
3366 the first one from the secret keyring or the one set with
3369 '--no-default-recipient'
3370 Reset '--default-recipient' and '--default-recipient-self'. Should
3371 not be used in an option file.
3374 Give more information during processing. If used twice, the input
3375 data is listed in detail.
3378 Reset verbose level to 0. Should not be used in an option file.
3381 Try to be as quiet as possible. Should not be used in an option
3386 Use batch mode. Never ask, do not allow interactive commands.
3387 '--no-batch' disables this option. Note that even with a filename
3388 given on the command line, gpg might still need to read from STDIN
3389 (in particular if gpg figures that the input is a detached
3390 signature and no data file has been specified). Thus if you do not
3391 want to feed data via STDIN, you should connect STDIN to
3394 It is highly recommended to use this option along with the options
3395 '--status-fd' and '--with-colons' for any unattended use of 'gpg'.
3396 Should not be used in an option file.
3399 Make sure that the TTY (terminal) is never used for any output.
3400 This option is needed in some cases because GnuPG sometimes prints
3401 warnings to the TTY even if '--batch' is used.
3404 Assume "yes" on most questions. Should not be used in an option
3408 Assume "no" on most questions. Should not be used in an option
3411 '--list-options PARAMETERS'
3412 This is a space or comma delimited string that gives options used
3413 when listing keys and signatures (that is, '--list-keys',
3414 '--check-signatures', '--list-public-keys', '--list-secret-keys',
3415 and the '--edit-key' functions). Options can be prepended with a
3416 'no-' (after the two dashes) to give the opposite meaning. The
3420 Causes '--list-keys', '--check-signatures',
3421 '--list-public-keys', and '--list-secret-keys' to display any
3422 photo IDs attached to the key. Defaults to no. See also
3423 '--photo-viewer'. Does not work with '--with-colons': see
3424 '--attribute-fd' for the appropriate way to get photo data for
3425 scripts and other frontends.
3428 Show usage information for keys and subkeys in the standard
3429 key listing. This is a list of letters indicating the allowed
3430 usage for a key ('E'=encryption, 'S'=signing,
3431 'C'=certification, 'A'=authentication). Defaults to yes.
3434 Show policy URLs in the '--check-signatures' listings.
3440 Show all, IETF standard, or user-defined signature notations
3441 in the '--check-signatures' listings. Defaults to no.
3444 Show any preferred keyserver URL in the '--check-signatures'
3445 listings. Defaults to no.
3448 Display the calculated validity of user IDs during key
3449 listings. Defaults to yes.
3452 Show revoked and expired user IDs in key listings. Defaults
3455 show-unusable-subkeys
3456 Show revoked and expired subkeys in key listings. Defaults to
3460 Display the keyring name at the head of key listings to show
3461 which keyring a given key resides on. Defaults to no.
3464 Show signature expiration dates (if any) during
3465 '--check-signatures' listings. Defaults to no.
3468 Include signature subpackets in the key listing. This option
3469 can take an optional argument list of the subpackets to list.
3470 If no argument is passed, list all subpackets. Defaults to
3471 no. This option is only meaningful when using '--with-colons'
3472 along with '--check-signatures'.
3475 For each user-id which has a valid mail address print only the
3476 fingerprint followed by the mail address.
3478 '--verify-options PARAMETERS'
3479 This is a space or comma delimited string that gives options used
3480 when verifying signatures. Options can be prepended with a 'no-'
3481 to give the opposite meaning. The options are:
3484 Display any photo IDs present on the key that issued the
3485 signature. Defaults to no. See also '--photo-viewer'.
3488 Show policy URLs in the signature being verified. Defaults to
3494 Show all, IETF standard, or user-defined signature notations
3495 in the signature being verified. Defaults to IETF standard.
3498 Show any preferred keyserver URL in the signature being
3499 verified. Defaults to yes.
3502 Display the calculated validity of the user IDs on the key
3503 that issued the signature. Defaults to yes.
3506 Show revoked and expired user IDs during signature
3507 verification. Defaults to no.
3509 show-primary-uid-only
3510 Show only the primary user ID during signature verification.
3511 That is all the AKA lines as well as photo Ids are not shown
3512 with the signature verification status.
3515 Enable PKA lookups to verify sender addresses. Note that PKA
3516 is based on DNS, and so enabling this option may disclose
3517 information on when and what signatures are verified or to
3518 whom data is encrypted. This is similar to the "web bug"
3519 described for the '--auto-key-retrieve' option.
3522 Raise the trust in a signature to full if the signature passes
3523 PKA validation. This option is only meaningful if pka-lookups
3526 '--enable-large-rsa'
3527 '--disable-large-rsa'
3528 With -generate-key and -batch, enable the creation of RSA secret
3529 keys as large as 8192 bit. Note: 8192 bit is more than is
3530 generally recommended. These large keys don't significantly
3531 improve security, but they are more expensive to use, and their
3532 signatures and certifications are larger. This option is only
3533 available if the binary was build with large-secmem support.
3537 Enable hash truncation for all DSA keys even for old DSA Keys up to
3538 1024 bit. This is also the default with '--openpgp'. Note that
3539 older versions of GnuPG also required this flag to allow the
3540 generation of DSA larger than 1024 bit.
3542 '--photo-viewer STRING'
3543 This is the command line that should be run to view a photo ID.
3544 "%i" will be expanded to a filename containing the photo. "%I"
3545 does the same, except the file will not be deleted once the viewer
3546 exits. Other flags are "%k" for the key ID, "%K" for the long key
3547 ID, "%f" for the key fingerprint, "%t" for the extension of the
3548 image type (e.g. "jpg"), "%T" for the MIME type of the image (e.g.
3549 "image/jpeg"), "%v" for the single-character calculated validity of
3550 the image being viewed (e.g. "f"), "%V" for the calculated
3551 validity as a string (e.g. "full"), "%U" for a base32 encoded hash
3552 of the user ID, and "%%" for an actual percent sign. If neither %i
3553 or %I are present, then the photo will be supplied to the viewer on
3556 On Unix the default viewer is 'xloadimage -fork -quiet -title
3557 'KeyID 0x%k' STDIN' with a fallback to 'display -title 'KeyID 0x%k'
3558 %i' and finally to 'xdg-open %i'. On Windows '!ShellExecute 400
3559 %i' is used; here the command is a meta command to use that API
3560 call followed by a wait time in milliseconds which is used to give
3561 the viewer time to read the temporary image file before gpg deletes
3562 it again. Note that if your image viewer program is not secure,
3563 then executing it from gpg does not make it secure.
3565 '--exec-path STRING'
3566 Sets a list of directories to search for photo viewers If not
3567 provided photo viewers use the 'PATH' environment variable.
3570 Add FILE to the current list of keyrings. If FILE begins with a
3571 tilde and a slash, these are replaced by the $HOME directory. If
3572 the filename does not contain a slash, it is assumed to be in the
3573 GnuPG home directory ("~/.gnupg" unless '--homedir' or $GNUPGHOME
3576 Note that this adds a keyring to the current list. If the intent
3577 is to use the specified keyring alone, use '--keyring' along with
3578 '--no-default-keyring'.
3580 If the option '--no-keyring' has been used no keyrings will be used
3583 '--primary-keyring FILE'
3584 This is a varian of '--keyring' and designates FILE as the primary
3585 public keyring. This means that newly imported keys (via
3586 '--import' or keyserver '--recv-from') will go to this keyring.
3588 '--secret-keyring FILE'
3589 This is an obsolete option and ignored. All secret keys are stored
3590 in the 'private-keys-v1.d' directory below the GnuPG home
3593 '--trustdb-name FILE'
3594 Use FILE instead of the default trustdb. If FILE begins with a
3595 tilde and a slash, these are replaced by the $HOME directory. If
3596 the filename does not contain a slash, it is assumed to be in the
3597 GnuPG home directory ('~/.gnupg' if '--homedir' or $GNUPGHOME is
3601 Set the name of the home directory to DIR. If this option is not
3602 used, the home directory defaults to '~/.gnupg'. It is only
3603 recognized when given on the command line. It also overrides any
3604 home directory stated through the environment variable 'GNUPGHOME'
3605 or (on Windows systems) by means of the Registry entry
3606 HKCU\SOFTWARE\GNU\GNUPG:HOMEDIR.
3608 On Windows systems it is possible to install GnuPG as a portable
3609 application. In this case only this command line option is
3610 considered, all other ways to set a home directory are ignored.
3612 To install GnuPG as a portable application under Windows, create an
3613 empty file named 'gpgconf.ctl' in the same directory as the tool
3614 'gpgconf.exe'. The root of the installation is then that
3615 directory; or, if 'gpgconf.exe' has been installed directly below a
3616 directory named 'bin', its parent directory. You also need to make
3617 sure that the following directories exist and are writable:
3618 'ROOT/home' for the GnuPG home and 'ROOT/usr/local/var/cache/gnupg'
3619 for internal cache files.
3621 '--display-charset NAME'
3622 Set the name of the native character set. This is used to convert
3623 some informational strings like user IDs to the proper UTF-8
3624 encoding. Note that this has nothing to do with the character set
3625 of data to be encrypted or signed; GnuPG does not recode
3626 user-supplied data. If this option is not used, the default
3627 character set is determined from the current locale. A verbosity
3628 level of 3 shows the chosen set. This option should not be used on
3629 Windows. Valid values for NAME are:
3632 This is the Latin 1 set.
3638 This is currently an alias for the Latin 1 set.
3641 The usual Russian set (RFC-1489).
3644 Bypass all translations and assume that the OS uses native
3649 Assume that command line arguments are given as UTF-8 strings. The
3650 default ('--no-utf8-strings') is to assume that arguments are
3651 encoded in the character set as specified by '--display-charset'.
3652 These options affect all following arguments. Both options may be
3653 used multiple times. This option should not be used in an option
3656 This option has no effect on Windows. There the internal used
3657 UTF-8 encoding is translated for console input and output. The
3658 command line arguments are expected as Unicode and translated to
3659 UTF-8. Thus when calling this program from another, make sure to
3660 use the Unicode version of CreateProcess.
3663 Read options from FILE and do not try to read them from the default
3664 options file in the homedir (see '--homedir'). This option is
3665 ignored if used in an options file.
3668 Shortcut for '--options /dev/null'. This option is detected before
3669 an attempt to open an option file. Using this option will also
3670 prevent the creation of a '~/.gnupg' homedir.
3673 '--compress-level N'
3674 '--bzip2-compress-level N'
3675 Set compression level to N for the ZIP and ZLIB compression
3676 algorithms. The default is to use the default compression level of
3677 zlib (normally 6). '--bzip2-compress-level' sets the compression
3678 level for the BZIP2 compression algorithm (defaulting to 6 as
3679 well). This is a different option from '--compress-level' since
3680 BZIP2 uses a significant amount of memory for each additional
3681 compression level. '-z' sets both. A value of 0 for N disables
3684 '--bzip2-decompress-lowmem'
3685 Use a different decompression method for BZIP2 compressed files.
3686 This alternate method uses a bit more than half the memory, but
3687 also runs at half the speed. This is useful under extreme low
3688 memory circumstances when the file was originally compressed at a
3689 high '--bzip2-compress-level'.
3691 '--mangle-dos-filenames'
3692 '--no-mangle-dos-filenames'
3693 Older version of Windows cannot handle filenames with more than one
3694 dot. '--mangle-dos-filenames' causes GnuPG to replace (rather than
3695 add to) the extension of an output filename to avoid this problem.
3696 This option is off by default and has no effect on non-Windows
3700 '--no-ask-cert-level'
3701 When making a key signature, prompt for a certification level. If
3702 this option is not specified, the certification level used is set
3703 via '--default-cert-level'. See '--default-cert-level' for
3704 information on the specific levels and how they are used.
3705 '--no-ask-cert-level' disables this option. This option defaults
3708 '--default-cert-level N'
3709 The default to use for the check level when signing a key.
3711 0 means you make no particular claim as to how carefully you
3714 1 means you believe the key is owned by the person who claims to
3715 own it but you could not, or did not verify the key at all. This
3716 is useful for a "persona" verification, where you sign the key of a
3719 2 means you did casual verification of the key. For example, this
3720 could mean that you verified the key fingerprint and checked the
3721 user ID on the key against a photo ID.
3723 3 means you did extensive verification of the key. For example,
3724 this could mean that you verified the key fingerprint with the
3725 owner of the key in person, and that you checked, by means of a
3726 hard to forge document with a photo ID (such as a passport) that
3727 the name of the key owner matches the name in the user ID on the
3728 key, and finally that you verified (by exchange of email) that the
3729 email address on the key belongs to the key owner.
3731 Note that the examples given above for levels 2 and 3 are just
3732 that: examples. In the end, it is up to you to decide just what
3733 "casual" and "extensive" mean to you.
3735 This option defaults to 0 (no particular claim).
3738 When building the trust database, treat any signatures with a
3739 certification level below this as invalid. Defaults to 2, which
3740 disregards level 1 signatures. Note that level 0 "no particular
3741 claim" signatures are always accepted.
3743 '--trusted-key LONG KEY ID OR FINGERPRINT'
3744 Assume that the specified key (which should be given as
3745 fingerprint) is as trustworthy as one of your own secret keys.
3746 This option is useful if you don't want to keep your secret keys
3747 (or one of them) online but still want to be able to check the
3748 validity of a given recipient's or signator's key. If the given
3749 key is not locally available but an LDAP keyserver is configured
3750 the missing key is imported from that server.
3752 '--trust-model {pgp|classic|tofu|tofu+pgp|direct|always|auto}'
3753 Set what trust model GnuPG should follow. The models are:
3756 This is the Web of Trust combined with trust signatures as
3757 used in PGP 5.x and later. This is the default trust model
3758 when creating a new trust database.
3761 This is the standard Web of Trust as introduced by PGP 2.
3764 TOFU stands for Trust On First Use. In this trust model, the
3765 first time a key is seen, it is memorized. If later another
3766 key with a user id with the same email address is seen, both
3767 keys are marked as suspect. In that case, the next time
3768 either is used, a warning is displayed describing the
3769 conflict, why it might have occurred (either the user
3770 generated a new key and failed to cross sign the old and new
3771 keys, the key is forgery, or a man-in-the-middle attack is
3772 being attempted), and the user is prompted to manually confirm
3773 the validity of the key in question.
3775 Because a potential attacker is able to control the email
3776 address and thereby circumvent the conflict detection
3777 algorithm by using an email address that is similar in
3778 appearance to a trusted email address, whenever a message is
3779 verified, statistics about the number of messages signed with
3780 the key are shown. In this way, a user can easily identify
3781 attacks using fake keys for regular correspondents.
3783 When compared with the Web of Trust, TOFU offers significantly
3784 weaker security guarantees. In particular, TOFU only helps
3785 ensure consistency (that is, that the binding between a key
3786 and email address doesn't change). A major advantage of TOFU
3787 is that it requires little maintenance to use correctly. To
3788 use the web of trust properly, you need to actively sign keys
3789 and mark users as trusted introducers. This is a
3790 time-consuming process and anecdotal evidence suggests that
3791 even security-conscious users rarely take the time to do this
3792 thoroughly and instead rely on an ad-hoc TOFU process.
3794 In the TOFU model, policies are associated with bindings
3795 between keys and email addresses (which are extracted from
3796 user ids and normalized). There are five policies, which can
3797 be set manually using the '--tofu-policy' option. The default
3798 policy can be set using the '--tofu-default-policy' option.
3800 The TOFU policies are: 'auto', 'good', 'unknown', 'bad' and
3801 'ask'. The 'auto' policy is used by default (unless
3802 overridden by '--tofu-default-policy') and marks a binding as
3803 marginally trusted. The 'good', 'unknown' and 'bad' policies
3804 mark a binding as fully trusted, as having unknown trust or as
3805 having trust never, respectively. The 'unknown' policy is
3806 useful for just using TOFU to detect conflicts, but to never
3807 assign positive trust to a binding. The final policy, 'ask'
3808 prompts the user to indicate the binding's trust. If batch
3809 mode is enabled (or input is inappropriate in the context),
3810 then the user is not prompted and the 'undefined' trust level
3814 This trust model combines TOFU with the Web of Trust. This is
3815 done by computing the trust level for each model and then
3816 taking the maximum trust level where the trust levels are
3817 ordered as follows: 'unknown < undefined < marginal < fully <
3818 ultimate < expired < never'.
3820 By setting '--tofu-default-policy=unknown', this model can be
3821 used to implement the web of trust with TOFU's conflict
3822 detection algorithm, but without its assignment of positive
3823 trust values, which some security-conscious users don't like.
3826 Key validity is set directly by the user and not calculated
3827 via the Web of Trust. This model is solely based on the key
3828 and does not distinguish user IDs. Note that when changing to
3829 another trust model the trust values assigned to a key are
3830 transformed into ownertrust values, which also indicate how
3831 you trust the owner of the key to sign other keys.
3834 Skip key validation and assume that used keys are always fully
3835 valid. You generally won't use this unless you are using some
3836 external validation scheme. This option also suppresses the
3837 "[uncertain]" tag printed with signature checks when there is
3838 no evidence that the user ID is bound to the key. Note that
3839 this trust model still does not allow the use of expired,
3840 revoked, or disabled keys.
3843 Select the trust model depending on whatever the internal
3844 trust database says. This is the default model if such a
3845 database already exists. Note that a tofu trust model is not
3846 considered here and must be enabled explicitly.
3848 '--auto-key-locate MECHANISMS'
3849 '--no-auto-key-locate'
3850 GnuPG can automatically locate and retrieve keys as needed using
3851 this option. This happens when encrypting to an email address (in
3852 the "user@example.com" form), and there are no "user@example.com"
3853 keys on the local keyring. This option takes any number of the
3854 mechanisms listed below, in the order they are to be tried.
3855 Instead of listing the mechanisms as comma delimited arguments, the
3856 option may also be given several times to add more mechanism. The
3857 option '--no-auto-key-locate' or the mechanism "clear" resets the
3858 list. The default is "local,wkd".
3861 Locate a key using DNS CERT, as specified in RFC-4398.
3864 Locate a key using DNS PKA.
3867 Locate a key using DANE, as specified in
3868 draft-ietf-dane-openpgpkey-05.txt.
3871 Locate a key using the Web Key Directory protocol.
3874 Using DNS Service Discovery, check the domain in question for
3875 any LDAP keyservers to use. If this fails, attempt to locate
3876 the key using the PGP Universal method of checking
3877 'ldap://keys.(thedomain)'.
3880 Locate the key using the Active Directory (Windows only).
3881 This method also allows to search by fingerprint using the
3882 command '--locate-external-key'. Note that this mechanism is
3883 actually a shortcut for the mechanism 'keyserver' but using
3884 "ldap:///" as the keyserver.
3887 Locate a key using a keyserver. This method also allows to
3888 search by fingerprint using the command
3889 '--locate-external-key' if any of the configured keyservers is
3893 In addition, a keyserver URL as used in the 'dirmngr'
3894 configuration may be used here to query that particular
3895 keyserver. This method also allows to search by fingerprint
3896 using the command '--locate-external-key' if the URL specifies
3900 Locate the key using the local keyrings. This mechanism
3901 allows the user to select the order a local key lookup is
3902 done. Thus using '--auto-key-locate local' is identical to
3903 '--no-auto-key-locate'.
3906 This flag disables the standard local key lookup, done before
3907 any of the mechanisms defined by the '--auto-key-locate' are
3908 tried. The position of this mechanism in the list does not
3909 matter. It is not required if 'local' is also used.
3912 Clear all defined mechanisms. This is useful to override
3913 mechanisms given in a config file. Note that a 'nodefault' in
3914 MECHANISMS will also be cleared unless it is given after the
3918 '--no-auto-key-import'
3919 This is an offline mechanism to get a missing key for signature
3920 verification and for later encryption to this key. If this option
3921 is enabled and a signature includes an embedded key, that key is
3922 used to verify the signature and on verification success that key
3923 is imported. The default is '--no-auto-key-import'.
3925 On the sender (signing) site the option '--include-key-block' needs
3926 to be used to put the public part of the signing key as “Key Block
3927 subpacket” into the signature.
3929 '--auto-key-retrieve'
3930 '--no-auto-key-retrieve'
3931 These options enable or disable the automatic retrieving of keys
3932 from a keyserver when verifying signatures made by keys that are
3933 not on the local keyring. The default is '--no-auto-key-retrieve'.
3935 The order of methods tried to lookup the key is:
3937 1. If the option '--auto-key-import' is set and the signatures
3938 includes an embedded key, that key is used to verify the signature
3939 and on verification success that key is imported.
3941 2. If a preferred keyserver is specified in the signature and the
3942 option 'honor-keyserver-url' is active (which is not the default),
3943 that keyserver is tried. Note that the creator of the signature
3944 uses the option '--sig-keyserver-url' to specify the preferred
3945 keyserver for data signatures.
3947 3. If the signature has the Signer's UID set (e.g. using
3948 '--sender' while creating the signature) a Web Key Directory (WKD)
3949 lookup is done. This is the default configuration but can be
3950 disabled by removing WKD from the auto-key-locate list or by using
3951 the option '--disable-signer-uid'.
3953 4. If the option 'honor-pka-record' is active, the legacy PKA
3956 5. If any keyserver is configured and the Issuer Fingerprint is
3957 part of the signature (since GnuPG 2.1.16), the configured
3958 keyservers are tried.
3960 Note that this option makes a "web bug" like behavior possible.
3961 Keyserver or Web Key Directory operators can see which keys you
3962 request, so by sending you a message signed by a brand new key
3963 (which you naturally will not have on your local keyring), the
3964 operator can tell both your IP address and the time when you
3965 verified the signature.
3967 '--keyid-format {none|short|0xshort|long|0xlong}'
3968 Select how to display key IDs. "none" does not show the key ID at
3969 all but shows the fingerprint in a separate line. "short" is the
3970 traditional 8-character key ID. "long" is the more accurate (but
3971 less convenient) 16-character key ID. Add an "0x" to either to
3972 include an "0x" at the beginning of the key ID, as in 0x99242560.
3973 Note that this option is ignored if the option '--with-colons' is
3977 This option is deprecated - please use the '--keyserver' in
3978 'dirmngr.conf' instead.
3980 Use NAME as your keyserver. This is the server that
3981 '--receive-keys', '--send-keys', and '--search-keys' will
3982 communicate with to receive keys from, send keys to, and search for
3983 keys on. The format of the NAME is a URI:
3984 'scheme:[//]keyservername[:port]' The scheme is the type of
3985 keyserver: "hkp"/"hkps" for the HTTP (or compatible) keyservers or
3986 "ldap"/"ldaps" for the LDAP keyservers. Note that your particular
3987 installation of GnuPG may have other keyserver types available as
3988 well. Keyserver schemes are case-insensitive.
3990 Most keyservers synchronize with each other, so there is generally
3991 no need to send keys to more than one server. The keyserver
3992 'hkp://keys.gnupg.net' uses round robin DNS to give a different
3993 keyserver each time you use it.
3995 '--keyserver-options {NAME=VALUE}'
3996 This is a space or comma delimited string that gives options for
3997 the keyserver. Options can be prefixed with a 'no-' to give the
3998 opposite meaning. Valid import-options or export-options may be
3999 used here as well to apply to importing ('--recv-key') or exporting
4000 ('--send-key') a key from a keyserver. While not all options are
4001 available for all keyserver types, some common options are:
4004 When searching for a key with '--search-keys', include keys
4005 that are marked on the keyserver as revoked. Note that not
4006 all keyservers differentiate between revoked and unrevoked
4007 keys, and for such keyservers this option is meaningless.
4008 Note also that most keyservers do not have cryptographic
4009 verification of key revocations, and so turning this option
4010 off may result in skipping keys that are incorrectly marked as
4014 When searching for a key with '--search-keys', include keys
4015 that are marked on the keyserver as disabled. Note that this
4016 option is not used with HKP keyservers.
4019 This is an obsolete alias for the option 'auto-key-retrieve'.
4020 Please do not use it; it will be removed in future versions..
4023 When using '--refresh-keys', if the key in question has a
4024 preferred keyserver URL, then use that preferred keyserver to
4025 refresh the key from. In addition, if auto-key-retrieve is
4026 set, and the signature being verified has a preferred
4027 keyserver URL, then use that preferred keyserver to fetch the
4028 key from. Note that this option introduces a "web bug": The
4029 creator of the key can see when the keys is refreshed. Thus
4030 this option is not enabled by default.
4033 If '--auto-key-retrieve' is used, and the signature being
4034 verified has a PKA record, then use the PKA information to
4035 fetch the key. Defaults to "yes".
4038 When receiving a key, include subkeys as potential targets.
4039 Note that this option is not used with HKP keyservers, as they
4040 do not support retrieving keys by subkey id.
4048 These options have no more function since GnuPG 2.1. Use the
4049 'dirmngr' configuration options instead.
4051 The default list of options is: "self-sigs-only, import-clean,
4052 repair-keys, repair-pks-subkey-bug, export-attributes,
4053 honor-pka-record". However, if the actual used source is an LDAP
4054 server "no-self-sigs-only" is assumed unless "self-sigs-only" has
4055 been explictly configured.
4057 '--completes-needed N'
4058 Number of completely trusted users to introduce a new key signer
4061 '--marginals-needed N'
4062 Number of marginally trusted users to introduce a new key signer
4065 '--tofu-default-policy {auto|good|unknown|bad|ask}'
4066 The default TOFU policy (defaults to 'auto'). For more information
4067 about the meaning of this option, *note trust-model-tofu::.
4069 '--max-cert-depth N'
4070 Maximum depth of a certification chain (default is 5).
4073 Do not cache the verification status of key signatures. Caching
4074 gives a much better performance in key listings. However, if you
4075 suspect that your public keyring is not safe against write
4076 modifications, you can use this option to disable the caching. It
4077 probably does not make sense to disable it because all kind of
4078 damage can be done if someone else has write access to your public
4081 '--auto-check-trustdb'
4082 '--no-auto-check-trustdb'
4083 If GnuPG feels that its information about the Web of Trust has to
4084 be updated, it automatically runs the '--check-trustdb' command
4085 internally. This may be a time consuming process.
4086 '--no-auto-check-trustdb' disables this option.
4090 This is dummy option. 'gpg' always requires the agent.
4093 This is dummy option. It has no effect when used with 'gpg'.
4095 '--agent-program FILE'
4096 Specify an agent program to be used for secret key operations. The
4097 default value is determined by running 'gpgconf' with the option
4098 '--list-dirs'. Note that the pipe symbol ('|') is used for a
4099 regression test suite hack and may thus not be used in the file
4102 '--dirmngr-program FILE'
4103 Specify a dirmngr program to be used for keyserver access. The
4104 default value is '/usr/local/bin/dirmngr'.
4107 Entirely disable the use of the Dirmngr.
4110 Do not start the gpg-agent or the dirmngr if it has not yet been
4111 started and its service is required. This option is mostly useful
4112 on machines where the connection to gpg-agent has been redirected
4113 to another machines. If dirmngr is required on the remote machine,
4114 it may be started manually using 'gpgconf --launch dirmngr'.
4117 Lock the databases the first time a lock is requested and do not
4118 release the lock until the process terminates.
4121 Release the locks every time a lock is no longer needed. Use this
4122 to override a previous '--lock-once' from a config file.
4125 Disable locking entirely. This option should be used only in very
4126 special environments, where it can be assured that only one process
4127 is accessing those files. A bootable floppy with a stand-alone
4128 encryption system will probably use this. Improper usage of this
4129 option may lead to data and key corruption.
4131 '--exit-on-status-write-error'
4132 This option will cause write errors on the status FD to immediately
4133 terminate the process. That should in fact be the default but it
4134 never worked this way and thus we need an option to enable this, so
4135 that the change won't break applications which close their end of a
4136 status fd connected pipe too early. Using this option along with
4137 '--enable-progress-filter' may be used to cleanly cancel long
4138 running gpg operations.
4140 '--limit-card-insert-tries N'
4141 With N greater than 0 the number of prompts asking to insert a
4142 smartcard gets limited to N-1. Thus with a value of 1 gpg won't at
4143 all ask to insert a card if none has been inserted at startup.
4144 This option is useful in the configuration file in case an
4145 application does not know about the smartcard support and waits ad
4146 infinitum for an inserted card.
4148 '--no-random-seed-file'
4149 GnuPG uses a file to store its internal random pool over
4150 invocations. This makes random generation faster; however
4151 sometimes write operations are not desired. This option can be
4152 used to achieve that with the cost of slower random generation.
4155 Suppress the initial copyright message.
4157 '--no-secmem-warning'
4158 Suppress the warning about "using insecure memory".
4160 '--no-permission-warning'
4161 Suppress the warning about unsafe file and home directory
4162 ('--homedir') permissions. Note that the permission checks that
4163 GnuPG performs are not intended to be authoritative, but rather
4164 they simply warn about certain common permission problems. Do not
4165 assume that the lack of a warning means that your system is secure.
4167 Note that the warning for unsafe '--homedir' permissions cannot be
4168 suppressed in the gpg.conf file, as this would allow an attacker to
4169 place an unsafe gpg.conf file in place, and use this file to
4170 suppress warnings about itself. The '--homedir' permissions
4171 warning may only be suppressed on the command line.
4174 '--no-require-secmem'
4175 Refuse to run if GnuPG cannot get secure memory. Defaults to no
4176 (i.e. run, but give a warning).
4178 '--require-cross-certification'
4179 '--no-require-cross-certification'
4180 When verifying a signature made from a subkey, ensure that the
4181 cross certification "back signature" on the subkey is present and
4182 valid. This protects against a subtle attack against subkeys that
4183 can sign. Defaults to '--require-cross-certification' for 'gpg'.
4187 Allow the user to do certain nonsensical or "silly" things like
4188 signing an expired or revoked key, or certain potentially
4189 incompatible things like generating unusual key types. This also
4190 disables certain warning messages about potentially incompatible
4191 actions. As the name implies, this option is for experts only. If
4192 you don't fully understand the implications of what it allows you
4193 to do, leave this off. '--no-expert' disables this option.
4196 File: gnupg.info, Node: GPG Key related Options, Next: GPG Input and Output, Prev: GPG Configuration Options, Up: GPG Options
4198 4.2.2 Key related options
4199 -------------------------
4203 Encrypt for user id NAME. If this option or '--hidden-recipient'
4204 is not specified, GnuPG asks for the user-id unless
4205 '--default-recipient' is given.
4207 '--hidden-recipient NAME'
4209 Encrypt for user ID NAME, but hide the key ID of this user's key.
4210 This option helps to hide the receiver of the message and is a
4211 limited countermeasure against traffic analysis. If this option or
4212 '--recipient' is not specified, GnuPG asks for the user ID unless
4213 '--default-recipient' is given.
4215 '--recipient-file FILE'
4217 This option is similar to '--recipient' except that it encrypts to
4218 a key stored in the given file. FILE must be the name of a file
4219 containing exactly one key. 'gpg' assumes that the key in this
4220 file is fully valid.
4222 '--hidden-recipient-file FILE'
4224 This option is similar to '--hidden-recipient' except that it
4225 encrypts to a key stored in the given file. FILE must be the name
4226 of a file containing exactly one key. 'gpg' assumes that the key
4227 in this file is fully valid.
4230 Same as '--recipient' but this one is intended for use in the
4231 options file and may be used with your own user-id as an
4232 "encrypt-to-self". These keys are only used when there are other
4233 recipients given either by use of '--recipient' or by the asked
4234 user id. No trust checking is performed for these user ids and
4235 even disabled keys can be used.
4237 '--hidden-encrypt-to NAME'
4238 Same as '--hidden-recipient' but this one is intended for use in
4239 the options file and may be used with your own user-id as a hidden
4240 "encrypt-to-self". These keys are only used when there are other
4241 recipients given either by use of '--recipient' or by the asked
4242 user id. No trust checking is performed for these user ids and
4243 even disabled keys can be used.
4246 Disable the use of all '--encrypt-to' and '--hidden-encrypt-to'
4249 '--group {NAME=VALUE}'
4250 Sets up a named group, which is similar to aliases in email
4251 programs. Any time the group name is a recipient ('-r' or
4252 '--recipient'), it will be expanded to the values specified.
4253 Multiple groups with the same name are automatically merged into a
4256 The values are 'key IDs' or fingerprints, but any key description
4257 is accepted. Note that a value with spaces in it will be treated
4258 as two different values. Note also there is only one level of
4259 expansion -- you cannot make an group that points to another group.
4260 When used from the command line, it may be necessary to quote the
4261 argument to this option to prevent the shell from treating it as
4265 Remove a given entry from the '--group' list.
4268 Remove all entries from the '--group' list.
4272 Use NAME as the key to sign with. Note that this option overrides
4276 This option has two purposes. MBOX must either be a complete user
4277 id with a proper mail address or just a mail address. When
4278 creating a signature this option tells gpg the user id of a key
4279 used to make a signature if the key was not directly specified by a
4280 user id. When verifying a signature the MBOX is used to restrict
4281 the information printed by the TOFU code to matching user ids.
4283 '--try-secret-key NAME'
4284 For hidden recipients GPG needs to know the keys to use for trial
4285 decryption. The key set with '--default-key' is always tried
4286 first, but this is often not sufficient. This option allows
4287 setting more keys to be used for trial decryption. Although any
4288 valid user-id specification may be used for NAME it makes sense to
4289 use at least the long keyid to avoid ambiguities. Note that
4290 gpg-agent might pop up a pinentry for a lot keys to do the trial
4291 decryption. If you want to stop all further trial decryption you
4292 may use close-window button instead of the cancel button.
4295 Don't look at the key ID as stored in the message but try all
4296 secret keys in turn to find the right decryption key. This option
4297 forces the behaviour as used by anonymous recipients (created by
4298 using '--throw-keyids' or '--hidden-recipient') and might come
4299 handy in case where an encrypted message contains a bogus key ID.
4301 '--skip-hidden-recipients'
4302 '--no-skip-hidden-recipients'
4303 During decryption skip all anonymous recipients. This option helps
4304 in the case that people use the hidden recipients feature to hide
4305 their own encrypt-to key from others. If one has many secret keys
4306 this may lead to a major annoyance because all keys are tried in
4307 turn to decrypt something which was not really intended for it.
4308 The drawback of this option is that it is currently not possible to
4309 decrypt a message which includes real anonymous recipients.
4312 File: gnupg.info, Node: GPG Input and Output, Next: OpenPGP Options, Prev: GPG Key related Options, Up: GPG Options
4314 4.2.3 Input and Output
4315 ----------------------
4319 Create ASCII armored output. The default is to create the binary
4323 Assume the input data is not in ASCII armored format.
4327 Write output to FILE. To write to stdout use '-' as the filename.
4330 This option sets a limit on the number of bytes that will be
4331 generated when processing a file. Since OpenPGP supports various
4332 levels of compression, it is possible that the plaintext of a given
4333 message may be significantly larger than the original OpenPGP
4334 message. While GnuPG works properly with such messages, there is
4335 often a desire to set a maximum file size that will be generated
4336 before processing is forced to stop by the OS limits. Defaults to
4337 0, which means "no limit".
4339 '--input-size-hint N'
4340 This option can be used to tell GPG the size of the input data in
4341 bytes. N must be a positive base-10 number. This option is only
4342 useful if the input is not taken from a file. GPG may use this
4343 hint to optimize its buffer allocation strategy. It is also used
4344 by the '--status-fd' line "PROGRESS" to provide a value for "total"
4345 if that is not available by other means.
4347 '--key-origin STRING[,URL]'
4348 gpg can track the origin of a key. Certain origins are implicitly
4349 known (e.g. keyserver, web key directory) and set. For a standard
4350 import the origin of the keys imported can be set with this option.
4351 To list the possible values use "help" for STRING. Some origins
4352 can store an optional URL argument. That URL can appended to
4353 STRING after a comma.
4355 '--import-options PARAMETERS'
4356 This is a space or comma delimited string that gives options for
4357 importing keys. Options can be prepended with a 'no-' to give the
4358 opposite meaning. The options are:
4361 Allow importing key signatures marked as "local". This is not
4362 generally useful unless a shared keyring scheme is being used.
4366 Normally possible still existing ownertrust values of a key
4367 are cleared if a key is imported. This is in general
4368 desirable so that a formerly deleted key does not
4369 automatically gain an ownertrust values merely due to import.
4370 On the other hand it is sometimes necessary to re-import a
4371 trusted set of keys again but keeping already assigned
4372 ownertrust values. This can be achieved by using this option.
4374 repair-pks-subkey-bug
4375 During import, attempt to repair the damage caused by the PKS
4376 keyserver bug (pre version 0.9.6) that mangles keys with
4377 multiple subkeys. Note that this cannot completely repair the
4378 damaged key as some crucial data is removed by the keyserver,
4379 but it does at least give you back one subkey. Defaults to no
4380 for regular '--import' and to yes for keyserver
4385 Show a listing of the key as imported right before it is
4386 stored. This can be combined with the option '--dry-run' to
4387 only look at keys; the option 'show-only' is a shortcut for
4388 this combination. The command '--show-keys' is another
4389 shortcut for this. Note that suffixes like '#' for "sec" and
4390 "sbb" lines may or may not be printed.
4393 Run the entire import code but instead of storing the key to
4394 the local keyring write it to the output. The export options
4395 'export-pka' and 'export-dane' affect the output. This option
4396 can be used to remove all invalid parts from a key without the
4400 During import, allow key updates to existing keys, but do not
4401 allow any new keys to be imported. Defaults to no.
4404 After import, compact (remove all signatures except the
4405 self-signature) any user IDs from the new key that are not
4406 usable. Then, remove any signatures from the new key that are
4407 not usable. This includes signatures that were issued by keys
4408 that are not present on the keyring. This option is the same
4409 as running the '--edit-key' command "clean" after import.
4413 Accept only self-signatures while importing a key. All other
4414 key signatures are skipped at an early import stage. This
4415 option can be used with 'keyserver-options' to mitigate
4416 attempts to flood a key with bogus signatures from a
4417 keyserver. The drawback is that all other valid key
4418 signatures, as required by the Web of Trust are also not
4419 imported. Note that when using this option along with
4420 import-clean it suppresses the final clean step after merging
4421 the imported key into the existing key.
4424 After import, fix various problems with the keys. For
4425 example, this reorders signatures, and strips duplicate
4426 signatures. Defaults to yes.
4429 Import the smallest key possible. This removes all signatures
4430 except the most recent self-signature on each user ID. This
4431 option is the same as running the '--edit-key' command
4432 "minimize" after import. Defaults to no.
4436 Import in key restore mode. This imports all data which is
4437 usually skipped during import; including all GnuPG specific
4438 data. All other contradicting options are overridden.
4440 '--import-filter {NAME=EXPR}'
4441 '--export-filter {NAME=EXPR}'
4442 These options define an import/export filter which are applied to
4443 the imported/exported keyblock right before it will be
4444 stored/written. NAME defines the type of filter to use, EXPR the
4445 expression to evaluate. The option can be used several times which
4446 then appends more expression to the same NAME.
4448 The available filter types are:
4451 This filter will keep a user id packet and its dependent
4452 packets in the keyblock if the expression evaluates to true.
4455 This filter drops the selected subkeys. Currently only
4456 implemented for -export-filter.
4459 This filter drops the selected key signatures on user ids.
4460 Self-signatures are not considered. Currently only
4461 implemented for -import-filter.
4463 For the syntax of the expression see the chapter "FILTER
4464 EXPRESSIONS". The property names for the expressions depend on the
4465 actual filter type and are indicated in the following table.
4467 The available properties are:
4470 A string with the user id. (keep-uid)
4473 The addr-spec part of a user id with mailbox or the empty
4477 A number with the public key algorithm of a key or subkey
4478 packet. (drop-subkey)
4482 The first is the timestamp a public key or subkey packet was
4483 created. The second is the same but given as an ISO string,
4484 e.g. "2016-08-17". (drop-subkey)
4487 The hexified fingerprint of the current subkey or primary key.
4491 Boolean indicating whether the user id is the primary one.
4495 Boolean indicating whether a user id (keep-uid), a key
4496 (drop-subkey), or a signature (drop-sig) expired.
4499 Boolean indicating whether a user id (keep-uid) or a key
4500 (drop-subkey) has been revoked.
4503 Boolean indicating whether a primary key is disabled. (not
4507 Boolean indicating whether a key or subkey is a secret one.
4511 A string indicating the usage flags for the subkey, from the
4512 sequence "ecsa?". For example, a subkey capable of just
4513 signing and authentication would be an exact match for "sa".
4518 The first is the timestamp a signature packet was created.
4519 The second is the same but given as an ISO date string, e.g.
4520 "2016-08-17". (drop-sig)
4523 A number with the public key algorithm of a signature packet.
4527 A number with the digest algorithm of a signature packet.
4530 '--export-options PARAMETERS'
4531 This is a space or comma delimited string that gives options for
4532 exporting keys. Options can be prepended with a 'no-' to give the
4533 opposite meaning. The options are:
4536 Allow exporting key signatures marked as "local". This is not
4537 generally useful unless a shared keyring scheme is being used.
4541 Include attribute user IDs (photo IDs) while exporting. Not
4542 including attribute user IDs is useful to export keys that are
4543 going to be used by an OpenPGP program that does not accept
4544 attribute user IDs. Defaults to yes.
4546 export-sensitive-revkeys
4547 Include designated revoker information that was marked as
4548 "sensitive". Defaults to no.
4552 Export for use as a backup. The exported data includes all
4553 data which is needed to restore the key or keys later with
4554 GnuPG. The format is basically the OpenPGP format but enhanced
4555 with GnuPG specific data. All other contradicting options are
4559 Compact (remove all signatures from) user IDs on the key being
4560 exported if the user IDs are not usable. Also, do not export
4561 any signatures that are not usable. This includes signatures
4562 that were issued by keys that are not present on the keyring.
4563 This option is the same as running the '--edit-key' command
4564 "clean" before export except that the local copy of the key is
4565 not modified. Defaults to no.
4568 Export the smallest key possible. This removes all signatures
4569 except the most recent self-signature on each user ID. This
4570 option is the same as running the '--edit-key' command
4571 "minimize" before export except that the local copy of the key
4572 is not modified. Defaults to no.
4575 Instead of outputting the key material output PKA records
4576 suitable to put into DNS zone files. An ORIGIN line is
4577 printed before each record to allow diverting the records to
4578 the corresponding zone file.
4581 Instead of outputting the key material output OpenPGP DANE
4582 records suitable to put into DNS zone files. An ORIGIN line
4583 is printed before each record to allow diverting the records
4584 to the corresponding zone file.
4587 Print key listings delimited by colons. Note that the output will
4588 be encoded in UTF-8 regardless of any '--display-charset' setting.
4589 This format is useful when GnuPG is called from scripts and other
4590 programs as it is easily machine parsed. The details of this
4591 format are documented in the file 'doc/DETAILS', which is included
4592 in the GnuPG source distribution.
4595 Do not merge primary user ID and primary key in '--with-colon'
4596 listing mode and print all timestamps as seconds since 1970-01-01.
4597 Since GnuPG 2.0.10, this mode is always used and thus this option
4598 is obsolete; it does not harm to use it though.
4600 '--legacy-list-mode'
4601 Revert to the pre-2.1 public key list mode. This only affects the
4602 human readable output and not the machine interface (i.e.
4603 '--with-colons'). Note that the legacy format does not convey
4604 suitable information for elliptic curves.
4606 '--with-fingerprint'
4607 Same as the command '--fingerprint' but changes only the format of
4608 the output and may be used together with another command.
4610 '--with-subkey-fingerprint'
4611 If a fingerprint is printed for the primary key, this option forces
4612 printing of the fingerprint for all subkeys. This could also be
4613 achieved by using the '--with-fingerprint' twice but by using this
4614 option along with keyid-format "none" a compact fingerprint is
4617 '--with-icao-spelling'
4618 Print the ICAO spelling of the fingerprint in addition to the hex
4622 Include the keygrip in the key listings. In '--with-colons' mode
4623 this is implicitly enable for secret keys.
4626 Include the locally held information on the origin and last update
4627 of a key in a key listing. In '--with-colons' mode this is always
4628 printed. This data is currently experimental and shall not be
4629 considered part of the stable API.
4632 Print a Web Key Directory identifier along with each user ID in key
4633 listings. This is an experimental feature and semantics may
4637 Include info about the presence of a secret key in public key
4638 listings done with '--with-colons'.
4641 File: gnupg.info, Node: OpenPGP Options, Next: Compliance Options, Prev: GPG Input and Output, Up: GPG Options
4643 4.2.4 OpenPGP protocol specific options
4644 ---------------------------------------
4648 Treat input files as text and store them in the OpenPGP canonical
4649 text form with standard "CRLF" line endings. This also sets the
4650 necessary flags to inform the recipient that the encrypted or
4651 signed data is text and may need its line endings converted back to
4652 whatever the local system uses. This option is useful when
4653 communicating between two platforms that have different line ending
4654 conventions (UNIX-like to Mac, Mac to Windows, etc).
4655 '--no-textmode' disables this option, and is the default.
4658 '--no-force-v3-sigs'
4660 '--no-force-v4-certs'
4661 These options are obsolete and have no effect since GnuPG 2.1.
4665 These options are obsolete and have no effect since GnuPG 2.2.8.
4666 The MDC is always used. But note: If the creation of a legacy
4667 non-MDC message is exceptionally required, the option '--rfc2440'
4670 '--disable-signer-uid'
4671 By default the user ID of the signing key is embedded in the data
4672 signature. As of now this is only done if the signing key has been
4673 specified with 'local-user' using a mail address, or with 'sender'.
4674 This information can be helpful for verifier to locate the key; see
4675 option '--auto-key-retrieve'.
4677 '--include-key-block'
4678 This option is used to embed the actual signing key into a data
4679 signature. The embedded key is stripped down to a single user id
4680 and includes only the signing subkey used to create the signature
4681 as well as as valid encryption subkeys. All other info is removed
4682 from the key to keep it and thus the signature small. This option
4683 is the OpenPGP counterpart to the 'gpgsm' option '--include-certs'.
4685 '--personal-cipher-preferences STRING'
4686 Set the list of personal cipher preferences to STRING. Use 'gpg
4687 --version' to get a list of available algorithms, and use 'none' to
4688 set no preference at all. This allows the user to safely override
4689 the algorithm chosen by the recipient key preferences, as GPG will
4690 only select an algorithm that is usable by all recipients. The
4691 most highly ranked cipher in this list is also used for the
4692 '--symmetric' encryption command.
4694 '--personal-digest-preferences STRING'
4695 Set the list of personal digest preferences to STRING. Use 'gpg
4696 --version' to get a list of available algorithms, and use 'none' to
4697 set no preference at all. This allows the user to safely override
4698 the algorithm chosen by the recipient key preferences, as GPG will
4699 only select an algorithm that is usable by all recipients. The
4700 most highly ranked digest algorithm in this list is also used when
4701 signing without encryption (e.g. '--clear-sign' or '--sign').
4703 '--personal-compress-preferences STRING'
4704 Set the list of personal compression preferences to STRING. Use
4705 'gpg --version' to get a list of available algorithms, and use
4706 'none' to set no preference at all. This allows the user to safely
4707 override the algorithm chosen by the recipient key preferences, as
4708 GPG will only select an algorithm that is usable by all recipients.
4709 The most highly ranked compression algorithm in this list is also
4710 used when there are no recipient keys to consider (e.g.
4713 '--s2k-cipher-algo NAME'
4714 Use NAME as the cipher algorithm for symmetric encryption with a
4715 passphrase if '--personal-cipher-preferences' and '--cipher-algo'
4716 are not given. The default is AES-128.
4718 '--s2k-digest-algo NAME'
4719 Use NAME as the digest algorithm used to mangle the passphrases for
4720 symmetric encryption. The default is SHA-1.
4723 Selects how passphrases for symmetric encryption are mangled. If N
4724 is 0 a plain passphrase (which is in general not recommended) will
4725 be used, a 1 adds a salt (which should not be used) to the
4726 passphrase and a 3 (the default) iterates the whole process a
4727 number of times (see '--s2k-count').
4730 Specify how many times the passphrases mangling for symmetric
4731 encryption is repeated. This value may range between 1024 and
4732 65011712 inclusive. The default is inquired from gpg-agent. Note
4733 that not all values in the 1024-65011712 range are legal and if an
4734 illegal value is selected, GnuPG will round up to the nearest legal
4735 value. This option is only meaningful if '--s2k-mode' is set to
4739 File: gnupg.info, Node: Compliance Options, Next: GPG Esoteric Options, Prev: OpenPGP Options, Up: GPG Options
4741 4.2.5 Compliance options
4742 ------------------------
4744 These options control what GnuPG is compliant to. Only one of these
4745 options may be active at a time. Note that the default setting of this
4746 is nearly always the correct one. See the INTEROPERABILITY WITH OTHER
4747 OPENPGP PROGRAMS section below before using one of these options.
4750 Use standard GnuPG behavior. This is essentially OpenPGP behavior
4751 (see '--openpgp'), but with some additional workarounds for common
4752 compatibility problems in different versions of PGP. This is the
4753 default option, so it is not generally needed, but it may be useful
4754 to override a different compliance option in the gpg.conf file.
4757 Reset all packet, cipher and digest options to strict OpenPGP
4758 behavior. Use this option to reset all previous options like
4759 '--s2k-*', '--cipher-algo', '--digest-algo' and '--compress-algo'
4760 to OpenPGP compliant values. All PGP workarounds are disabled.
4763 Reset all packet, cipher and digest options to strict RFC-4880
4764 behavior. Note that this is currently the same thing as
4768 Enable experimental features from proposed updates to RFC-4880.
4769 This option can be used in addition to the other compliance
4770 options. Warning: The behavior may change with any GnuPG release
4771 and created keys or data may not be usable with future GnuPG
4775 Reset all packet, cipher and digest options to strict RFC-2440
4776 behavior. Note that by using this option encryption packets are
4777 created in a legacy mode without MDC protection. This is dangerous
4778 and should thus only be used for experiments. See also option
4779 '--ignore-mdc-error'.
4782 Set up all options to be as PGP 6 compliant as possible. This
4783 restricts you to the ciphers IDEA (if the IDEA plugin is
4784 installed), 3DES, and CAST5, the hashes MD5, SHA1 and RIPEMD160,
4785 and the compression algorithms none and ZIP. This also disables
4786 '--throw-keyids', and making signatures with signing subkeys as PGP
4787 6 does not understand signatures made by signing subkeys.
4789 This option implies '--escape-from-lines'.
4792 Set up all options to be as PGP 7 compliant as possible. This is
4793 identical to '--pgp6' except that MDCs are not disabled, and the
4794 list of allowable ciphers is expanded to add AES128, AES192,
4795 AES256, and TWOFISH.
4798 Set up all options to be as PGP 8 compliant as possible. PGP 8 is
4799 a lot closer to the OpenPGP standard than previous versions of PGP,
4800 so all this does is disable '--throw-keyids' and set
4801 '--escape-from-lines'. All algorithms are allowed except for the
4802 SHA224, SHA384, and SHA512 digests.
4804 '--compliance STRING'
4805 This option can be used instead of one of the options above. Valid
4806 values for STRING are the above option names (without the double
4807 dash) and possibly others as shown when using "help" for STRING.
4809 '--min-rsa-length N'
4810 This option adjusts the compliance mode "de-vs" for stricter key
4811 size requirements. For example, a value of 3000 turns rsa2048 and
4812 dsa2048 keys into non-VS-NfD compliant keys.
4815 File: gnupg.info, Node: GPG Esoteric Options, Next: Deprecated Options, Prev: Compliance Options, Up: GPG Options
4817 4.2.6 Doing things one usually doesn't want to do
4818 -------------------------------------------------
4822 Don't make any changes (this is not completely implemented).
4825 Changes the behaviour of some commands. This is like '--dry-run'
4826 but different in some cases. The semantic of this option may be
4827 extended in the future. Currently it only skips the actual
4828 decryption pass and therefore enables a fast listing of the
4833 Prompt before overwriting any files.
4835 '--debug-level LEVEL'
4836 Select the debug level for investigating problems. LEVEL may be a
4837 numeric value or by a keyword:
4840 No debugging at all. A value of less than 1 may be used
4841 instead of the keyword.
4843 Some basic debug messages. A value between 1 and 2 may be
4844 used instead of the keyword.
4846 More verbose debug messages. A value between 3 and 5 may be
4847 used instead of the keyword.
4849 Even more detailed messages. A value between 6 and 8 may be
4850 used instead of the keyword.
4852 All of the debug messages you can get. A value greater than 8
4853 may be used instead of the keyword. The creation of hash
4854 tracing files is only enabled if the keyword is used.
4856 How these messages are mapped to the actual debugging flags is not
4857 specified and may change with newer releases of this program. They
4858 are however carefully selected to best aid in debugging.
4861 Set debugging flags. All flags are or-ed and FLAGS may be given in
4862 C syntax (e.g. 0x0042) or as a comma separated list of flag names.
4863 To get a list of all supported flags the single word "help" can be
4867 Set all useful debugging flags.
4870 Set stdout into line buffered mode. This option is only honored
4871 when given on the command line.
4873 '--faked-system-time EPOCH'
4874 This option is only useful for testing; it sets the system time
4875 back or forth to EPOCH which is the number of seconds elapsed since
4876 the year 1970. Alternatively EPOCH may be given as a full ISO time
4877 string (e.g. "20070924T154812").
4879 If you suffix EPOCH with an exclamation mark (!), the system time
4880 will appear to be frozen at the specified time.
4882 '--enable-progress-filter'
4883 Enable certain PROGRESS status outputs. This option allows
4884 frontends to display a progress indicator while gpg is processing
4885 larger files. There is a slight performance overhead using it.
4888 Write special status strings to the file descriptor N. See the
4889 file DETAILS in the documentation for a listing of them.
4891 '--status-file FILE'
4892 Same as '--status-fd', except the status data is written to file
4896 Write log output to file descriptor N and not to STDERR.
4899 '--logger-file FILE'
4900 Same as '--logger-fd', except the logger data is written to file
4901 FILE. Use 'socket://' to log to a socket. Note that in this
4902 version of gpg the option has only an effect if '--batch' is also
4906 Write attribute subpackets to the file descriptor N. This is most
4907 useful for use with '--status-fd', since the status messages are
4908 needed to separate out the various subpackets from the stream
4909 delivered to the file descriptor.
4911 '--attribute-file FILE'
4912 Same as '--attribute-fd', except the attribute data is written to
4917 Use STRING as a comment string in cleartext signatures and ASCII
4918 armored messages or keys (see '--armor'). The default behavior is
4919 not to use a comment string. '--comment' may be repeated multiple
4920 times to get multiple comment strings. '--no-comments' removes all
4921 comments. It is a good idea to keep the length of a single comment
4922 below 60 characters to avoid problems with mail programs wrapping
4923 such lines. Note that comment lines, like all other header lines,
4924 are not protected by the signature.
4928 Force inclusion of the version string in ASCII armored output. If
4929 given once only the name of the program and the major number is
4930 emitted, given twice the minor is also emitted, given thrice the
4931 micro is added, and given four times an operating system
4932 identification is also emitted. '--no-emit-version' (default)
4933 disables the version line.
4935 '--sig-notation {NAME=VALUE}'
4936 '--cert-notation {NAME=VALUE}'
4937 '-N, --set-notation {NAME=VALUE}'
4938 Put the name value pair into the signature as notation data. NAME
4939 must consist only of printable characters or spaces, and must
4940 contain a '@' character in the form keyname@domain.example.com
4941 (substituting the appropriate keyname and domain name, of course).
4942 This is to help prevent pollution of the IETF reserved notation
4943 namespace. The '--expert' flag overrides the '@' check. VALUE may
4944 be any printable string; it will be encoded in UTF-8, so you should
4945 check that your '--display-charset' is set correctly. If you
4946 prefix NAME with an exclamation mark (!), the notation data will be
4947 flagged as critical (rfc4880:5.2.3.16). '--sig-notation' sets a
4948 notation for data signatures. '--cert-notation' sets a notation
4949 for key signatures (certifications). '--set-notation' sets both.
4951 There are special codes that may be used in notation names. "%k"
4952 will be expanded into the key ID of the key being signed, "%K" into
4953 the long key ID of the key being signed, "%f" into the fingerprint
4954 of the key being signed, "%s" into the key ID of the key making the
4955 signature, "%S" into the long key ID of the key making the
4956 signature, "%g" into the fingerprint of the key making the
4957 signature (which might be a subkey), "%p" into the fingerprint of
4958 the primary key of the key making the signature, "%c" into the
4959 signature count from the OpenPGP smartcard, and "%%" results in a
4960 single "%". %k, %K, and %f are only meaningful when making a key
4961 signature (certification), and %c is only meaningful when using the
4964 '--known-notation NAME'
4965 Adds NAME to a list of known critical signature notations. The
4966 effect of this is that gpg will not mark a signature with a
4967 critical signature notation of that name as bad. Note that gpg
4968 already knows by default about a few critical signatures notation
4971 '--sig-policy-url STRING'
4972 '--cert-policy-url STRING'
4973 '--set-policy-url STRING'
4974 Use STRING as a Policy URL for signatures (rfc4880:5.2.3.20). If
4975 you prefix it with an exclamation mark (!), the policy URL packet
4976 will be flagged as critical. '--sig-policy-url' sets a policy url
4977 for data signatures. '--cert-policy-url' sets a policy url for key
4978 signatures (certifications). '--set-policy-url' sets both.
4980 The same %-expandos used for notation data are available here as
4983 '--sig-keyserver-url STRING'
4984 Use STRING as a preferred keyserver URL for data signatures. If
4985 you prefix it with an exclamation mark (!), the keyserver URL
4986 packet will be flagged as critical.
4988 The same %-expandos used for notation data are available here as
4991 '--set-filename STRING'
4992 Use STRING as the filename which is stored inside messages. This
4993 overrides the default, which is to use the actual filename of the
4994 file being encrypted. Using the empty string for STRING
4995 effectively removes the filename from the output.
4997 '--for-your-eyes-only'
4998 '--no-for-your-eyes-only'
4999 Set the 'for your eyes only' flag in the message. This causes
5000 GnuPG to refuse to save the file unless the '--output' option is
5001 given, and PGP to use a "secure viewer" with a claimed
5002 Tempest-resistant font to display the message. This option
5003 overrides '--set-filename'. '--no-for-your-eyes-only' disables
5006 '--use-embedded-filename'
5007 '--no-use-embedded-filename'
5008 Try to create a file with a name as embedded in the data. This can
5009 be a dangerous option as it enables overwriting files. Defaults to
5010 no. Note that the option '--output' overrides this option.
5012 '--cipher-algo NAME'
5013 Use NAME as cipher algorithm. Running the program with the command
5014 '--version' yields a list of supported algorithms. If this is not
5015 used the cipher algorithm is selected from the preferences stored
5016 with the key. In general, you do not want to use this option as it
5017 allows you to violate the OpenPGP standard.
5018 '--personal-cipher-preferences' is the safe way to accomplish the
5021 '--digest-algo NAME'
5022 Use NAME as the message digest algorithm. Running the program with
5023 the command '--version' yields a list of supported algorithms. In
5024 general, you do not want to use this option as it allows you to
5025 violate the OpenPGP standard. '--personal-digest-preferences' is
5026 the safe way to accomplish the same thing.
5028 '--compress-algo NAME'
5029 Use compression algorithm NAME. "zlib" is RFC-1950 ZLIB
5030 compression. "zip" is RFC-1951 ZIP compression which is used by
5031 PGP. "bzip2" is a more modern compression scheme that can compress
5032 some things better than zip or zlib, but at the cost of more memory
5033 used during compression and decompression. "uncompressed" or
5034 "none" disables compression. If this option is not used, the
5035 default behavior is to examine the recipient key preferences to see
5036 which algorithms the recipient supports. If all else fails, ZIP is
5037 used for maximum compatibility.
5039 ZLIB may give better compression results than ZIP, as the
5040 compression window size is not limited to 8k. BZIP2 may give even
5041 better compression results than that, but will use a significantly
5042 larger amount of memory while compressing and decompressing. This
5043 may be significant in low memory situations. Note, however, that
5044 PGP (all versions) only supports ZIP compression. Using any
5045 algorithm other than ZIP or "none" will make the message unreadable
5046 with PGP. In general, you do not want to use this option as it
5047 allows you to violate the OpenPGP standard.
5048 '--personal-compress-preferences' is the safe way to accomplish the
5051 '--cert-digest-algo NAME'
5052 Use NAME as the message digest algorithm used when signing a key.
5053 Running the program with the command '--version' yields a list of
5054 supported algorithms. Be aware that if you choose an algorithm
5055 that GnuPG supports but other OpenPGP implementations do not, then
5056 some users will not be able to use the key signatures you make, or
5057 quite possibly your entire key.
5059 '--disable-cipher-algo NAME'
5060 Never allow the use of NAME as cipher algorithm. The given name
5061 will not be checked so that a later loaded algorithm will still get
5064 '--disable-pubkey-algo NAME'
5065 Never allow the use of NAME as public key algorithm. The given
5066 name will not be checked so that a later loaded algorithm will
5071 Do not put the recipient key IDs into encrypted messages. This
5072 helps to hide the receivers of the message and is a limited
5073 countermeasure against traffic analysis.(1) On the receiving side,
5074 it may slow down the decryption process because all available
5075 secret keys must be tried. '--no-throw-keyids' disables this
5076 option. This option is essentially the same as using
5077 '--hidden-recipient' for all recipients.
5079 '--not-dash-escaped'
5080 This option changes the behavior of cleartext signatures so that
5081 they can be used for patch files. You should not send such an
5082 armored file via email because all spaces and line endings are
5083 hashed too. You can not use this option for data which has 5
5084 dashes at the beginning of a line, patch files don't have this. A
5085 special armor header line tells GnuPG about this cleartext
5088 '--escape-from-lines'
5089 '--no-escape-from-lines'
5090 Because some mailers change lines starting with "From " to ">From "
5091 it is good to handle such lines in a special way when creating
5092 cleartext signatures to prevent the mail system from breaking the
5093 signature. Note that all other PGP versions do it this way too.
5094 Enabled by default. '--no-escape-from-lines' disables this option.
5096 '--passphrase-repeat N'
5097 Specify how many times 'gpg' will request a new passphrase be
5098 repeated. This is useful for helping memorize a passphrase.
5099 Defaults to 1 repetition; can be set to 0 to disable any passphrase
5100 repetition. Note that a N greater than 1 will pop up the pinentry
5101 window N+1 times even if a modern pinentry with two entry fields is
5105 Read the passphrase from file descriptor N. Only the first line
5106 will be read from file descriptor N. If you use 0 for N, the
5107 passphrase will be read from STDIN. This can only be used if only
5108 one passphrase is supplied.
5110 Note that since Version 2.0 this passphrase is only used if the
5111 option '--batch' has also been given. Since Version 2.1 the
5112 '--pinentry-mode' also needs to be set to 'loopback'.
5114 '--passphrase-file FILE'
5115 Read the passphrase from file FILE. Only the first line will be
5116 read from file FILE. This can only be used if only one passphrase
5117 is supplied. Obviously, a passphrase stored in a file is of
5118 questionable security if other users can read this file. Don't use
5119 this option if you can avoid it.
5121 Note that since Version 2.0 this passphrase is only used if the
5122 option '--batch' has also been given. Since Version 2.1 the
5123 '--pinentry-mode' also needs to be set to 'loopback'.
5125 '--passphrase STRING'
5126 Use STRING as the passphrase. This can only be used if only one
5127 passphrase is supplied. Obviously, this is of very questionable
5128 security on a multi-user system. Don't use this option if you can
5131 Note that since Version 2.0 this passphrase is only used if the
5132 option '--batch' has also been given. Since Version 2.1 the
5133 '--pinentry-mode' also needs to be set to 'loopback'.
5135 '--pinentry-mode MODE'
5136 Set the pinentry mode to MODE. Allowed values for MODE are:
5138 Use the default of the agent, which is 'ask'.
5140 Force the use of the Pinentry.
5142 Emulate use of Pinentry's cancel button.
5144 Return a Pinentry error ("No Pinentry").
5146 Redirect Pinentry queries to the caller. Note that in
5147 contrast to Pinentry the user is not prompted again if he
5148 enters a bad password.
5151 Disable the passphrase cache used for symmetrical en- and
5152 decryption. This cache is based on the message specific salt value
5155 '--request-origin ORIGIN'
5156 Tell gpg to assume that the operation ultimately originated at
5157 ORIGIN. Depending on the origin certain restrictions are applied
5158 and the Pinentry may include an extra note on the origin.
5159 Supported values for ORIGIN are: 'local' which is the default,
5160 'remote' to indicate a remote origin or 'browser' for an operation
5161 requested by a web browser.
5164 This is a replacement for the deprecated shared-memory IPC mode.
5165 If this option is enabled, user input on questions is not expected
5166 from the TTY but from the given file descriptor. It should be used
5167 together with '--status-fd'. See the file doc/DETAILS in the
5168 source distribution for details on how to use it.
5170 '--command-file FILE'
5171 Same as '--command-fd', except the commands are read out of file
5174 '--allow-non-selfsigned-uid'
5175 '--no-allow-non-selfsigned-uid'
5176 Allow the import and use of keys with user IDs which are not
5177 self-signed. This is not recommended, as a non self-signed user ID
5178 is trivial to forge. '--no-allow-non-selfsigned-uid' disables.
5180 '--allow-freeform-uid'
5181 Disable all checks on the form of the user ID while generating a
5182 new one. This option should only be used in very special
5183 environments as it does not ensure the de-facto standard format of
5186 '--ignore-time-conflict'
5187 GnuPG normally checks that the timestamps associated with keys and
5188 signatures have plausible values. However, sometimes a signature
5189 seems to be older than the key due to clock problems. This option
5190 makes these checks just a warning. See also '--ignore-valid-from'
5191 for timestamp issues on subkeys.
5193 '--ignore-valid-from'
5194 GnuPG normally does not select and use subkeys created in the
5195 future. This option allows the use of such keys and thus exhibits
5196 the pre-1.0.7 behaviour. You should not use this option unless
5197 there is some clock problem. See also '--ignore-time-conflict' for
5198 timestamp issues with signatures.
5200 '--ignore-crc-error'
5201 The ASCII armor used by OpenPGP is protected by a CRC checksum
5202 against transmission errors. Occasionally the CRC gets mangled
5203 somewhere on the transmission channel but the actual content (which
5204 is protected by the OpenPGP protocol anyway) is still okay. This
5205 option allows GnuPG to ignore CRC errors.
5207 '--ignore-mdc-error'
5208 This option changes a MDC integrity protection failure into a
5209 warning. It is required to decrypt old messages which did not use
5210 an MDC. It may also be useful if a message is partially garbled,
5211 but it is necessary to get as much data as possible out of that
5212 garbled message. Be aware that a missing or failed MDC can be an
5213 indication of an attack. Use with great caution; see also option
5216 '--allow-weak-digest-algos'
5217 Signatures made with known-weak digest algorithms are normally
5218 rejected with an "invalid digest algorithm" message. This option
5219 allows the verification of signatures made with such weak
5220 algorithms. MD5 is the only digest algorithm considered weak by
5221 default. See also '--weak-digest' to reject other digest
5224 '--weak-digest NAME'
5225 Treat the specified digest algorithm as weak. Signatures made over
5226 weak digests algorithms are normally rejected. This option can be
5227 supplied multiple times if multiple algorithms should be considered
5228 weak. See also '--allow-weak-digest-algos' to disable rejection of
5229 weak digests. MD5 is always considered weak, and does not need to
5230 be listed explicitly.
5232 '--allow-weak-key-signatures'
5233 To avoid a minor risk of collision attacks on third-party key
5234 signatures made using SHA-1, those key signatures are considered
5235 invalid. This options allows to override this restriction.
5237 '--override-compliance-check'
5238 The signature verification only allows the use of keys suitable in
5239 the current compliance mode. If the compliance mode has been
5240 forced by a global option, there might be no way to check certain
5241 signature. This option allows to override this and prints an extra
5242 warning in such a case. This option is ignored in -batch mode so
5243 that no accidental unattended verification may happen.
5245 '--no-default-keyring'
5246 Do not add the default keyring to the list of keyrings. Note that
5247 GnuPG needs for almost all operations a keyring. Thus if you use
5248 this option and do not provide alternate keyrings via '--keyring',
5249 then GnuPG will still use the default keyring.
5252 Do not use any keyring at all. This overrides the default and all
5253 options which specify keyrings.
5256 Skip the signature verification step. This may be used to make the
5257 decryption faster if the signature verification is not needed.
5260 Print key listings delimited by colons (like '--with-colons') and
5261 print the public key data.
5265 Same as '--list-keys', but the signatures are listed too. This
5266 command has the same effect as using '--list-keys' with
5267 '--with-sig-list'. Note that in contrast to '--check-signatures'
5268 the key signatures are not verified. This command can be used to
5269 create a list of signing keys missing in the local keyring; for
5272 gpg --list-sigs --with-colons USERID | \
5273 awk -F: '$1=="sig" && $2=="?" {if($13){print $13}else{print $5}}'
5276 Changes the output of the list commands to work faster; this is
5277 achieved by leaving some parts empty. Some applications don't need
5278 the user ID and the trust information given in the listings. By
5279 using this options they can get a faster listing. The exact
5280 behaviour of this option may change in future versions. If you are
5281 missing some information, don't use this option.
5284 This is not for normal use. Use the source to see for what it
5288 This is not for normal use. Use the source to see for what it
5291 '--show-session-key'
5292 Display the session key used for one message. See
5293 '--override-session-key' for the counterpart of this option.
5295 We think that Key Escrow is a Bad Thing; however the user should
5296 have the freedom to decide whether to go to prison or to reveal the
5297 content of one specific message without compromising all messages
5298 ever encrypted for one secret key.
5300 You can also use this option if you receive an encrypted message
5301 which is abusive or offensive, to prove to the administrators of
5302 the messaging system that the ciphertext transmitted corresponds to
5303 an inappropriate plaintext so they can take action against the
5306 '--override-session-key STRING'
5307 '--override-session-key-fd FD'
5308 Don't use the public key but the session key STRING respective the
5309 session key taken from the first line read from file descriptor FD.
5310 The format of this string is the same as the one printed by
5311 '--show-session-key'. This option is normally not used but comes
5312 handy in case someone forces you to reveal the content of an
5313 encrypted message; using this option you can do this without
5314 handing out the secret key. Note that using
5315 '--override-session-key' may reveal the session key to all local
5316 users via the global process table. Often it is useful to combine
5317 this option with '--no-keyring'.
5320 '--no-ask-sig-expire'
5321 When making a data signature, prompt for an expiration time. If
5322 this option is not specified, the expiration time set via
5323 '--default-sig-expire' is used. '--no-ask-sig-expire' disables
5326 '--default-sig-expire'
5327 The default expiration time to use for signature expiration. Valid
5328 values are "0" for no expiration, a number followed by the letter d
5329 (for days), w (for weeks), m (for months), or y (for years) (for
5330 example "2m" for two months, or "5y" for five years), or an
5331 absolute date in the form YYYY-MM-DD. Defaults to "0".
5334 '--no-ask-cert-expire'
5335 When making a key signature, prompt for an expiration time. If
5336 this option is not specified, the expiration time set via
5337 '--default-cert-expire' is used. '--no-ask-cert-expire' disables
5340 '--default-cert-expire'
5341 The default expiration time to use for key signature expiration.
5342 Valid values are "0" for no expiration, a number followed by the
5343 letter d (for days), w (for weeks), m (for months), or y (for
5344 years) (for example "2m" for two months, or "5y" for five years),
5345 or an absolute date in the form YYYY-MM-DD. Defaults to "0".
5347 '--default-new-key-algo STRING'
5348 This option can be used to change the default algorithms for key
5349 generation. The STRING is similar to the arguments required for
5350 the command '--quick-add-key' but slightly different. For example
5351 the current default of '"rsa2048/cert,sign+rsa2048/encr"' (or
5352 '"rsa3072"') can be changed to the value of what we currently call
5353 future default, which is '"ed25519/cert,sign+cv25519/encr"'. You
5354 need to consult the source code to learn the details. Note that
5355 the advanced key generation commands can always be used to specify
5356 a key algorithm directly.
5359 This option modifies the behaviour of the commands
5360 '--quick-sign-key', '--quick-lsign-key', and the "sign"
5361 sub-commands of '--edit-key' by forcing the creation of a key
5362 signature, even if one already exists.
5365 This option is intended for use in the global config file to
5366 disallow the use of generate key commands. Those commands will
5367 then fail with the error code for Not Enabled.
5369 '--allow-secret-key-import'
5370 This is an obsolete option and is not used anywhere.
5372 '--allow-multiple-messages'
5373 '--no-allow-multiple-messages'
5374 Allow processing of multiple OpenPGP messages contained in a single
5375 file or stream. Some programs that call GPG are not prepared to
5376 deal with multiple messages being processed together, so this
5377 option defaults to no. Note that versions of GPG prior to 1.4.7
5378 always allowed multiple messages. Future versions of GnUPG will
5381 Warning: Do not use this option unless you need it as a temporary
5384 '--enable-special-filenames'
5385 This option enables a mode in which filenames of the form '-&n',
5386 where n is a non-negative decimal number, refer to the file
5387 descriptor n and not to a file with that name.
5389 '--no-expensive-trust-checks'
5390 Experimental use only.
5392 '--preserve-permissions'
5393 Don't change the permissions of a secret keyring back to user
5394 read/write only. Use this option only if you really know what you
5397 '--default-preference-list STRING'
5398 Set the list of default preferences to STRING. This preference
5399 list is used for new keys and becomes the default for "setpref" in
5402 '--default-keyserver-url NAME'
5403 Set the default keyserver URL to NAME. This keyserver will be used
5404 as the keyserver URL when writing a new self-signature on a key,
5405 which includes key generation and changing preferences.
5408 Display various internal configuration parameters of GnuPG. This
5409 option is intended for external programs that call GnuPG to perform
5410 tasks, and is thus not generally useful. See the file
5411 'doc/DETAILS' in the source distribution for the details of which
5412 configuration items may be listed. '--list-config' is only usable
5413 with '--with-colons' set.
5415 '--list-gcrypt-config'
5416 Display various internal configuration parameters of Libgcrypt.
5419 This command is similar to '--list-config' but in general only
5420 internally used by the 'gpgconf' tool.
5423 This is more or less dummy action. However it parses the
5424 configuration file and returns with failure if the configuration
5425 file would prevent 'gpg' from startup. Thus it may be used to run
5426 a syntax check on the configuration file.
5428 ---------- Footnotes ----------
5430 (1) Using a little social engineering anyone who is able to decrypt
5431 the message can check whether one of the other recipients is the one he
5435 File: gnupg.info, Node: Deprecated Options, Prev: GPG Esoteric Options, Up: GPG Options
5437 4.2.7 Deprecated options
5438 ------------------------
5442 Causes '--list-keys', '--list-signatures', '--list-public-keys',
5443 '--list-secret-keys', and verifying a signature to also display the
5444 photo ID attached to the key, if any. See also '--photo-viewer'.
5445 These options are deprecated. Use '--list-options
5446 [no-]show-photos' and/or '--verify-options [no-]show-photos'
5450 Display the keyring name at the head of key listings to show which
5451 keyring a given key resides on. This option is deprecated: use
5452 '--list-options [no-]show-keyring' instead.
5455 Identical to '--trust-model always'. This option is deprecated.
5458 '--no-show-notation'
5459 Show signature notations in the '--list-signatures' or
5460 '--check-signatures' listings as well as when verifying a signature
5461 with a notation in it. These options are deprecated. Use
5462 '--list-options [no-]show-notation' and/or '--verify-options
5463 [no-]show-notation' instead.
5466 '--no-show-policy-url'
5467 Show policy URLs in the '--list-signatures' or '--check-signatures'
5468 listings as well as when verifying a signature with a policy URL in
5469 it. These options are deprecated. Use '--list-options
5470 [no-]show-policy-url' and/or '--verify-options
5471 [no-]show-policy-url' instead.
5474 File: gnupg.info, Node: GPG Configuration, Next: GPG Examples, Prev: GPG Options, Up: Invoking GPG
5476 4.3 Configuration files
5477 =======================
5479 There are a few configuration files to control certain aspects of
5480 'gpg''s operation. Unless noted, they are expected in the current home
5481 directory (*note option --homedir::).
5484 This is the standard configuration file read by 'gpg' on startup.
5485 It may contain any valid long option; the leading two dashes may
5486 not be entered and the option may not be abbreviated. This default
5487 name may be changed on the command line (*note gpg-option
5488 --options::). You should backup this file.
5490 Note that on larger installations, it is useful to put predefined
5491 files into the directory '/etc/skel/.gnupg' so that newly created users
5492 start up with a working configuration. For existing users a small
5493 helper script is provided to create these files (*note addgnupghome::).
5495 For internal purposes 'gpg' creates and maintains a few other files;
5496 They all live in the current home directory (*note option --homedir::).
5497 Only the 'gpg' program may modify these files.
5500 This is the default home directory which is used if neither the
5501 environment variable 'GNUPGHOME' nor the option '--homedir' is
5504 '~/.gnupg/pubring.gpg'
5505 The public keyring using a legacy format. You should backup this
5508 If this file is not available, 'gpg' defaults to the new keybox
5509 format and creates a file 'pubring.kbx' unless that file already
5510 exists in which case that file will also be used for OpenPGP keys.
5512 Note that in the case that both files, 'pubring.gpg' and
5513 'pubring.kbx' exists but the latter has no OpenPGP keys, the legacy
5514 file 'pubring.gpg' will be used. Take care: GnuPG versions before
5515 2.1 will always use the file 'pubring.gpg' because they do not know
5516 about the new keybox format. In the case that you have to use
5517 GnuPG 1.4 to decrypt archived data you should keep this file.
5519 '~/.gnupg/pubring.gpg.lock'
5520 The lock file for the public keyring.
5522 '~/.gnupg/pubring.kbx'
5523 The public keyring using the new keybox format. This file is
5524 shared with 'gpgsm'. You should backup this file. See above for
5525 the relation between this file and it predecessor.
5527 To convert an existing 'pubring.gpg' file to the keybox format, you
5528 first backup the ownertrust values, then rename 'pubring.gpg' to
5529 'publickeys.backup', so it won’t be recognized by any GnuPG
5530 version, run import, and finally restore the ownertrust values:
5533 $ gpg --export-ownertrust >otrust.lst
5534 $ mv pubring.gpg publickeys.backup
5535 $ gpg --import-options restore --import publickeys.backups
5536 $ gpg --import-ownertrust otrust.lst
5538 '~/.gnupg/pubring.kbx.lock'
5539 The lock file for 'pubring.kbx'.
5541 '~/.gnupg/secring.gpg'
5542 The legacy secret keyring as used by GnuPG versions before 2.1. It
5543 is not used by GnuPG 2.1 and later. You may want to keep it in
5544 case you have to use GnuPG 1.4 to decrypt archived data.
5546 '~/.gnupg/secring.gpg.lock'
5547 The lock file for the legacy secret keyring.
5549 '~/.gnupg/.gpg-v21-migrated'
5550 File indicating that a migration to GnuPG 2.1 has been done.
5552 '~/.gnupg/trustdb.gpg'
5553 The trust database. There is no need to backup this file; it is
5554 better to backup the ownertrust values (*note option
5555 --export-ownertrust::).
5557 '~/.gnupg/trustdb.gpg.lock'
5558 The lock file for the trust database.
5560 '~/.gnupg/random_seed'
5561 A file used to preserve the state of the internal random pool.
5563 '~/.gnupg/openpgp-revocs.d/'
5564 This is the directory where gpg stores pre-generated revocation
5565 certificates. The file name corresponds to the OpenPGP fingerprint
5566 of the respective key. It is suggested to backup those
5567 certificates and if the primary private key is not stored on the
5568 disk to move them to an external storage device. Anyone who can
5569 access theses files is able to revoke the corresponding key. You
5570 may want to print them out. You should backup all files in this
5571 directory and take care to keep this backup closed away.
5573 Operation is further controlled by a few environment variables:
5576 Used to locate the default home directory.
5579 If set directory used instead of "~/.gnupg".
5582 This variable is obsolete; it was used by GnuPG versions before
5586 This value is passed via gpg-agent to pinentry. It is useful to
5587 convey extra information to a custom pinentry.
5591 Used to size some displays to the full size of the screen.
5594 Apart from its use by GNU, it is used in the W32 version to
5595 override the language selection done through the Registry. If used
5596 and set to a valid and available language name (LANGID), the file
5597 with the translation is loaded from 'GPGDIR/gnupg.nls/LANGID.mo'.
5598 Here GPGDIR is the directory out of which the gpg binary has been
5599 loaded. If it can't be loaded the Registry is tried and as last
5600 resort the native Windows locale system is used.
5603 This variable is only used by the regression test suite as a helper
5604 under operating systems without proper support to figure out the
5605 name of a process' text file.
5607 When calling the gpg-agent component 'gpg' sends a set of environment
5608 variables to gpg-agent. The names of these variables can be listed
5611 gpg-connect-agent 'getinfo std_env_names' /bye | awk '$1=="D" {print $2}'
5614 File: gnupg.info, Node: GPG Examples, Next: Unattended Usage of GPG, Prev: GPG Configuration, Up: Invoking GPG
5619 gpg -se -r 'Bob' 'file'
5620 sign and encrypt for user Bob
5622 gpg -clear-sign 'file'
5623 make a cleartext signature
5626 make a detached signature
5628 gpg -u 0x12345678 -sb 'file'
5629 make a detached signature with the key 0x12345678
5631 gpg -list-keys 'user_ID'
5634 gpg -fingerprint 'user_ID'
5637 gpg -verify 'pgpfile'
5638 gpg -verify 'sigfile' ['datafile']
5639 Verify the signature of the file but do not output the data unless
5640 requested. The second form is used for detached signatures, where
5641 'sigfile' is the detached signature (either ASCII armored or
5642 binary) and 'datafile' are the signed data; if this is not given,
5643 the name of the file holding the signed data is constructed by
5644 cutting off the extension (".asc" or ".sig") of 'sigfile' or by
5645 asking the user for the filename. If the option '--output' is also
5646 used the signed data is written to the file specified by that
5647 option; use '-' to write the signed data to stdout.
5652 The options '--import-filter' and '--export-filter' use expressions with
5653 this syntax (square brackets indicate an optional part and curly braces
5654 a repetition, white space between the elements are allowed):
5656 [lc] {[{flag}] PROPNAME op VALUE [lc]}
5658 The name of a property (PROPNAME) may only consist of letters, digits
5659 and underscores. The description for the filter type describes which
5660 properties are defined. If an undefined property is used it evaluates
5661 to the empty string. Unless otherwise noted, the VALUE must always be
5662 given and may not be the empty string. No quoting is defined for the
5663 value, thus the value may not contain the strings '&&' or '||', which
5664 are used as logical connection operators. The flag '--' can be used to
5665 remove this restriction.
5667 Numerical values are computed as long int; standard C notation
5668 applies. LC is the logical connection operator; either '&&' for a
5669 conjunction or '||' for a disjunction. A conjunction is assumed at the
5670 begin of an expression. Conjunctions have higher precedence than
5671 disjunctions. If VALUE starts with one of the characters used in any OP
5672 a space after the OP is required.
5674 The supported operators (OP) are:
5677 Substring must match.
5680 Substring must not match.
5683 The full string must match.
5686 The full string must not match.
5689 The numerical value must match.
5692 The numerical value must not match.
5695 The numerical value of the field must be LE than the value.
5698 The numerical value of the field must be LT than the value.
5701 The numerical value of the field must be GT than the value.
5704 The numerical value of the field must be GE than the value.
5707 The string value of the field must be less or equal than the value.
5710 The string value of the field must be less than the value.
5713 The string value of the field must be greater than the value.
5716 The string value of the field must be greater or equal than the
5720 True if value is not empty (no value allowed).
5723 True if value is empty (no value allowed).
5726 Alias for "PROPNAME != 0" (no value allowed).
5729 Alias for "PROPNAME == 0" (no value allowed).
5731 Values for FLAG must be space separated. The supported flags are:
5734 VALUE spans to the end of the expression.
5736 The string match in this part is done case-sensitive.
5738 Leading and trailing spaces are not removed from VALUE. The
5739 optional single space after OP is here required.
5741 The filter options concatenate several specifications for a filter of
5742 the same type. For example the four options in this example:
5744 --import-filter keep-uid="uid =~ Alfa"
5745 --import-filter keep-uid="&& uid !~ Test"
5746 --import-filter keep-uid="|| uid =~ Alpha"
5747 --import-filter keep-uid="uid !~ Test"
5749 which is equivalent to
5752 keep-uid="uid =~ Alfa" && uid !~ Test" || uid =~ Alpha" && "uid !~ Test"
5754 imports only the user ids of a key containing the strings "Alfa" or
5755 "Alpha" but not the string "test".
5760 The program returns 0 if there are no severe errors, 1 if at least a
5761 signature was bad, and other error codes for fatal errors.
5763 Note that signature verification requires exact knowledge of what has
5764 been signed and by whom it has beensigned. Using only the return code
5765 is thus not an appropriate way to verify a signature by a script.
5766 Either make proper use or the status codes or use the 'gpgv' tool which
5767 has been designed to make signature verification easy for scripts.
5772 Use a good password for your user account and make sure that all
5773 security issues are always fixed on your machine. Also employ diligent
5774 physical protection to your machine. Consider to use a good passphrase
5775 as a last resort protection to your secret key in the case your machine
5776 gets stolen. It is important that your secret key is never leaked.
5777 Using an easy to carry around token or smartcard with the secret key is
5780 If you are going to verify detached signatures, make sure that the
5781 program knows about it; either give both filenames on the command line
5782 or use '-' to specify STDIN.
5784 For scripted or other unattended use of 'gpg' make sure to use the
5785 machine-parseable interface and not the default interface which is
5786 intended for direct use by humans. The machine-parseable interface
5787 provides a stable and well documented API independent of the locale or
5788 future changes of 'gpg'. To enable this interface use the options
5789 '--with-colons' and '--status-fd'. For certain operations the option
5790 '--command-fd' may come handy too. See this man page and the file
5791 'DETAILS' for the specification of the interface. Note that the GnuPG
5792 "info" pages as well as the PDF version of the GnuPG manual features a
5793 chapter on unattended use of GnuPG. As an alternative the library
5794 'GPGME' can be used as a high-level abstraction on top of that
5797 INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS
5798 ********************************************
5800 GnuPG tries to be a very flexible implementation of the OpenPGP
5801 standard. In particular, GnuPG implements many of the optional parts of
5802 the standard, such as the SHA-512 hash, and the ZLIB and BZIP2
5803 compression algorithms. It is important to be aware that not all
5804 OpenPGP programs implement these optional algorithms and that by forcing
5805 their use via the '--cipher-algo', '--digest-algo',
5806 '--cert-digest-algo', or '--compress-algo' options in GnuPG, it is
5807 possible to create a perfectly valid OpenPGP message, but one that
5808 cannot be read by the intended recipient.
5810 There are dozens of variations of OpenPGP programs available, and
5811 each supports a slightly different subset of these optional algorithms.
5812 For example, until recently, no (unhacked) version of PGP supported the
5813 BLOWFISH cipher algorithm. A message using BLOWFISH simply could not be
5814 read by a PGP user. By default, GnuPG uses the standard OpenPGP
5815 preferences system that will always do the right thing and create
5816 messages that are usable by all recipients, regardless of which OpenPGP
5817 program they use. Only override this safe default if you really know
5820 If you absolutely must override the safe default, or if the
5821 preferences on a given key are invalid for some reason, you are far
5822 better off using the '--pgp6', '--pgp7', or '--pgp8' options. These
5823 options are safe as they do not force any particular algorithms in
5824 violation of OpenPGP, but rather reduce the available algorithms to a
5830 On older systems this program should be installed as setuid(root). This
5831 is necessary to lock memory pages. Locking memory pages prevents the
5832 operating system from writing memory pages (which may contain
5833 passphrases or other sensitive material) to disk. If you get no warning
5834 message about insecure memory your operating system supports locking
5835 without being root. The program drops root privileges as soon as locked
5836 memory is allocated.
5838 Note also that some systems (especially laptops) have the ability to
5839 "suspend to disk" (also known as "safe sleep" or "hibernate"). This
5840 writes all memory to disk before going into a low power or even powered
5841 off mode. Unless measures are taken in the operating system to protect
5842 the saved memory, passphrases or other sensitive material may be
5843 recoverable from it later.
5845 Before you report a bug you should first search the mailing list
5846 archives for similar problems and second check whether such a bug has
5847 already been reported to our bug tracker at <https://bugs.gnupg.org>.
5850 File: gnupg.info, Node: Unattended Usage of GPG, Prev: GPG Examples, Up: Invoking GPG
5852 4.5 Unattended Usage
5853 ====================
5855 'gpg' is often used as a backend engine by other software. To help with
5856 this a machine interface has been defined to have an unambiguous way to
5857 do this. The options '--status-fd' and '--batch' are almost always
5862 * Programmatic use of GnuPG:: Programmatic use of GnuPG
5863 * Ephemeral home directories:: Ephemeral home directories
5864 * The quick key manipulation interface:: The quick key manipulation interface
5865 * Unattended GPG key generation:: Unattended key generation
5868 File: gnupg.info, Node: Programmatic use of GnuPG, Next: Ephemeral home directories, Up: Unattended Usage of GPG
5870 4.5.1 Programmatic use of GnuPG
5871 -------------------------------
5873 Please consider using GPGME instead of calling 'gpg' directly. GPGME
5874 offers a stable, backend-independent interface for many cryptographic
5875 operations. It supports OpenPGP and S/MIME, and also allows interaction
5876 with various GnuPG components.
5878 GPGME provides a C-API, and comes with bindings for C++, Qt, and
5879 Python. Bindings for other languages are available.
5882 File: gnupg.info, Node: Ephemeral home directories, Next: The quick key manipulation interface, Prev: Programmatic use of GnuPG, Up: Unattended Usage of GPG
5884 4.5.2 Ephemeral home directories
5885 --------------------------------
5887 Sometimes you want to contain effects of some operation, for example you
5888 want to import a key to inspect it, but you do not want this key to be
5889 added to your keyring. In earlier versions of GnuPG, it was possible to
5890 specify alternate keyring files for both public and secret keys. In
5891 modern GnuPG versions, however, we changed how secret keys are stored in
5892 order to better protect secret key material, and it was not possible to
5893 preserve this interface.
5895 The preferred way to do this is to use ephemeral home directories.
5896 This technique works across all versions of GnuPG.
5898 Create a temporary directory, create (or copy) a configuration that
5899 meets your needs, make 'gpg' use this directory either using the
5900 environment variable GNUPGHOME, or the option '--homedir'. GPGME
5901 supports this too on a per-context basis, by modifying the engine info
5902 of contexts. Now execute whatever operation you like, import and export
5903 key material as necessary. Once finished, you can delete the directory.
5904 All GnuPG backend services that were started will detect this and shut
5908 File: gnupg.info, Node: The quick key manipulation interface, Next: Unattended GPG key generation, Prev: Ephemeral home directories, Up: Unattended Usage of GPG
5910 4.5.3 The quick key manipulation interface
5911 ------------------------------------------
5913 Recent versions of GnuPG have an interface to manipulate keys without
5914 using the interactive command '--edit-key'. This interface was added
5915 mainly for the benefit of GPGME (please consider using GPGME, see the
5916 manual subsection "Programmatic use of GnuPG"). This interface is
5917 described in the subsection "How to manage your keys".
5920 File: gnupg.info, Node: Unattended GPG key generation, Prev: The quick key manipulation interface, Up: Unattended Usage of GPG
5922 4.5.4 Unattended key generation
5923 -------------------------------
5925 The command '--generate-key' may be used along with the option '--batch'
5926 for unattended key generation. This is the most flexible way of
5927 generating keys, but it is also the most complex one. Consider using
5928 the quick key manipulation interface described in the previous
5929 subsection "The quick key manipulation interface".
5931 The parameters for the key are either read from stdin or given as a
5932 file on the command line. The format of the parameter file is as
5935 * Text only, line length is limited to about 1000 characters.
5936 * UTF-8 encoding must be used to specify non-ASCII characters.
5937 * Empty lines are ignored.
5938 * Leading and trailing white space is ignored.
5939 * A hash sign as the first non white space character indicates a
5941 * Control statements are indicated by a leading percent sign, the
5942 arguments are separated by white space from the keyword.
5943 * Parameters are specified by a keyword, followed by a colon.
5944 Arguments are separated by white space.
5945 * The first parameter must be 'Key-Type'; control statements may be
5947 * The order of the parameters does not matter except for 'Key-Type'
5948 which must be the first parameter. The parameters are only used
5949 for the generated keyblock (primary and subkeys); parameters from
5950 previous sets are not used. Some syntactically checks may be
5952 * Key generation takes place when either the end of the parameter
5953 file is reached, the next 'Key-Type' parameter is encountered or at
5954 the control statement '%commit' is encountered.
5959 Print TEXT as diagnostic.
5962 Suppress actual key generation (useful for syntax checking).
5965 Perform the key generation. Note that an implicit commit is done
5966 at the next Key-Type parameter.
5969 Do not write the key to the default or commandline given keyring
5970 but to FILENAME. This must be given before the first commit to
5971 take place, duplicate specification of the same filename is
5972 ignored, the last filename before a commit is used. The filename
5973 is used until a new filename is used (at commit points) and all
5974 keys are written to that file. If a new filename is given, this
5975 file is created (and overwrites an existing one).
5977 See the previous subsection "Ephemeral home directories" for a more
5978 robust way to contain side-effects.
5981 This option is a no-op for GnuPG 2.1 and later.
5983 See the previous subsection "Ephemeral home directories".
5987 This option is a no-op for GnuPG 2.1 and later.
5990 Using this option allows the creation of keys without any
5991 passphrase protection. This option is mainly intended for
5995 If given the keys are created using a faster and a somewhat less
5996 secure random number generator. This option may be used for keys
5997 which are only used for a short time and do not require full
5998 cryptographic strength. It takes only effect if used together with
5999 the control statement '%no-protection'.
6004 Starts a new parameter block by giving the type of the primary key.
6005 The algorithm must be capable of signing. This is a required
6006 parameter. ALGO may either be an OpenPGP algorithm number or a
6007 string with the algorithm name. The special value 'default' may be
6008 used for ALGO to create the default key type; in this case a
6009 'Key-Usage' shall not be given and 'default' also be used for
6013 The requested length of the generated key in bits. The default is
6014 returned by running the command 'gpg --gpgconf-list'. For ECC keys
6015 this parameter is ignored.
6018 The requested elliptic curve of the generated key. This is a
6019 required parameter for ECC keys. It is ignored for non-ECC keys.
6022 This is optional and used to generate a CSR or certificate for an
6023 already existing key. Key-Length will be ignored when given.
6025 Key-Usage: USAGE-LIST
6026 Space or comma delimited list of key usages. Allowed values are
6027 'encrypt', 'sign', and 'auth'. This is used to generate the key
6028 flags. Please make sure that the algorithm is capable of this
6029 usage. Note that OpenPGP requires that all primary keys are
6030 capable of certification, so no matter what usage is given here,
6031 the 'cert' flag will be on. If no 'Key-Usage' is specified and the
6032 'Key-Type' is not 'default', all allowed usages for that particular
6033 algorithm are used; if it is not given but 'default' is used the
6034 usage will be 'sign'.
6037 This generates a secondary key (subkey). Currently only one subkey
6038 can be handled. See also 'Key-Type' above.
6040 Subkey-Length: NBITS
6041 Length of the secondary key (subkey) in bits. The default is
6042 returned by running the command 'gpg --gpgconf-list'.
6045 Key curve for a subkey; similar to 'Key-Curve'.
6047 Subkey-Usage: USAGE-LIST
6048 Key usage lists for a subkey; similar to 'Key-Usage'.
6051 If you want to specify a passphrase for the secret key, enter it
6052 here. Default is to use the Pinentry dialog to ask for a
6056 Name-Comment: COMMENT
6058 The three parts of a user name. Remember to use UTF-8 encoding
6059 here. If you don't give any of them, no user ID is created.
6061 Expire-Date: ISO-DATE|(NUMBER[d|w|m|y])
6062 Set the expiration date for the key (and the subkey). It may
6063 either be entered in ISO date format (e.g. "20000815T145012") or
6064 as number of days, weeks, month or years after the creation date.
6065 The special notation "seconds=N" is also allowed to specify a
6066 number of seconds since creation. Without a letter days are
6067 assumed. Note that there is no check done on the overflow of the
6068 type used by OpenPGP for timestamps. Thus you better make sure
6069 that the given value make sense. Although OpenPGP works with time
6070 intervals, GnuPG uses an absolute value internally and thus the
6071 last year we can represent is 2105.
6073 Creation-Date: ISO-DATE
6074 Set the creation date of the key as stored in the key information
6075 and which is also part of the fingerprint calculation. Either a
6076 date like "1986-04-26" or a full timestamp like "19860426T042640"
6077 may be used. The time is considered to be UTC. The special
6078 notation "seconds=N" may be used to directly specify a the number
6079 of seconds since Epoch (Unix time). If it is not given the current
6083 Set the cipher, hash, and compression preference values for this
6084 key. This expects the same type of string as the sub-command
6085 'setpref' in the '--edit-key' menu.
6087 Revoker: ALGO:FPR [sensitive]
6088 Add a designated revoker to the generated key. Algo is the public
6089 key algorithm of the designated revoker (i.e. RSA=1, DSA=17, etc.)
6090 FPR is the fingerprint of the designated revoker. The optional
6091 'sensitive' flag marks the designated revoker as sensitive
6092 information. Only v4 keys may be designated revokers.
6095 This is an optional parameter that specifies the preferred
6096 keyserver URL for the key.
6099 This is an optional parameter only used with the status lines
6100 KEY_CREATED and KEY_NOT_CREATED. STRING may be up to 100 characters
6101 and should not contain spaces. It is useful for batch key
6102 generation to associate a key parameter block with a status line.
6104 Here is an example on how to create a key in an ephemeral home
6106 $ export GNUPGHOME="$(mktemp -d)"
6108 %echo Generating a basic OpenPGP key
6113 Name-Real: Joe Tester
6114 Name-Comment: with stupid passphrase
6115 Name-Email: joe@foo.bar
6118 # Do a commit here, so that we can later print "done" :-)
6122 $ gpg --batch --generate-key foo
6124 $ gpg --list-secret-keys
6125 /tmp/tmp.0NQxB74PEf/pubring.kbx
6126 -------------------------------
6127 sec dsa1024 2016-12-16 [SCA]
6128 768E895903FC1C44045C8CB95EEBDB71E9E849D0
6129 uid [ultimate] Joe Tester (with stupid passphrase) <joe@foo.bar>
6130 ssb elg1024 2016-12-16 [E]
6132 If you want to create a key with the default algorithms you would use
6134 %echo Generating a default key
6136 Subkey-Type: default
6137 Name-Real: Joe Tester
6138 Name-Comment: with stupid passphrase
6139 Name-Email: joe@foo.bar
6142 # Do a commit here, so that we can later print "done" :-)
6147 File: gnupg.info, Node: Invoking GPGSM, Next: Invoking SCDAEMON, Prev: Invoking GPG, Up: Top
6152 'gpgsm' is a tool similar to 'gpg' to provide digital encryption and
6153 signing services on X.509 certificates and the CMS protocol. It is
6154 mainly used as a backend for S/MIME mail processing. 'gpgsm' includes a
6155 full featured certificate management and complies with all rules defined
6156 for the German Sphinx project.
6158 *Note Option Index::, for an index to 'GPGSM''s commands and options.
6162 * GPGSM Commands:: List of all commands.
6163 * GPGSM Options:: List of all options.
6164 * GPGSM Configuration:: Configuration files.
6165 * GPGSM Examples:: Some usage examples.
6167 Developer information:
6168 * Unattended Usage:: Using 'gpgsm' from other programs.
6169 * GPGSM Protocol:: The protocol the server mode uses.
6172 File: gnupg.info, Node: GPGSM Commands, Next: GPGSM Options, Up: Invoking GPGSM
6177 Commands are not distinguished from options except for the fact that
6178 only one command is allowed.
6182 * General GPGSM Commands:: Commands not specific to the functionality.
6183 * Operational GPGSM Commands:: Commands to select the type of operation.
6184 * Certificate Management:: How to manage certificates.
6187 File: gnupg.info, Node: General GPGSM Commands, Next: Operational GPGSM Commands, Up: GPGSM Commands
6189 5.1.1 Commands not specific to the function
6190 -------------------------------------------
6193 Print the program version and licensing information. Note that you
6194 cannot abbreviate this command.
6197 Print a usage message summarizing the most useful command-line
6198 options. Note that you cannot abbreviate this command.
6201 Print warranty information. Note that you cannot abbreviate this
6205 Print a list of all available options and commands. Note that you
6206 cannot abbreviate this command.
6209 File: gnupg.info, Node: Operational GPGSM Commands, Next: Certificate Management, Prev: General GPGSM Commands, Up: GPGSM Commands
6211 5.1.2 Commands to select the type of operation
6212 ----------------------------------------------
6215 Perform an encryption. The keys the data is encrypted to must be
6216 set using the option '--recipient'.
6219 Perform a decryption; the type of input is automatically
6220 determined. It may either be in binary form or PEM encoded;
6221 automatic determination of base-64 encoding is not done.
6224 Create a digital signature. The key used is either the fist one
6225 found in the keybox or those set with the '--local-user' option.
6228 Check a signature file for validity. Depending on the arguments a
6229 detached signature may also be checked.
6232 Run in server mode and wait for commands on the 'stdin'.
6234 '--call-dirmngr COMMAND [ARGS]'
6235 Behave as a Dirmngr client issuing the request COMMAND with the
6236 optional list of ARGS. The output of the Dirmngr is printed
6237 stdout. Please note that file names given as arguments should have
6238 an absolute file name (i.e. commencing with '/') because they are
6239 passed verbatim to the Dirmngr and the working directory of the
6240 Dirmngr might not be the same as the one of this client. Currently
6241 it is not possible to pass data via stdin to the Dirmngr. COMMAND
6242 should not contain spaces.
6244 This is command is required for certain maintaining tasks of the
6245 dirmngr where a dirmngr must be able to call back to 'gpgsm'. See
6246 the Dirmngr manual for details.
6248 '--call-protect-tool ARGUMENTS'
6249 Certain maintenance operations are done by an external program call
6250 'gpg-protect-tool'; this is usually not installed in a directory
6251 listed in the PATH variable. This command provides a simple
6252 wrapper to access this tool. ARGUMENTS are passed verbatim to this
6253 command; use '--help' to get a list of supported operations.
6256 File: gnupg.info, Node: Certificate Management, Prev: Operational GPGSM Commands, Up: GPGSM Commands
6258 5.1.3 How to manage the certificates and keys
6259 ---------------------------------------------
6263 This command allows the creation of a certificate signing request
6264 or a self-signed certificate. It is commonly used along with the
6265 '--output' option to save the created CSR or certificate into a
6266 file. If used with the '--batch' a parameter file is used to
6267 create the CSR or certificate and it is further possible to create
6268 non-self-signed certificates.
6272 List all available certificates stored in the local key database.
6273 Note that the displayed data might be reformatted for better human
6274 readability and illegal characters are replaced by safe
6277 '--list-secret-keys'
6279 List all available certificates for which a corresponding a secret
6282 '--list-external-keys PATTERN'
6283 List certificates matching PATTERN using an external server. This
6284 utilizes the 'dirmngr' service.
6287 Same as '--list-keys' but also prints all keys making up the chain.
6291 List all available certificates stored in the local key database
6292 using a format useful mainly for debugging.
6295 Same as '--dump-keys' but also prints all keys making up the chain.
6297 '--dump-secret-keys'
6298 List all available certificates for which a corresponding a secret
6299 key is available using a format useful mainly for debugging.
6301 '--dump-external-keys PATTERN'
6302 List certificates matching PATTERN using an external server. This
6303 utilizes the 'dirmngr' service. It uses a format useful mainly for
6306 '--keydb-clear-some-cert-flags'
6307 This is a debugging aid to reset certain flags in the key database
6308 which are used to cache certain certificate stati. It is
6309 especially useful if a bad CRL or a weird running OCSP responder
6310 did accidentally revoke certificate. There is no security issue
6311 with this command because 'gpgsm' always make sure that the
6312 validity of a certificate is checked right before it is used.
6314 '--delete-keys PATTERN'
6315 Delete the keys matching PATTERN. Note that there is no command to
6316 delete the secret part of the key directly. In case you need to do
6317 this, you should run the command 'gpgsm --dump-secret-keys KEYID'
6318 before you delete the key, copy the string of hex-digits in the
6319 "keygrip" line and delete the file consisting of these hex-digits
6320 and the suffix '.key' from the 'private-keys-v1.d' directory below
6321 our GnuPG home directory (usually '~/.gnupg').
6323 '--export [PATTERN]'
6324 Export all certificates stored in the Keybox or those specified by
6325 the optional PATTERN. Those pattern consist of a list of user ids
6326 (*note how-to-specify-a-user-id::). When used along with the
6327 '--armor' option a few informational lines are prepended before
6328 each block. There is one limitation: As there is no commonly
6329 agreed upon way to pack more than one certificate into an ASN.1
6330 structure, the binary export (i.e. without using 'armor') works
6331 only for the export of one certificate. Thus it is required to
6332 specify a PATTERN which yields exactly one certificate. Ephemeral
6333 certificate are only exported if all PATTERN are given as
6334 fingerprints or keygrips.
6336 '--export-secret-key-p12 KEY-ID'
6337 Export the private key and the certificate identified by KEY-ID
6338 using the PKCS#12 format. When used with the '--armor' option a
6339 few informational lines are prepended to the output. Note, that
6340 the PKCS#12 format is not very secure and proper transport security
6341 should be used to convey the exported key. (*Note option
6344 '--export-secret-key-p8 KEY-ID'
6345 '--export-secret-key-raw KEY-ID'
6346 Export the private key of the certificate identified by KEY-ID with
6347 any encryption stripped. The '...-raw' command exports in PKCS#1
6348 format; the '...-p8' command exports in PKCS#8 format. When used
6349 with the '--armor' option a few informational lines are prepended
6350 to the output. These commands are useful to prepare a key for use
6354 Import the certificates from the PEM or binary encoded files as
6355 well as from signed-only messages. This command may also be used
6356 to import a secret key from a PKCS#12 file.
6359 Read information about the private keys from the smartcard and
6360 import the certificates from there. This command utilizes the
6361 'gpg-agent' and in turn the 'scdaemon'.
6363 '--change-passphrase USER_ID'
6365 Change the passphrase of the private key belonging to the
6366 certificate specified as USER_ID. Note, that changing the
6367 passphrase/PIN of a smartcard is not yet supported.
6370 File: gnupg.info, Node: GPGSM Options, Next: GPGSM Configuration, Prev: GPGSM Commands, Up: Invoking GPGSM
6375 'GPGSM' features a bunch of options to control the exact behaviour and
6376 to change the default configuration.
6380 * Configuration Options:: How to change the configuration.
6381 * Certificate Options:: Certificate related options.
6382 * Input and Output:: Input and Output.
6383 * CMS Options:: How to change how the CMS is created.
6384 * Esoteric Options:: Doing things one usually do not want to do.
6387 File: gnupg.info, Node: Configuration Options, Next: Certificate Options, Up: GPGSM Options
6389 5.2.1 How to change the configuration
6390 -------------------------------------
6392 These options are used to change the configuration and are usually found
6396 Reads configuration from FILE instead of from the default per-user
6397 configuration file. The default configuration file is named
6398 'gpgsm.conf' and expected in the '.gnupg' directory directly below
6399 the home directory of the user.
6402 Set the name of the home directory to DIR. If this option is not
6403 used, the home directory defaults to '~/.gnupg'. It is only
6404 recognized when given on the command line. It also overrides any
6405 home directory stated through the environment variable 'GNUPGHOME'
6406 or (on Windows systems) by means of the Registry entry
6407 HKCU\SOFTWARE\GNU\GNUPG:HOMEDIR.
6409 On Windows systems it is possible to install GnuPG as a portable
6410 application. In this case only this command line option is
6411 considered, all other ways to set a home directory are ignored.
6413 To install GnuPG as a portable application under Windows, create an
6414 empty file named 'gpgconf.ctl' in the same directory as the tool
6415 'gpgconf.exe'. The root of the installation is then that
6416 directory; or, if 'gpgconf.exe' has been installed directly below a
6417 directory named 'bin', its parent directory. You also need to make
6418 sure that the following directories exist and are writable:
6419 'ROOT/home' for the GnuPG home and 'ROOT/usr/local/var/cache/gnupg'
6420 for internal cache files.
6424 Outputs additional information while running. You can increase the
6425 verbosity by giving several verbose commands to 'gpgsm', such as
6428 '--ldapserver STRING'
6429 '--keyserver STRING'
6430 Add an LDAP server to use for X.509 certificate and CRL lookup.
6431 This option can be given multiple times to configure more than one
6432 LDAP server. Note that in general 'dirmngr' should be configured
6433 with the list of LDAP servers; if this option is also configured
6434 here, it is used in addition to those configured in dirmngr. For
6435 the syntax see the description of dirmngr's ldapserver option.
6437 '--policy-file FILENAME'
6438 Change the default name of the policy file to FILENAME.
6440 '--agent-program FILE'
6441 Specify an agent program to be used for secret key operations. The
6442 default value is determined by running the command 'gpgconf'. Note
6443 that the pipe symbol ('|') is used for a regression test suite hack
6444 and may thus not be used in the file name.
6446 '--dirmngr-program FILE'
6447 Specify a dirmngr program to be used for CRL checks. The default
6448 value is '/usr/local/bin/dirmngr'.
6450 '--prefer-system-dirmngr'
6451 This option is obsolete and ignored.
6454 Entirely disable the use of the Dirmngr.
6457 Do not start the gpg-agent or the dirmngr if it has not yet been
6458 started and its service is required. This option is mostly useful
6459 on machines where the connection to gpg-agent has been redirected
6460 to another machines. If dirmngr is required on the remote machine,
6461 it may be started manually using 'gpgconf --launch dirmngr'.
6463 '--no-secmem-warning'
6464 Do not print a warning when the so called "secure memory" cannot be
6468 When running in server mode, append all logging output to FILE.
6469 Use 'socket://' to log to socket.
6472 File: gnupg.info, Node: Certificate Options, Next: Input and Output, Prev: Configuration Options, Up: GPGSM Options
6474 5.2.2 Certificate related options
6475 ---------------------------------
6477 '--enable-policy-checks'
6478 '--disable-policy-checks'
6479 By default policy checks are enabled. These options may be used to
6482 '--enable-crl-checks'
6483 '--disable-crl-checks'
6484 By default the CRL checks are enabled and the DirMngr is used to
6485 check for revoked certificates. The disable option is most useful
6486 with an off-line network connection to suppress this check and also
6487 to avoid that new certificates introduce a web bug by including a
6488 certificate specific CRL DP. The disable option also disables an
6489 issuer certificate lookup via the authorityInfoAccess property of
6490 the certificate; the '--enable-issuer-key-retrieve' can be used to
6491 make use of that property anyway.
6493 '--enable-trusted-cert-crl-check'
6494 '--disable-trusted-cert-crl-check'
6495 By default the CRL for trusted root certificates are checked like
6496 for any other certificates. This allows a CA to revoke its own
6497 certificates voluntary without the need of putting all ever issued
6498 certificates into a CRL. The disable option may be used to switch
6499 this extra check off. Due to the caching done by the Dirmngr,
6500 there will not be any noticeable performance gain. Note, that this
6501 also disables possible OCSP checks for trusted root certificates.
6502 A more specific way of disabling this check is by adding the
6503 "relax" keyword to the root CA line of the 'trustlist.txt'
6505 '--force-crl-refresh'
6506 Tell the dirmngr to reload the CRL for each request. For better
6507 performance, the dirmngr will actually optimize this by suppressing
6508 the loading for short time intervals (e.g. 30 minutes). This
6509 option is useful to make sure that a fresh CRL is available for
6510 certificates hold in the keybox. The suggested way of doing this
6511 is by using it along with the option '--with-validation' for a key
6512 listing command. This option should not be used in a configuration
6515 '--enable-issuer-based-crl-check'
6516 Run a CRL check even for certificates which do not have any CRL
6517 distribution point. This requires that a suitable LDAP server has
6518 been configured in Dirmngr and that the CRL can be found using the
6519 issuer. This option reverts to what GnuPG did up to version
6520 2.2.20. This option is in general not useful.
6524 By default OCSP checks are disabled. The enable option may be used
6525 to enable OCSP checks via Dirmngr. If CRL checks are also enabled,
6526 CRLs will be used as a fallback if for some reason an OCSP request
6527 will not succeed. Note, that you have to allow OCSP requests in
6528 Dirmngr's configuration too (option '--allow-ocsp') and configure
6529 Dirmngr properly. If you do not do so you will get the error code
6532 '--auto-issuer-key-retrieve'
6533 If a required certificate is missing while validating the chain of
6534 certificates, try to load that certificate from an external
6535 location. This usually means that Dirmngr is employed to search
6536 for the certificate. Note that this option makes a "web bug" like
6537 behavior possible. LDAP server operators can see which keys you
6538 request, so by sending you a message signed by a brand new key
6539 (which you naturally will not have on your local keybox), the
6540 operator can tell both your IP address and the time when you
6541 verified the signature.
6543 '--validation-model NAME'
6544 This option changes the default validation model. The only
6545 possible values are "shell" (which is the default), "chain" which
6546 forces the use of the chain model and "steed" for a new simplified
6547 model. The chain model is also used if an option in the
6548 'trustlist.txt' or an attribute of the certificate requests it.
6549 However the standard model (shell) is in that case always tried
6552 '--ignore-cert-extension OID'
6553 Add OID to the list of ignored certificate extensions. The OID is
6554 expected to be in dotted decimal form, like '2.5.29.3'. This
6555 option may be used more than once. Critical flagged certificate
6556 extensions matching one of the OIDs in the list are treated as if
6557 they are actually handled and thus the certificate will not be
6558 rejected due to an unknown critical extension. Use this option
6559 with care because extensions are usually flagged as critical for a
6563 File: gnupg.info, Node: Input and Output, Next: CMS Options, Prev: Certificate Options, Up: GPGSM Options
6565 5.2.3 Input and Output
6566 ----------------------
6570 Create PEM encoded output. Default is binary output.
6573 Create Base-64 encoded output; i.e. PEM without the header lines.
6576 Assume the input data is PEM encoded. Default is to autodetect the
6577 encoding but this is may fail.
6580 Assume the input data is plain base-64 encoded.
6583 Assume the input data is binary encoded.
6585 '--p12-charset NAME'
6586 'gpgsm' uses the UTF-8 encoding when encoding passphrases for
6587 PKCS#12 files. This option may be used to force the passphrase to
6588 be encoded in the specified encoding NAME. This is useful if the
6589 application used to import the key uses a different encoding and
6590 thus will not be able to import a file generated by 'gpgsm'.
6591 Commonly used values for NAME are 'Latin1' and 'CP850'. Note that
6592 'gpgsm' itself automagically imports any file with a passphrase
6593 encoded to the most commonly used encodings.
6595 '--default-key USER_ID'
6596 Use USER_ID as the standard key for signing. This key is used if
6597 no other key has been defined as a signing key. Note, that the
6598 first '--local-users' option also sets this key if it has not yet
6599 been set; however '--default-key' always overrides this.
6601 '--local-user USER_ID'
6603 Set the user(s) to be used for signing. The default is the first
6604 secret key found in the database.
6608 Encrypt to the user id NAME. There are several ways a user id may
6609 be given (*note how-to-specify-a-user-id::).
6613 Write output to FILE. The default is to write it to stdout.
6616 Displays extra information with the '--list-keys' commands.
6617 Especially a line tagged 'grp' is printed which tells you the
6618 keygrip of a key. This string is for example used as the file name
6619 of the secret key. Implies '--with-colons'.
6622 When doing a key listing, do a full validation check for each key
6623 and print the result. This is usually a slow operation because it
6624 requires a CRL lookup and other operations.
6626 When used along with '--import', a validation of the certificate to
6627 import is done and only imported if it succeeds the test. Note
6628 that this does not affect an already available certificate in the
6629 DB. This option is therefore useful to simply verify a certificate.
6631 '--with-md5-fingerprint'
6632 For standard key listings, also print the MD5 fingerprint of the
6636 Include the keygrip in standard key listings. Note that the
6637 keygrip is always listed in '--with-colons' mode.
6640 Include info about the presence of a secret key in public key
6641 listings done with '--with-colons'.
6644 File: gnupg.info, Node: CMS Options, Next: Esoteric Options, Prev: Input and Output, Up: GPGSM Options
6646 5.2.4 How to change how the CMS is created
6647 ------------------------------------------
6650 Using N of -2 includes all certificate except for the root cert, -1
6651 includes all certs, 0 does not include any certs, 1 includes only
6652 the signers cert and all other positive values include up to N
6653 certificates starting with the signer cert. The default is -2.
6656 Use the cipher algorithm with the ASN.1 object identifier OID for
6657 encryption. For convenience the strings '3DES', 'AES' and 'AES256'
6658 may be used instead of their OIDs. The default is 'AES'
6659 (2.16.840.1.101.3.4.1.2).
6661 '--digest-algo name'
6662 Use 'name' as the message digest algorithm. Usually this algorithm
6663 is deduced from the respective signing certificate. This option
6664 forces the use of the given algorithm and may lead to severe
6665 interoperability problems.
6668 File: gnupg.info, Node: Esoteric Options, Prev: CMS Options, Up: GPGSM Options
6670 5.2.5 Doing things one usually do not want to do
6671 ------------------------------------------------
6673 '--extra-digest-algo NAME'
6674 Sometimes signatures are broken in that they announce a different
6675 digest algorithm than actually used. 'gpgsm' uses a one-pass data
6676 processing model and thus needs to rely on the announced digest
6677 algorithms to properly hash the data. As a workaround this option
6678 may be used to tell 'gpgsm' to also hash the data using the
6679 algorithm NAME; this slows processing down a little bit but allows
6680 verification of such broken signatures. If 'gpgsm' prints an error
6681 like "digest algo 8 has not been enabled" you may want to try this
6682 option, with 'SHA256' for NAME.
6684 '--compliance STRING'
6685 Set the compliance mode. Valid values are shown when using "help"
6688 '--min-rsa-length N'
6689 This option adjusts the compliance mode "de-vs" for stricter key
6690 size requirements. For example, a value of 3000 turns rsa2048 and
6691 dsa2048 keys into non-VS-NfD compliant keys.
6693 '--faked-system-time EPOCH'
6694 This option is only useful for testing; it sets the system time
6695 back or forth to EPOCH which is the number of seconds elapsed since
6696 the year 1970. Alternatively EPOCH may be given as a full ISO time
6697 string (e.g. "20070924T154812").
6699 '--with-ephemeral-keys'
6700 Include ephemeral flagged keys in the output of key listings. Note
6701 that they are included anyway if the key specification for a
6702 listing is given as fingerprint or keygrip.
6704 '--debug-level LEVEL'
6705 Select the debug level for investigating problems. LEVEL may be a
6706 numeric value or by a keyword:
6709 No debugging at all. A value of less than 1 may be used
6710 instead of the keyword.
6712 Some basic debug messages. A value between 1 and 2 may be
6713 used instead of the keyword.
6715 More verbose debug messages. A value between 3 and 5 may be
6716 used instead of the keyword.
6718 Even more detailed messages. A value between 6 and 8 may be
6719 used instead of the keyword.
6721 All of the debug messages you can get. A value greater than 8
6722 may be used instead of the keyword. The creation of hash
6723 tracing files is only enabled if the keyword is used.
6725 How these messages are mapped to the actual debugging flags is not
6726 specified and may change with newer releases of this program. They
6727 are however carefully selected to best aid in debugging.
6730 This option is only useful for debugging and the behaviour may
6731 change at any time without notice; using '--debug-levels' is the
6732 preferred method to select the debug verbosity. FLAGS are bit
6733 encoded and may be given in usual C-Syntax. The currently defined
6737 X.509 or OpenPGP protocol related data
6739 values of big number integers
6741 low level crypto operations
6747 show memory statistics
6749 write hashed data to files named 'dbgmd-000*'
6751 trace Assuan protocol
6753 Note, that all flags set using this option may get overridden by
6757 Same as '--debug=0xffffffff'
6759 '--debug-allow-core-dump'
6760 Usually 'gpgsm' tries to avoid dumping core by well written code
6761 and by disabling core dumps for security reasons. However, bugs
6762 are pretty durable beasts and to squash them it is sometimes useful
6763 to have a core dump. This option enables core dumps unless the Bad
6764 Thing happened before the option parsing.
6766 '--debug-no-chain-validation'
6767 This is actually not a debugging option but only useful as such.
6768 It lets 'gpgsm' bypass all certificate chain validation checks.
6770 '--debug-ignore-expiration'
6771 This is actually not a debugging option but only useful as such.
6772 It lets 'gpgsm' ignore all notAfter dates, this is used by the
6776 Read the passphrase from file descriptor 'n'. Only the first line
6777 will be read from file descriptor 'n'. If you use 0 for 'n', the
6778 passphrase will be read from STDIN. This can only be used if only
6779 one passphrase is supplied.
6781 Note that this passphrase is only used if the option '--batch' has
6784 '--pinentry-mode mode'
6785 Set the pinentry mode to 'mode'. Allowed values for 'mode' are:
6787 Use the default of the agent, which is 'ask'.
6789 Force the use of the Pinentry.
6791 Emulate use of Pinentry's cancel button.
6793 Return a Pinentry error ("No Pinentry").
6795 Redirect Pinentry queries to the caller. Note that in
6796 contrast to Pinentry the user is not prompted again if he
6797 enters a bad password.
6799 '--request-origin ORIGIN'
6800 Tell gpgsm to assume that the operation ultimately originated at
6801 ORIGIN. Depending on the origin certain restrictions are applied
6802 and the Pinentry may include an extra note on the origin.
6803 Supported values for ORIGIN are: 'local' which is the default,
6804 'remote' to indicate a remote origin or 'browser' for an operation
6805 requested by a web browser.
6807 '--no-common-certs-import'
6808 Suppress the import of common certificates on keybox creation.
6810 All the long options may also be given in the configuration file
6811 after stripping off the two leading dashes.
6814 File: gnupg.info, Node: GPGSM Configuration, Next: GPGSM Examples, Prev: GPGSM Options, Up: Invoking GPGSM
6816 5.3 Configuration files
6817 =======================
6819 There are a few configuration files to control certain aspects of
6820 'gpgsm''s operation. Unless noted, they are expected in the current
6821 home directory (*note option --homedir::).
6824 This is the standard configuration file read by 'gpgsm' on startup.
6825 It may contain any valid long option; the leading two dashes may
6826 not be entered and the option may not be abbreviated. This default
6827 name may be changed on the command line (*note gpgsm-option
6828 --options::). You should backup this file.
6831 This is a list of allowed CA policies. This file should list the
6832 object identifiers of the policies line by line. Empty lines and
6833 lines starting with a hash mark are ignored. Policies missing in
6834 this file and not marked as critical in the certificate will print
6835 only a warning; certificates with policies marked as critical and
6836 not listed in this file will fail the signature verification. You
6837 should backup this file.
6839 For example, to allow only the policy 2.289.9.9, the file should
6846 This is the list of root certificates used for qualified
6847 certificates. They are defined as certificates capable of creating
6848 legally binding signatures in the same way as handwritten
6849 signatures are. Comments start with a hash mark and empty lines
6850 are ignored. Lines do have a length limit but this is not a
6851 serious limitation as the format of the entries is fixed and
6852 checked by 'gpgsm': A non-comment line starts with optional
6853 whitespace, followed by exactly 40 hex characters, white space and
6854 a lowercased 2 letter country code. Additional data delimited with
6855 by a white space is current ignored but might late be used for
6858 Note that even if a certificate is listed in this file, this does
6859 not mean that the certificate is trusted; in general the
6860 certificates listed in this file need to be listed also in
6863 This is a global file an installed in the data directory (e.g.
6864 '/usr/local/share/gnupg/qualified.txt'). GnuPG installs a suitable
6865 file with root certificates as used in Germany. As new Root-CA
6866 certificates may be issued over time, these entries may need to be
6867 updated; new distributions of this software should come with an
6868 updated list but it is still the responsibility of the
6869 Administrator to check that this list is correct.
6871 Every time 'gpgsm' uses a certificate for signing or verification
6872 this file will be consulted to check whether the certificate under
6873 question has ultimately been issued by one of these CAs. If this
6874 is the case the user will be informed that the verified signature
6875 represents a legally binding ("qualified") signature. When
6876 creating a signature using such a certificate an extra prompt will
6877 be issued to let the user confirm that such a legally binding
6878 signature shall really be created.
6880 Because this software has not yet been approved for use with such
6881 certificates, appropriate notices will be shown to indicate this
6885 This is plain text file with a few help entries used with
6886 'pinentry' as well as a large list of help items for 'gpg' and
6887 'gpgsm'. The standard file has English help texts; to install
6888 localized versions use filenames like 'help.LL.txt' with LL
6889 denoting the locale. GnuPG comes with a set of predefined help
6890 files in the data directory (e.g.
6891 '/usr/local/share/gnupg/gnupg/help.de.txt') and allows overriding
6892 of any help item by help files stored in the system configuration
6893 directory (e.g. '/etc/gnupg/help.de.txt'). For a reference of the
6894 help file's syntax, please see the installed 'help.txt' file.
6897 This file is a collection of common certificates used to populated
6898 a newly created 'pubring.kbx'. An administrator may replace this
6899 file with a custom one. The format is a concatenation of PEM
6900 encoded X.509 certificates. This global file is installed in the
6901 data directory (e.g. '/usr/local/share/gnupg/com-certs.pem').
6903 Note that on larger installations, it is useful to put predefined
6904 files into the directory '/etc/skel/.gnupg/' so that newly created users
6905 start up with a working configuration. For existing users a small
6906 helper script is provided to create these files (*note addgnupghome::).
6908 For internal purposes 'gpgsm' creates and maintains a few other
6909 files; they all live in the current home directory (*note option
6910 --homedir::). Only 'gpgsm' may modify these files.
6913 This a database file storing the certificates as well as meta
6914 information. For debugging purposes the tool 'kbxutil' may be used
6915 to show the internal structure of this file. You should backup
6919 This content of this file is used to maintain the internal state of
6920 the random number generator across invocations. The same file is
6921 used by other programs of this software too.
6924 If this file exists 'gpgsm' will first try to connect to this
6925 socket for accessing 'gpg-agent' before starting a new 'gpg-agent'
6926 instance. Under Windows this socket (which in reality be a plain
6927 file describing a regular TCP listening port) is the standard way
6928 of connecting the 'gpg-agent'.
6931 File: gnupg.info, Node: GPGSM Examples, Next: Unattended Usage, Prev: GPGSM Configuration, Up: Invoking GPGSM
6936 $ gpgsm -er goo@bar.net <plaintext >ciphertext
6939 File: gnupg.info, Node: Unattended Usage, Next: GPGSM Protocol, Prev: GPGSM Examples, Up: Invoking GPGSM
6941 5.5 Unattended Usage
6942 ====================
6944 'gpgsm' is often used as a backend engine by other software. To help
6945 with this a machine interface has been defined to have an unambiguous
6946 way to do this. This is most likely used with the '--server' command
6947 but may also be used in the standard operation mode by using the
6948 '--status-fd' option.
6952 * Automated signature checking:: Automated signature checking.
6953 * CSR and certificate creation:: CSR and certificate creation.
6956 File: gnupg.info, Node: Automated signature checking, Next: CSR and certificate creation, Up: Unattended Usage
6958 5.5.1 Automated signature checking
6959 ----------------------------------
6961 It is very important to understand the semantics used with signature
6962 verification. Checking a signature is not as simple as it may sound and
6963 so the operation is a bit complicated. In most cases it is required to
6964 look at several status lines. Here is a table of all cases a signed
6967 The signature is valid
6968 This does mean that the signature has been successfully verified,
6969 the certificates are all sane. However there are two subcases with
6970 important information: One of the certificates may have expired or
6971 a signature of a message itself as expired. It is a sound practise
6972 to consider such a signature still as valid but additional
6973 information should be displayed. Depending on the subcase 'gpgsm'
6974 will issue these status codes:
6975 signature valid and nothing did expire
6976 'GOODSIG', 'VALIDSIG', 'TRUST_FULLY'
6977 signature valid but at least one certificate has expired
6978 'EXPKEYSIG', 'VALIDSIG', 'TRUST_FULLY'
6979 signature valid but expired
6980 'EXPSIG', 'VALIDSIG', 'TRUST_FULLY' Note, that this case is
6981 currently not implemented.
6983 The signature is invalid
6984 This means that the signature verification failed (this is an
6985 indication of a transfer error, a program error or tampering with
6986 the message). 'gpgsm' issues one of these status codes sequences:
6988 'GOODSIG, VALIDSIG TRUST_NEVER'
6990 Error verifying a signature
6991 For some reason the signature could not be verified, i.e. it
6992 cannot be decided whether the signature is valid or invalid. A
6993 common reason for this is a missing certificate.
6996 File: gnupg.info, Node: CSR and certificate creation, Prev: Automated signature checking, Up: Unattended Usage
6998 5.5.2 CSR and certificate creation
6999 ----------------------------------
7001 The command '--generate-key' may be used along with the option '--batch'
7002 to either create a certificate signing request (CSR) or an X.509
7003 certificate. This is controlled by a parameter file; the format of this
7006 * Text only, line length is limited to about 1000 characters.
7007 * UTF-8 encoding must be used to specify non-ASCII characters.
7008 * Empty lines are ignored.
7009 * Leading and trailing while space is ignored.
7010 * A hash sign as the first non white space character indicates a
7012 * Control statements are indicated by a leading percent sign, the
7013 arguments are separated by white space from the keyword.
7014 * Parameters are specified by a keyword, followed by a colon.
7015 Arguments are separated by white space.
7016 * The first parameter must be 'Key-Type', control statements may be
7018 * The order of the parameters does not matter except for 'Key-Type'
7019 which must be the first parameter. The parameters are only used
7020 for the generated CSR/certificate; parameters from previous sets
7021 are not used. Some syntactically checks may be performed.
7022 * Key generation takes place when either the end of the parameter
7023 file is reached, the next 'Key-Type' parameter is encountered or at
7024 the control statement '%commit' is encountered.
7029 Print TEXT as diagnostic.
7032 Suppress actual key generation (useful for syntax checking).
7035 Perform the key generation. Note that an implicit commit is done
7036 at the next Key-Type parameter.
7041 Starts a new parameter block by giving the type of the primary key.
7042 The algorithm must be capable of signing. This is a required
7043 parameter. The only supported value for ALGO is 'rsa'.
7046 The requested length of a generated key in bits. Defaults to 3072.
7049 This is optional and used to generate a CSR or certificate for an
7050 already existing key. Key-Length will be ignored when given.
7052 Key-Usage: USAGE-LIST
7053 Space or comma delimited list of key usage, allowed values are
7054 'encrypt', 'sign' and 'cert'. This is used to generate the
7055 keyUsage extension. Please make sure that the algorithm is capable
7056 of this usage. Default is to allow encrypt and sign.
7058 Name-DN: SUBJECT-NAME
7059 This is the Distinguished Name (DN) of the subject in RFC-2253
7063 This is an email address for the altSubjectName. This parameter is
7064 optional but may occur several times to add several email addresses
7068 The is an DNS name for the altSubjectName. This parameter is
7069 optional but may occur several times to add several DNS names to a
7073 This is an URI for the altSubjectName. This parameter is optional
7074 but may occur several times to add several URIs to a certificate.
7076 Additional parameters used to create a certificate (in contrast to a
7077 certificate signing request):
7080 If this parameter is given an X.509 certificate will be generated.
7081 SN is expected to be a hex string representing an unsigned integer
7082 of arbitrary length. The special value 'random' can be used to
7083 create a 64 bit random serial number.
7085 Issuer-DN: ISSUER-NAME
7086 This is the DN name of the issuer in RFC-2253 format. If it is not
7087 set it will default to the subject DN and a special GnuPG extension
7088 will be included in the certificate to mark it as a standalone
7091 Creation-Date: ISO-DATE
7092 Not-Before: ISO-DATE
7093 Set the notBefore date of the certificate. Either a date like
7094 '1986-04-26' or '1986-04-26 12:00' or a standard ISO timestamp like
7095 '19860426T042640' may be used. The time is considered to be UTC.
7096 If it is not given the current date is used.
7098 Expire-Date: ISO-DATE
7100 Set the notAfter date of the certificate. Either a date like
7101 '2063-04-05' or '2063-04-05 17:00' or a standard ISO timestamp like
7102 '20630405T170000' may be used. The time is considered to be UTC.
7103 If it is not given a default value in the not too far future is
7106 Signing-Key: KEYGRIP
7107 This gives the keygrip of the key used to sign the certificate. If
7108 it is not given a self-signed certificate will be created. For
7109 compatibility with future versions, it is suggested to prefix the
7112 Hash-Algo: HASH-ALGO
7113 Use HASH-ALGO for this CSR or certificate. The supported hash
7114 algorithms are: 'sha1', 'sha256', 'sha384' and 'sha512'; they may
7115 also be specified with uppercase letters. The default is 'sha256'.