chiark / gitweb /
gpg: Fix searching for mail addresses in keyrings.
[gnupg2.git] / doc / gnupg.info-1
1 This is gnupg.info, produced by makeinfo version 6.3 from gnupg.texi.
2
3 This is the 'The GNU Privacy Guard Manual' (version 2.1.18, January
4 2017).
5
6    (C) 2002, 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
7 (C) 2013, 2014, 2015 Werner Koch.
8 (C) 2015 g10 Code GmbH.
9
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
16 START-INFO-DIR-ENTRY
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.
22 END-INFO-DIR-ENTRY
23
24 \1f
25 File: gnupg.info,  Node: Top,  Next: Installation,  Up: (dir)
26
27 Using the GNU Privacy Guard
28 ***************************
29
30 This is the 'The GNU Privacy Guard Manual' (version 2.1.18, January
31 2017).
32
33    (C) 2002, 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
34 (C) 2013, 2014, 2015 Werner Koch.
35 (C) 2015 g10 Code GmbH.
36
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".
42
43    This manual documents how to use the GNU Privacy Guard system as well
44 as the administration and the architecture.
45
46 * Menu:
47
48 * Installation::        A short installation guide.
49
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
57 * Helper Tools::        Description of small helper tools
58
59 * Howtos::              How to do certain things.
60 * System Notes::        Notes pertaining to certain OSes.
61 * Debugging::           How to solve problems
62
63 * Copying::             GNU General Public License says
64                         how you can copy and share GnuPG
65 * Contributors::        People who have contributed to GnuPG.
66
67 * Glossary::            Short description of terms used.
68 * Option Index::        Index to command line options.
69 * Environment Index::   Index to environment variables and files.
70 * Index::               Index of concepts and symbol names.
71
72 \1f
73 File: gnupg.info,  Node: Installation,  Next: Invoking GPG-AGENT,  Prev: Top,  Up: Top
74
75 1 A short installation guide
76 ****************************
77
78 Unfortunately the installation guide has not been finished in time.
79 Instead of delaying the release of GnuPG 2.0 even further, I decided to
80 release without that guide.  The chapter on gpg-agent and gpgsm do
81 include brief information on how to set up the whole thing.  Please
82 watch the GnuPG website for updates of the documentation.  In the
83 meantime you may search the GnuPG mailing list archives or ask on the
84 gnupg-users mailing list for advise on how to solve problems or how to
85 get that whole thing up and running.
86
87    ** Building the software
88
89    Building the software is described in the file 'INSTALL'.  Given that
90 you are already reading this documentation we can only give some extra
91 hints.
92
93    To comply with the rules on GNU systems you should have build time
94 configured 'gnupg' using:
95
96      ./configure --sysconfdir=/etc --localstatedir=/var
97
98    This is to make sure that system wide configuration files are
99 searched in the directory '/etc' and variable data below '/var'; the
100 default would be to also install them below '/usr/local' where the
101 binaries get installed.  If you selected to use the '--prefix=/' you
102 obviously don't need those option as they are the default then.
103
104    ** Notes on setting a root CA key to trusted
105
106    X.509 is based on a hierarchical key infrastructure.  At the root of
107 the tree a trusted anchor (root certificate) is required.  There are
108 usually no other means of verifying whether this root certificate is
109 trustworthy than looking it up in a list.  GnuPG uses a file
110 ('trustlist.txt') to keep track of all root certificates it knows about.
111 There are 3 ways to get certificates into this list:
112
113    * Use the list which comes with GnuPG. However this list only
114      contains a few root certificates.  Most installations will need
115      more.
116
117    * Let 'gpgsm' ask you whether you want to insert a new root
118      certificate.  This feature is enabled by default; you may disable
119      it using the option 'no-allow-mark-trusted' into 'gpg-agent.conf'.
120
121    * Manually maintain the list of trusted root certificates.  For a
122      multi user installation this can be done once for all users on a
123      machine.  Specific changes on a per-user base are also possible.
124
125 \1f
126 File: gnupg.info,  Node: Invoking GPG-AGENT,  Next: Invoking DIRMNGR,  Prev: Installation,  Up: Top
127
128 2 Invoking GPG-AGENT
129 ********************
130
131 'gpg-agent' is a daemon to manage secret (private) keys independently
132 from any protocol.  It is used as a backend for 'gpg' and 'gpgsm' as
133 well as for a couple of other utilities.
134
135    The agent is automatically started on demand by 'gpg', 'gpgsm',
136 'gpgconf', or 'gpg-connect-agent'.  Thus there is no reason to start it
137 manually.  In case you want to use the included Secure Shell Agent you
138 may start the agent using:
139
140      gpg-connect-agent /bye
141
142 If you want to manually terminate the currently-running agent, you can
143 safely do so with:
144
145      gpgconf --kill gpg-agent
146
147 You should always add the following lines to your '.bashrc' or whatever
148 initialization file is used for all shell invocations:
149
150      GPG_TTY=$(tty)
151      export GPG_TTY
152
153 It is important that this environment variable always reflects the
154 output of the 'tty' command.  For W32 systems this option is not
155 required.
156
157    Please make sure that a proper pinentry program has been installed
158 under the default filename (which is system dependent) or use the option
159 'pinentry-program' to specify the full name of that program.  It is
160 often useful to install a symbolic link from the actual used pinentry
161 (e.g.  '/usr/local/bin/pinentry-gtk') to the expected one (e.g.
162 '/usr/local/bin/pinentry').
163
164 *Note Option Index::, for an index to 'GPG-AGENT''s commands and
165 options.
166
167 * Menu:
168
169 * Agent Commands::      List of all commands.
170 * Agent Options::       List of all options.
171 * Agent Configuration:: Configuration files.
172 * Agent Signals::       Use of some signals.
173 * Agent Examples::      Some usage examples.
174 * Agent Protocol::      The protocol the agent uses.
175
176 \1f
177 File: gnupg.info,  Node: Agent Commands,  Next: Agent Options,  Up: Invoking GPG-AGENT
178
179 2.1 Commands
180 ============
181
182 Commands are not distinguished from options except for the fact that
183 only one command is allowed.
184
185 '--version'
186      Print the program version and licensing information.  Note that you
187      cannot abbreviate this command.
188
189 '--help'
190 '-h'
191      Print a usage message summarizing the most useful command-line
192      options.  Note that you cannot abbreviate this command.
193
194 '--dump-options'
195      Print a list of all available options and commands.  Note that you
196      cannot abbreviate this command.
197
198 '--server'
199      Run in server mode and wait for commands on the 'stdin'.  The
200      default mode is to create a socket and listen for commands there.
201
202 '--daemon [COMMAND LINE]'
203      Start the gpg-agent as a daemon; that is, detach it from the
204      console and run it in the background.
205
206      As an alternative you may create a new process as a child of
207      gpg-agent: 'gpg-agent --daemon /bin/sh'.  This way you get a new
208      shell with the environment setup properly; after you exit from this
209      shell, gpg-agent terminates within a few seconds.
210
211 '--supervised'
212      Run in the foreground, sending logs by default to stderr, and
213      listening on provided file descriptors, which must already be bound
214      to listening sockets.  This command is useful when running under
215      systemd or other similar process supervision schemes.  This option
216      is not supported on Windows.
217
218      In -supervised mode, different file descriptors can be provided for
219      use as different socket types (e.g.  ssh, extra) as long as they
220      are identified in the environment variable 'LISTEN_FDNAMES' (see
221      sd_listen_fds(3) on some Linux distributions for more information
222      on this convention).
223
224 \1f
225 File: gnupg.info,  Node: Agent Options,  Next: Agent Configuration,  Prev: Agent Commands,  Up: Invoking GPG-AGENT
226
227 2.2 Option Summary
228 ==================
229
230 '--options FILE'
231      Reads configuration from FILE instead of from the default per-user
232      configuration file.  The default configuration file is named
233      'gpg-agent.conf' and expected in the '.gnupg' directory directly
234      below the home directory of the user.
235
236 '--homedir DIR'
237      Set the name of the home directory to DIR.  If this option is not
238      used, the home directory defaults to '~/.gnupg'.  It is only
239      recognized when given on the command line.  It also overrides any
240      home directory stated through the environment variable 'GNUPGHOME'
241      or (on Windows systems) by means of the Registry entry
242      HKCU\SOFTWARE\GNU\GNUPG:HOMEDIR.
243
244      On Windows systems it is possible to install GnuPG as a portable
245      application.  In this case only this command line option is
246      considered, all other ways to set a home directory are ignored.
247
248      To install GnuPG as a portable application under Windows, create an
249      empty file named 'gpgconf.ctl' in the same directory as the tool
250      'gpgconf.exe'.  The root of the installation is then that
251      directory; or, if 'gpgconf.exe' has been installed directly below a
252      directory named 'bin', its parent directory.  You also need to make
253      sure that the following directories exist and are writable:
254      'ROOT/home' for the GnuPG home and 'ROOT/usr/local/var/cache/gnupg'
255      for internal cache files.
256
257 '-v'
258 '--verbose'
259      Outputs additional information while running.  You can increase the
260      verbosity by giving several verbose commands to 'gpgsm', such as
261      '-vv'.
262
263 '-q'
264 '--quiet'
265      Try to be as quiet as possible.
266
267 '--batch'
268      Don't invoke a pinentry or do any other thing requiring human
269      interaction.
270
271 '--faked-system-time EPOCH'
272      This option is only useful for testing; it sets the system time
273      back or forth to EPOCH which is the number of seconds elapsed since
274      the year 1970.
275
276 '--debug-level LEVEL'
277      Select the debug level for investigating problems.  LEVEL may be a
278      numeric value or a keyword:
279
280      'none'
281           No debugging at all.  A value of less than 1 may be used
282           instead of the keyword.
283      'basic'
284           Some basic debug messages.  A value between 1 and 2 may be
285           used instead of the keyword.
286      'advanced'
287           More verbose debug messages.  A value between 3 and 5 may be
288           used instead of the keyword.
289      'expert'
290           Even more detailed messages.  A value between 6 and 8 may be
291           used instead of the keyword.
292      'guru'
293           All of the debug messages you can get.  A value greater than 8
294           may be used instead of the keyword.  The creation of hash
295           tracing files is only enabled if the keyword is used.
296
297      How these messages are mapped to the actual debugging flags is not
298      specified and may change with newer releases of this program.  They
299      are however carefully selected to best aid in debugging.
300
301 '--debug FLAGS'
302      This option is only useful for debugging and the behavior may
303      change at any time without notice.  FLAGS are bit encoded and may
304      be given in usual C-Syntax.  The currently defined bits are:
305
306      '0 (1)'
307           X.509 or OpenPGP protocol related data
308      '1 (2)'
309           values of big number integers
310      '2 (4)'
311           low level crypto operations
312      '5 (32)'
313           memory allocation
314      '6 (64)'
315           caching
316      '7 (128)'
317           show memory statistics
318      '9 (512)'
319           write hashed data to files named 'dbgmd-000*'
320      '10 (1024)'
321           trace Assuan protocol
322      '12 (4096)'
323           bypass all certificate validation
324
325 '--debug-all'
326      Same as '--debug=0xffffffff'
327
328 '--debug-wait N'
329      When running in server mode, wait N seconds before entering the
330      actual processing loop and print the pid.  This gives time to
331      attach a debugger.
332
333 '--debug-quick-random'
334      This option inhibits the use of the very secure random quality
335      level (Libgcrypt’s 'GCRY_VERY_STRONG_RANDOM') and degrades all
336      request down to standard random quality.  It is only used for
337      testing and should not be used for any production quality keys.
338      This option is only effective when given on the command line.
339
340      On GNU/Linux, another way to quickly generate insecure keys is to
341      use 'rngd' to fill the kernel's entropy pool with lower quality
342      random data.  'rngd' is typically provided by the 'rng-tools'
343      package.  It can be run as follows: 'sudo rngd -f -r /dev/urandom'.
344
345 '--debug-pinentry'
346      This option enables extra debug information pertaining to the
347      Pinentry.  As of now it is only useful when used along with
348      '--debug 1024'.
349
350 '--no-detach'
351      Don't detach the process from the console.  This is mainly useful
352      for debugging.
353
354 '-s'
355 '--sh'
356 '-c'
357 '--csh'
358      Format the info output in daemon mode for use with the standard
359      Bourne shell or the C-shell respectively.  The default is to guess
360      it based on the environment variable 'SHELL' which is correct in
361      almost all cases.
362
363 '--no-grab'
364      Tell the pinentry not to grab the keyboard and mouse.  This option
365      should in general not be used to avoid X-sniffing attacks.
366
367 '--log-file FILE'
368      Append all logging output to FILE.  This is very helpful in seeing
369      what the agent actually does.  Use 'socket://' to log to socket.
370      If neither a log file nor a log file descriptor has been set on a
371      Windows platform, the Registry entry
372      'HKCU\Software\GNU\GnuPG:DefaultLogFile', if set, is used to
373      specify the logging output.
374
375 '--no-allow-mark-trusted'
376      Do not allow clients to mark keys as trusted, i.e.  put them into
377      the 'trustlist.txt' file.  This makes it harder for users to
378      inadvertently accept Root-CA keys.
379
380 '--allow-preset-passphrase'
381      This option allows the use of 'gpg-preset-passphrase' to seed the
382      internal cache of 'gpg-agent' with passphrases.
383
384 '--no-allow-loopback-pinentry'
385 '--allow-loopback-pinentry'
386      Disallow or allow clients to use the loopback pinentry features;
387      see the option 'pinentry-mode' for details.  Allow is the default.
388
389      The '--force' option of the Assuan command 'DELETE_KEY' is also
390      controlled by this option: The option is ignored if a loopback
391      pinentry is disallowed.
392
393 '--no-allow-external-cache'
394      Tell Pinentry not to enable features which use an external cache
395      for passphrases.
396
397      Some desktop environments prefer to unlock all credentials with one
398      master password and may have installed a Pinentry which employs an
399      additional external cache to implement such a policy.  By using
400      this option the Pinentry is advised not to make use of such a cache
401      and instead always ask the user for the requested passphrase.
402
403 '--allow-emacs-pinentry'
404      Tell Pinentry to allow features to divert the passphrase entry to a
405      running Emacs instance.  How this is exactly handled depends on the
406      version of the used Pinentry.
407
408 '--ignore-cache-for-signing'
409      This option will let 'gpg-agent' bypass the passphrase cache for
410      all signing operation.  Note that there is also a per-session
411      option to control this behavior but this command line option takes
412      precedence.
413
414 '--default-cache-ttl N'
415      Set the time a cache entry is valid to N seconds.  The default is
416      600 seconds.  Each time a cache entry is accessed, the entry's
417      timer is reset.  To set an entry's maximum lifetime, use
418      'max-cache-ttl'.
419
420 '--default-cache-ttl-ssh N'
421      Set the time a cache entry used for SSH keys is valid to N seconds.
422      The default is 1800 seconds.  Each time a cache entry is accessed,
423      the entry's timer is reset.  To set an entry's maximum lifetime,
424      use 'max-cache-ttl-ssh'.
425
426 '--max-cache-ttl N'
427      Set the maximum time a cache entry is valid to N seconds.  After
428      this time a cache entry will be expired even if it has been
429      accessed recently or has been set using 'gpg-preset-passphrase'.
430      The default is 2 hours (7200 seconds).
431
432 '--max-cache-ttl-ssh N'
433      Set the maximum time a cache entry used for SSH keys is valid to N
434      seconds.  After this time a cache entry will be expired even if it
435      has been accessed recently or has been set using
436      'gpg-preset-passphrase'.  The default is 2 hours (7200 seconds).
437
438 '--enforce-passphrase-constraints'
439      Enforce the passphrase constraints by not allowing the user to
440      bypass them using the "Take it anyway" button.
441
442 '--min-passphrase-len N'
443      Set the minimal length of a passphrase.  When entering a new
444      passphrase shorter than this value a warning will be displayed.
445      Defaults to 8.
446
447 '--min-passphrase-nonalpha N'
448      Set the minimal number of digits or special characters required in
449      a passphrase.  When entering a new passphrase with less than this
450      number of digits or special characters a warning will be displayed.
451      Defaults to 1.
452
453 '--check-passphrase-pattern FILE'
454      Check the passphrase against the pattern given in FILE.  When
455      entering a new passphrase matching one of these pattern a warning
456      will be displayed.  FILE should be an absolute filename.  The
457      default is not to use any pattern file.
458
459      Security note: It is known that checking a passphrase against a
460      list of pattern or even against a complete dictionary is not very
461      effective to enforce good passphrases.  Users will soon figure up
462      ways to bypass such a policy.  A better policy is to educate users
463      on good security behavior and optionally to run a passphrase
464      cracker regularly on all users passphrases to catch the very simple
465      ones.
466
467 '--max-passphrase-days N'
468      Ask the user to change the passphrase if N days have passed since
469      the last change.  With '--enforce-passphrase-constraints' set the
470      user may not bypass this check.
471
472 '--enable-passphrase-history'
473      This option does nothing yet.
474
475 '--pinentry-invisible-char CHAR'
476      This option asks the Pinentry to use CHAR for displaying hidden
477      characters.  CHAR must be one character UTF-8 string.  A Pinentry
478      may or may not honor this request.
479
480 '--pinentry-timeout N'
481      This option asks the Pinentry to timeout after N seconds with no
482      user input.  The default value of 0 does not ask the pinentry to
483      timeout, however a Pinentry may use its own default timeout value
484      in this case.  A Pinentry may or may not honor this request.
485
486 '--pinentry-program FILENAME'
487      Use program FILENAME as the PIN entry.  The default is installation
488      dependent.  With the default configuration the name of the default
489      pinentry is 'pinentry'; if that file does not exist but a
490      'pinentry-basic' exist the latter is used.
491
492      On a Windows platform the default is to use the first existing
493      program from this list: 'bin\pinentry.exe',
494      '..\Gpg4win\bin\pinentry.exe', '..\Gpg4win\pinentry.exe',
495      '..\GNU\GnuPG\pinentry.exe', '..\GNU\bin\pinentry.exe',
496      'bin\pinentry-basic.exe' where the file names are relative to the
497      GnuPG installation directory.
498
499 '--pinentry-touch-file FILENAME'
500      By default the filename of the socket gpg-agent is listening for
501      requests is passed to Pinentry, so that it can touch that file
502      before exiting (it does this only in curses mode).  This option
503      changes the file passed to Pinentry to FILENAME.  The special name
504      '/dev/null' may be used to completely disable this feature.  Note
505      that Pinentry will not create that file, it will only change the
506      modification and access time.
507
508 '--scdaemon-program FILENAME'
509      Use program FILENAME as the Smartcard daemon.  The default is
510      installation dependent and can be shown with the 'gpgconf' command.
511
512 '--disable-scdaemon'
513      Do not make use of the scdaemon tool.  This option has the effect
514      of disabling the ability to do smartcard operations.  Note, that
515      enabling this option at runtime does not kill an already forked
516      scdaemon.
517
518 '--disable-check-own-socket'
519      'gpg-agent' employs a periodic self-test to detect a stolen socket.
520      This usually means a second instance of 'gpg-agent' has taken over
521      the socket and 'gpg-agent' will then terminate itself.  This option
522      may be used to disable this self-test for debugging purposes.
523
524 '--use-standard-socket'
525 '--no-use-standard-socket'
526 '--use-standard-socket-p'
527      Since GnuPG 2.1 the standard socket is always used.  These options
528      have no more effect.  The command 'gpg-agent
529      --use-standard-socket-p' will thus always return success.
530
531 '--display STRING'
532 '--ttyname STRING'
533 '--ttytype STRING'
534 '--lc-ctype STRING'
535 '--lc-messages STRING'
536 '--xauthority STRING'
537      These options are used with the server mode to pass localization
538      information.
539
540 '--keep-tty'
541 '--keep-display'
542      Ignore requests to change the current 'tty' or X window system's
543      'DISPLAY' variable respectively.  This is useful to lock the
544      pinentry to pop up at the 'tty' or display you started the agent.
545
546 '--extra-socket NAME'
547      The extra socket is created by default, you may use this option to
548      change the name of the socket.  To disable the creation of the
549      socket use "none" or "/dev/null" for NAME.
550
551      Also listen on native gpg-agent connections on the given socket.
552      The intended use for this extra socket is to setup a Unix domain
553      socket forwarding from a remote machine to this socket on the local
554      machine.  A 'gpg' running on the remote machine may then connect to
555      the local gpg-agent and use its private keys.  This enables
556      decrypting or signing data on a remote machine without exposing the
557      private keys to the remote machine.
558
559 '--enable-ssh-support'
560 '--enable-putty-support'
561
562      The OpenSSH Agent protocol is always enabled, but 'gpg-agent' will
563      only set the 'SSH_AUTH_SOCK' variable if this flag is given.
564
565      In this mode of operation, the agent does not only implement the
566      gpg-agent protocol, but also the agent protocol used by OpenSSH
567      (through a separate socket).  Consequently, it should be possible
568      to use the gpg-agent as a drop-in replacement for the well known
569      ssh-agent.
570
571      SSH Keys, which are to be used through the agent, need to be added
572      to the gpg-agent initially through the ssh-add utility.  When a key
573      is added, ssh-add will ask for the password of the provided key
574      file and send the unprotected key material to the agent; this
575      causes the gpg-agent to ask for a passphrase, which is to be used
576      for encrypting the newly received key and storing it in a gpg-agent
577      specific directory.
578
579      Once a key has been added to the gpg-agent this way, the gpg-agent
580      will be ready to use the key.
581
582      Note: in case the gpg-agent receives a signature request, the user
583      might need to be prompted for a passphrase, which is necessary for
584      decrypting the stored key.  Since the ssh-agent protocol does not
585      contain a mechanism for telling the agent on which display/terminal
586      it is running, gpg-agent's ssh-support will use the TTY or X
587      display where gpg-agent has been started.  To switch this display
588      to the current one, the following command may be used:
589
590           gpg-connect-agent updatestartuptty /bye
591
592      Although all GnuPG components try to start the gpg-agent as needed,
593      this is not possible for the ssh support because ssh does not know
594      about it.  Thus if no GnuPG tool which accesses the agent has been
595      run, there is no guarantee that ssh is able to use gpg-agent for
596      authentication.  To fix this you may start gpg-agent if needed
597      using this simple command:
598
599           gpg-connect-agent /bye
600
601      Adding the '--verbose' shows the progress of starting the agent.
602
603      The '--enable-putty-support' is only available under Windows and
604      allows the use of gpg-agent with the ssh implementation 'putty'.
605      This is similar to the regular ssh-agent support but makes use of
606      Windows message queue as required by 'putty'.
607
608    All the long options may also be given in the configuration file
609 after stripping off the two leading dashes.
610
611 \1f
612 File: gnupg.info,  Node: Agent Configuration,  Next: Agent Signals,  Prev: Agent Options,  Up: Invoking GPG-AGENT
613
614 2.3 Configuration
615 =================
616
617 There are a few configuration files needed for the operation of the
618 agent.  By default they may all be found in the current home directory
619 (*note option --homedir::).
620
621 'gpg-agent.conf'
622      This is the standard configuration file read by 'gpg-agent' on
623      startup.  It may contain any valid long option; the leading two
624      dashes may not be entered and the option may not be abbreviated.
625      This file is also read after a 'SIGHUP' however only a few options
626      will actually have an effect.  This default name may be changed on
627      the command line (*note option --options::).  You should backup
628      this file.
629
630 'trustlist.txt'
631      This is the list of trusted keys.  You should backup this file.
632
633      Comment lines, indicated by a leading hash mark, as well as empty
634      lines are ignored.  To mark a key as trusted you need to enter its
635      fingerprint followed by a space and a capital letter 'S'.  Colons
636      may optionally be used to separate the bytes of a fingerprint; this
637      enables cutting and pasting the fingerprint from a key listing
638      output.  If the line is prefixed with a '!' the key is explicitly
639      marked as not trusted.
640
641      Here is an example where two keys are marked as ultimately trusted
642      and one as not trusted:
643
644             # CN=Wurzel ZS 3,O=Intevation GmbH,C=DE
645             A6935DD34EF3087973C706FC311AA2CCF733765B S
646
647             # CN=PCA-1-Verwaltung-02/O=PKI-1-Verwaltung/C=DE
648             DC:BD:69:25:48:BD:BB:7E:31:6E:BB:80:D3:00:80:35:D4:F8:A6:CD S
649
650             # CN=Root-CA/O=Schlapphuete/L=Pullach/C=DE
651             !14:56:98:D3:FE:9C:CA:5A:31:6E:BC:81:D3:11:4E:00:90:A3:44:C2 S
652   
653
654      Before entering a key into this file, you need to ensure its
655      authenticity.  How to do this depends on your organisation; your
656      administrator might have already entered those keys which are
657      deemed trustworthy enough into this file.  Places where to look for
658      the fingerprint of a root certificate are letters received from the
659      CA or the website of the CA (after making 100% sure that this is
660      indeed the website of that CA). You may want to consider
661      disallowing interactive updates of this file by using the *note
662      option --no-allow-mark-trusted::.  It might even be advisable to
663      change the permissions to read-only so that this file can't be
664      changed inadvertently.
665
666      As a special feature a line 'include-default' will include a global
667      list of trusted certificates (e.g.  '/etc/gnupg/trustlist.txt').
668      This global list is also used if the local list is not available.
669
670      It is possible to add further flags after the 'S' for use by the
671      caller:
672
673      'relax'
674           Relax checking of some root certificate requirements.  As of
675           now this flag allows the use of root certificates with a
676           missing basicConstraints attribute (despite that it is a MUST
677           for CA certificates) and disables CRL checking for the root
678           certificate.
679
680      'cm'
681           If validation of a certificate finally issued by a CA with
682           this flag set fails, try again using the chain validation
683           model.
684
685 'sshcontrol'
686      This file is used when support for the secure shell agent protocol
687      has been enabled (*note option --enable-ssh-support::).  Only keys
688      present in this file are used in the SSH protocol.  You should
689      backup this file.
690
691      The 'ssh-add' tool may be used to add new entries to this file; you
692      may also add them manually.  Comment lines, indicated by a leading
693      hash mark, as well as empty lines are ignored.  An entry starts
694      with optional whitespace, followed by the keygrip of the key given
695      as 40 hex digits, optionally followed by the caching TTL in seconds
696      and another optional field for arbitrary flags.  A non-zero TTL
697      overrides the global default as set by '--default-cache-ttl-ssh'.
698
699      The only flag support is 'confirm'.  If this flag is found for a
700      key, each use of the key will pop up a pinentry to confirm the use
701      of that key.  The flag is automatically set if a new key was loaded
702      into 'gpg-agent' using the option '-c' of the 'ssh-add' command.
703
704      The keygrip may be prefixed with a '!' to disable an entry.
705
706      The following example lists exactly one key.  Note that keys
707      available through a OpenPGP smartcard in the active smartcard
708      reader are implicitly added to this list; i.e.  there is no need to
709      list them.
710
711                  # Key added on: 2011-07-20 20:38:46
712                  # Fingerprint:  5e:8d:c4:ad:e7:af:6e:27:8a:d6:13:e4:79:ad:0b:81
713                  34B62F25E277CF13D3C6BCEBFD3F85D08F0A864B 0 confirm
714
715 'private-keys-v1.d/'
716
717      This is the directory where gpg-agent stores the private keys.
718      Each key is stored in a file with the name made up of the keygrip
719      and the suffix 'key'.  You should backup all files in this
720      directory and take great care to keep this backup closed away.
721
722    Note that on larger installations, it is useful to put predefined
723 files into the directory '/etc/skel/.gnupg' so that newly created users
724 start up with a working configuration.  For existing users the a small
725 helper script is provided to create these files (*note addgnupghome::).
726
727 \1f
728 File: gnupg.info,  Node: Agent Signals,  Next: Agent Examples,  Prev: Agent Configuration,  Up: Invoking GPG-AGENT
729
730 2.4 Use of some signals
731 =======================
732
733 A running 'gpg-agent' may be controlled by signals, i.e.  using the
734 'kill' command to send a signal to the process.
735
736    Here is a list of supported signals:
737
738 'SIGHUP'
739      This signal flushes all cached passphrases and if the program has
740      been started with a configuration file, the configuration file is
741      read again.  Only certain options are honored: 'quiet', 'verbose',
742      'debug', 'debug-all', 'debug-level', 'debug-pinentry', 'no-grab',
743      'pinentry-program', 'pinentry-invisible-char', 'default-cache-ttl',
744      'max-cache-ttl', 'ignore-cache-for-signing',
745      'no-allow-external-cache', 'allow-emacs-pinentry',
746      'no-allow-mark-trusted', 'disable-scdaemon', and
747      'disable-check-own-socket'.  'scdaemon-program' is also supported
748      but due to the current implementation, which calls the scdaemon
749      only once, it is not of much use unless you manually kill the
750      scdaemon.
751
752 'SIGTERM'
753      Shuts down the process but waits until all current requests are
754      fulfilled.  If the process has received 3 of these signals and
755      requests are still pending, a shutdown is forced.
756
757 'SIGINT'
758      Shuts down the process immediately.
759
760 'SIGUSR1'
761      Dump internal information to the log file.
762
763 'SIGUSR2'
764      This signal is used for internal purposes.
765
766 \1f
767 File: gnupg.info,  Node: Agent Examples,  Next: Agent Protocol,  Prev: Agent Signals,  Up: Invoking GPG-AGENT
768
769 2.5 Examples
770 ============
771
772 It is important to set the environment variable 'GPG_TTY' in your login
773 shell, for example in the '~/.bashrc' init script:
774
775        export GPG_TTY=$(tty)
776
777    If you enabled the Ssh Agent Support, you also need to tell ssh about
778 it by adding this to your init script:
779
780      unset SSH_AGENT_PID
781      if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
782        export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
783      fi
784
785 \1f
786 File: gnupg.info,  Node: Agent Protocol,  Prev: Agent Examples,  Up: Invoking GPG-AGENT
787
788 2.6 Agent's Assuan Protocol
789 ===========================
790
791 Note: this section does only document the protocol, which is used by
792 GnuPG components; it does not deal with the ssh-agent protocol.  To see
793 the full specification of each command, use
794
795        gpg-connect-agent 'help COMMAND' /bye
796
797 or just 'help' to list all available commands.
798
799 The 'gpg-agent' daemon is started on demand by the GnuPG components.
800
801    To identify a key we use a thing called keygrip which is the SHA-1
802 hash of an canonical encoded S-Expression of the public key as used in
803 Libgcrypt.  For the purpose of this interface the keygrip is given as a
804 hex string.  The advantage of using this and not the hash of a
805 certificate is that it will be possible to use the same keypair for
806 different protocols, thereby saving space on the token used to keep the
807 secret keys.
808
809    The 'gpg-agent' may send status messages during a command or when
810 returning from a command to inform a client about the progress or result
811 of an operation.  For example, the INQUIRE_MAXLEN status message may be
812 sent during a server inquire to inform the client of the maximum usable
813 length of the inquired data (which should not be exceeded).
814
815 * Menu:
816
817 * Agent PKDECRYPT::       Decrypting a session key
818 * Agent PKSIGN::          Signing a Hash
819 * Agent GENKEY::          Generating a Key
820 * Agent IMPORT::          Importing a Secret Key
821 * Agent EXPORT::          Exporting a Secret Key
822 * Agent ISTRUSTED::       Importing a Root Certificate
823 * Agent GET_PASSPHRASE::  Ask for a passphrase
824 * Agent CLEAR_PASSPHRASE:: Expire a cached passphrase
825 * Agent PRESET_PASSPHRASE:: Set a passphrase for a keygrip
826 * Agent GET_CONFIRMATION:: Ask for confirmation
827 * Agent HAVEKEY::         Check whether a key is available
828 * Agent LEARN::           Register a smartcard
829 * Agent PASSWD::          Change a Passphrase
830 * Agent UPDATESTARTUPTTY:: Change the Standard Display
831 * Agent GETEVENTCOUNTER:: Get the Event Counters
832 * Agent GETINFO::         Return information about the process
833 * Agent OPTION::          Set options for the session
834
835 \1f
836 File: gnupg.info,  Node: Agent PKDECRYPT,  Next: Agent PKSIGN,  Up: Agent Protocol
837
838 2.6.1 Decrypting a session key
839 ------------------------------
840
841 The client asks the server to decrypt a session key.  The encrypted
842 session key should have all information needed to select the appropriate
843 secret key or to delegate it to a smartcard.
844
845        SETKEY <keyGrip>
846
847    Tell the server about the key to be used for decryption.  If this is
848 not used, 'gpg-agent' may try to figure out the key by trying to decrypt
849 the message with each key available.
850
851        PKDECRYPT
852
853    The agent checks whether this command is allowed and then does an
854 INQUIRY to get the ciphertext the client should then send the cipher
855 text.
856
857          S: INQUIRE CIPHERTEXT
858          C: D (xxxxxx
859          C: D xxxx)
860          C: END
861
862    Please note that the server may send status info lines while reading
863 the data lines from the client.  The data send is a SPKI like S-Exp with
864 this structure:
865
866           (enc-val
867             (<algo>
868               (<param_name1> <mpi>)
869            ...
870               (<param_namen> <mpi>)))
871
872    Where algo is a string with the name of the algorithm; see the
873 libgcrypt documentation for a list of valid algorithms.  The number and
874 names of the parameters depend on the algorithm.  The agent does return
875 an error if there is an inconsistency.
876
877    If the decryption was successful the decrypted data is returned by
878 means of "D" lines.
879
880    Here is an example session:
881         C: PKDECRYPT
882         S: INQUIRE CIPHERTEXT
883         C: D (enc-val elg (a 349324324)
884         C: D    (b 3F444677CA)))
885         C: END
886         S: # session key follows
887         S: S PADDING 0
888         S: D (value 1234567890ABCDEF0)
889         S: OK decryption successful
890
891    The “PADDING” status line is only send if gpg-agent can tell what
892 kind of padding is used.  As of now only the value 0 is used to indicate
893 that the padding has been removed.
894
895 \1f
896 File: gnupg.info,  Node: Agent PKSIGN,  Next: Agent GENKEY,  Prev: Agent PKDECRYPT,  Up: Agent Protocol
897
898 2.6.2 Signing a Hash
899 --------------------
900
901 The client asks the agent to sign a given hash value.  A default key
902 will be chosen if no key has been set.  To set a key a client first
903 uses:
904
905         SIGKEY <keyGrip>
906
907    This can be used multiple times to create multiple signature, the
908 list of keys is reset with the next PKSIGN command or a RESET. The
909 server tests whether the key is a valid key to sign something and
910 responds with okay.
911
912         SETHASH --hash=<name>|<algo> <hexstring>
913
914    The client can use this command to tell the server about the data
915 <hexstring> (which usually is a hash) to be signed.  <algo> is the
916 decimal encoded hash algorithm number as used by Libgcrypt.  Either
917 <algo> or -hash=<name> must be given.  Valid names for <name> are:
918
919 'sha1'
920      The SHA-1 hash algorithm
921 'sha256'
922      The SHA-256 hash algorithm
923 'rmd160'
924      The RIPE-MD160 hash algorithm
925 'md5'
926      The old and broken MD5 hash algorithm
927 'tls-md5sha1'
928      A combined hash algorithm as used by the TLS protocol.
929
930 The actual signing is done using
931
932         PKSIGN <options>
933
934    Options are not yet defined, but may later be used to choose among
935 different algorithms.  The agent does then some checks, asks for the
936 passphrase and as a result the server returns the signature as an SPKI
937 like S-expression in "D" lines:
938
939           (sig-val
940             (<algo>
941               (<param_name1> <mpi>)
942            ...
943               (<param_namen> <mpi>)))
944
945    The operation is affected by the option
946
947         OPTION use-cache-for-signing=0|1
948
949    The default of '1' uses the cache.  Setting this option to '0' will
950 lead 'gpg-agent' to ignore the passphrase cache.  Note, that there is
951 also a global command line option for 'gpg-agent' to globally disable
952 the caching.
953
954    Here is an example session:
955         C: SIGKEY <keyGrip>
956         S: OK key available
957         C: SIGKEY <keyGrip>
958         S: OK key available
959         C: PKSIGN
960         S: # I did ask the user whether he really wants to sign
961         S: # I did ask the user for the passphrase
962         S: INQUIRE HASHVAL
963         C: D ABCDEF012345678901234
964         C: END
965         S: # signature follows
966         S: D (sig-val rsa (s 45435453654612121212))
967         S: OK
968
969 \1f
970 File: gnupg.info,  Node: Agent GENKEY,  Next: Agent IMPORT,  Prev: Agent PKSIGN,  Up: Agent Protocol
971
972 2.6.3 Generating a Key
973 ----------------------
974
975 This is used to create a new keypair and store the secret key inside the
976 active PSE -- which is in most cases a Soft-PSE. A not-yet-defined
977 option allows choosing the storage location.  To get the secret key out
978 of the PSE, a special export tool has to be used.
979
980         GENKEY [--no-protection] [--preset] [<cache_nonce>]
981
982    Invokes the key generation process and the server will then inquire
983 on the generation parameters, like:
984
985         S: INQUIRE KEYPARM
986         C: D (genkey (rsa (nbits  1024)))
987         C: END
988
989    The format of the key parameters which depends on the algorithm is of
990 the form:
991
992          (genkey
993            (algo
994              (parameter_name_1 ....)
995                ....
996              (parameter_name_n ....)))
997
998    If everything succeeds, the server returns the *public key* in a SPKI
999 like S-Expression like this:
1000
1001           (public-key
1002             (rsa
1003          (n <mpi>)
1004          (e <mpi>)))
1005
1006    Here is an example session:
1007         C: GENKEY
1008         S: INQUIRE KEYPARM
1009         C: D (genkey (rsa (nbits  1024)))
1010         C: END
1011         S: D (public-key
1012         S: D   (rsa (n 326487324683264) (e 10001)))
1013         S  OK key created
1014
1015    The '--no-protection' option may be used to prevent prompting for a
1016 passphrase to protect the secret key while leaving the secret key
1017 unprotected.  The '--preset' option may be used to add the passphrase to
1018 the cache using the default cache parameters.
1019
1020    The '--inq-passwd' option may be used to create the key with a
1021 supplied passphrase.  When used the agent does an inquiry with the
1022 keyword 'NEWPASSWD' to retrieve that passphrase.  This option takes
1023 precedence over '--no-protection'; however if the client sends a empty
1024 (zero-length) passphrase, this is identical to '--no-protection'.
1025
1026 \1f
1027 File: gnupg.info,  Node: Agent IMPORT,  Next: Agent EXPORT,  Prev: Agent GENKEY,  Up: Agent Protocol
1028
1029 2.6.4 Importing a Secret Key
1030 ----------------------------
1031
1032 This operation is not yet supported by GpgAgent.  Specialized tools are
1033 to be used for this.
1034
1035    There is no actual need because we can expect that secret keys
1036 created by a 3rd party are stored on a smartcard.  If we have generated
1037 the key ourselves, we do not need to import it.
1038
1039 \1f
1040 File: gnupg.info,  Node: Agent EXPORT,  Next: Agent ISTRUSTED,  Prev: Agent IMPORT,  Up: Agent Protocol
1041
1042 2.6.5 Export a Secret Key
1043 -------------------------
1044
1045 Not implemented.
1046
1047    Should be done by an extra tool.
1048
1049 \1f
1050 File: gnupg.info,  Node: Agent ISTRUSTED,  Next: Agent GET_PASSPHRASE,  Prev: Agent EXPORT,  Up: Agent Protocol
1051
1052 2.6.6 Importing a Root Certificate
1053 ----------------------------------
1054
1055 Actually we do not import a Root Cert but provide a way to validate any
1056 piece of data by storing its Hash along with a description and an
1057 identifier in the PSE. Here is the interface description:
1058
1059          ISTRUSTED <fingerprint>
1060
1061    Check whether the OpenPGP primary key or the X.509 certificate with
1062 the given fingerprint is an ultimately trusted key or a trusted Root CA
1063 certificate.  The fingerprint should be given as a hexstring (without
1064 any blanks or colons or whatever in between) and may be left padded with
1065 00 in case of an MD5 fingerprint.  GPGAgent will answer with:
1066
1067          OK
1068
1069    The key is in the table of trusted keys.
1070
1071          ERR 304 (Not Trusted)
1072
1073    The key is not in this table.
1074
1075    Gpg needs the entire list of trusted keys to maintain the web of
1076 trust; the following command is therefore quite helpful:
1077
1078          LISTTRUSTED
1079
1080    GpgAgent returns a list of trusted keys line by line:
1081
1082          S: D 000000001234454556565656677878AF2F1ECCFF P
1083          S: D 340387563485634856435645634856438576457A P
1084          S: D FEDC6532453745367FD83474357495743757435D S
1085          S: OK
1086
1087    The first item on a line is the hexified fingerprint where MD5
1088 fingerprints are '00' padded to the left and the second item is a flag
1089 to indicate the type of key (so that gpg is able to only take care of
1090 PGP keys).  P = OpenPGP, S = S/MIME. A client should ignore the rest of
1091 the line, so that we can extend the format in the future.
1092
1093    Finally a client should be able to mark a key as trusted:
1094
1095         MARKTRUSTED FINGERPRINT "P"|"S"
1096
1097    The server will then pop up a window to ask the user whether she
1098 really trusts this key.  For this it will probably ask for a text to be
1099 displayed like this:
1100
1101         S: INQUIRE TRUSTDESC
1102         C: D Do you trust the key with the fingerprint @FPR@
1103         C: D bla fasel blurb.
1104         C: END
1105         S: OK
1106
1107    Known sequences with the pattern @foo@ are replaced according to this
1108 table:
1109
1110 '@FPR16@'
1111      Format the fingerprint according to gpg rules for a v3 keys.
1112 '@FPR20@'
1113      Format the fingerprint according to gpg rules for a v4 keys.
1114 '@FPR@'
1115      Choose an appropriate format to format the fingerprint.
1116 '@@'
1117      Replaced by a single '@'.
1118
1119 \1f
1120 File: gnupg.info,  Node: Agent GET_PASSPHRASE,  Next: Agent CLEAR_PASSPHRASE,  Prev: Agent ISTRUSTED,  Up: Agent Protocol
1121
1122 2.6.7 Ask for a passphrase
1123 --------------------------
1124
1125 This function is usually used to ask for a passphrase to be used for
1126 symmetric encryption, but may also be used by programs which need
1127 special handling of passphrases.  This command uses a syntax which helps
1128 clients to use the agent with minimum effort.
1129
1130        GET_PASSPHRASE [--data] [--check] [--no-ask] [--repeat[=N]] \
1131                       [--qualitybar] CACHE_ID                \
1132                       [ERROR_MESSAGE PROMPT DESCRIPTION]
1133
1134    CACHE_ID is expected to be a string used to identify a cached
1135 passphrase.  Use a 'X' to bypass the cache.  With no other arguments the
1136 agent returns a cached passphrase or an error.  By convention either the
1137 hexified fingerprint of the key shall be used for CACHE_ID or an
1138 arbitrary string prefixed with the name of the calling application and a
1139 colon: Like 'gpg:somestring'.
1140
1141    ERROR_MESSAGE is either a single 'X' for no error message or a string
1142 to be shown as an error message like (e.g.  "invalid passphrase").
1143 Blanks must be percent escaped or replaced by '+''.
1144
1145    PROMPT is either a single 'X' for a default prompt or the text to be
1146 shown as the prompt.  Blanks must be percent escaped or replaced by '+'.
1147
1148    DESCRIPTION is a text shown above the entry field.  Blanks must be
1149 percent escaped or replaced by '+'.
1150
1151    The agent either returns with an error or with a OK followed by the
1152 hex encoded passphrase.  Note that the length of the strings is
1153 implicitly limited by the maximum length of a command.  If the option
1154 '--data' is used, the passphrase is not returned on the OK line but by
1155 regular data lines; this is the preferred method.
1156
1157    If the option '--check' is used, the standard passphrase constraints
1158 checks are applied.  A check is not done if the passphrase has been
1159 found in the cache.
1160
1161    If the option '--no-ask' is used and the passphrase is not in the
1162 cache the user will not be asked to enter a passphrase but the error
1163 code 'GPG_ERR_NO_DATA' is returned.
1164
1165    If the option '--qualitybar' is used and a minimum passphrase length
1166 has been configured, a visual indication of the entered passphrase
1167 quality is shown.
1168
1169        CLEAR_PASSPHRASE CACHE_ID
1170
1171    may be used to invalidate the cache entry for a passphrase.  The
1172 function returns with OK even when there is no cached passphrase.
1173
1174 \1f
1175 File: gnupg.info,  Node: Agent CLEAR_PASSPHRASE,  Next: Agent PRESET_PASSPHRASE,  Prev: Agent GET_PASSPHRASE,  Up: Agent Protocol
1176
1177 2.6.8 Remove a cached passphrase
1178 --------------------------------
1179
1180 Use this command to remove a cached passphrase.
1181
1182        CLEAR_PASSPHRASE [--mode=normal] <cache_id>
1183
1184    The '--mode=normal' option can be used to clear a CACHE_ID that was
1185 set by gpg-agent.
1186
1187 \1f
1188 File: gnupg.info,  Node: Agent PRESET_PASSPHRASE,  Next: Agent GET_CONFIRMATION,  Prev: Agent CLEAR_PASSPHRASE,  Up: Agent Protocol
1189
1190 2.6.9 Set a passphrase for a keygrip
1191 ------------------------------------
1192
1193 This command adds a passphrase to the cache for the specified KEYGRIP.
1194
1195        PRESET_PASSPHRASE [--inquire] <string_or_keygrip> <timeout> [<hexstring>]
1196
1197    The passphrase is a hexidecimal string when specified.  When not
1198 specified, the passphrase will be retrieved from the pinentry module
1199 unless the '--inquire' option was specified in which case the passphrase
1200 will be retrieved from the client.
1201
1202    The TIMEOUT parameter keeps the passphrase cached for the specified
1203 number of seconds.  A value of '-1' means infinite while '0' means the
1204 default (currently only a timeout of -1 is allowed, which means to never
1205 expire it).
1206
1207 \1f
1208 File: gnupg.info,  Node: Agent GET_CONFIRMATION,  Next: Agent HAVEKEY,  Prev: Agent PRESET_PASSPHRASE,  Up: Agent Protocol
1209
1210 2.6.10 Ask for confirmation
1211 ---------------------------
1212
1213 This command may be used to ask for a simple confirmation by presenting
1214 a text and 2 buttons: Okay and Cancel.
1215
1216        GET_CONFIRMATION DESCRIPTION
1217
1218    DESCRIPTIONis displayed along with a Okay and Cancel button.  Blanks
1219 must be percent escaped or replaced by '+'.  A 'X' may be used to
1220 display confirmation dialog with a default text.
1221
1222    The agent either returns with an error or with a OK. Note, that the
1223 length of DESCRIPTION is implicitly limited by the maximum length of a
1224 command.
1225
1226 \1f
1227 File: gnupg.info,  Node: Agent HAVEKEY,  Next: Agent LEARN,  Prev: Agent GET_CONFIRMATION,  Up: Agent Protocol
1228
1229 2.6.11 Check whether a key is available
1230 ---------------------------------------
1231
1232 This can be used to see whether a secret key is available.  It does not
1233 return any information on whether the key is somehow protected.
1234
1235        HAVEKEY KEYGRIPS
1236
1237    The agent answers either with OK or 'No_Secret_Key' (208).  The
1238 caller may want to check for other error codes as well.  More than one
1239 keygrip may be given.  In this case the command returns success if at
1240 least one of the keygrips corresponds to an available secret key.
1241
1242 \1f
1243 File: gnupg.info,  Node: Agent LEARN,  Next: Agent PASSWD,  Prev: Agent HAVEKEY,  Up: Agent Protocol
1244
1245 2.6.12 Register a smartcard
1246 ---------------------------
1247
1248        LEARN [--send]
1249
1250    This command is used to register a smartcard.  With the '--send'
1251 option given the certificates are sent back.
1252
1253 \1f
1254 File: gnupg.info,  Node: Agent PASSWD,  Next: Agent UPDATESTARTUPTTY,  Prev: Agent LEARN,  Up: Agent Protocol
1255
1256 2.6.13 Change a Passphrase
1257 --------------------------
1258
1259        PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] [--preset] KEYGRIP
1260
1261    This command is used to interactively change the passphrase of the
1262 key identified by the hex string KEYGRIP.  The '--preset' option may be
1263 used to add the new passphrase to the cache using the default cache
1264 parameters.
1265
1266 \1f
1267 File: gnupg.info,  Node: Agent UPDATESTARTUPTTY,  Next: Agent GETEVENTCOUNTER,  Prev: Agent PASSWD,  Up: Agent Protocol
1268
1269 2.6.14 Change the standard display
1270 ----------------------------------
1271
1272        UPDATESTARTUPTTY
1273
1274    Set the startup TTY and X-DISPLAY variables to the values of this
1275 session.  This command is useful to direct future pinentry invocations
1276 to another screen.  It is only required because there is no way in the
1277 ssh-agent protocol to convey this information.
1278
1279 \1f
1280 File: gnupg.info,  Node: Agent GETEVENTCOUNTER,  Next: Agent GETINFO,  Prev: Agent UPDATESTARTUPTTY,  Up: Agent Protocol
1281
1282 2.6.15 Get the Event Counters
1283 -----------------------------
1284
1285        GETEVENTCOUNTER
1286
1287    This function return one status line with the current values of the
1288 event counters.  The event counters are useful to avoid polling by
1289 delaying a poll until something has changed.  The values are decimal
1290 numbers in the range '0' to 'UINT_MAX' and wrapping around to 0.  The
1291 actual values should not be relied upon; they shall only be used to
1292 detect a change.
1293
1294    The currently defined counters are are:
1295 'ANY'
1296      Incremented with any change of any of the other counters.
1297 'KEY'
1298      Incremented for added or removed private keys.
1299 'CARD'
1300      Incremented for changes of the card readers stati.
1301
1302 \1f
1303 File: gnupg.info,  Node: Agent GETINFO,  Next: Agent OPTION,  Prev: Agent GETEVENTCOUNTER,  Up: Agent Protocol
1304
1305 2.6.16 Return information about the process
1306 -------------------------------------------
1307
1308 This is a multipurpose function to return a variety of information.
1309
1310      GETINFO WHAT
1311
1312    The value of WHAT specifies the kind of information returned:
1313 'version'
1314      Return the version of the program.
1315 'pid'
1316      Return the process id of the process.
1317 'socket_name'
1318      Return the name of the socket used to connect the agent.
1319 'ssh_socket_name'
1320      Return the name of the socket used for SSH connections.  If SSH
1321      support has not been enabled the error 'GPG_ERR_NO_DATA' will be
1322      returned.
1323
1324 \1f
1325 File: gnupg.info,  Node: Agent OPTION,  Prev: Agent GETINFO,  Up: Agent Protocol
1326
1327 2.6.17 Set options for the session
1328 ----------------------------------
1329
1330 Here is a list of session options which are not yet described with other
1331 commands.  The general syntax for an Assuan option is:
1332
1333      OPTION  KEY=VALUE
1334
1335 Supported KEYs are:
1336
1337 'agent-awareness'
1338      This may be used to tell gpg-agent of which gpg-agent version the
1339      client is aware of.  gpg-agent uses this information to enable
1340      features which might break older clients.
1341
1342 'putenv'
1343      Change the session's environment to be used for the Pinentry.
1344      Valid values are:
1345
1346      'NAME'
1347           Delete envvar NAME
1348      'NAME='
1349           Set envvar NAME to the empty string
1350      'NAME=VALUE'
1351           Set envvar NAME to the string VALUE.
1352
1353 'use-cache-for-signing'
1354      See Assuan command 'PKSIGN'.
1355
1356 'allow-pinentry-notify'
1357      This does not need any value.  It is used to enable the
1358      PINENTRY_LAUNCHED inquiry.
1359
1360 'pinentry-mode'
1361      This option is used to change the operation mode of the pinentry.
1362      The following values are defined:
1363
1364      'ask'
1365           This is the default mode which pops up a pinentry as needed.
1366
1367      'cancel'
1368           Instead of popping up a pinentry, return the error code
1369           'GPG_ERR_CANCELED'.
1370
1371      'error'
1372           Instead of popping up a pinentry, return the error code
1373           'GPG_ERR_NO_PIN_ENTRY'.
1374
1375      'loopback'
1376           Use a loopback pinentry.  This fakes a pinentry by using
1377           inquiries back to the caller to ask for a passphrase.  This
1378           option may only be set if the agent has been configured for
1379           that.  To disable this feature use *note option
1380           --no-allow-loopback-pinentry::.
1381
1382 'cache-ttl-opt-preset'
1383      This option sets the cache TTL for new entries created by GENKEY
1384      and PASSWD commands when using the '--preset' option.  It it is not
1385      used a default value is used.
1386
1387 's2k-count'
1388      Instead of using the standard S2K count (which is computed on the
1389      fly), the given S2K count is used for new keys or when changing the
1390      passphrase of a key.  Values below 65536 are considered to be 0.
1391      This option is valid for the entire session or until reset to 0.
1392      This option is useful if the key is later used on boxes which are
1393      either much slower or faster than the actual box.
1394
1395 \1f
1396 File: gnupg.info,  Node: Invoking DIRMNGR,  Next: Invoking GPG,  Prev: Invoking GPG-AGENT,  Up: Top
1397
1398 3 Invoking DIRMNGR
1399 ******************
1400
1401 Since version 2.1 of GnuPG, 'dirmngr' takes care of accessing the
1402 OpenPGP keyservers.  As with previous versions it is also used as a
1403 server for managing and downloading certificate revocation lists (CRLs)
1404 for X.509 certificates, downloading X.509 certificates, and providing
1405 access to OCSP providers.  Dirmngr is invoked internally by 'gpg',
1406 'gpgsm', or via the 'gpg-connect-agent' tool.
1407
1408 *Note Option Index::,for an index to 'DIRMNGR''s commands and options.
1409
1410 * Menu:
1411
1412 * Dirmngr Commands::      List of all commands.
1413 * Dirmngr Options::       List of all options.
1414 * Dirmngr Configuration:: Configuration files.
1415 * Dirmngr Signals::       Use of signals.
1416 * Dirmngr Examples::      Some usage examples.
1417 * Dirmngr Protocol::      The protocol dirmngr uses.
1418
1419 \1f
1420 File: gnupg.info,  Node: Dirmngr Commands,  Next: Dirmngr Options,  Up: Invoking DIRMNGR
1421
1422 3.1 Commands
1423 ============
1424
1425 Commands are not distinguished from options except for the fact that
1426 only one command is allowed.
1427
1428 '--version'
1429      Print the program version and licensing information.  Note that you
1430      cannot abbreviate this command.
1431
1432 '--help, -h'
1433      Print a usage message summarizing the most useful command-line
1434      options.  Note that you cannot abbreviate this command.
1435
1436 '--dump-options'
1437      Print a list of all available options and commands.  Note that you
1438      cannot abbreviate this command.
1439
1440 '--server'
1441      Run in server mode and wait for commands on the 'stdin'.  The
1442      default mode is to create a socket and listen for commands there.
1443      This is only used for testing.
1444
1445 '--daemon'
1446      Run in background daemon mode and listen for commands on a socket.
1447      This is the way 'dirmngr' is started on demand by the other GnuPG
1448      components.  To force starting 'dirmngr' it is in general best to
1449      use 'gpgconf --launch dirmngr'.
1450
1451 '--supervised'
1452      Run in the foreground, sending logs to stderr, and listening on
1453      file descriptor 3, which must already be bound to a listening
1454      socket.  This is useful when running under systemd or other similar
1455      process supervision schemes.  This option is not supported on
1456      Windows.
1457
1458 '--list-crls'
1459      List the contents of the CRL cache on 'stdout'.  This is probably
1460      only useful for debugging purposes.
1461
1462 '--load-crl FILE'
1463      This command requires a filename as additional argument, and it
1464      will make Dirmngr try to import the CRL in FILE into it's cache.
1465      Note, that this is only possible if Dirmngr is able to retrieve the
1466      CA's certificate directly by its own means.  In general it is
1467      better to use 'gpgsm''s '--call-dirmngr loadcrl filename' command
1468      so that 'gpgsm' can help dirmngr.
1469
1470 '--fetch-crl URL'
1471      This command requires an URL as additional argument, and it will
1472      make dirmngr try to retrieve and import the CRL from that URL into
1473      it's cache.  This is mainly useful for debugging purposes.  The
1474      'dirmngr-client' provides the same feature for a running dirmngr.
1475
1476 '--shutdown'
1477      This commands shuts down an running instance of Dirmngr.  This
1478      command has currently no effect.
1479
1480 '--flush'
1481      This command removes all CRLs from Dirmngr's cache.  Client
1482      requests will thus trigger reading of fresh CRLs.
1483
1484 \1f
1485 File: gnupg.info,  Node: Dirmngr Options,  Next: Dirmngr Configuration,  Prev: Dirmngr Commands,  Up: Invoking DIRMNGR
1486
1487 3.2 Option Summary
1488 ==================
1489
1490 Note that all long options with the exception of '--options' and
1491 '--homedir' may also be given in the configuration file after stripping
1492 off the two leading dashes.
1493
1494 '--options FILE'
1495      Reads configuration from FILE instead of from the default per-user
1496      configuration file.  The default configuration file is named
1497      'dirmngr.conf' and expected in the home directory.
1498
1499 '--homedir DIR'
1500      Set the name of the home directory to DIR.  This option is only
1501      effective when used on the command line.  The default is the
1502      directory named '.gnupg' directly below the home directory of the
1503      user unless the environment variable 'GNUPGHOME' has been set in
1504      which case its value will be used.  Many kinds of data are stored
1505      within this directory.
1506
1507 '-v'
1508 '--verbose'
1509      Outputs additional information while running.  You can increase the
1510      verbosity by giving several verbose commands to DIRMNGR, such as
1511      '-vv'.
1512
1513 '--log-file FILE'
1514      Append all logging output to FILE.  This is very helpful in seeing
1515      what the agent actually does.  Use 'socket://' to log to socket.
1516
1517 '--debug-level LEVEL'
1518      Select the debug level for investigating problems.  LEVEL may be a
1519      numeric value or by a keyword:
1520
1521      'none'
1522           No debugging at all.  A value of less than 1 may be used
1523           instead of the keyword.
1524      'basic'
1525           Some basic debug messages.  A value between 1 and 2 may be
1526           used instead of the keyword.
1527      'advanced'
1528           More verbose debug messages.  A value between 3 and 5 may be
1529           used instead of the keyword.
1530      'expert'
1531           Even more detailed messages.  A value between 6 and 8 may be
1532           used instead of the keyword.
1533      'guru'
1534           All of the debug messages you can get.  A value greater than 8
1535           may be used instead of the keyword.  The creation of hash
1536           tracing files is only enabled if the keyword is used.
1537
1538      How these messages are mapped to the actual debugging flags is not
1539      specified and may change with newer releases of this program.  They
1540      are however carefully selected to best aid in debugging.
1541
1542 '--debug FLAGS'
1543      Set debugging flags.  This option is only useful for debugging and
1544      its behavior may change with a new release.  All flags are or-ed
1545      and may be given in C syntax (e.g.  0x0042) or as a comma separated
1546      list of flag names.  To get a list of all supported flags the
1547      single word "help" can be used.
1548
1549 '--debug-all'
1550      Same as '--debug=0xffffffff'
1551
1552 '--gnutls-debug LEVEL'
1553      Enable debugging of GNUTLS at LEVEL.
1554
1555 '--debug-wait N'
1556      When running in server mode, wait N seconds before entering the
1557      actual processing loop and print the pid.  This gives time to
1558      attach a debugger.
1559
1560 '--disable-check-own-socket'
1561      On some platforms 'dirmngr' is able to detect the removal of its
1562      socket file and shutdown itself.  This option disable this
1563      self-test for debugging purposes.
1564
1565 '-s'
1566 '--sh'
1567 '-c'
1568 '--csh'
1569      Format the info output in daemon mode for use with the standard
1570      Bourne shell respective the C-shell.  The default is to guess it
1571      based on the environment variable 'SHELL' which is in almost all
1572      cases sufficient.
1573
1574 '--force'
1575      Enabling this option forces loading of expired CRLs; this is only
1576      useful for debugging.
1577
1578 '--use-tor'
1579      This option switches Dirmngr and thus GnuPG into "Tor mode" to
1580      route all network access via Tor (an anonymity network).  Certain
1581      other features are disabled if this mode is active.
1582
1583 '--standard-resolver'
1584      This option forces the use of the system's standard DNS resolver
1585      code.  This is mainly used for debugging.  Note that on Windows a
1586      standard resolver is not used and all DNS access will return the
1587      error "Not Implemented" if this function is used.
1588
1589 '--recursive-resolver'
1590      When possible use a recursive resolver instead of a stub resolver.
1591
1592 '--resolver-timeout N'
1593      Set the timeout for the DNS resolver to N seconds.  The default are
1594      30 seconds.
1595
1596 '--allow-version-check'
1597      Allow Dirmngr to connect to 'https://versions.gnupg.org' to get the
1598      list of current software versions.  If this option is enabled, or
1599      if 'use-tor' is active, the list is retrieved when the local copy
1600      does not exist or is older than 5 to 7 days.  See the option
1601      '--query-swdb' of the command 'gpgconf' for more details.  Note,
1602      that regardless of this option a version check can always be
1603      triggered using this command:
1604
1605                  gpg-connect-agent --dirmngr 'loadswdb --force' /bye
1606
1607 '--keyserver NAME'
1608      Use NAME as your keyserver.  This is the server that 'gpg'
1609      communicates with to receive keys, send keys, and search for keys.
1610      The format of the NAME is a URI: 'scheme:[//]keyservername[:port]'
1611      The scheme is the type of keyserver: "hkp" for the HTTP (or
1612      compatible) keyservers, "ldap" for the LDAP keyservers, or "mailto"
1613      for the Graff email keyserver.  Note that your particular
1614      installation of GnuPG may have other keyserver types available as
1615      well.  Keyserver schemes are case-insensitive.  After the keyserver
1616      name, optional keyserver configuration options may be provided.
1617      These are the same as the '--keyserver-options' of 'gpg', but apply
1618      only to this particular keyserver.
1619
1620      Most keyservers synchronize with each other, so there is generally
1621      no need to send keys to more than one server.  The keyserver
1622      'hkp://keys.gnupg.net' uses round robin DNS to give a different
1623      keyserver each time you use it.
1624
1625      If exactly two keyservers are configured and only one is a Tor
1626      hidden service (.onion), Dirmngr selects the keyserver to use
1627      depending on whether Tor is locally running or not.  The check for
1628      a running Tor is done for each new connection.
1629
1630      If no keyserver is explicitly configured, dirmngr will use the
1631      built-in default of hkps://hkps.pool.sks-keyservers.net.
1632
1633 '--nameserver IPADDR'
1634      In "Tor mode" Dirmngr uses a public resolver via Tor to resolve DNS
1635      names.  If the default public resolver, which is '8.8.8.8', shall
1636      not be used a different one can be given using this option.  Note
1637      that a numerical IP address must be given (IPv6 or IPv4) and that
1638      no error checking is done for IPADDR.
1639
1640 '--disable-ldap'
1641      Entirely disables the use of LDAP.
1642
1643 '--disable-http'
1644      Entirely disables the use of HTTP.
1645
1646 '--ignore-http-dp'
1647      When looking for the location of a CRL, the to be tested
1648      certificate usually contains so called "CRL Distribution Point"
1649      (DP) entries which are URLs describing the way to access the CRL.
1650      The first found DP entry is used.  With this option all entries
1651      using the HTTP scheme are ignored when looking for a suitable DP.
1652
1653 '--ignore-ldap-dp'
1654      This is similar to '--ignore-http-dp' but ignores entries using the
1655      LDAP scheme.  Both options may be combined resulting in ignoring
1656      DPs entirely.
1657
1658 '--ignore-ocsp-service-url'
1659      Ignore all OCSP URLs contained in the certificate.  The effect is
1660      to force the use of the default responder.
1661
1662 '--honor-http-proxy'
1663      If the environment variable 'http_proxy' has been set, use its
1664      value to access HTTP servers.
1665
1666 '--http-proxy HOST[:PORT]'
1667      Use HOST and PORT to access HTTP servers.  The use of this option
1668      overrides the environment variable 'http_proxy' regardless whether
1669      '--honor-http-proxy' has been set.
1670
1671 '--ldap-proxy HOST[:PORT]'
1672      Use HOST and PORT to connect to LDAP servers.  If PORT is omitted,
1673      port 389 (standard LDAP port) is used.  This overrides any
1674      specified host and port part in a LDAP URL and will also be used if
1675      host and port have been omitted from the URL.
1676
1677 '--only-ldap-proxy'
1678      Never use anything else but the LDAP "proxy" as configured with
1679      '--ldap-proxy'.  Usually 'dirmngr' tries to use other configured
1680      LDAP server if the connection using the "proxy" failed.
1681
1682 '--ldapserverlist-file FILE'
1683      Read the list of LDAP servers to consult for CRLs and certificates
1684      from file instead of the default per-user ldap server list file.
1685      The default value for FILE is 'dirmngr_ldapservers.conf'.
1686
1687      This server list file contains one LDAP server per line in the
1688      format
1689
1690      HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN
1691
1692      Lines starting with a '#' are comments.
1693
1694      Note that as usual all strings entered are expected to be UTF-8
1695      encoded.  Obviously this will lead to problems if the password has
1696      originally been encoded as Latin-1.  There is no other solution
1697      here than to put such a password in the binary encoding into the
1698      file (i.e.  non-ascii characters won't show up readable).(1)
1699
1700 '--ldaptimeout SECS'
1701      Specify the number of seconds to wait for an LDAP query before
1702      timing out.  The default is currently 100 seconds.  0 will never
1703      timeout.
1704
1705 '--add-servers'
1706      This option makes dirmngr add any servers it discovers when
1707      validating certificates against CRLs to the internal list of
1708      servers to consult for certificates and CRLs.
1709
1710      This option is useful when trying to validate a certificate that
1711      has a CRL distribution point that points to a server that is not
1712      already listed in the ldapserverlist.  Dirmngr will always go to
1713      this server and try to download the CRL, but chances are high that
1714      the certificate used to sign the CRL is located on the same server.
1715      So if dirmngr doesn't add that new server to list, it will often
1716      not be able to verify the signature of the CRL unless the
1717      '--add-servers' option is used.
1718
1719      Note: The current version of dirmngr has this option disabled by
1720      default.
1721
1722 '--allow-ocsp'
1723      This option enables OCSP support if requested by the client.
1724
1725      OCSP requests are rejected by default because they may violate the
1726      privacy of the user; for example it is possible to track the time
1727      when a user is reading a mail.
1728
1729 '--ocsp-responder URL'
1730      Use URL as the default OCSP Responder if the certificate does not
1731      contain information about an assigned responder.  Note, that
1732      '--ocsp-signer' must also be set to a valid certificate.
1733
1734 '--ocsp-signer FPR|FILE'
1735      Use the certificate with the fingerprint FPR to check the responses
1736      of the default OCSP Responder.  Alternatively a filename can be
1737      given in which case the response is expected to be signed by one of
1738      the certificates described in that file.  Any argument which
1739      contains a slash, dot or tilde is considered a filename.  Usual
1740      filename expansion takes place: A tilde at the start followed by a
1741      slash is replaced by the content of 'HOME', no slash at start
1742      describes a relative filename which will be searched at the home
1743      directory.  To make sure that the FILE is searched in the home
1744      directory, either prepend the name with "./" or use a name which
1745      contains a dot.
1746
1747      If a response has been signed by a certificate described by these
1748      fingerprints no further check upon the validity of this certificate
1749      is done.
1750
1751      The format of the FILE is a list of SHA-1 fingerprint, one per line
1752      with optional colons between the bytes.  Empty lines and lines
1753      prefix with a hash mark are ignored.
1754
1755 '--ocsp-max-clock-skew N'
1756      The number of seconds a skew between the OCSP responder and them
1757      local clock is accepted.  Default is 600 (10 minutes).
1758
1759 '--ocsp-max-period N'
1760      Seconds a response is at maximum considered valid after the time
1761      given in the thisUpdate field.  Default is 7776000 (90 days).
1762
1763 '--ocsp-current-period N'
1764      The number of seconds an OCSP response is considered valid after
1765      the time given in the NEXT_UPDATE datum.  Default is 10800 (3
1766      hours).
1767
1768 '--max-replies N'
1769      Do not return more that N items in one query.  The default is 10.
1770
1771 '--ignore-cert-extension OID'
1772      Add OID to the list of ignored certificate extensions.  The OID is
1773      expected to be in dotted decimal form, like '2.5.29.3'.  This
1774      option may be used more than once.  Critical flagged certificate
1775      extensions matching one of the OIDs in the list are treated as if
1776      they are actually handled and thus the certificate won't be
1777      rejected due to an unknown critical extension.  Use this option
1778      with care because extensions are usually flagged as critical for a
1779      reason.
1780
1781 '--hkp-cacert FILE'
1782      Use the root certificates in FILE for verification of the TLS
1783      certificates used with 'hkps' (keyserver access over TLS). If the
1784      file is in PEM format a suffix of '.pem' is expected for FILE.
1785      This option may be given multiple times to add more root
1786      certificates.  Tilde expansion is supported.
1787
1788      If no 'hkp-cacert' directive is present, dirmngr will make a
1789      reasonable choice: if the keyserver in question is the special pool
1790      'hkps.pool.sks-keyservers.net', it will use the bundled root
1791      certificate for that pool.  Otherwise, it will use the system CAs.
1792
1793    ---------- Footnotes ----------
1794
1795    (1) The 'gpgconf' tool might be helpful for frontends as it enables
1796 editing this configuration file using percent-escaped strings.
1797
1798 \1f
1799 File: gnupg.info,  Node: Dirmngr Configuration,  Next: Dirmngr Signals,  Prev: Dirmngr Options,  Up: Invoking DIRMNGR
1800
1801 3.3 Configuration
1802 =================
1803
1804 Dirmngr makes use of several directories when running in daemon mode:
1805 There are a few configuration files whih control the operation of
1806 dirmngr.  By default they may all be found in the current home directory
1807 (*note option --homedir::).
1808
1809 'dirmngr.conf'
1810      This is the standard configuration file read by 'dirmngr' on
1811      startup.  It may contain any valid long option; the leading two
1812      dashes may not be entered and the option may not be abbreviated.
1813      This file is also read after a 'SIGHUP' however not all options
1814      will actually have an effect.  This default name may be changed on
1815      the command line (*note option --options::).  You should backup
1816      this file.
1817
1818 '/etc/gnupg/trusted-certs'
1819      This directory should be filled with certificates of Root CAs you
1820      are trusting in checking the CRLs and signing OCSP Responses.
1821
1822      Usually these are the same certificates you use with the
1823      applications making use of dirmngr.  It is expected that each of
1824      these certificate files contain exactly one DER encoded certificate
1825      in a file with the suffix '.crt' or '.der'.  'dirmngr' reads those
1826      certificates on startup and when given a SIGHUP. Certificates which
1827      are not readable or do not make up a proper X.509 certificate are
1828      ignored; see the log file for details.
1829
1830      Applications using dirmngr (e.g.  gpgsm) can request these
1831      certificates to complete a trust chain in the same way as with the
1832      extra-certs directory (see below).
1833
1834      Note that for OCSP responses the certificate specified using the
1835      option '--ocsp-signer' is always considered valid to sign OCSP
1836      requests.
1837
1838 '/etc/gnupg/extra-certs'
1839      This directory may contain extra certificates which are preloaded
1840      into the internal cache on startup.  Applications using dirmngr
1841      (e.g.  gpgsm) can request cached certificates to complete a trust
1842      chain.  This is convenient in cases you have a couple intermediate
1843      CA certificates or certificates usually used to sign OCSP
1844      responses.  These certificates are first tried before going out to
1845      the net to look for them.  These certificates must also be DER
1846      encoded and suffixed with '.crt' or '.der'.
1847
1848 '~/.gnupg/crls.d'
1849      This directory is used to store cached CRLs.  The 'crls.d' part
1850      will be created by dirmngr if it does not exists but you need to
1851      make sure that the upper directory exists.
1852
1853    To be able to see what's going on you should create the configure
1854 file '~/gnupg/dirmngr.conf' with at least one line:
1855
1856      log-file ~/dirmngr.log
1857
1858    To be able to perform OCSP requests you probably want to add the
1859 line:
1860
1861      allow-ocsp
1862
1863    To make sure that new options are read and that after the
1864 installation of a new GnuPG versions the installed dirmngr is running,
1865 you may want to kill an existing dirmngr first:
1866
1867      gpgconf --kill dirmngr
1868
1869    You may check the log file to see whether all desired root
1870 certificates have been loaded correctly.
1871
1872 \1f
1873 File: gnupg.info,  Node: Dirmngr Signals,  Next: Dirmngr Examples,  Prev: Dirmngr Configuration,  Up: Invoking DIRMNGR
1874
1875 3.4 Use of signals
1876 ==================
1877
1878 A running 'dirmngr' may be controlled by signals, i.e.  using the 'kill'
1879 command to send a signal to the process.
1880
1881    Here is a list of supported signals:
1882
1883 'SIGHUP'
1884      This signal flushes all internally cached CRLs as well as any
1885      cached certificates.  Then the certificate cache is reinitialized
1886      as on startup.  Options are re-read from the configuration file.
1887      Instead of sending this signal it is better to use
1888           gpgconf --reload dirmngr
1889
1890 'SIGTERM'
1891      Shuts down the process but waits until all current requests are
1892      fulfilled.  If the process has received 3 of these signals and
1893      requests are still pending, a shutdown is forced.  You may also use
1894           gpgconf --kill dirmngr
1895      instead of this signal
1896
1897 'SIGINT'
1898      Shuts down the process immediately.
1899
1900 'SIGUSR1'
1901      This prints some caching statistics to the log file.
1902
1903 \1f
1904 File: gnupg.info,  Node: Dirmngr Examples,  Next: Dirmngr Protocol,  Prev: Dirmngr Signals,  Up: Invoking DIRMNGR
1905
1906 3.5 Examples
1907 ============
1908
1909 Here is an example on how to show dirmngr's internal table of OpenPGP
1910 keyserver addresses.  The output is intended for debugging purposes and
1911 not part of a defined API.
1912
1913        gpg-connect-agent --dirmngr 'keyserver --hosttable' /bye
1914
1915    To inhibit the use of a particular host you have noticed in one of
1916 the keyserver pools, you may use
1917
1918       gpg-connect-agent --dirmngr 'keyserver --dead pgpkeys.bnd.de' /bye
1919
1920    The description of the 'keyserver' command can be printed using
1921
1922       gpg-connect-agent --dirmngr 'help keyserver' /bye
1923
1924 \1f
1925 File: gnupg.info,  Node: Dirmngr Protocol,  Prev: Dirmngr Examples,  Up: Invoking DIRMNGR
1926
1927 3.6 Dirmngr's Assuan Protocol
1928 =============================
1929
1930 Assuan is the IPC protocol used to access dirmngr.  This is a
1931 description of the commands implemented by dirmngr.
1932
1933 * Menu:
1934
1935 * Dirmngr LOOKUP::      Look up a certificate via LDAP
1936 * Dirmngr ISVALID::     Validate a certificate using a CRL or OCSP.
1937 * Dirmngr CHECKCRL::    Validate a certificate using a CRL.
1938 * Dirmngr CHECKOCSP::   Validate a certificate using OCSP.
1939 * Dirmngr CACHECERT::   Put a certificate into the internal cache.
1940 * Dirmngr VALIDATE::    Validate a certificate for debugging.
1941
1942 \1f
1943 File: gnupg.info,  Node: Dirmngr LOOKUP,  Next: Dirmngr ISVALID,  Up: Dirmngr Protocol
1944
1945 3.6.1 Return the certificate(s) found
1946 -------------------------------------
1947
1948 Lookup certificate.  To allow multiple patterns (which are ORed) quoting
1949 is required: Spaces are to be translated into "+" or into "%20";
1950 obviously this requires that the usual escape quoting rules are applied.
1951 The server responds with:
1952
1953        S: D <DER encoded certificate>
1954        S: END
1955        S: D <second DER encoded certificate>
1956        S: END
1957        S: OK
1958
1959    In this example 2 certificates are returned.  The server may return
1960 any number of certificates; OK will also be returned when no
1961 certificates were found.  The dirmngr might return a status line
1962
1963        S: S TRUNCATED <n>
1964
1965    To indicate that the output was truncated to N items due to a
1966 limitation of the server or by an arbitrary set limit.
1967
1968    The option '--url' may be used if instead of a search pattern a
1969 complete URL to the certificate is known:
1970
1971        C: LOOKUP --url CN%3DWerner%20Koch,o%3DIntevation%20GmbH,c%3DDE?userCertificate
1972
1973    If the option '--cache-only' is given, no external lookup is done so
1974 that only certificates from the cache are returned.
1975
1976    With the option '--single', the first and only the first match will
1977 be returned.  Unless option '--cache-only' is also used, no local lookup
1978 will be done in this case.
1979
1980 \1f
1981 File: gnupg.info,  Node: Dirmngr ISVALID,  Next: Dirmngr CHECKCRL,  Prev: Dirmngr LOOKUP,  Up: Dirmngr Protocol
1982
1983 3.6.2 Validate a certificate using a CRL or OCSP
1984 ------------------------------------------------
1985
1986        ISVALID [--only-ocsp] [--force-default-responder] CERTID|CERTFPR
1987
1988    Check whether the certificate described by the CERTID has been
1989 revoked.  Due to caching, the Dirmngr is able to answer immediately in
1990 most cases.
1991
1992    The CERTID is a hex encoded string consisting of two parts, delimited
1993 by a single dot.  The first part is the SHA-1 hash of the issuer name
1994 and the second part the serial number.
1995
1996    Alternatively the certificate's SHA-1 fingerprint CERTFPR may be
1997 given in which case an OCSP request is done before consulting the CRL.
1998 If the option '--only-ocsp' is given, no fallback to a CRL check will be
1999 used.  If the option '--force-default-responder' is given, only the
2000 default OCSP responder will be used and any other methods of obtaining
2001 an OCSP responder URL won't be used.
2002
2003 Common return values are:
2004
2005 'GPG_ERR_NO_ERROR (0)'
2006      This is the positive answer: The certificate is not revoked and we
2007      have an up-to-date revocation list for that certificate.  If OCSP
2008      was used the responder confirmed that the certificate has not been
2009      revoked.
2010
2011 'GPG_ERR_CERT_REVOKED'
2012      This is the negative answer: The certificate has been revoked.
2013      Either it is in a CRL and that list is up to date or an OCSP
2014      responder informed us that it has been revoked.
2015
2016 'GPG_ERR_NO_CRL_KNOWN'
2017      No CRL is known for this certificate or the CRL is not valid or out
2018      of date.
2019
2020 'GPG_ERR_NO_DATA'
2021      The OCSP responder returned an "unknown" status.  This means that
2022      it is not aware of the certificate's status.
2023
2024 'GPG_ERR_NOT_SUPPORTED'
2025      This is commonly seen if OCSP support has not been enabled in the
2026      configuration.
2027
2028    If DirMngr has not enough information about the given certificate
2029 (which is the case for not yet cached certificates), it will will
2030 inquire the missing data:
2031
2032        S: INQUIRE SENDCERT <CertID>
2033        C: D <DER encoded certificate>
2034        C: END
2035
2036    A client should be aware that DirMngr may ask for more than one
2037 certificate.
2038
2039    If Dirmngr has a certificate but the signature of the certificate
2040 could not been validated because the root certificate is not known to
2041 dirmngr as trusted, it may ask back to see whether the client trusts
2042 this the root certificate:
2043
2044        S: INQUIRE ISTRUSTED <CertHexfpr>
2045        C: D 1
2046        C: END
2047
2048    Only this answer will let Dirmngr consider the certificate as valid.
2049
2050 \1f
2051 File: gnupg.info,  Node: Dirmngr CHECKCRL,  Next: Dirmngr CHECKOCSP,  Prev: Dirmngr ISVALID,  Up: Dirmngr Protocol
2052
2053 3.6.3 Validate a certificate using a CRL
2054 ----------------------------------------
2055
2056 Check whether the certificate with FINGERPRINT (SHA-1 hash of the entire
2057 X.509 certificate blob) is valid or not by consulting the CRL
2058 responsible for this certificate.  If the fingerprint has not been given
2059 or the certificate is not known, the function inquires the certificate
2060 using:
2061
2062        S: INQUIRE TARGETCERT
2063        C: D <DER encoded certificate>
2064        C: END
2065
2066    Thus the caller is expected to return the certificate for the request
2067 (which should match FINGERPRINT) as a binary blob.  Processing then
2068 takes place without further interaction; in particular dirmngr tries to
2069 locate other required certificate by its own mechanism which includes a
2070 local certificate store as well as a list of trusted root certificates.
2071
2072 The return code is 0 for success; i.e.  the certificate has not been
2073 revoked or one of the usual error codes from libgpg-error.
2074
2075 \1f
2076 File: gnupg.info,  Node: Dirmngr CHECKOCSP,  Next: Dirmngr CACHECERT,  Prev: Dirmngr CHECKCRL,  Up: Dirmngr Protocol
2077
2078 3.6.4 Validate a certificate using OCSP
2079 ---------------------------------------
2080
2081        CHECKOCSP [--force-default-responder] [FINGERPRINT]
2082
2083    Check whether the certificate with FINGERPRINT (the SHA-1 hash of the
2084 entire X.509 certificate blob) is valid by consulting the appropriate
2085 OCSP responder.  If the fingerprint has not been given or the
2086 certificate is not known by Dirmngr, the function inquires the
2087 certificate using:
2088
2089        S: INQUIRE TARGETCERT
2090        C: D <DER encoded certificate>
2091        C: END
2092
2093    Thus the caller is expected to return the certificate for the request
2094 (which should match FINGERPRINT) as a binary blob.  Processing then
2095 takes place without further interaction; in particular dirmngr tries to
2096 locate other required certificates by its own mechanism which includes a
2097 local certificate store as well as a list of trusted root certificates.
2098
2099    If the option '--force-default-responder' is given, only the default
2100 OCSP responder is used.  This option is the per-command variant of the
2101 global option '--ignore-ocsp-service-url'.
2102
2103 The return code is 0 for success; i.e.  the certificate has not been
2104 revoked or one of the usual error codes from libgpg-error.
2105
2106 \1f
2107 File: gnupg.info,  Node: Dirmngr CACHECERT,  Next: Dirmngr VALIDATE,  Prev: Dirmngr CHECKOCSP,  Up: Dirmngr Protocol
2108
2109 3.6.5 Put a certificate into the internal cache
2110 -----------------------------------------------
2111
2112 Put a certificate into the internal cache.  This command might be useful
2113 if a client knows in advance certificates required for a test and wants
2114 to make sure they get added to the internal cache.  It is also helpful
2115 for debugging.  To get the actual certificate, this command immediately
2116 inquires it using
2117
2118        S: INQUIRE TARGETCERT
2119        C: D <DER encoded certificate>
2120        C: END
2121
2122    Thus the caller is expected to return the certificate for the request
2123 as a binary blob.
2124
2125 The return code is 0 for success; i.e.  the certificate has not been
2126 successfully cached or one of the usual error codes from libgpg-error.
2127
2128 \1f
2129 File: gnupg.info,  Node: Dirmngr VALIDATE,  Prev: Dirmngr CACHECERT,  Up: Dirmngr Protocol
2130
2131 3.6.6 Validate a certificate for debugging
2132 ------------------------------------------
2133
2134 Validate a certificate using the certificate validation function used
2135 internally by dirmngr.  This command is only useful for debugging.  To
2136 get the actual certificate, this command immediately inquires it using
2137
2138        S: INQUIRE TARGETCERT
2139        C: D <DER encoded certificate>
2140        C: END
2141
2142    Thus the caller is expected to return the certificate for the request
2143 as a binary blob.
2144
2145 \1f
2146 File: gnupg.info,  Node: Invoking GPG,  Next: Invoking GPGSM,  Prev: Invoking DIRMNGR,  Up: Top
2147
2148 4 Invoking GPG
2149 **************
2150
2151 'gpg' is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool
2152 to provide digital encryption and signing services using the OpenPGP
2153 standard.  'gpg' features complete key management and all the bells and
2154 whistles you would expect from a full OpenPGP implementation.
2155
2156    There are two main versions of GnuPG: GnuPG 1.x and GnuPG 2.x.  GnuPG
2157 2.x supports modern encryption algorithms and thus should be preferred
2158 over GnuPG 1.x.  You only need to use GnuPG 1.x if your platform doesn't
2159 support GnuPG 2.x, or you need support for some features that GnuPG 2.x
2160 has deprecated, e.g., decrypting data created with PGP-2 keys.
2161
2162    If you are looking for version 1 of GnuPG, you may find that version
2163 installed under the name 'gpg1'.
2164
2165    *Note Option Index::, for an index to 'gpg''s commands and options.
2166
2167 * Menu:
2168
2169 * GPG Commands::            List of all commands.
2170 * GPG Options::             List of all options.
2171 * GPG Configuration::       Configuration files.
2172 * GPG Examples::            Some usage examples.
2173
2174 Developer information:
2175 * Unattended Usage of GPG:: Using 'gpg' from other programs.
2176
2177 \1f
2178 File: gnupg.info,  Node: GPG Commands,  Next: GPG Options,  Up: Invoking GPG
2179
2180 4.1 Commands
2181 ============
2182
2183 Commands are not distinguished from options except for the fact that
2184 only one command is allowed.  Generally speaking, irrelevant options are
2185 silently ignored, and may not be checked for correctness.
2186
2187    'gpg' may be run with no commands.  In this case it will perform a
2188 reasonable action depending on the type of file it is given as input (an
2189 encrypted message is decrypted, a signature is verified, a file
2190 containing keys is listed, etc.).
2191
2192 * Menu:
2193
2194 * General GPG Commands::        Commands not specific to the functionality.
2195 * Operational GPG Commands::    Commands to select the type of operation.
2196 * OpenPGP Key Management::      How to manage your keys.
2197
2198 \1f
2199 File: gnupg.info,  Node: General GPG Commands,  Next: Operational GPG Commands,  Up: GPG Commands
2200
2201 4.1.1 Commands not specific to the function
2202 -------------------------------------------
2203
2204 '--version'
2205      Print the program version and licensing information.  Note that you
2206      cannot abbreviate this command.
2207
2208 '--help'
2209 '-h'
2210      Print a usage message summarizing the most useful command-line
2211      options.  Note that you cannot abbreviate this command.
2212
2213 '--warranty'
2214      Print warranty information.
2215
2216 '--dump-options'
2217      Print a list of all available options and commands.  Note that you
2218      cannot abbreviate this command.
2219
2220 \1f
2221 File: gnupg.info,  Node: Operational GPG Commands,  Next: OpenPGP Key Management,  Prev: General GPG Commands,  Up: GPG Commands
2222
2223 4.1.2 Commands to select the type of operation
2224 ----------------------------------------------
2225
2226 '--sign'
2227 '-s'
2228      Sign a message.  This command may be combined with '--encrypt' (to
2229      sign and encrypt a message), '--symmetric' (to sign and
2230      symmetrically encrypt a message), or both '--encrypt' and
2231      '--symmetric' (to sign and encrypt a message that can be decrypted
2232      using a secret key or a passphrase).  The signing key is chosen by
2233      default or can be set explicitly using the '--local-user' and
2234      '--default-key' options.
2235
2236 '--clear-sign'
2237 '--clearsign'
2238      Make a cleartext signature.  The content in a cleartext signature
2239      is readable without any special software.  OpenPGP software is only
2240      needed to verify the signature.  cleartext signatures may modify
2241      end-of-line whitespace for platform independence and are not
2242      intended to be reversible.  The signing key is chosen by default or
2243      can be set explicitly using the '--local-user' and '--default-key'
2244      options.
2245
2246 '--detach-sign'
2247 '-b'
2248      Make a detached signature.
2249
2250 '--encrypt'
2251 '-e'
2252      Encrypt data.  This command may be combined with '--sign' (to sign
2253      and encrypt a message), '--symmetric' (to encrypt a message that
2254      can decrypted using a secret key or a passphrase), or '--sign' and
2255      '--symmetric' together (for a signed message that can be decrypted
2256      using a secret key or a passphrase).
2257
2258 '--symmetric'
2259 '-c'
2260      Encrypt with a symmetric cipher using a passphrase.  The default
2261      symmetric cipher used is AES-128, but may be chosen with the
2262      '--cipher-algo' option.  This command may be combined with '--sign'
2263      (for a signed and symmetrically encrypted message), '--encrypt'
2264      (for a message that may be decrypted via a secret key or a
2265      passphrase), or '--sign' and '--encrypt' together (for a signed
2266      message that may be decrypted via a secret key or a passphrase).
2267
2268 '--store'
2269      Store only (make a simple literal data packet).
2270
2271 '--decrypt'
2272 '-d'
2273      Decrypt the file given on the command line (or STDIN if no file is
2274      specified) and write it to STDOUT (or the file specified with
2275      '--output').  If the decrypted file is signed, the signature is
2276      also verified.  This command differs from the default operation, as
2277      it never writes to the filename which is included in the file and
2278      it rejects files that don't begin with an encrypted message.
2279
2280 '--verify'
2281      Assume that the first argument is a signed file and verify it
2282      without generating any output.  With no arguments, the signature
2283      packet is read from STDIN. If only one argument is given, the
2284      specified file is expected to include a complete signature.
2285
2286      With more than one argument, the first argument should specify a
2287      file with a detached signature and the remaining files should
2288      contain the signed data.  To read the signed data from STDIN, use
2289      '-' as the second filename.  For security reasons, a detached
2290      signature will not read the signed material from STDIN if not
2291      explicitly specified.
2292
2293      Note: If the option '--batch' is not used, 'gpg' may assume that a
2294      single argument is a file with a detached signature, and it will
2295      try to find a matching data file by stripping certain suffixes.
2296      Using this historical feature to verify a detached signature is
2297      strongly discouraged; you should always specify the data file
2298      explicitly.
2299
2300      Note: When verifying a cleartext signature, 'gpg' verifies only
2301      what makes up the cleartext signed data and not any extra data
2302      outside of the cleartext signature or the header lines directly
2303      following the dash marker line.  The option '--output' may be used
2304      to write out the actual signed data, but there are other pitfalls
2305      with this format as well.  It is suggested to avoid cleartext
2306      signatures in favor of detached signatures.
2307
2308      Note: Sometimes the use of the 'gpgv' tool is easier than using the
2309      full-fledged 'gpg' with this option.  'gpgv' is designed to compare
2310      signed data against a list of trusted keys and returns with success
2311      only for a good signature.  It has its own manual page.
2312
2313 '--multifile'
2314      This modifies certain other commands to accept multiple files for
2315      processing on the command line or read from STDIN with each
2316      filename on a separate line.  This allows for many files to be
2317      processed at once.  '--multifile' may currently be used along with
2318      '--verify', '--encrypt', and '--decrypt'.  Note that '--multifile
2319      --verify' may not be used with detached signatures.
2320
2321 '--verify-files'
2322      Identical to '--multifile --verify'.
2323
2324 '--encrypt-files'
2325      Identical to '--multifile --encrypt'.
2326
2327 '--decrypt-files'
2328      Identical to '--multifile --decrypt'.
2329
2330 '--list-keys'
2331 '-k'
2332 '--list-public-keys'
2333      List the specified keys.  If no keys are specified, then all keys
2334      from the configured public keyrings are listed.
2335
2336      Never use the output of this command in scripts or other programs.
2337      The output is intended only for humans and its format is likely to
2338      change.  The '--with-colons' option emits the output in a stable,
2339      machine-parseable format, which is intended for use by scripts and
2340      other programs.
2341
2342 '--list-secret-keys'
2343 '-K'
2344      List the specified secret keys.  If no keys are specified, then all
2345      known secret keys are listed.  A '#' after the letters 'sec' means
2346      that the secret key is not usable (for example, if it was exported
2347      using '--export-secret-subkeys').  See also '--list-keys'.
2348
2349 '--list-signatures'
2350 '--list-sigs'
2351      Same as '--list-keys', but the signatures are listed too.  This
2352      command has the same effect as using '--list-keys' with
2353      '--with-sig-list'.
2354
2355      For each signature listed, there are several flags in between the
2356      "sig" tag and keyid.  These flags give additional information about
2357      each signature.  From left to right, they are the numbers 1-3 for
2358      certificate check level (see '--ask-cert-level'), "L" for a local
2359      or non-exportable signature (see '--lsign-key'), "R" for a
2360      nonRevocable signature (see the '--edit-key' command "nrsign"), "P"
2361      for a signature that contains a policy URL (see
2362      '--cert-policy-url'), "N" for a signature that contains a notation
2363      (see '--cert-notation'), "X" for an eXpired signature (see
2364      '--ask-cert-expire'), and the numbers 1-9 or "T" for 10 and above
2365      to indicate trust signature levels (see the '--edit-key' command
2366      "tsign").
2367
2368 '--check-signatures'
2369 '--check-sigs'
2370      Same as '--list-signatures', but the signatures are verified.  Note
2371      that for performance reasons the revocation status of a signing key
2372      is not shown.  This command has the same effect as using
2373      '--list-keys' with '--with-sig-check'.
2374
2375      The status of the verification is indicated by a flag directly
2376      following the "sig" tag (and thus before the flags described above
2377      for '--list-signatures').  A "!"  indicates that the signature has
2378      been successfully verified, a "-" denotes a bad signature and a "%"
2379      is used if an error occurred while checking the signature (e.g.  a
2380      non supported algorithm).
2381
2382 '--locate-keys'
2383      Locate the keys given as arguments.  This command basically uses
2384      the same algorithm as used when locating keys for encryption or
2385      signing and may thus be used to see what keys 'gpg' might use.  In
2386      particular external methods as defined by '--auto-key-locate' may
2387      be used to locate a key.  Only public keys are listed.
2388
2389 '--fingerprint'
2390      List all keys (or the specified ones) along with their
2391      fingerprints.  This is the same output as '--list-keys' but with
2392      the additional output of a line with the fingerprint.  May also be
2393      combined with '--list-signatures' or '--check-signatures'.  If this
2394      command is given twice, the fingerprints of all secondary keys are
2395      listed too.  This command also forces pretty printing of
2396      fingerprints if the keyid format has been set to "none".
2397
2398 '--list-packets'
2399      List only the sequence of packets.  This command is only useful for
2400      debugging.  When used with option '--verbose' the actual MPI values
2401      are dumped and not only their lengths.  Note that the output of
2402      this command may change with new releases.
2403
2404 '--edit-card'
2405 '--card-edit'
2406      Present a menu to work with a smartcard.  The subcommand "help"
2407      provides an overview on available commands.  For a detailed
2408      description, please see the Card HOWTO at
2409      https://gnupg.org/documentation/howtos.html#GnuPG-cardHOWTO .
2410
2411 '--card-status'
2412      Show the content of the smart card.
2413
2414 '--change-pin'
2415      Present a menu to allow changing the PIN of a smartcard.  This
2416      functionality is also available as the subcommand "passwd" with the
2417      '--edit-card' command.
2418
2419 '--delete-keys name'
2420 '--delete-keys name'
2421      Remove key from the public keyring.  In batch mode either '--yes'
2422      is required or the key must be specified by fingerprint.  This is a
2423      safeguard against accidental deletion of multiple keys.
2424
2425 '--delete-secret-keys name'
2426      Remove key from the secret keyring.  In batch mode the key must be
2427      specified by fingerprint.  The option '--yes' can be used to advice
2428      gpg-agent not to request a confirmation.  This extra pre-caution is
2429      done because 'gpg' can't be sure that the secret key (as controlled
2430      by gpg-agent) is only used for the given OpenPGP public key.
2431
2432 '--delete-secret-and-public-key name'
2433      Same as '--delete-key', but if a secret key exists, it will be
2434      removed first.  In batch mode the key must be specified by
2435      fingerprint.  The option '--yes' can be used to advice gpg-agent
2436      not to request a confirmation.
2437
2438 '--export'
2439      Either export all keys from all keyrings (default keyrings and
2440      those registered via option '--keyring'), or if at least one name
2441      is given, those of the given name.  The exported keys are written
2442      to STDOUT or to the file given with option '--output'.  Use
2443      together with '--armor' to mail those keys.
2444
2445 '--send-keys key IDs'
2446      Similar to '--export' but sends the keys to a keyserver.
2447      Fingerprints may be used instead of key IDs.  Option '--keyserver'
2448      must be used to give the name of this keyserver.  Don't send your
2449      complete keyring to a keyserver -- select only those keys which are
2450      new or changed by you.  If no key IDs are given, 'gpg' does
2451      nothing.
2452
2453 '--export-secret-keys'
2454 '--export-secret-subkeys'
2455      Same as '--export', but exports the secret keys instead.  The
2456      exported keys are written to STDOUT or to the file given with
2457      option '--output'.  This command is often used along with the
2458      option '--armor' to allow for easy printing of the key for paper
2459      backup; however the external tool 'paperkey' does a better job of
2460      creating backups on paper.  Note that exporting a secret key can be
2461      a security risk if the exported keys are sent over an insecure
2462      channel.
2463
2464      The second form of the command has the special property to render
2465      the secret part of the primary key useless; this is a GNU extension
2466      to OpenPGP and other implementations can not be expected to
2467      successfully import such a key.  Its intended use is in generating
2468      a full key with an additional signing subkey on a dedicated
2469      machine.  This command then exports the key without the primary key
2470      to the main machine.
2471
2472      GnuPG may ask you to enter the passphrase for the key.  This is
2473      required, because the internal protection method of the secret key
2474      is different from the one specified by the OpenPGP protocol.
2475
2476 '--export-ssh-key'
2477      This command is used to export a key in the OpenSSH public key
2478      format.  It requires the specification of one key by the usual
2479      means and exports the latest valid subkey which has an
2480      authentication capability to STDOUT or to the file given with
2481      option '--output'.  That output can directly be added to ssh's
2482      'authorized_key' file.
2483
2484      By specifying the key to export using a key ID or a fingerprint
2485      suffixed with an exclamation mark (!), a specific subkey or the
2486      primary key can be exported.  This does not even require that the
2487      key has the authentication capability flag set.
2488
2489 '--import'
2490 '--fast-import'
2491      Import/merge keys.  This adds the given keys to the keyring.  The
2492      fast version is currently just a synonym.
2493
2494      There are a few other options which control how this command works.
2495      Most notable here is the '--import-options merge-only' option which
2496      does not insert new keys but does only the merging of new
2497      signatures, user-IDs and subkeys.
2498
2499 '--receive-keys key IDs'
2500 '--recv-keys key IDs'
2501      Import the keys with the given key IDs from a keyserver.  Option
2502      '--keyserver' must be used to give the name of this keyserver.
2503
2504 '--refresh-keys'
2505      Request updates from a keyserver for keys that already exist on the
2506      local keyring.  This is useful for updating a key with the latest
2507      signatures, user IDs, etc.  Calling this with no arguments will
2508      refresh the entire keyring.  Option '--keyserver' must be used to
2509      give the name of the keyserver for all keys that do not have
2510      preferred keyservers set (see '--keyserver-options
2511      honor-keyserver-url').
2512
2513 '--search-keys names'
2514      Search the keyserver for the given names.  Multiple names given
2515      here will be joined together to create the search string for the
2516      keyserver.  Option '--keyserver' must be used to give the name of
2517      this keyserver.  Keyservers that support different search methods
2518      allow using the syntax specified in "How to specify a user ID"
2519      below.  Note that different keyserver types support different
2520      search methods.  Currently only LDAP supports them all.
2521
2522 '--fetch-keys URIs'
2523      Retrieve keys located at the specified URIs.  Note that different
2524      installations of GnuPG may support different protocols (HTTP, FTP,
2525      LDAP, etc.).  When using HTTPS the system provided root
2526      certificates are used by this command.
2527
2528 '--update-trustdb'
2529      Do trust database maintenance.  This command iterates over all keys
2530      and builds the Web of Trust.  This is an interactive command
2531      because it may have to ask for the "ownertrust" values for keys.
2532      The user has to give an estimation of how far she trusts the owner
2533      of the displayed key to correctly certify (sign) other keys.  GnuPG
2534      only asks for the ownertrust value if it has not yet been assigned
2535      to a key.  Using the '--edit-key' menu, the assigned value can be
2536      changed at any time.
2537
2538 '--check-trustdb'
2539      Do trust database maintenance without user interaction.  From time
2540      to time the trust database must be updated so that expired keys or
2541      signatures and the resulting changes in the Web of Trust can be
2542      tracked.  Normally, GnuPG will calculate when this is required and
2543      do it automatically unless '--no-auto-check-trustdb' is set.  This
2544      command can be used to force a trust database check at any time.
2545      The processing is identical to that of '--update-trustdb' but it
2546      skips keys with a not yet defined "ownertrust".
2547
2548      For use with cron jobs, this command can be used together with
2549      '--batch' in which case the trust database check is done only if a
2550      check is needed.  To force a run even in batch mode add the option
2551      '--yes'.
2552
2553 '--export-ownertrust'
2554      Send the ownertrust values to STDOUT. This is useful for backup
2555      purposes as these values are the only ones which can't be
2556      re-created from a corrupted trustdb.  Example:
2557             gpg --export-ownertrust > otrust.txt
2558
2559 '--import-ownertrust'
2560      Update the trustdb with the ownertrust values stored in 'files' (or
2561      STDIN if not given); existing values will be overwritten.  In case
2562      of a severely damaged trustdb and if you have a recent backup of
2563      the ownertrust values (e.g.  in the file 'otrust.txt'), you may
2564      re-create the trustdb using these commands:
2565             cd ~/.gnupg
2566             rm trustdb.gpg
2567             gpg --import-ownertrust < otrust.txt
2568
2569 '--rebuild-keydb-caches'
2570      When updating from version 1.0.6 to 1.0.7 this command should be
2571      used to create signature caches in the keyring.  It might be handy
2572      in other situations too.
2573
2574 '--print-md algo'
2575 '--print-mds'
2576      Print message digest of algorithm ALGO for all given files or
2577      STDIN. With the second form (or a deprecated "*" as algo) digests
2578      for all available algorithms are printed.
2579
2580 '--gen-random 0|1|2 count'
2581      Emit COUNT random bytes of the given quality level 0, 1 or 2.  If
2582      COUNT is not given or zero, an endless sequence of random bytes
2583      will be emitted.  If used with '--armor' the output will be base64
2584      encoded.  PLEASE, don't use this command unless you know what you
2585      are doing; it may remove precious entropy from the system!
2586
2587 '--gen-prime mode bits'
2588      Use the source, Luke :-).  The output format is still subject to
2589      change.
2590
2591 '--enarmor'
2592 '--dearmor'
2593      Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
2594      This is a GnuPG extension to OpenPGP and in general not very
2595      useful.
2596
2597 '--tofu-policy auto|good|unknown|bad|ask key...'
2598      Set the TOFU policy for all the bindings associated with the
2599      specified keys.  For more information about the meaning of the
2600      policies, *note trust-model-tofu::.  The keys may be specified
2601      either by their fingerprint (preferred) or their keyid.
2602
2603 \1f
2604 File: gnupg.info,  Node: OpenPGP Key Management,  Prev: Operational GPG Commands,  Up: GPG Commands
2605
2606 4.1.3 How to manage your keys
2607 -----------------------------
2608
2609 This section explains the main commands for key management.
2610
2611 '--quick-generate-key user-id [algo [usage [expire]]]'
2612      This is a simple command to generate a standard key with one user
2613      id.  In contrast to '--generate-key' the key is generated directly
2614      without the need to answer a bunch of prompts.  Unless the option
2615      '--yes' is given, the key creation will be canceled if the given
2616      user id already exists in the keyring.
2617
2618      If invoked directly on the console without any special options an
2619      answer to a "Continue?"  style confirmation prompt is required.  In
2620      case the user id already exists in the keyring a second prompt to
2621      force the creation of the key will show up.
2622
2623      If 'algo' or 'usage' are given, only the primary key is created and
2624      no prompts are shown.  To specify an expiration date but still
2625      create a primary and subkey use "default" or "future-default" for
2626      'algo' and "default" for 'usage'.  For a description of these
2627      optional arguments see the command '--quick-add-key'.  The 'usage'
2628      accepts also the value "cert" which can be used to create a
2629      certification only primary key; the default is to a create
2630      certification and signing key.
2631
2632      The 'expire' argument can be used to specify an expiration date for
2633      the key.  Several formats are supported; commonly the ISO
2634      YYYY-MM-DD format is used.  The values "never", "none" can be used
2635      for no expiration date.  Not specifying a value, or using "-"
2636      results in a key expiring in a reasonable default interval.
2637
2638      If this command is used with '--batch', '--pinentry-mode' has been
2639      set to 'loopback', and one of the passphrase options
2640      ('--passphrase', '--passphrase-fd', or 'passphrase-file') is used,
2641      the supplied passphrase is used for the new key and the agent does
2642      not ask for it.  To create a key without any protection
2643      '--passphrase ''' may be used.
2644
2645 '--quick-set-expire fpr expire'
2646      Directly set the expiration time of the primary key to 'expire'.
2647      To remove the expiration time '0' can be used.
2648
2649 '--quick-add-key fpr [algo [usage [expire]]]'
2650      Directly add a subkey to the key identified by the fingerprint
2651      'fpr'.  Without the optional arguments an encryption subkey is
2652      added.  If any of the arguments are given a more specific subkey is
2653      added.
2654
2655      'algo' may be any of the supported algorithms or curve names given
2656      in the format as used by key listings.  To use the default
2657      algorithm the string "default" or "-" can be used.  Supported
2658      algorithms are "rsa", "dsa", "elg", "ed25519", "cv25519", and other
2659      ECC curves.  For example the string "rsa" adds an RSA key with the
2660      default key length; a string "rsa4096" requests that the key length
2661      is 4096 bits.  The string "future-default" is an alias for the
2662      algorithm which will likely be used as default algorithm in future
2663      versions of gpg.
2664
2665      Depending on the given 'algo' the subkey may either be an
2666      encryption subkey or a signing subkey.  If an algorithm is capable
2667      of signing and encryption and such a subkey is desired, a 'usage'
2668      string must be given.  This string is either "default" or "-" to
2669      keep the default or a comma delimited list of keywords: "sign" for
2670      a signing subkey, "auth" for an authentication subkey, and "encr"
2671      for an encryption subkey ("encrypt" can be used as alias for
2672      "encr").  The valid combinations depend on the algorithm.
2673
2674      The 'expire' argument can be used to specify an expiration date for
2675      the subkey.  Several formats are supported; commonly the ISO
2676      YYYY-MM-DD format is used.  The values "never", "none", or "-" can
2677      be used for no expiration date.
2678
2679 '--generate-key'
2680 '--gen-key'
2681      Generate a new key pair using the current default parameters.  This
2682      is the standard command to create a new key.  In addition to the
2683      key a revocation certificate is created and stored in the
2684      'openpgp-revocs.d' directory below the GnuPG home directory.
2685
2686 '--full-generate-key'
2687 '--full-gen-key'
2688      Generate a new key pair with dialogs for all options.  This is an
2689      extended version of '--generate-key'.
2690
2691      There is also a feature which allows you to create keys in batch
2692      mode.  See the manual section "Unattended key generation" on how to
2693      use this.
2694
2695 '--generate-revocation name'
2696 '--gen-revoke name'
2697      Generate a revocation certificate for the complete key.  To only
2698      revoke a subkey or a key signature, use the '--edit' command.
2699
2700      This command merely creates the revocation certificate so that it
2701      can be used to revoke the key if that is ever needed.  To actually
2702      revoke a key the created revocation certificate needs to be merged
2703      with the key to revoke.  This is done by importing the revocation
2704      certificate using the '--import' command.  Then the revoked key
2705      needs to be published, which is best done by sending the key to a
2706      keyserver (command '--send-key') and by exporting ('--export') it
2707      to a file which is then send to frequent communication partners.
2708
2709 '--generate-designated-revocation name'
2710 '--desig-revoke name'
2711      Generate a designated revocation certificate for a key.  This
2712      allows a user (with the permission of the keyholder) to revoke
2713      someone else's key.
2714
2715 '--edit-key'
2716      Present a menu which enables you to do most of the key management
2717      related tasks.  It expects the specification of a key on the
2718      command line.
2719
2720      uid 'n'
2721           Toggle selection of user ID or photographic user ID with index
2722           'n'.  Use '*' to select all and '0' to deselect all.
2723
2724      key 'n'
2725           Toggle selection of subkey with index 'n' or key ID 'n'.  Use
2726           '*' to select all and '0' to deselect all.
2727
2728      sign
2729           Make a signature on key of user 'name'.  If the key is not yet
2730           signed by the default user (or the users given with '-u'), the
2731           program displays the information of the key again, together
2732           with its fingerprint and asks whether it should be signed.
2733           This question is repeated for all users specified with '-u'.
2734
2735      lsign
2736           Same as "sign" but the signature is marked as non-exportable
2737           and will therefore never be used by others.  This may be used
2738           to make keys valid only in the local environment.
2739
2740      nrsign
2741           Same as "sign" but the signature is marked as non-revocable
2742           and can therefore never be revoked.
2743
2744      tsign
2745           Make a trust signature.  This is a signature that combines the
2746           notions of certification (like a regular signature), and trust
2747           (like the "trust" command).  It is generally only useful in
2748           distinct communities or groups.  For more information please
2749           read the sections "Trust Signature" and "Regular Expression"
2750           in RFC-4880.
2751
2752      Note that "l" (for local / non-exportable), "nr" (for
2753      non-revocable, and "t" (for trust) may be freely mixed and prefixed
2754      to "sign" to create a signature of any type desired.
2755
2756      If the option '--only-sign-text-ids' is specified, then any
2757      non-text based user ids (e.g., photo IDs) will not be selected for
2758      signing.
2759
2760      delsig
2761           Delete a signature.  Note that it is not possible to retract a
2762           signature, once it has been send to the public (i.e.  to a
2763           keyserver).  In that case you better use 'revsig'.
2764
2765      revsig
2766           Revoke a signature.  For every signature which has been
2767           generated by one of the secret keys, GnuPG asks whether a
2768           revocation certificate should be generated.
2769
2770      check
2771           Check the signatures on all selected user IDs.  With the extra
2772           option 'selfsig' only self-signatures are shown.
2773
2774      adduid
2775           Create an additional user ID.
2776
2777      addphoto
2778           Create a photographic user ID. This will prompt for a JPEG
2779           file that will be embedded into the user ID. Note that a very
2780           large JPEG will make for a very large key.  Also note that
2781           some programs will display your JPEG unchanged (GnuPG), and
2782           some programs will scale it to fit in a dialog box (PGP).
2783
2784      showphoto
2785           Display the selected photographic user ID.
2786
2787      deluid
2788           Delete a user ID or photographic user ID. Note that it is not
2789           possible to retract a user id, once it has been send to the
2790           public (i.e.  to a keyserver).  In that case you better use
2791           'revuid'.
2792
2793      revuid
2794           Revoke a user ID or photographic user ID.
2795
2796      primary
2797           Flag the current user id as the primary one, removes the
2798           primary user id flag from all other user ids and sets the
2799           timestamp of all affected self-signatures one second ahead.
2800           Note that setting a photo user ID as primary makes it primary
2801           over other photo user IDs, and setting a regular user ID as
2802           primary makes it primary over other regular user IDs.
2803
2804      keyserver
2805           Set a preferred keyserver for the specified user ID(s).  This
2806           allows other users to know where you prefer they get your key
2807           from.  See '--keyserver-options honor-keyserver-url' for more
2808           on how this works.  Setting a value of "none" removes an
2809           existing preferred keyserver.
2810
2811      notation
2812           Set a name=value notation for the specified user ID(s).  See
2813           '--cert-notation' for more on how this works.  Setting a value
2814           of "none" removes all notations, setting a notation prefixed
2815           with a minus sign (-) removes that notation, and setting a
2816           notation name (without the =value) prefixed with a minus sign
2817           removes all notations with that name.
2818
2819      pref
2820           List preferences from the selected user ID. This shows the
2821           actual preferences, without including any implied preferences.
2822
2823      showpref
2824           More verbose preferences listing for the selected user ID.
2825           This shows the preferences in effect by including the implied
2826           preferences of 3DES (cipher), SHA-1 (digest), and Uncompressed
2827           (compression) if they are not already included in the
2828           preference list.  In addition, the preferred keyserver and
2829           signature notations (if any) are shown.
2830
2831      setpref 'string'
2832           Set the list of user ID preferences to 'string' for all (or
2833           just the selected) user IDs.  Calling setpref with no
2834           arguments sets the preference list to the default (either
2835           built-in or set via '--default-preference-list'), and calling
2836           setpref with "none" as the argument sets an empty preference
2837           list.  Use 'gpg --version' to get a list of available
2838           algorithms.  Note that while you can change the preferences on
2839           an attribute user ID (aka "photo ID"), GnuPG does not select
2840           keys via attribute user IDs so these preferences will not be
2841           used by GnuPG.
2842
2843           When setting preferences, you should list the algorithms in
2844           the order which you'd like to see them used by someone else
2845           when encrypting a message to your key.  If you don't include
2846           3DES, it will be automatically added at the end.  Note that
2847           there are many factors that go into choosing an algorithm (for
2848           example, your key may not be the only recipient), and so the
2849           remote OpenPGP application being used to send to you may or
2850           may not follow your exact chosen order for a given message.
2851           It will, however, only choose an algorithm that is present on
2852           the preference list of every recipient key.  See also the
2853           INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
2854
2855      addkey
2856           Add a subkey to this key.
2857
2858      addcardkey
2859           Generate a subkey on a card and add it to this key.
2860
2861      keytocard
2862           Transfer the selected secret subkey (or the primary key if no
2863           subkey has been selected) to a smartcard.  The secret key in
2864           the keyring will be replaced by a stub if the key could be
2865           stored successfully on the card and you use the save command
2866           later.  Only certain key types may be transferred to the card.
2867           A sub menu allows you to select on what card to store the key.
2868           Note that it is not possible to get that key back from the
2869           card - if the card gets broken your secret key will be lost
2870           unless you have a backup somewhere.
2871
2872      bkuptocard 'file'
2873           Restore the given file to a card.  This command may be used to
2874           restore a backup key (as generated during card initialization)
2875           to a new card.  In almost all cases this will be the
2876           encryption key.  You should use this command only with the
2877           corresponding public key and make sure that the file given as
2878           argument is indeed the backup to restore.  You should then
2879           select 2 to restore as encryption key.  You will first be
2880           asked to enter the passphrase of the backup key and then for
2881           the Admin PIN of the card.
2882
2883      delkey
2884           Remove a subkey (secondary key).  Note that it is not possible
2885           to retract a subkey, once it has been send to the public (i.e.
2886           to a keyserver).  In that case you better use 'revkey'.  Also
2887           note that this only deletes the public part of a key.
2888
2889      revkey
2890           Revoke a subkey.
2891
2892      expire
2893           Change the key or subkey expiration time.  If a subkey is
2894           selected, the expiration time of this subkey will be changed.
2895           With no selection, the key expiration of the primary key is
2896           changed.
2897
2898      trust
2899           Change the owner trust value for the key.  This updates the
2900           trust-db immediately and no save is required.
2901
2902      disable
2903      enable
2904           Disable or enable an entire key.  A disabled key can not
2905           normally be used for encryption.
2906
2907      addrevoker
2908           Add a designated revoker to the key.  This takes one optional
2909           argument: "sensitive".  If a designated revoker is marked as
2910           sensitive, it will not be exported by default (see
2911           export-options).
2912
2913      passwd
2914           Change the passphrase of the secret key.
2915
2916      toggle
2917           This is dummy command which exists only for backward
2918           compatibility.
2919
2920      clean
2921           Compact (by removing all signatures except the selfsig) any
2922           user ID that is no longer usable (e.g.  revoked, or expired).
2923           Then, remove any signatures that are not usable by the trust
2924           calculations.  Specifically, this removes any signature that
2925           does not validate, any signature that is superseded by a later
2926           signature, revoked signatures, and signatures issued by keys
2927           that are not present on the keyring.
2928
2929      minimize
2930           Make the key as small as possible.  This removes all
2931           signatures from each user ID except for the most recent
2932           self-signature.
2933
2934      cross-certify
2935           Add cross-certification signatures to signing subkeys that may
2936           not currently have them.  Cross-certification signatures
2937           protect against a subtle attack against signing subkeys.  See
2938           '--require-cross-certification'.  All new keys generated have
2939           this signature by default, so this command is only useful to
2940           bring older keys up to date.
2941
2942      save
2943           Save all changes to the keyrings and quit.
2944
2945      quit
2946           Quit the program without updating the keyrings.
2947
2948      The listing shows you the key with its secondary keys and all user
2949      ids.  The primary user id is indicated by a dot, and selected keys
2950      or user ids are indicated by an asterisk.  The trust value is
2951      displayed with the primary key: the first is the assigned owner
2952      trust and the second is the calculated trust value.  Letters are
2953      used for the values:
2954
2955      -
2956           No ownertrust assigned / not yet calculated.
2957
2958      e
2959           Trust calculation has failed; probably due to an expired key.
2960
2961      q
2962           Not enough information for calculation.
2963
2964      n
2965           Never trust this key.
2966
2967      m
2968           Marginally trusted.
2969
2970      f
2971           Fully trusted.
2972
2973      u
2974           Ultimately trusted.
2975
2976 '--sign-key name'
2977      Signs a public key with your secret key.  This is a shortcut
2978      version of the subcommand "sign" from '--edit'.
2979
2980 '--lsign-key name'
2981      Signs a public key with your secret key but marks it as
2982      non-exportable.  This is a shortcut version of the subcommand
2983      "lsign" from '--edit-key'.
2984
2985 '--quick-sign-key fpr [names]'
2986 '--quick-lsign-key fpr [names]'
2987      Directly sign a key from the passphrase without any further user
2988      interaction.  The 'fpr' must be the verified primary fingerprint of
2989      a key in the local keyring.  If no 'names' are given, all useful
2990      user ids are signed; with given ['names'] only useful user ids
2991      matching one of theses names are signed.  By default, or if a name
2992      is prefixed with a '*', a case insensitive substring match is used.
2993      If a name is prefixed with a '=' a case sensitive exact match is
2994      done.
2995
2996      The command '--quick-lsign-key' marks the signatures as
2997      non-exportable.  If such a non-exportable signature already exists
2998      the '--quick-sign-key' turns it into a exportable signature.
2999
3000      This command uses reasonable defaults and thus does not provide the
3001      full flexibility of the "sign" subcommand from '--edit-key'.  Its
3002      intended use is to help unattended key signing by utilizing a list
3003      of verified fingerprints.
3004
3005 '--quick-add-uid USER-ID NEW-USER-ID'
3006      This command adds a new user id to an existing key.  In contrast to
3007      the interactive sub-command 'adduid' of '--edit-key' the
3008      NEW-USER-ID is added verbatim with only leading and trailing white
3009      space removed, it is expected to be UTF-8 encoded, and no checks on
3010      its form are applied.
3011
3012 '--quick-revoke-uid USER-ID USER-ID-TO-REVOKE'
3013      This command revokes a User ID on an existing key.  It cannot be
3014      used to revoke the last User ID on key (some non-revoked User ID
3015      must remain), with revocation reason "User ID is no longer valid".
3016      If you want to specify a different revocation reason, or to supply
3017      supplementary revocation text, you should use the interactive
3018      sub-command 'revuid' of '--edit-key'.
3019
3020 '--change-passphrase USER_ID'
3021 '--passwd USER_ID'
3022      Change the passphrase of the secret key belonging to the
3023      certificate specified as USER_ID.  This is a shortcut for the
3024      sub-command 'passwd' of the edit key menu.
3025
3026 \1f
3027 File: gnupg.info,  Node: GPG Options,  Next: GPG Configuration,  Prev: GPG Commands,  Up: Invoking GPG
3028
3029 4.2 Option Summary
3030 ==================
3031
3032 'gpg' features a bunch of options to control the exact behaviour and to
3033 change the default configuration.
3034
3035 * Menu:
3036
3037 * GPG Configuration Options::   How to change the configuration.
3038 * GPG Key related Options::     Key related options.
3039 * GPG Input and Output::        Input and Output.
3040 * OpenPGP Options::             OpenPGP protocol specific options.
3041 * Compliance Options::          Compliance options.
3042 * GPG Esoteric Options::        Doing things one usually doesn't want to do.
3043 * Deprecated Options::          Deprecated options.
3044
3045    Long options can be put in an options file (default
3046 "~/.gnupg/gpg.conf").  Short option names will not work - for example,
3047 "armor" is a valid option for the options file, while "a" is not.  Do
3048 not write the 2 dashes, but simply the name of the option and any
3049 required arguments.  Lines with a hash ('#') as the first
3050 non-white-space character are ignored.  Commands may be put in this file
3051 too, but that is not generally useful as the command will execute
3052 automatically with every execution of gpg.
3053
3054    Please remember that option parsing stops as soon as a non-option is
3055 encountered, you can explicitly stop parsing by using the special option
3056 '--'.
3057
3058 \1f
3059 File: gnupg.info,  Node: GPG Configuration Options,  Next: GPG Key related Options,  Up: GPG Options
3060
3061 4.2.1 How to change the configuration
3062 -------------------------------------
3063
3064 These options are used to change the configuration and are usually found
3065 in the option file.
3066
3067 '--default-key NAME'
3068      Use NAME as the default key to sign with.  If this option is not
3069      used, the default key is the first key found in the secret keyring.
3070      Note that '-u' or '--local-user' overrides this option.  This
3071      option may be given multiple times.  In this case, the last key for
3072      which a secret key is available is used.  If there is no secret key
3073      available for any of the specified values, GnuPG will not emit an
3074      error message but continue as if this option wasn't given.
3075
3076 '--default-recipient NAME'
3077      Use NAME as default recipient if option '--recipient' is not used
3078      and don't ask if this is a valid one.  NAME must be non-empty.
3079
3080 '--default-recipient-self'
3081      Use the default key as default recipient if option '--recipient' is
3082      not used and don't ask if this is a valid one.  The default key is
3083      the first one from the secret keyring or the one set with
3084      '--default-key'.
3085
3086 '--no-default-recipient'
3087      Reset '--default-recipient' and '--default-recipient-self'.
3088
3089 '-v, --verbose'
3090      Give more information during processing.  If used twice, the input
3091      data is listed in detail.
3092
3093 '--no-verbose'
3094      Reset verbose level to 0.
3095
3096 '-q, --quiet'
3097      Try to be as quiet as possible.
3098
3099 '--batch'
3100 '--no-batch'
3101      Use batch mode.  Never ask, do not allow interactive commands.
3102      '--no-batch' disables this option.  Note that even with a filename
3103      given on the command line, gpg might still need to read from STDIN
3104      (in particular if gpg figures that the input is a detached
3105      signature and no data file has been specified).  Thus if you do not
3106      want to feed data via STDIN, you should connect STDIN to
3107      g'/dev/null'.
3108
3109      It is highly recommended to use this option along with the options
3110      '--status-fd' and '--with-colons' for any unattended of 'gpg'.
3111
3112 '--no-tty'
3113      Make sure that the TTY (terminal) is never used for any output.
3114      This option is needed in some cases because GnuPG sometimes prints
3115      warnings to the TTY even if '--batch' is used.
3116
3117 '--yes'
3118      Assume "yes" on most questions.
3119
3120 '--no'
3121      Assume "no" on most questions.
3122
3123 '--list-options parameters'
3124      This is a space or comma delimited string that gives options used
3125      when listing keys and signatures (that is, '--list-keys',
3126      '--list-signatures', '--list-public-keys', '--list-secret-keys',
3127      and the '--edit-key' functions).  Options can be prepended with a
3128      'no-' (after the two dashes) to give the opposite meaning.  The
3129      options are:
3130
3131      show-photos
3132           Causes '--list-keys', '--list-signatures',
3133           '--list-public-keys', and '--list-secret-keys' to display any
3134           photo IDs attached to the key.  Defaults to no.  See also
3135           '--photo-viewer'.  Does not work with '--with-colons': see
3136           '--attribute-fd' for the appropriate way to get photo data for
3137           scripts and other frontends.
3138
3139      show-usage
3140           Show usage information for keys and subkeys in the standard
3141           key listing.  This is a list of letters indicating the allowed
3142           usage for a key ('E'=encryption, 'S'=signing,
3143           'C'=certification, 'A'=authentication).  Defaults to yes.
3144
3145      show-policy-urls
3146           Show policy URLs in the '--list-signatures' or
3147           '--check-signatures' listings.  Defaults to no.
3148
3149      show-notations
3150      show-std-notations
3151      show-user-notations
3152           Show all, IETF standard, or user-defined signature notations
3153           in the '--list-signatures' or '--check-signatures' listings.
3154           Defaults to no.
3155
3156      show-keyserver-urls
3157           Show any preferred keyserver URL in the '--list-signatures' or
3158           '--check-signatures' listings.  Defaults to no.
3159
3160      show-uid-validity
3161           Display the calculated validity of user IDs during key
3162           listings.  Defaults to yes.
3163
3164      show-unusable-uids
3165           Show revoked and expired user IDs in key listings.  Defaults
3166           to no.
3167
3168      show-unusable-subkeys
3169           Show revoked and expired subkeys in key listings.  Defaults to
3170           no.
3171
3172      show-keyring
3173           Display the keyring name at the head of key listings to show
3174           which keyring a given key resides on.  Defaults to no.
3175
3176      show-sig-expire
3177           Show signature expiration dates (if any) during
3178           '--list-signatures' or '--check-signatures' listings.
3179           Defaults to no.
3180
3181      show-sig-subpackets
3182           Include signature subpackets in the key listing.  This option
3183           can take an optional argument list of the subpackets to list.
3184           If no argument is passed, list all subpackets.  Defaults to
3185           no.  This option is only meaningful when using '--with-colons'
3186           along with '--list-signatures' or '--check-signatures'.
3187
3188 '--verify-options parameters'
3189      This is a space or comma delimited string that gives options used
3190      when verifying signatures.  Options can be prepended with a 'no-'
3191      to give the opposite meaning.  The options are:
3192
3193      show-photos
3194           Display any photo IDs present on the key that issued the
3195           signature.  Defaults to no.  See also '--photo-viewer'.
3196
3197      show-policy-urls
3198           Show policy URLs in the signature being verified.  Defaults to
3199           yes.
3200
3201      show-notations
3202      show-std-notations
3203      show-user-notations
3204           Show all, IETF standard, or user-defined signature notations
3205           in the signature being verified.  Defaults to IETF standard.
3206
3207      show-keyserver-urls
3208           Show any preferred keyserver URL in the signature being
3209           verified.  Defaults to yes.
3210
3211      show-uid-validity
3212           Display the calculated validity of the user IDs on the key
3213           that issued the signature.  Defaults to yes.
3214
3215      show-unusable-uids
3216           Show revoked and expired user IDs during signature
3217           verification.  Defaults to no.
3218
3219      show-primary-uid-only
3220           Show only the primary user ID during signature verification.
3221           That is all the AKA lines as well as photo Ids are not shown
3222           with the signature verification status.
3223
3224      pka-lookups
3225           Enable PKA lookups to verify sender addresses.  Note that PKA
3226           is based on DNS, and so enabling this option may disclose
3227           information on when and what signatures are verified or to
3228           whom data is encrypted.  This is similar to the "web bug"
3229           described for the '--auto-key-retrieve' option.
3230
3231      pka-trust-increase
3232           Raise the trust in a signature to full if the signature passes
3233           PKA validation.  This option is only meaningful if pka-lookups
3234           is set.
3235
3236 '--enable-large-rsa'
3237 '--disable-large-rsa'
3238      With -generate-key and -batch, enable the creation of RSA secret
3239      keys as large as 8192 bit.  Note: 8192 bit is more than is
3240      generally recommended.  These large keys don't significantly
3241      improve security, but they are more expensive to use, and their
3242      signatures and certifications are larger.  This option is only
3243      available if the binary was build with large-secmem support.
3244
3245 '--enable-dsa2'
3246 '--disable-dsa2'
3247      Enable hash truncation for all DSA keys even for old DSA Keys up to
3248      1024 bit.  This is also the default with '--openpgp'.  Note that
3249      older versions of GnuPG also required this flag to allow the
3250      generation of DSA larger than 1024 bit.
3251
3252 '--photo-viewer string'
3253      This is the command line that should be run to view a photo ID.
3254      "%i" will be expanded to a filename containing the photo.  "%I"
3255      does the same, except the file will not be deleted once the viewer
3256      exits.  Other flags are "%k" for the key ID, "%K" for the long key
3257      ID, "%f" for the key fingerprint, "%t" for the extension of the
3258      image type (e.g.  "jpg"), "%T" for the MIME type of the image (e.g.
3259      "image/jpeg"), "%v" for the single-character calculated validity of
3260      the image being viewed (e.g.  "f"), "%V" for the calculated
3261      validity as a string (e.g.  "full"), "%U" for a base32 encoded hash
3262      of the user ID, and "%%" for an actual percent sign.  If neither %i
3263      or %I are present, then the photo will be supplied to the viewer on
3264      standard input.
3265
3266      The default viewer is "xloadimage -fork -quiet -title 'KeyID 0x%k'
3267      STDIN". Note that if your image viewer program is not secure, then
3268      executing it from GnuPG does not make it secure.
3269
3270 '--exec-path string'
3271      Sets a list of directories to search for photo viewers and
3272      keyserver helpers.  If not provided, keyserver helpers use the
3273      compiled-in default directory, and photo viewers use the 'PATH'
3274      environment variable.  Note, that on W32 system this value is
3275      ignored when searching for keyserver helpers.
3276
3277 '--keyring file'
3278      Add 'file' to the current list of keyrings.  If 'file' begins with
3279      a tilde and a slash, these are replaced by the $HOME directory.  If
3280      the filename does not contain a slash, it is assumed to be in the
3281      GnuPG home directory ("~/.gnupg" if '--homedir' or $GNUPGHOME is
3282      not used).
3283
3284      Note that this adds a keyring to the current list.  If the intent
3285      is to use the specified keyring alone, use '--keyring' along with
3286      '--no-default-keyring'.
3287
3288      If the the option '--no-keyring' has been used no keyrings will be
3289      used at all.
3290
3291 '--secret-keyring file'
3292      This is an obsolete option and ignored.  All secret keys are stored
3293      in the 'private-keys-v1.d' directory below the GnuPG home
3294      directory.
3295
3296 '--primary-keyring file'
3297      Designate 'file' as the primary public keyring.  This means that
3298      newly imported keys (via '--import' or keyserver '--recv-from')
3299      will go to this keyring.
3300
3301 '--trustdb-name file'
3302      Use 'file' instead of the default trustdb.  If 'file' begins with a
3303      tilde and a slash, these are replaced by the $HOME directory.  If
3304      the filename does not contain a slash, it is assumed to be in the
3305      GnuPG home directory ('~/.gnupg' if '--homedir' or $GNUPGHOME is
3306      not used).
3307
3308 '--homedir DIR'
3309      Set the name of the home directory to DIR.  If this option is not
3310      used, the home directory defaults to '~/.gnupg'.  It is only
3311      recognized when given on the command line.  It also overrides any
3312      home directory stated through the environment variable 'GNUPGHOME'
3313      or (on Windows systems) by means of the Registry entry
3314      HKCU\SOFTWARE\GNU\GNUPG:HOMEDIR.
3315
3316      On Windows systems it is possible to install GnuPG as a portable
3317      application.  In this case only this command line option is
3318      considered, all other ways to set a home directory are ignored.
3319
3320      To install GnuPG as a portable application under Windows, create an
3321      empty file named 'gpgconf.ctl' in the same directory as the tool
3322      'gpgconf.exe'.  The root of the installation is then that
3323      directory; or, if 'gpgconf.exe' has been installed directly below a
3324      directory named 'bin', its parent directory.  You also need to make
3325      sure that the following directories exist and are writable:
3326      'ROOT/home' for the GnuPG home and 'ROOT/usr/local/var/cache/gnupg'
3327      for internal cache files.
3328
3329 '--display-charset name'
3330      Set the name of the native character set.  This is used to convert
3331      some informational strings like user IDs to the proper UTF-8
3332      encoding.  Note that this has nothing to do with the character set
3333      of data to be encrypted or signed; GnuPG does not recode
3334      user-supplied data.  If this option is not used, the default
3335      character set is determined from the current locale.  A verbosity
3336      level of 3 shows the chosen set.  Valid values for 'name' are:
3337
3338      iso-8859-1
3339           This is the Latin 1 set.
3340
3341      iso-8859-2
3342           The Latin 2 set.
3343
3344      iso-8859-15
3345           This is currently an alias for the Latin 1 set.
3346
3347      koi8-r
3348           The usual Russian set (RFC-1489).
3349
3350      utf-8
3351           Bypass all translations and assume that the OS uses native
3352           UTF-8 encoding.
3353
3354 '--utf8-strings'
3355 '--no-utf8-strings'
3356      Assume that command line arguments are given as UTF-8 strings.  The
3357      default ('--no-utf8-strings') is to assume that arguments are
3358      encoded in the character set as specified by '--display-charset'.
3359      These options affect all following arguments.  Both options may be
3360      used multiple times.
3361
3362 '--options file'
3363      Read options from 'file' and do not try to read them from the
3364      default options file in the homedir (see '--homedir').  This option
3365      is ignored if used in an options file.
3366
3367 '--no-options'
3368      Shortcut for '--options /dev/null'.  This option is detected before
3369      an attempt to open an option file.  Using this option will also
3370      prevent the creation of a '~/.gnupg' homedir.
3371
3372 '-z n'
3373 '--compress-level n'
3374 '--bzip2-compress-level n'
3375      Set compression level to 'n' for the ZIP and ZLIB compression
3376      algorithms.  The default is to use the default compression level of
3377      zlib (normally 6).  '--bzip2-compress-level' sets the compression
3378      level for the BZIP2 compression algorithm (defaulting to 6 as
3379      well).  This is a different option from '--compress-level' since
3380      BZIP2 uses a significant amount of memory for each additional
3381      compression level.  '-z' sets both.  A value of 0 for 'n' disables
3382      compression.
3383
3384 '--bzip2-decompress-lowmem'
3385      Use a different decompression method for BZIP2 compressed files.
3386      This alternate method uses a bit more than half the memory, but
3387      also runs at half the speed.  This is useful under extreme low
3388      memory circumstances when the file was originally compressed at a
3389      high '--bzip2-compress-level'.
3390
3391 '--mangle-dos-filenames'
3392 '--no-mangle-dos-filenames'
3393      Older version of Windows cannot handle filenames with more than one
3394      dot.  '--mangle-dos-filenames' causes GnuPG to replace (rather than
3395      add to) the extension of an output filename to avoid this problem.
3396      This option is off by default and has no effect on non-Windows
3397      platforms.
3398
3399 '--ask-cert-level'
3400 '--no-ask-cert-level'
3401      When making a key signature, prompt for a certification level.  If
3402      this option is not specified, the certification level used is set
3403      via '--default-cert-level'.  See '--default-cert-level' for
3404      information on the specific levels and how they are used.
3405      '--no-ask-cert-level' disables this option.  This option defaults
3406      to no.
3407
3408 '--default-cert-level n'
3409      The default to use for the check level when signing a key.
3410
3411      0 means you make no particular claim as to how carefully you
3412      verified the key.
3413
3414      1 means you believe the key is owned by the person who claims to
3415      own it but you could not, or did not verify the key at all.  This
3416      is useful for a "persona" verification, where you sign the key of a
3417      pseudonymous user.
3418
3419      2 means you did casual verification of the key.  For example, this
3420      could mean that you verified the key fingerprint and checked the
3421      user ID on the key against a photo ID.
3422
3423      3 means you did extensive verification of the key.  For example,
3424      this could mean that you verified the key fingerprint with the
3425      owner of the key in person, and that you checked, by means of a
3426      hard to forge document with a photo ID (such as a passport) that
3427      the name of the key owner matches the name in the user ID on the
3428      key, and finally that you verified (by exchange of email) that the
3429      email address on the key belongs to the key owner.
3430
3431      Note that the examples given above for levels 2 and 3 are just
3432      that: examples.  In the end, it is up to you to decide just what
3433      "casual" and "extensive" mean to you.
3434
3435      This option defaults to 0 (no particular claim).
3436
3437 '--min-cert-level'
3438      When building the trust database, treat any signatures with a
3439      certification level below this as invalid.  Defaults to 2, which
3440      disregards level 1 signatures.  Note that level 0 "no particular
3441      claim" signatures are always accepted.
3442
3443 '--trusted-key long key ID'
3444      Assume that the specified key (which must be given as a full 8 byte
3445      key ID) is as trustworthy as one of your own secret keys.  This
3446      option is useful if you don't want to keep your secret keys (or one
3447      of them) online but still want to be able to check the validity of
3448      a given recipient's or signator's key.
3449
3450 '--trust-model pgp|classic|tofu|tofu+pgp|direct|always|auto'
3451      Set what trust model GnuPG should follow.  The models are:
3452
3453      pgp
3454           This is the Web of Trust combined with trust signatures as
3455           used in PGP 5.x and later.  This is the default trust model
3456           when creating a new trust database.
3457
3458      classic
3459           This is the standard Web of Trust as introduced by PGP 2.
3460
3461      tofu
3462           TOFU stands for Trust On First Use.  In this trust model, the
3463           first time a key is seen, it is memorized.  If later another
3464           key is seen with a user id with the same email address, a
3465           warning is displayed indicating that there is a conflict and
3466           that the key might be a forgery and an attempt at a
3467           man-in-the-middle attack.
3468
3469           Because a potential attacker is able to control the email
3470           address and thereby circumvent the conflict detection
3471           algorithm by using an email address that is similar in
3472           appearance to a trusted email address, whenever a message is
3473           verified, statistics about the number of messages signed with
3474           the key are shown.  In this way, a user can easily identify
3475           attacks using fake keys for regular correspondents.
3476
3477           When compared with the Web of Trust, TOFU offers significantly
3478           weaker security guarantees.  In particular, TOFU only helps
3479           ensure consistency (that is, that the binding between a key
3480           and email address doesn't change).  A major advantage of TOFU
3481           is that it requires little maintenance to use correctly.  To
3482           use the web of trust properly, you need to actively sign keys
3483           and mark users as trusted introducers.  This is a
3484           time-consuming process and anecdotal evidence suggests that
3485           even security-conscious users rarely take the time to do this
3486           thoroughly and instead rely on an ad-hoc TOFU process.
3487
3488           In the TOFU model, policies are associated with bindings
3489           between keys and email addresses (which are extracted from
3490           user ids and normalized).  There are five policies, which can
3491           be set manually using the '--tofu-policy' option.  The default
3492           policy can be set using the '--tofu-default-policy' option.
3493
3494           The TOFU policies are: 'auto', 'good', 'unknown', 'bad' and
3495           'ask'.  The 'auto' policy is used by default (unless
3496           overridden by '--tofu-default-policy') and marks a binding as
3497           marginally trusted.  The 'good', 'unknown' and 'bad' policies
3498           mark a binding as fully trusted, as having unknown trust or as
3499           having trust never, respectively.  The 'unknown' policy is
3500           useful for just using TOFU to detect conflicts, but to never
3501           assign positive trust to a binding.  The final policy, 'ask'
3502           prompts the user to indicate the binding's trust.  If batch
3503           mode is enabled (or input is inappropriate in the context),
3504           then the user is not prompted and the 'undefined' trust level
3505           is returned.
3506
3507      tofu+pgp
3508           This trust model combines TOFU with the Web of Trust.  This is
3509           done by computing the trust level for each model and then
3510           taking the maximum trust level where the trust levels are
3511           ordered as follows: 'unknown < undefined < marginal < fully <
3512           ultimate < expired < never'.
3513
3514           By setting '--tofu-default-policy=unknown', this model can be
3515           used to implement the web of trust with TOFU's conflict
3516           detection algorithm, but without its assignment of positive
3517           trust values, which some security-conscious users don't like.
3518
3519      direct
3520           Key validity is set directly by the user and not calculated
3521           via the Web of Trust.
3522
3523      always
3524           Skip key validation and assume that used keys are always fully
3525           valid.  You generally won't use this unless you are using some
3526           external validation scheme.  This option also suppresses the
3527           "[uncertain]" tag printed with signature checks when there is
3528           no evidence that the user ID is bound to the key.  Note that
3529           this trust model still does not allow the use of expired,
3530           revoked, or disabled keys.
3531
3532      auto
3533           Select the trust model depending on whatever the internal
3534           trust database says.  This is the default model if such a
3535           database already exists.
3536
3537 '--auto-key-locate parameters'
3538 '--no-auto-key-locate'
3539      GnuPG can automatically locate and retrieve keys as needed using
3540      this option.  This happens when encrypting to an email address (in
3541      the "user@example.com" form), and there are no user@example.com
3542      keys on the local keyring.  This option takes any number of the
3543      following mechanisms, in the order they are to be tried:
3544
3545      cert
3546           Locate a key using DNS CERT, as specified in RFC-4398.
3547
3548      pka
3549           Locate a key using DNS PKA.
3550
3551      dane
3552           Locate a key using DANE, as specified in
3553           draft-ietf-dane-openpgpkey-05.txt.
3554
3555      wkd
3556           Locate a key using the Web Key Directory protocol.  This is an
3557           experimental method and semantics may change.
3558
3559      ldap
3560           Using DNS Service Discovery, check the domain in question for
3561           any LDAP keyservers to use.  If this fails, attempt to locate
3562           the key using the PGP Universal method of checking
3563           'ldap://keys.(thedomain)'.
3564
3565      keyserver
3566           Locate a key using whatever keyserver is defined using the
3567           '--keyserver' option.
3568
3569      keyserver-URL
3570           In addition, a keyserver URL as used in the '--keyserver'
3571           option may be used here to query that particular keyserver.
3572
3573      local
3574           Locate the key using the local keyrings.  This mechanism
3575           allows the user to select the order a local key lookup is
3576           done.  Thus using '--auto-key-locate local' is identical to
3577           '--no-auto-key-locate'.
3578
3579      nodefault
3580           This flag disables the standard local key lookup, done before
3581           any of the mechanisms defined by the '--auto-key-locate' are
3582           tried.  The position of this mechanism in the list does not
3583           matter.  It is not required if 'local' is also used.
3584
3585      clear
3586           Clear all defined mechanisms.  This is useful to override
3587           mechanisms given in a config file.
3588
3589 '--auto-key-retrieve'
3590 '--no-auto-key-retrieve'
3591      This option enables the automatic retrieving of keys from a
3592      keyserver when verifying signatures made by keys that are not on
3593      the local keyring.
3594
3595      If the method "wkd" is included in the list of methods given to
3596      'auto-key-locate', the Signer's User ID is part of the signature,
3597      and the option '--disable-signer-uid' is not used, the "wkd" method
3598      may also be used to retrieve a key.
3599
3600      Note that this option makes a "web bug" like behavior possible.
3601      Keyserver or Web Key Directory operators can see which keys you
3602      request, so by sending you a message signed by a brand new key
3603      (which you naturally will not have on your local keyring), the
3604      operator can tell both your IP address and the time when you
3605      verified the signature.
3606
3607 '--keyid-format none|short|0xshort|long|0xlong'
3608      Select how to display key IDs.  "none" does not show the key ID at
3609      all but shows the fingerprint in a separate line.  "short" is the
3610      traditional 8-character key ID. "long" is the more accurate (but
3611      less convenient) 16-character key ID. Add an "0x" to either to
3612      include an "0x" at the beginning of the key ID, as in 0x99242560.
3613      Note that this option is ignored if the option '--with-colons' is
3614      used.
3615
3616 '--keyserver name'
3617      This option is deprecated - please use the '--keyserver' in
3618      'dirmngr.conf' instead.
3619
3620      Use 'name' as your keyserver.  This is the server that
3621      '--receive-keys', '--send-keys', and '--search-keys' will
3622      communicate with to receive keys from, send keys to, and search for
3623      keys on.  The format of the 'name' is a URI:
3624      'scheme:[//]keyservername[:port]' The scheme is the type of
3625      keyserver: "hkp" for the HTTP (or compatible) keyservers, "ldap"
3626      for the LDAP keyservers, or "mailto" for the Graff email keyserver.
3627      Note that your particular installation of GnuPG may have other
3628      keyserver types available as well.  Keyserver schemes are
3629      case-insensitive.  After the keyserver name, optional keyserver
3630      configuration options may be provided.  These are the same as the
3631      global '--keyserver-options' from below, but apply only to this
3632      particular keyserver.
3633
3634      Most keyservers synchronize with each other, so there is generally
3635      no need to send keys to more than one server.  The keyserver
3636      'hkp://keys.gnupg.net' uses round robin DNS to give a different
3637      keyserver each time you use it.
3638
3639 '--keyserver-options name=value'
3640      This is a space or comma delimited string that gives options for
3641      the keyserver.  Options can be prefixed with a 'no-' to give the
3642      opposite meaning.  Valid import-options or export-options may be
3643      used here as well to apply to importing ('--recv-key') or exporting
3644      ('--send-key') a key from a keyserver.  While not all options are
3645      available for all keyserver types, some common options are:
3646
3647      include-revoked
3648           When searching for a key with '--search-keys', include keys
3649           that are marked on the keyserver as revoked.  Note that not
3650           all keyservers differentiate between revoked and unrevoked
3651           keys, and for such keyservers this option is meaningless.
3652           Note also that most keyservers do not have cryptographic
3653           verification of key revocations, and so turning this option
3654           off may result in skipping keys that are incorrectly marked as
3655           revoked.
3656
3657      include-disabled
3658           When searching for a key with '--search-keys', include keys
3659           that are marked on the keyserver as disabled.  Note that this
3660           option is not used with HKP keyservers.
3661
3662      auto-key-retrieve
3663           This is the same as the option 'auto-key-retrieve'.
3664
3665      honor-keyserver-url
3666           When using '--refresh-keys', if the key in question has a
3667           preferred keyserver URL, then use that preferred keyserver to
3668           refresh the key from.  In addition, if auto-key-retrieve is
3669           set, and the signature being verified has a preferred
3670           keyserver URL, then use that preferred keyserver to fetch the
3671           key from.  Note that this option introduces a "web bug": The
3672           creator of the key can see when the keys is refreshed.  Thus
3673           this option is not enabled by default.
3674
3675      honor-pka-record
3676           If '--auto-key-retrieve' is used, and the signature being
3677           verified has a PKA record, then use the PKA information to
3678           fetch the key.  Defaults to "yes".
3679
3680      include-subkeys
3681           When receiving a key, include subkeys as potential targets.
3682           Note that this option is not used with HKP keyservers, as they
3683           do not support retrieving keys by subkey id.
3684
3685      timeout
3686           Tell the keyserver helper program how long (in seconds) to try
3687           and perform a keyserver action before giving up.  Note that
3688           performing multiple actions at the same time uses this timeout
3689           value per action.  For example, when retrieving multiple keys
3690           via '--receive-keys', the timeout applies separately to each
3691           key retrieval, and not to the '--receive-keys' command as a
3692           whole.  Defaults to 30 seconds.
3693
3694      http-proxy='value'
3695           This option is deprecated.  Set the proxy to use for HTTP and
3696           HKP keyservers.  This overrides any proxy defined in
3697           'dirmngr.conf'.
3698
3699      verbose
3700           This option has no more function since GnuPG 2.1.  Use the
3701           'dirmngr' configuration options instead.
3702
3703      debug
3704           This option has no more function since GnuPG 2.1.  Use the
3705           'dirmngr' configuration options instead.
3706
3707      check-cert
3708           This option has no more function since GnuPG 2.1.  Use the
3709           'dirmngr' configuration options instead.
3710
3711      ca-cert-file
3712           This option has no more function since GnuPG 2.1.  Use the
3713           'dirmngr' configuration options instead.
3714
3715 '--completes-needed n'
3716      Number of completely trusted users to introduce a new key signer
3717      (defaults to 1).
3718
3719 '--marginals-needed n'
3720      Number of marginally trusted users to introduce a new key signer
3721      (defaults to 3)
3722
3723 '--tofu-default-policy auto|good|unknown|bad|ask'
3724      The default TOFU policy (defaults to 'auto').  For more information
3725      about the meaning of this option, *note trust-model-tofu::.
3726
3727 '--max-cert-depth n'
3728      Maximum depth of a certification chain (default is 5).
3729
3730 '--no-sig-cache'
3731      Do not cache the verification status of key signatures.  Caching
3732      gives a much better performance in key listings.  However, if you
3733      suspect that your public keyring is not safe against write
3734      modifications, you can use this option to disable the caching.  It
3735      probably does not make sense to disable it because all kind of
3736      damage can be done if someone else has write access to your public
3737      keyring.
3738
3739 '--auto-check-trustdb'
3740 '--no-auto-check-trustdb'
3741      If GnuPG feels that its information about the Web of Trust has to
3742      be updated, it automatically runs the '--check-trustdb' command
3743      internally.  This may be a time consuming process.
3744      '--no-auto-check-trustdb' disables this option.
3745
3746 '--use-agent'
3747 '--no-use-agent'
3748      This is dummy option.  'gpg' always requires the agent.
3749
3750 '--gpg-agent-info'
3751      This is dummy option.  It has no effect when used with 'gpg'.
3752
3753 '--agent-program FILE'
3754      Specify an agent program to be used for secret key operations.  The
3755      default value is determined by running 'gpgconf' with the option
3756      '--list-dirs'.  Note that the pipe symbol ('|') is used for a
3757      regression test suite hack and may thus not be used in the file
3758      name.
3759
3760 '--dirmngr-program FILE'
3761      Specify a dirmngr program to be used for keyserver access.  The
3762      default value is '/usr/local/bin/dirmngr'.
3763
3764 '--no-autostart'
3765      Do not start the gpg-agent or the dirmngr if it has not yet been
3766      started and its service is required.  This option is mostly useful
3767      on machines where the connection to gpg-agent has been redirected
3768      to another machines.  If dirmngr is required on the remote machine,
3769      it may be started manually using 'gpgconf --launch dirmngr'.
3770
3771 '--lock-once'
3772      Lock the databases the first time a lock is requested and do not
3773      release the lock until the process terminates.
3774
3775 '--lock-multiple'
3776      Release the locks every time a lock is no longer needed.  Use this
3777      to override a previous '--lock-once' from a config file.
3778
3779 '--lock-never'
3780      Disable locking entirely.  This option should be used only in very
3781      special environments, where it can be assured that only one process
3782      is accessing those files.  A bootable floppy with a stand-alone
3783      encryption system will probably use this.  Improper usage of this
3784      option may lead to data and key corruption.
3785
3786 '--exit-on-status-write-error'
3787      This option will cause write errors on the status FD to immediately
3788      terminate the process.  That should in fact be the default but it
3789      never worked this way and thus we need an option to enable this, so
3790      that the change won't break applications which close their end of a
3791      status fd connected pipe too early.  Using this option along with
3792      '--enable-progress-filter' may be used to cleanly cancel long
3793      running gpg operations.
3794
3795 '--limit-card-insert-tries n'
3796      With 'n' greater than 0 the number of prompts asking to insert a
3797      smartcard gets limited to N-1.  Thus with a value of 1 gpg won't at
3798      all ask to insert a card if none has been inserted at startup.
3799      This option is useful in the configuration file in case an
3800      application does not know about the smartcard support and waits ad
3801      infinitum for an inserted card.
3802
3803 '--no-random-seed-file'
3804      GnuPG uses a file to store its internal random pool over
3805      invocations.  This makes random generation faster; however
3806      sometimes write operations are not desired.  This option can be
3807      used to achieve that with the cost of slower random generation.
3808
3809 '--no-greeting'
3810      Suppress the initial copyright message.
3811
3812 '--no-secmem-warning'
3813      Suppress the warning about "using insecure memory".
3814
3815 '--no-permission-warning'
3816      Suppress the warning about unsafe file and home directory
3817      ('--homedir') permissions.  Note that the permission checks that
3818      GnuPG performs are not intended to be authoritative, but rather
3819      they simply warn about certain common permission problems.  Do not
3820      assume that the lack of a warning means that your system is secure.
3821
3822      Note that the warning for unsafe '--homedir' permissions cannot be
3823      suppressed in the gpg.conf file, as this would allow an attacker to
3824      place an unsafe gpg.conf file in place, and use this file to
3825      suppress warnings about itself.  The '--homedir' permissions
3826      warning may only be suppressed on the command line.
3827
3828 '--no-mdc-warning'
3829      Suppress the warning about missing MDC integrity protection.
3830
3831 '--require-secmem'
3832 '--no-require-secmem'
3833      Refuse to run if GnuPG cannot get secure memory.  Defaults to no
3834      (i.e.  run, but give a warning).
3835
3836 '--require-cross-certification'
3837 '--no-require-cross-certification'
3838      When verifying a signature made from a subkey, ensure that the
3839      cross certification "back signature" on the subkey is present and
3840      valid.  This protects against a subtle attack against subkeys that
3841      can sign.  Defaults to '--require-cross-certification' for 'gpg'.
3842
3843 '--expert'
3844 '--no-expert'
3845      Allow the user to do certain nonsensical or "silly" things like
3846      signing an expired or revoked key, or certain potentially
3847      incompatible things like generating unusual key types.  This also
3848      disables certain warning messages about potentially incompatible
3849      actions.  As the name implies, this option is for experts only.  If
3850      you don't fully understand the implications of what it allows you
3851      to do, leave this off.  '--no-expert' disables this option.
3852
3853 \1f
3854 File: gnupg.info,  Node: GPG Key related Options,  Next: GPG Input and Output,  Prev: GPG Configuration Options,  Up: GPG Options
3855
3856 4.2.2 Key related options
3857 -------------------------
3858
3859 '--recipient NAME'
3860 '-r'
3861      Encrypt for user id NAME.  If this option or '--hidden-recipient'
3862      is not specified, GnuPG asks for the user-id unless
3863      '--default-recipient' is given.
3864
3865 '--hidden-recipient NAME'
3866 '-R'
3867      Encrypt for user ID NAME, but hide the key ID of this user's key.
3868      This option helps to hide the receiver of the message and is a
3869      limited countermeasure against traffic analysis.  If this option or
3870      '--recipient' is not specified, GnuPG asks for the user ID unless
3871      '--default-recipient' is given.
3872
3873 '--recipient-file FILE'
3874 '-f'
3875      This option is similar to '--recipient' except that it encrypts to
3876      a key stored in the given file.  FILE must be the name of a file
3877      containing exactly one key.  'gpg' assumes that the key in this
3878      file is fully valid.
3879
3880 '--hidden-recipient-file FILE'
3881 '-F'
3882      This option is similar to '--hidden-recipient' except that it
3883      encrypts to a key stored in the given file.  FILE must be the name
3884      of a file containing exactly one key.  'gpg' assumes that the key
3885      in this file is fully valid.
3886
3887 '--encrypt-to name'
3888      Same as '--recipient' but this one is intended for use in the
3889      options file and may be used with your own user-id as an
3890      "encrypt-to-self".  These keys are only used when there are other
3891      recipients given either by use of '--recipient' or by the asked
3892      user id.  No trust checking is performed for these user ids and
3893      even disabled keys can be used.
3894
3895 '--hidden-encrypt-to name'
3896      Same as '--hidden-recipient' but this one is intended for use in
3897      the options file and may be used with your own user-id as a hidden
3898      "encrypt-to-self".  These keys are only used when there are other
3899      recipients given either by use of '--recipient' or by the asked
3900      user id.  No trust checking is performed for these user ids and
3901      even disabled keys can be used.
3902
3903 '--no-encrypt-to'
3904      Disable the use of all '--encrypt-to' and '--hidden-encrypt-to'
3905      keys.
3906
3907 '--group name=value'
3908      Sets up a named group, which is similar to aliases in email
3909      programs.  Any time the group name is a recipient ('-r' or
3910      '--recipient'), it will be expanded to the values specified.
3911      Multiple groups with the same name are automatically merged into a
3912      single group.
3913
3914      The values are 'key IDs' or fingerprints, but any key description
3915      is accepted.  Note that a value with spaces in it will be treated
3916      as two different values.  Note also there is only one level of
3917      expansion -- you cannot make an group that points to another group.
3918      When used from the command line, it may be necessary to quote the
3919      argument to this option to prevent the shell from treating it as
3920      multiple arguments.
3921
3922 '--ungroup name'
3923      Remove a given entry from the '--group' list.
3924
3925 '--no-groups'
3926      Remove all entries from the '--group' list.
3927
3928 '--local-user NAME'
3929 '-u'
3930      Use NAME as the key to sign with.  Note that this option overrides
3931      '--default-key'.
3932
3933 '--sender MBOX'
3934      This option has two purposes.  MBOX must either be a complete user
3935      id with a proper mail address or just a mail address.  When
3936      creating a signature this option tells gpg the user id of a key
3937      used to make a signature if the key was not directly specified by a
3938      user id.  When verifying a signature the MBOX is used to restrict
3939      the information printed by the TOFU code to matching user ids.
3940
3941 '--try-secret-key NAME'
3942      For hidden recipients GPG needs to know the keys to use for trial
3943      decryption.  The key set with '--default-key' is always tried
3944      first, but this is often not sufficient.  This option allows
3945      setting more keys to be used for trial decryption.  Although any
3946      valid user-id specification may be used for NAME it makes sense to
3947      use at least the long keyid to avoid ambiguities.  Note that
3948      gpg-agent might pop up a pinentry for a lot keys to do the trial
3949      decryption.  If you want to stop all further trial decryption you
3950      may use close-window button instead of the cancel button.
3951
3952 '--try-all-secrets'
3953      Don't look at the key ID as stored in the message but try all
3954      secret keys in turn to find the right decryption key.  This option
3955      forces the behaviour as used by anonymous recipients (created by
3956      using '--throw-keyids' or '--hidden-recipient') and might come
3957      handy in case where an encrypted message contains a bogus key ID.
3958
3959 '--skip-hidden-recipients'
3960 '--no-skip-hidden-recipients'
3961      During decryption skip all anonymous recipients.  This option helps
3962      in the case that people use the hidden recipients feature to hide
3963      there own encrypt-to key from others.  If oneself has many secret
3964      keys this may lead to a major annoyance because all keys are tried
3965      in turn to decrypt something which was not really intended for it.
3966      The drawback of this option is that it is currently not possible to
3967      decrypt a message which includes real anonymous recipients.
3968
3969 \1f
3970 File: gnupg.info,  Node: GPG Input and Output,  Next: OpenPGP Options,  Prev: GPG Key related Options,  Up: GPG Options
3971
3972 4.2.3 Input and Output
3973 ----------------------
3974
3975 '--armor'
3976 '-a'
3977      Create ASCII armored output.  The default is to create the binary
3978      OpenPGP format.
3979
3980 '--no-armor'
3981      Assume the input data is not in ASCII armored format.
3982
3983 '--output FILE'
3984 '-o FILE'
3985      Write output to FILE.  To write to stdout use '-' as the filename.
3986
3987 '--max-output n'
3988      This option sets a limit on the number of bytes that will be
3989      generated when processing a file.  Since OpenPGP supports various
3990      levels of compression, it is possible that the plaintext of a given
3991      message may be significantly larger than the original OpenPGP
3992      message.  While GnuPG works properly with such messages, there is
3993      often a desire to set a maximum file size that will be generated
3994      before processing is forced to stop by the OS limits.  Defaults to
3995      0, which means "no limit".
3996
3997 '--input-size-hint N'
3998      This option can be used to tell GPG the size of the input data in
3999      bytes.  N must be a positive base-10 number.  This option is only
4000      useful if the input is not taken from a file.  GPG may use this
4001      hint to optimize its buffer allocation strategy.  It is also used
4002      by the '--status-fd' line "PROGRESS" to provide a value for "total"
4003      if that is not available by other means.
4004
4005 '--import-options parameters'
4006      This is a space or comma delimited string that gives options for
4007      importing keys.  Options can be prepended with a 'no-' to give the
4008      opposite meaning.  The options are:
4009
4010      import-local-sigs
4011           Allow importing key signatures marked as "local".  This is not
4012           generally useful unless a shared keyring scheme is being used.
4013           Defaults to no.
4014
4015      keep-ownertrust
4016           Normally possible still existing ownertrust values of a key
4017           are cleared if a key is imported.  This is in general
4018           desirable so that a formerly deleted key does not
4019           automatically gain an ownertrust values merely due to import.
4020           On the other hand it is sometimes necessary to re-import a
4021           trusted set of keys again but keeping already assigned
4022           ownertrust values.  This can be achieved by using this option.
4023
4024      repair-pks-subkey-bug
4025           During import, attempt to repair the damage caused by the PKS
4026           keyserver bug (pre version 0.9.6) that mangles keys with
4027           multiple subkeys.  Note that this cannot completely repair the
4028           damaged key as some crucial data is removed by the keyserver,
4029           but it does at least give you back one subkey.  Defaults to no
4030           for regular '--import' and to yes for keyserver
4031           '--receive-keys'.
4032
4033      import-show
4034           Show a listing of the key as imported right before it is
4035           stored.  This can be combined with the option '--dry-run' to
4036           only look at keys.
4037
4038      import-export
4039           Run the entire import code but instead of storing the key to
4040           the local keyring write it to the output.  The export options
4041           'export-pka' and 'export-dane' affect the output.  This option
4042           can be used to remove all invalid parts from a key without the
4043           need to store it.
4044
4045      merge-only
4046           During import, allow key updates to existing keys, but do not
4047           allow any new keys to be imported.  Defaults to no.
4048
4049      import-clean
4050           After import, compact (remove all signatures except the
4051           self-signature) any user IDs from the new key that are not
4052           usable.  Then, remove any signatures from the new key that are
4053           not usable.  This includes signatures that were issued by keys
4054           that are not present on the keyring.  This option is the same
4055           as running the '--edit-key' command "clean" after import.
4056           Defaults to no.
4057
4058      import-minimal
4059           Import the smallest key possible.  This removes all signatures
4060           except the most recent self-signature on each user ID. This
4061           option is the same as running the '--edit-key' command
4062           "minimize" after import.  Defaults to no.
4063
4064      restore
4065      import-restore
4066           Import in key restore mode.  This imports all data which is
4067           usually skipped during import; including all GnuPG specific
4068           data.  All other contradicting options are overridden.
4069
4070 '--import-filter NAME=EXPR'
4071 '--export-filter NAME=EXPR'
4072      These options define an import/export filter which are applied to
4073      the imported/exported keyblock right before it will be
4074      stored/written.  NAME defines the type of filter to use, EXPR the
4075      expression to evaluate.  The option can be used several times which
4076      then appends more expression to the same NAME.
4077
4078      The available filter types are:
4079
4080      keep-uid
4081           This filter will keep a user id packet and its dependent
4082           packets in the keyblock if the expression evaluates to true.
4083
4084      drop-subkey
4085           This filter drops the selected subkeys.  Currently only
4086           implemented for -export-filter.
4087
4088      drop-sig
4089           This filter drops the selected key signatures on user ids.
4090           Self-signatures are not considered.  Currently only
4091           implemented for -import-filter.
4092
4093      For the syntax of the expression see the chapter "FILTER
4094      EXPRESSIONS". The property names for the expressions depend on the
4095      actual filter type and are indicated in the following table.
4096
4097      The available properties are:
4098
4099      uid
4100           A string with the user id.  (keep-uid)
4101
4102      mbox
4103           The addr-spec part of a user id with mailbox or the empty
4104           string.  (keep-uid)
4105
4106      key_algo
4107           A number with the public key algorithm of a key or subkey
4108           packet.  (drop-subkey)
4109
4110      key_created
4111      key_created_d
4112           The first is the timestamp a public key or subkey packet was
4113           created.  The second is the same but given as an ISO string,
4114           e.g.  "2016-08-17".  (drop-subkey)
4115
4116      primary
4117           Boolean indicating whether the user id is the primary one.
4118           (keep-uid)
4119
4120      secret
4121           Boolean indicating whether a key or subkey is a secret one.
4122           drop-subkey)
4123
4124      sig_created
4125      sig_created_d
4126           The first is the timestamp a signature packet was created.
4127           The second is the same but given as an ISO string, e.g.
4128           "2016-08-17".  (drop-sig)
4129
4130      sig_algo
4131           A number with the public key algorithm of a signature packet.
4132           (drop-sig)
4133
4134      sig_digest_algo
4135           A number with the digest algorithm of a signature packet.
4136           (drop-sig)
4137
4138 '--export-options parameters'
4139      This is a space or comma delimited string that gives options for
4140      exporting keys.  Options can be prepended with a 'no-' to give the
4141      opposite meaning.  The options are:
4142
4143      export-local-sigs
4144           Allow exporting key signatures marked as "local".  This is not
4145           generally useful unless a shared keyring scheme is being used.
4146           Defaults to no.
4147
4148      export-attributes
4149           Include attribute user IDs (photo IDs) while exporting.  This
4150           is useful to export keys if they are going to be used by an
4151           OpenPGP program that does not accept attribute user IDs.
4152           Defaults to yes.
4153
4154      export-sensitive-revkeys
4155           Include designated revoker information that was marked as
4156           "sensitive".  Defaults to no.
4157
4158      backup
4159      export-backup
4160           Export for use as a backup.  The exported data includes all
4161           data which is needed to restore the key or keys later with
4162           GnuPG. The format is basically the OpenPGP format but enhanced
4163           with GnuPG specific data.  All other contradicting options are
4164           overridden.
4165
4166      export-clean
4167           Compact (remove all signatures from) user IDs on the key being
4168           exported if the user IDs are not usable.  Also, do not export
4169           any signatures that are not usable.  This includes signatures
4170           that were issued by keys that are not present on the keyring.
4171           This option is the same as running the '--edit-key' command
4172           "clean" before export except that the local copy of the key is
4173           not modified.  Defaults to no.
4174
4175      export-minimal
4176           Export the smallest key possible.  This removes all signatures
4177           except the most recent self-signature on each user ID. This
4178           option is the same as running the '--edit-key' command
4179           "minimize" before export except that the local copy of the key
4180           is not modified.  Defaults to no.
4181
4182      export-pka
4183           Instead of outputting the key material output PKA records
4184           suitable to put into DNS zone files.  An ORIGIN line is
4185           printed before each record to allow diverting the records to
4186           the corresponding zone file.
4187
4188      export-dane
4189           Instead of outputting the key material output OpenPGP DANE
4190           records suitable to put into DNS zone files.  An ORIGIN line
4191           is printed before each record to allow diverting the records
4192           to the corresponding zone file.
4193
4194 '--with-colons'
4195      Print key listings delimited by colons.  Note that the output will
4196      be encoded in UTF-8 regardless of any '--display-charset' setting.
4197      This format is useful when GnuPG is called from scripts and other
4198      programs as it is easily machine parsed.  The details of this
4199      format are documented in the file 'doc/DETAILS', which is included
4200      in the GnuPG source distribution.
4201
4202 '--fixed-list-mode'
4203      Do not merge primary user ID and primary key in '--with-colon'
4204      listing mode and print all timestamps as seconds since 1970-01-01.
4205      Since GnuPG 2.0.10, this mode is always used and thus this option
4206      is obsolete; it does not harm to use it though.
4207
4208 '--legacy-list-mode'
4209      Revert to the pre-2.1 public key list mode.  This only affects the
4210      human readable output and not the machine interface (i.e.
4211      '--with-colons').  Note that the legacy format does not convey
4212      suitable information for elliptic curves.
4213
4214 '--with-fingerprint'
4215      Same as the command '--fingerprint' but changes only the format of
4216      the output and may be used together with another command.
4217
4218 '--with-subkey-fingerprint'
4219      If a fingerprint is printed for the primary key, this option forces
4220      printing of the fingerprint for all subkeys.  This could also be
4221      achieved by using the '--with-fingerprint' twice but by using this
4222      option along with keyid-format "none" a compact fingerprint is
4223      printed.
4224
4225 '--with-icao-spelling'
4226      Print the ICAO spelling of the fingerprint in addition to the hex
4227      digits.
4228
4229 '--with-keygrip'
4230      Include the keygrip in the key listings.  In '--with-colons' mode
4231      this is implicitly enable for secret keys.
4232
4233 '--with-wkd-hash'
4234      Print a Web Key Directory identifier along with each user ID in key
4235      listings.  This is an experimental feature and semantics may
4236      change.
4237
4238 '--with-secret'
4239      Include info about the presence of a secret key in public key
4240      listings done with '--with-colons'.
4241
4242 \1f
4243 File: gnupg.info,  Node: OpenPGP Options,  Next: Compliance Options,  Prev: GPG Input and Output,  Up: GPG Options
4244
4245 4.2.4 OpenPGP protocol specific options
4246 ---------------------------------------
4247
4248 '-t, --textmode'
4249 '--no-textmode'
4250      Treat input files as text and store them in the OpenPGP canonical
4251      text form with standard "CRLF" line endings.  This also sets the
4252      necessary flags to inform the recipient that the encrypted or
4253      signed data is text and may need its line endings converted back to
4254      whatever the local system uses.  This option is useful when
4255      communicating between two platforms that have different line ending
4256      conventions (UNIX-like to Mac, Mac to Windows, etc).
4257      '--no-textmode' disables this option, and is the default.
4258
4259 '--force-v3-sigs'
4260 '--no-force-v3-sigs'
4261 '--force-v4-certs'
4262 '--no-force-v4-certs'
4263      These options are obsolete and have no effect since GnuPG 2.1.
4264
4265 '--force-mdc'
4266      Force the use of encryption with a modification detection code.
4267      This is always used with the newer ciphers (those with a blocksize
4268      greater than 64 bits), or if all of the recipient keys indicate MDC
4269      support in their feature flags.
4270
4271 '--disable-mdc'
4272      Disable the use of the modification detection code.  Note that by
4273      using this option, the encrypted message becomes vulnerable to a
4274      message modification attack.
4275
4276 '--disable-signer-uid'
4277      By default the user ID of the signing key is embedded in the data
4278      signature.  As of now this is only done if the signing key has been
4279      specified with 'local-user' using a mail address.  This information
4280      can be helpful for verifier to locate the key; see option
4281      '--auto-key-retrieve'.
4282
4283 '--personal-cipher-preferences string'
4284      Set the list of personal cipher preferences to 'string'.  Use 'gpg
4285      --version' to get a list of available algorithms, and use 'none' to
4286      set no preference at all.  This allows the user to safely override
4287      the algorithm chosen by the recipient key preferences, as GPG will
4288      only select an algorithm that is usable by all recipients.  The
4289      most highly ranked cipher in this list is also used for the
4290      '--symmetric' encryption command.
4291
4292 '--personal-digest-preferences string'
4293      Set the list of personal digest preferences to 'string'.  Use 'gpg
4294      --version' to get a list of available algorithms, and use 'none' to
4295      set no preference at all.  This allows the user to safely override
4296      the algorithm chosen by the recipient key preferences, as GPG will
4297      only select an algorithm that is usable by all recipients.  The
4298      most highly ranked digest algorithm in this list is also used when
4299      signing without encryption (e.g.  '--clear-sign' or '--sign').
4300
4301 '--personal-compress-preferences string'
4302      Set the list of personal compression preferences to 'string'.  Use
4303      'gpg --version' to get a list of available algorithms, and use
4304      'none' to set no preference at all.  This allows the user to safely
4305      override the algorithm chosen by the recipient key preferences, as
4306      GPG will only select an algorithm that is usable by all recipients.
4307      The most highly ranked compression algorithm in this list is also
4308      used when there are no recipient keys to consider (e.g.
4309      '--symmetric').
4310
4311 '--s2k-cipher-algo name'
4312      Use 'name' as the cipher algorithm for symmetric encryption with a
4313      passphrase if '--personal-cipher-preferences' and '--cipher-algo'
4314      are not given.  The default is AES-128.
4315
4316 '--s2k-digest-algo name'
4317      Use 'name' as the digest algorithm used to mangle the passphrases
4318      for symmetric encryption.  The default is SHA-1.
4319
4320 '--s2k-mode n'
4321      Selects how passphrases for symmetric encryption are mangled.  If
4322      'n' is 0 a plain passphrase (which is in general not recommended)
4323      will be used, a 1 adds a salt (which should not be used) to the
4324      passphrase and a 3 (the default) iterates the whole process a
4325      number of times (see '--s2k-count').
4326
4327 '--s2k-count n'
4328      Specify how many times the passphrases mangling for symmetric
4329      encryption is repeated.  This value may range between 1024 and
4330      65011712 inclusive.  The default is inquired from gpg-agent.  Note
4331      that not all values in the 1024-65011712 range are legal and if an
4332      illegal value is selected, GnuPG will round up to the nearest legal
4333      value.  This option is only meaningful if '--s2k-mode' is set to
4334      the default of 3.
4335
4336 \1f
4337 File: gnupg.info,  Node: Compliance Options,  Next: GPG Esoteric Options,  Prev: OpenPGP Options,  Up: GPG Options
4338
4339 4.2.5 Compliance options
4340 ------------------------
4341
4342 These options control what GnuPG is compliant to.  Only one of these
4343 options may be active at a time.  Note that the default setting of this
4344 is nearly always the correct one.  See the INTEROPERABILITY WITH OTHER
4345 OPENPGP PROGRAMS section below before using one of these options.
4346
4347 '--gnupg'
4348      Use standard GnuPG behavior.  This is essentially OpenPGP behavior
4349      (see '--openpgp'), but with some additional workarounds for common
4350      compatibility problems in different versions of PGP. This is the
4351      default option, so it is not generally needed, but it may be useful
4352      to override a different compliance option in the gpg.conf file.
4353
4354 '--openpgp'
4355      Reset all packet, cipher and digest options to strict OpenPGP
4356      behavior.  Use this option to reset all previous options like
4357      '--s2k-*', '--cipher-algo', '--digest-algo' and '--compress-algo'
4358      to OpenPGP compliant values.  All PGP workarounds are disabled.
4359
4360 '--rfc4880'
4361      Reset all packet, cipher and digest options to strict RFC-4880
4362      behavior.  Note that this is currently the same thing as
4363      '--openpgp'.
4364
4365 '--rfc4880bis'
4366      Enable experimental features from proposed updates to RFC-4880.
4367      This option can be used in addition to the other compliance
4368      options.  Warning: The behavior may change with any GnuPG release
4369      and created keys or data may not be usable with future GnuPG
4370      versions.
4371
4372 '--rfc2440'
4373      Reset all packet, cipher and digest options to strict RFC-2440
4374      behavior.
4375
4376 '--pgp6'
4377      Set up all options to be as PGP 6 compliant as possible.  This
4378      restricts you to the ciphers IDEA (if the IDEA plugin is
4379      installed), 3DES, and CAST5, the hashes MD5, SHA1 and RIPEMD160,
4380      and the compression algorithms none and ZIP. This also disables
4381      '--throw-keyids', and making signatures with signing subkeys as PGP
4382      6 does not understand signatures made by signing subkeys.
4383
4384      This option implies '--disable-mdc --escape-from-lines'.
4385
4386 '--pgp7'
4387      Set up all options to be as PGP 7 compliant as possible.  This is
4388      identical to '--pgp6' except that MDCs are not disabled, and the
4389      list of allowable ciphers is expanded to add AES128, AES192,
4390      AES256, and TWOFISH.
4391
4392 '--pgp8'
4393      Set up all options to be as PGP 8 compliant as possible.  PGP 8 is
4394      a lot closer to the OpenPGP standard than previous versions of PGP,
4395      so all this does is disable '--throw-keyids' and set
4396      '--escape-from-lines'.  All algorithms are allowed except for the
4397      SHA224, SHA384, and SHA512 digests.
4398
4399 '--compliance STRING'
4400      This option can be used instead of one of the options above.  Valid
4401      values for STRING are the above option names (without the double
4402      dash) and possibly others as shown when using "help" for VALUE.
4403
4404 \1f
4405 File: gnupg.info,  Node: GPG Esoteric Options,  Next: Deprecated Options,  Prev: Compliance Options,  Up: GPG Options
4406
4407 4.2.6 Doing things one usually doesn't want to do
4408 -------------------------------------------------
4409
4410 '-n'
4411 '--dry-run'
4412      Don't make any changes (this is not completely implemented).
4413
4414 '--list-only'
4415      Changes the behaviour of some commands.  This is like '--dry-run'
4416      but different in some cases.  The semantic of this option may be
4417      extended in the future.  Currently it only skips the actual
4418      decryption pass and therefore enables a fast listing of the
4419      encryption keys.
4420
4421 '-i'
4422 '--interactive'
4423      Prompt before overwriting any files.
4424
4425 '--debug-level LEVEL'
4426      Select the debug level for investigating problems.  LEVEL may be a
4427      numeric value or by a keyword:
4428
4429      'none'
4430           No debugging at all.  A value of less than 1 may be used
4431           instead of the keyword.
4432      'basic'
4433           Some basic debug messages.  A value between 1 and 2 may be
4434           used instead of the keyword.
4435      'advanced'
4436           More verbose debug messages.  A value between 3 and 5 may be
4437           used instead of the keyword.
4438      'expert'
4439           Even more detailed messages.  A value between 6 and 8 may be
4440           used instead of the keyword.
4441      'guru'
4442           All of the debug messages you can get.  A value greater than 8
4443           may be used instead of the keyword.  The creation of hash
4444           tracing files is only enabled if the keyword is used.
4445
4446      How these messages are mapped to the actual debugging flags is not
4447      specified and may change with newer releases of this program.  They
4448      are however carefully selected to best aid in debugging.
4449
4450 '--debug FLAGS'
4451      Set debugging flags.  All flags are or-ed and FLAGS may be given in
4452      C syntax (e.g.  0x0042) or as a comma separated list of flag names.
4453      To get a list of all supported flags the single word "help" can be
4454      used.
4455
4456 '--debug-all'
4457      Set all useful debugging flags.
4458
4459 '--debug-iolbf'
4460      Set stdout into line buffered mode.  This option is only honored
4461      when given on the command line.
4462
4463 '--faked-system-time EPOCH'
4464      This option is only useful for testing; it sets the system time
4465      back or forth to EPOCH which is the number of seconds elapsed since
4466      the year 1970.  Alternatively EPOCH may be given as a full ISO time
4467      string (e.g.  "20070924T154812").
4468
4469      If you suffix EPOCH with an exclamation mark (!), the system time
4470      will appear to be frozen at the specified time.
4471
4472 '--enable-progress-filter'
4473      Enable certain PROGRESS status outputs.  This option allows
4474      frontends to display a progress indicator while gpg is processing
4475      larger files.  There is a slight performance overhead using it.
4476
4477 '--status-fd n'
4478      Write special status strings to the file descriptor 'n'.  See the
4479      file DETAILS in the documentation for a listing of them.
4480
4481 '--status-file file'
4482      Same as '--status-fd', except the status data is written to file
4483      'file'.
4484
4485 '--logger-fd n'
4486      Write log output to file descriptor 'n' and not to STDERR.
4487
4488 '--log-file file'
4489 '--logger-file file'
4490      Same as '--logger-fd', except the logger data is written to file
4491      'file'.  Use 'socket://' to log to socket.
4492
4493 '--attribute-fd n'
4494      Write attribute subpackets to the file descriptor 'n'.  This is
4495      most useful for use with '--status-fd', since the status messages
4496      are needed to separate out the various subpackets from the stream
4497      delivered to the file descriptor.
4498
4499 '--attribute-file file'
4500      Same as '--attribute-fd', except the attribute data is written to
4501      file 'file'.
4502
4503 '--comment string'
4504 '--no-comments'
4505      Use 'string' as a comment string in cleartext signatures and ASCII
4506      armored messages or keys (see '--armor').  The default behavior is
4507      not to use a comment string.  '--comment' may be repeated multiple
4508      times to get multiple comment strings.  '--no-comments' removes all
4509      comments.  It is a good idea to keep the length of a single comment
4510      below 60 characters to avoid problems with mail programs wrapping
4511      such lines.  Note that comment lines, like all other header lines,
4512      are not protected by the signature.
4513
4514 '--emit-version'
4515 '--no-emit-version'
4516      Force inclusion of the version string in ASCII armored output.  If
4517      given once only the name of the program and the major number is
4518      emitted, given twice the minor is also emitted, given thrice the
4519      micro is added, and given four times an operating system
4520      identification is also emitted.  '--no-emit-version' (default)
4521      disables the version line.
4522
4523 '--sig-notation name=value'
4524 '--cert-notation name=value'
4525 '-N, --set-notation name=value'
4526      Put the name value pair into the signature as notation data.
4527      'name' must consist only of printable characters or spaces, and
4528      must contain a '@' character in the form keyname@domain.example.com
4529      (substituting the appropriate keyname and domain name, of course).
4530      This is to help prevent pollution of the IETF reserved notation
4531      namespace.  The '--expert' flag overrides the '@' check.  'value'
4532      may be any printable string; it will be encoded in UTF-8, so you
4533      should check that your '--display-charset' is set correctly.  If
4534      you prefix 'name' with an exclamation mark (!), the notation data
4535      will be flagged as critical (rfc4880:5.2.3.16).  '--sig-notation'
4536      sets a notation for data signatures.  '--cert-notation' sets a
4537      notation for key signatures (certifications).  '--set-notation'
4538      sets both.
4539
4540      There are special codes that may be used in notation names.  "%k"
4541      will be expanded into the key ID of the key being signed, "%K" into
4542      the long key ID of the key being signed, "%f" into the fingerprint
4543      of the key being signed, "%s" into the key ID of the key making the
4544      signature, "%S" into the long key ID of the key making the
4545      signature, "%g" into the fingerprint of the key making the
4546      signature (which might be a subkey), "%p" into the fingerprint of
4547      the primary key of the key making the signature, "%c" into the
4548      signature count from the OpenPGP smartcard, and "%%" results in a
4549      single "%".  %k, %K, and %f are only meaningful when making a key
4550      signature (certification), and %c is only meaningful when using the
4551      OpenPGP smartcard.
4552
4553 '--sig-policy-url string'
4554 '--cert-policy-url string'
4555 '--set-policy-url string'
4556      Use 'string' as a Policy URL for signatures (rfc4880:5.2.3.20).  If
4557      you prefix it with an exclamation mark (!), the policy URL packet
4558      will be flagged as critical.  '--sig-policy-url' sets a policy url
4559      for data signatures.  '--cert-policy-url' sets a policy url for key
4560      signatures (certifications).  '--set-policy-url' sets both.
4561
4562      The same %-expandos used for notation data are available here as
4563      well.
4564
4565 '--sig-keyserver-url string'
4566      Use 'string' as a preferred keyserver URL for data signatures.  If
4567      you prefix it with an exclamation mark (!), the keyserver URL
4568      packet will be flagged as critical.
4569
4570      The same %-expandos used for notation data are available here as
4571      well.
4572
4573 '--set-filename string'
4574      Use 'string' as the filename which is stored inside messages.  This
4575      overrides the default, which is to use the actual filename of the
4576      file being encrypted.  Using the empty string for 'string'
4577      effectively removes the filename from the output.
4578
4579 '--for-your-eyes-only'
4580 '--no-for-your-eyes-only'
4581      Set the 'for your eyes only' flag in the message.  This causes
4582      GnuPG to refuse to save the file unless the '--output' option is
4583      given, and PGP to use a "secure viewer" with a claimed
4584      Tempest-resistant font to display the message.  This option
4585      overrides '--set-filename'.  '--no-for-your-eyes-only' disables
4586      this option.
4587
4588 '--use-embedded-filename'
4589 '--no-use-embedded-filename'
4590      Try to create a file with a name as embedded in the data.  This can
4591      be a dangerous option as it enables overwriting files.  Defaults to
4592      no.
4593
4594 '--cipher-algo name'
4595      Use 'name' as cipher algorithm.  Running the program with the
4596      command '--version' yields a list of supported algorithms.  If this
4597      is not used the cipher algorithm is selected from the preferences
4598      stored with the key.  In general, you do not want to use this
4599      option as it allows you to violate the OpenPGP standard.
4600      '--personal-cipher-preferences' is the safe way to accomplish the
4601      same thing.
4602
4603 '--digest-algo name'
4604      Use 'name' as the message digest algorithm.  Running the program
4605      with the command '--version' yields a list of supported algorithms.
4606      In general, you do not want to use this option as it allows you to
4607      violate the OpenPGP standard.  '--personal-digest-preferences' is
4608      the safe way to accomplish the same thing.
4609
4610 '--compress-algo name'
4611      Use compression algorithm 'name'.  "zlib" is RFC-1950 ZLIB
4612      compression.  "zip" is RFC-1951 ZIP compression which is used by
4613      PGP. "bzip2" is a more modern compression scheme that can compress
4614      some things better than zip or zlib, but at the cost of more memory
4615      used during compression and decompression.  "uncompressed" or
4616      "none" disables compression.  If this option is not used, the
4617      default behavior is to examine the recipient key preferences to see
4618      which algorithms the recipient supports.  If all else fails, ZIP is
4619      used for maximum compatibility.
4620
4621      ZLIB may give better compression results than ZIP, as the
4622      compression window size is not limited to 8k.  BZIP2 may give even
4623      better compression results than that, but will use a significantly
4624      larger amount of memory while compressing and decompressing.  This
4625      may be significant in low memory situations.  Note, however, that
4626      PGP (all versions) only supports ZIP compression.  Using any
4627      algorithm other than ZIP or "none" will make the message unreadable
4628      with PGP. In general, you do not want to use this option as it
4629      allows you to violate the OpenPGP standard.
4630      '--personal-compress-preferences' is the safe way to accomplish the
4631      same thing.
4632
4633 '--cert-digest-algo name'
4634      Use 'name' as the message digest algorithm used when signing a key.
4635      Running the program with the command '--version' yields a list of
4636      supported algorithms.  Be aware that if you choose an algorithm
4637      that GnuPG supports but other OpenPGP implementations do not, then
4638      some users will not be able to use the key signatures you make, or
4639      quite possibly your entire key.
4640
4641 '--disable-cipher-algo name'
4642      Never allow the use of 'name' as cipher algorithm.  The given name
4643      will not be checked so that a later loaded algorithm will still get
4644      disabled.
4645
4646 '--disable-pubkey-algo name'
4647      Never allow the use of 'name' as public key algorithm.  The given
4648      name will not be checked so that a later loaded algorithm will
4649      still get disabled.
4650
4651 '--throw-keyids'
4652 '--no-throw-keyids'
4653      Do not put the recipient key IDs into encrypted messages.  This
4654      helps to hide the receivers of the message and is a limited
4655      countermeasure against traffic analysis.(1)  On the receiving side,
4656      it may slow down the decryption process because all available
4657      secret keys must be tried.  '--no-throw-keyids' disables this
4658      option.  This option is essentially the same as using
4659      '--hidden-recipient' for all recipients.
4660
4661 '--not-dash-escaped'
4662      This option changes the behavior of cleartext signatures so that
4663      they can be used for patch files.  You should not send such an
4664      armored file via email because all spaces and line endings are
4665      hashed too.  You can not use this option for data which has 5
4666      dashes at the beginning of a line, patch files don't have this.  A
4667      special armor header line tells GnuPG about this cleartext
4668      signature option.
4669
4670 '--escape-from-lines'
4671 '--no-escape-from-lines'
4672      Because some mailers change lines starting with "From " to ">From "
4673      it is good to handle such lines in a special way when creating
4674      cleartext signatures to prevent the mail system from breaking the
4675      signature.  Note that all other PGP versions do it this way too.
4676      Enabled by default.  '--no-escape-from-lines' disables this option.
4677
4678 '--passphrase-repeat n'
4679      Specify how many times 'gpg' will request a new passphrase be
4680      repeated.  This is useful for helping memorize a passphrase.
4681      Defaults to 1 repetition.
4682
4683 '--passphrase-fd n'
4684      Read the passphrase from file descriptor 'n'.  Only the first line
4685      will be read from file descriptor 'n'.  If you use 0 for 'n', the
4686      passphrase will be read from STDIN. This can only be used if only
4687      one passphrase is supplied.
4688
4689      Note that this passphrase is only used if the option '--batch' has
4690      also been given.  This is different from GnuPG version 1.x.
4691
4692 '--passphrase-file file'
4693      Read the passphrase from file 'file'.  Only the first line will be
4694      read from file 'file'.  This can only be used if only one
4695      passphrase is supplied.  Obviously, a passphrase stored in a file
4696      is of questionable security if other users can read this file.
4697      Don't use this option if you can avoid it.  Note that this
4698      passphrase is only used if the option '--batch' has also been
4699      given.  This is different from GnuPG version 1.x.
4700
4701 '--passphrase string'
4702      Use 'string' as the passphrase.  This can only be used if only one
4703      passphrase is supplied.  Obviously, this is of very questionable
4704      security on a multi-user system.  Don't use this option if you can
4705      avoid it.  Note that this passphrase is only used if the option
4706      '--batch' has also been given.  This is different from GnuPG
4707      version 1.x.
4708
4709 '--pinentry-mode mode'
4710      Set the pinentry mode to 'mode'.  Allowed values for 'mode' are:
4711      default
4712           Use the default of the agent, which is 'ask'.
4713      ask
4714           Force the use of the Pinentry.
4715      cancel
4716           Emulate use of Pinentry's cancel button.
4717      error
4718           Return a Pinentry error ("No Pinentry").
4719      loopback
4720           Redirect Pinentry queries to the caller.  Note that in
4721           contrast to Pinentry the user is not prompted again if he
4722           enters a bad password.
4723
4724 '--command-fd n'
4725      This is a replacement for the deprecated shared-memory IPC mode.
4726      If this option is enabled, user input on questions is not expected
4727      from the TTY but from the given file descriptor.  It should be used
4728      together with '--status-fd'.  See the file doc/DETAILS in the
4729      source distribution for details on how to use it.
4730
4731 '--command-file file'
4732      Same as '--command-fd', except the commands are read out of file
4733      'file'
4734
4735 '--allow-non-selfsigned-uid'
4736 '--no-allow-non-selfsigned-uid'
4737      Allow the import and use of keys with user IDs which are not
4738      self-signed.  This is not recommended, as a non self-signed user ID
4739      is trivial to forge.  '--no-allow-non-selfsigned-uid' disables.
4740
4741 '--allow-freeform-uid'
4742      Disable all checks on the form of the user ID while generating a
4743      new one.  This option should only be used in very special
4744      environments as it does not ensure the de-facto standard format of
4745      user IDs.
4746
4747 '--ignore-time-conflict'
4748      GnuPG normally checks that the timestamps associated with keys and
4749      signatures have plausible values.  However, sometimes a signature
4750      seems to be older than the key due to clock problems.  This option
4751      makes these checks just a warning.  See also '--ignore-valid-from'
4752      for timestamp issues on subkeys.
4753
4754 '--ignore-valid-from'
4755      GnuPG normally does not select and use subkeys created in the
4756      future.  This option allows the use of such keys and thus exhibits
4757      the pre-1.0.7 behaviour.  You should not use this option unless
4758      there is some clock problem.  See also '--ignore-time-conflict' for
4759      timestamp issues with signatures.
4760
4761 '--ignore-crc-error'
4762      The ASCII armor used by OpenPGP is protected by a CRC checksum
4763      against transmission errors.  Occasionally the CRC gets mangled
4764      somewhere on the transmission channel but the actual content (which
4765      is protected by the OpenPGP protocol anyway) is still okay.  This
4766      option allows GnuPG to ignore CRC errors.
4767
4768 '--ignore-mdc-error'
4769      This option changes a MDC integrity protection failure into a
4770      warning.  This can be useful if a message is partially corrupt, but
4771      it is necessary to get as much data as possible out of the corrupt
4772      message.  However, be aware that a MDC protection failure may also
4773      mean that the message was tampered with intentionally by an
4774      attacker.
4775
4776 '--allow-weak-digest-algos'
4777      Signatures made with known-weak digest algorithms are normally
4778      rejected with an "invalid digest algorithm" message.  This option
4779      allows the verification of signatures made with such weak
4780      algorithms.  MD5 is the only digest algorithm considered weak by
4781      default.  See also '--weak-digest' to reject other digest
4782      algorithms.
4783
4784 '--weak-digest name'
4785      Treat the specified digest algorithm as weak.  Signatures made over
4786      weak digests algorithms are normally rejected.  This option can be
4787      supplied multiple times if multiple algorithms should be considered
4788      weak.  See also '--allow-weak-digest-algos' to disable rejection of
4789      weak digests.  MD5 is always considered weak, and does not need to
4790      be listed explicitly.
4791
4792 '--no-default-keyring'
4793      Do not add the default keyrings to the list of keyrings.  Note that
4794      GnuPG will not operate without any keyrings, so if you use this
4795      option and do not provide alternate keyrings via '--keyring' or
4796      '--secret-keyring', then GnuPG will still use the default public or
4797      secret keyrings.
4798
4799 '--no-keyring'
4800      Do not add use any keyrings even if specified as options.
4801
4802 '--skip-verify'
4803      Skip the signature verification step.  This may be used to make the
4804      decryption faster if the signature verification is not needed.
4805
4806 '--with-key-data'
4807      Print key listings delimited by colons (like '--with-colons') and
4808      print the public key data.
4809
4810 '--fast-list-mode'
4811      Changes the output of the list commands to work faster; this is
4812      achieved by leaving some parts empty.  Some applications don't need
4813      the user ID and the trust information given in the listings.  By
4814      using this options they can get a faster listing.  The exact
4815      behaviour of this option may change in future versions.  If you are
4816      missing some information, don't use this option.
4817
4818 '--no-literal'
4819      This is not for normal use.  Use the source to see for what it
4820      might be useful.
4821
4822 '--set-filesize'
4823      This is not for normal use.  Use the source to see for what it
4824      might be useful.
4825
4826 '--show-session-key'
4827      Display the session key used for one message.  See
4828      '--override-session-key' for the counterpart of this option.
4829
4830      We think that Key Escrow is a Bad Thing; however the user should
4831      have the freedom to decide whether to go to prison or to reveal the
4832      content of one specific message without compromising all messages
4833      ever encrypted for one secret key.
4834
4835      You can also use this option if you receive an encrypted message
4836      which is abusive or offensive, to prove to the administrators of
4837      the messaging system that the ciphertext transmitted corresponds to
4838      an inappropriate plaintext so they can take action against the
4839      offending user.
4840
4841 '--override-session-key string'
4842 '--override-session-key-fd fd'
4843      Don't use the public key but the session key 'string' respective
4844      the session key taken from the first line read from file descriptor
4845      'fd'.  The format of this string is the same as the one printed by
4846      '--show-session-key'.  This option is normally not used but comes
4847      handy in case someone forces you to reveal the content of an
4848      encrypted message; using this option you can do this without
4849      handing out the secret key.  Note that using
4850      '--override-session-key' may reveal the session key to all local
4851      users via the global process table.
4852
4853 '--ask-sig-expire'
4854 '--no-ask-sig-expire'
4855      When making a data signature, prompt for an expiration time.  If
4856      this option is not specified, the expiration time set via
4857      '--default-sig-expire' is used.  '--no-ask-sig-expire' disables
4858      this option.
4859
4860 '--default-sig-expire'
4861      The default expiration time to use for signature expiration.  Valid
4862      values are "0" for no expiration, a number followed by the letter d
4863      (for days), w (for weeks), m (for months), or y (for years) (for
4864      example "2m" for two months, or "5y" for five years), or an
4865      absolute date in the form YYYY-MM-DD. Defaults to "0".
4866
4867 '--ask-cert-expire'
4868 '--no-ask-cert-expire'
4869      When making a key signature, prompt for an expiration time.  If
4870      this option is not specified, the expiration time set via
4871      '--default-cert-expire' is used.  '--no-ask-cert-expire' disables
4872      this option.
4873
4874 '--default-cert-expire'
4875      The default expiration time to use for key signature expiration.
4876      Valid values are "0" for no expiration, a number followed by the
4877      letter d (for days), w (for weeks), m (for months), or y (for
4878      years) (for example "2m" for two months, or "5y" for five years),
4879      or an absolute date in the form YYYY-MM-DD. Defaults to "0".
4880
4881 '--default-new-key-algo STRING'
4882      This option can be used to change the default algorithms for key
4883      generation.  Note that the advanced key generation commands can
4884      always be used to specify a key algorithm directly.  Please consult
4885      the source code to learn the syntax of STRING.
4886
4887 '--allow-secret-key-import'
4888      This is an obsolete option and is not used anywhere.
4889
4890 '--allow-multiple-messages'
4891 '--no-allow-multiple-messages'
4892      Allow processing of multiple OpenPGP messages contained in a single
4893      file or stream.  Some programs that call GPG are not prepared to
4894      deal with multiple messages being processed together, so this
4895      option defaults to no.  Note that versions of GPG prior to 1.4.7
4896      always allowed multiple messages.
4897
4898      Warning: Do not use this option unless you need it as a temporary
4899      workaround!
4900
4901 '--enable-special-filenames'
4902      This option enables a mode in which filenames of the form '-&n',
4903      where n is a non-negative decimal number, refer to the file
4904      descriptor n and not to a file with that name.
4905
4906 '--no-expensive-trust-checks'
4907      Experimental use only.
4908
4909 '--preserve-permissions'
4910      Don't change the permissions of a secret keyring back to user
4911      read/write only.  Use this option only if you really know what you
4912      are doing.
4913
4914 '--default-preference-list string'
4915      Set the list of default preferences to 'string'.  This preference
4916      list is used for new keys and becomes the default for "setpref" in
4917      the edit menu.
4918
4919 '--default-keyserver-url name'
4920      Set the default keyserver URL to 'name'.  This keyserver will be
4921      used as the keyserver URL when writing a new self-signature on a
4922      key, which includes key generation and changing preferences.
4923
4924 '--list-config'
4925      Display various internal configuration parameters of GnuPG. This
4926      option is intended for external programs that call GnuPG to perform
4927      tasks, and is thus not generally useful.  See the file
4928      'doc/DETAILS' in the source distribution for the details of which
4929      configuration items may be listed.  '--list-config' is only usable
4930      with '--with-colons' set.
4931
4932 '--list-gcrypt-config'
4933      Display various internal configuration parameters of Libgcrypt.
4934
4935 '--gpgconf-list'
4936      This command is similar to '--list-config' but in general only
4937      internally used by the 'gpgconf' tool.
4938
4939 '--gpgconf-test'
4940      This is more or less dummy action.  However it parses the
4941      configuration file and returns with failure if the configuration
4942      file would prevent 'gpg' from startup.  Thus it may be used to run
4943      a syntax check on the configuration file.
4944
4945    ---------- Footnotes ----------
4946
4947    (1) Using a little social engineering anyone who is able to decrypt
4948 the message can check whether one of the other recipients is the one he
4949 suspects.
4950
4951 \1f
4952 File: gnupg.info,  Node: Deprecated Options,  Prev: GPG Esoteric Options,  Up: GPG Options
4953
4954 4.2.7 Deprecated options
4955 ------------------------
4956
4957 '--show-photos'
4958 '--no-show-photos'
4959      Causes '--list-keys', '--list-signatures', '--list-public-keys',
4960      '--list-secret-keys', and verifying a signature to also display the
4961      photo ID attached to the key, if any.  See also '--photo-viewer'.
4962      These options are deprecated.  Use '--list-options
4963      [no-]show-photos' and/or '--verify-options [no-]show-photos'
4964      instead.
4965
4966 '--show-keyring'
4967      Display the keyring name at the head of key listings to show which
4968      keyring a given key resides on.  This option is deprecated: use
4969      '--list-options [no-]show-keyring' instead.
4970
4971 '--always-trust'
4972      Identical to '--trust-model always'.  This option is deprecated.
4973
4974 '--show-notation'
4975 '--no-show-notation'
4976      Show signature notations in the '--list-signatures' or
4977      '--check-signatures' listings as well as when verifying a signature
4978      with a notation in it.  These options are deprecated.  Use
4979      '--list-options [no-]show-notation' and/or '--verify-options
4980      [no-]show-notation' instead.
4981
4982 '--show-policy-url'
4983 '--no-show-policy-url'
4984      Show policy URLs in the '--list-signatures' or '--check-signatures'
4985      listings as well as when verifying a signature with a policy URL in
4986      it.  These options are deprecated.  Use '--list-options
4987      [no-]show-policy-url' and/or '--verify-options
4988      [no-]show-policy-url' instead.
4989
4990 \1f
4991 File: gnupg.info,  Node: GPG Configuration,  Next: GPG Examples,  Prev: GPG Options,  Up: Invoking GPG
4992
4993 4.3 Configuration files
4994 =======================
4995
4996 There are a few configuration files to control certain aspects of
4997 'gpg''s operation.  Unless noted, they are expected in the current home
4998 directory (*note option --homedir::).
4999
5000 'gpg.conf'
5001      This is the standard configuration file read by 'gpg' on startup.
5002      It may contain any valid long option; the leading two dashes may
5003      not be entered and the option may not be abbreviated.  This default
5004      name may be changed on the command line (*note gpg-option
5005      --options::).  You should backup this file.
5006
5007    Note that on larger installations, it is useful to put predefined
5008 files into the directory '/etc/skel/.gnupg' so that newly created users
5009 start up with a working configuration.  For existing users a small
5010 helper script is provided to create these files (*note addgnupghome::).
5011
5012    For internal purposes 'gpg' creates and maintains a few other files;
5013 They all live in in the current home directory (*note option
5014 --homedir::).  Only the 'gpg' program may modify these files.
5015
5016 '~/.gnupg'
5017      This is the default home directory which is used if neither the
5018      environment variable 'GNUPGHOME' nor the option '--homedir' is
5019      given.
5020
5021 '~/.gnupg/pubring.gpg'
5022      The public keyring.  You should backup this file.
5023
5024 '~/.gnupg/pubring.gpg.lock'
5025      The lock file for the public keyring.
5026
5027 '~/.gnupg/pubring.kbx'
5028      The public keyring using a different format.  This file is shared
5029      with 'gpgsm'.  You should backup this file.
5030
5031 '~/.gnupg/pubring.kbx.lock'
5032      The lock file for 'pubring.kbx'.
5033
5034 '~/.gnupg/secring.gpg'
5035      A secret keyring as used by GnuPG versions before 2.1.  It is not
5036      used by GnuPG 2.1 and later.
5037
5038 '~/.gnupg/secring.gpg.lock'
5039      The lock file for the secret keyring.
5040
5041 '~/.gnupg/.gpg-v21-migrated'
5042      File indicating that a migration to GnuPG 2.1 has been done.
5043
5044 '~/.gnupg/trustdb.gpg'
5045      The trust database.  There is no need to backup this file; it is
5046      better to backup the ownertrust values (*note option
5047      --export-ownertrust::).
5048
5049 '~/.gnupg/trustdb.gpg.lock'
5050      The lock file for the trust database.
5051
5052 '~/.gnupg/random_seed'
5053      A file used to preserve the state of the internal random pool.
5054
5055 '~/.gnupg/openpgp-revocs.d/'
5056      This is the directory where gpg stores pre-generated revocation
5057      certificates.  The file name corresponds to the OpenPGP fingerprint
5058      of the respective key.  It is suggested to backup those
5059      certificates and if the primary private key is not stored on the
5060      disk to move them to an external storage device.  Anyone who can
5061      access theses files is able to revoke the corresponding key.  You
5062      may want to print them out.  You should backup all files in this
5063      directory and take care to keep this backup closed away.
5064
5065 '/usr/local/share/gnupg/options.skel'
5066      The skeleton options file.
5067
5068    Operation is further controlled by a few environment variables:
5069
5070 HOME
5071      Used to locate the default home directory.
5072
5073 GNUPGHOME
5074      If set directory used instead of "~/.gnupg".
5075
5076 GPG_AGENT_INFO
5077      This variable is obsolete; it was used by GnuPG versions before
5078      2.1.
5079
5080 PINENTRY_USER_DATA
5081      This value is passed via gpg-agent to pinentry.  It is useful to
5082      convey extra information to a custom pinentry.
5083
5084 COLUMNS
5085 LINES
5086      Used to size some displays to the full size of the screen.
5087
5088 LANGUAGE
5089      Apart from its use by GNU, it is used in the W32 version to
5090      override the language selection done through the Registry.  If used
5091      and set to a valid and available language name (LANGID), the file
5092      with the translation is loaded from 'GPGDIR/gnupg.nls/LANGID.mo'.
5093      Here GPGDIR is the directory out of which the gpg binary has been
5094      loaded.  If it can't be loaded the Registry is tried and as last
5095      resort the native Windows locale system is used.
5096
5097 \1f
5098 File: gnupg.info,  Node: GPG Examples,  Next: Unattended Usage of GPG,  Prev: GPG Configuration,  Up: Invoking GPG
5099
5100 4.4 Examples
5101 ============
5102
5103 gpg -se -r 'Bob' 'file'
5104      sign and encrypt for user Bob
5105
5106 gpg -clear-sign 'file'
5107      make a cleartext signature
5108
5109 gpg -sb 'file'
5110      make a detached signature
5111
5112 gpg -u 0x12345678 -sb 'file'
5113      make a detached signature with the key 0x12345678
5114
5115 gpg -list-keys 'user_ID'
5116      show keys
5117
5118 gpg -fingerprint 'user_ID'
5119      show fingerprint
5120
5121 gpg -verify 'pgpfile'
5122 gpg -verify 'sigfile' ['datafile']
5123      Verify the signature of the file but do not output the data unless
5124      requested.  The second form is used for detached signatures, where
5125      'sigfile' is the detached signature (either ASCII armored or
5126      binary) and 'datafile' are the signed data; if this is not given,
5127      the name of the file holding the signed data is constructed by
5128      cutting off the extension (".asc" or ".sig") of 'sigfile' or by
5129      asking the user for the filename.  If the option '--output' is also
5130      used the signed data is written to the file specified by that
5131      option; use '-' to write the signed data to stdout.
5132
5133 FILTER EXPRESSIONS
5134 ******************
5135
5136 The options '--import-filter' and '--export-filter' use expressions with
5137 this syntax (square brackets indicate an optional part and curly braces
5138 a repetition, white space between the elements are allowed):
5139
5140        [lc] {[{flag}] PROPNAME op VALUE [lc]}
5141
5142    The name of a property (PROPNAME) may only consist of letters, digits
5143 and underscores.  The description for the filter type describes which
5144 properties are defined.  If an undefined property is used it evaluates
5145 to the empty string.  Unless otherwise noted, the VALUE must always be
5146 given and may not be the empty string.  No quoting is defined for the
5147 value, thus the value may not contain the strings '&&' or '||', which
5148 are used as logical connection operators.  The flag '--' can be used to
5149 remove this restriction.
5150
5151    Numerical values are computed as long int; standard C notation
5152 applies.  LC is the logical connection operator; either '&&' for a
5153 conjunction or '||' for a disjunction.  A conjunction is assumed at the
5154 begin of an expression.  Conjunctions have higher precedence than
5155 disjunctions.  If VALUE starts with one of the characters used in any OP
5156 a space after the OP is required.
5157
5158 The supported operators (OP) are:
5159
5160 =~
5161      Substring must match.
5162
5163 !~
5164      Substring must not match.
5165
5166 =
5167      The full string must match.
5168
5169 <>
5170      The full string must not match.
5171
5172 ==
5173      The numerical value must match.
5174
5175 !=
5176      The numerical value must not match.
5177
5178 <=
5179      The numerical value of the field must be LE than the value.
5180
5181 <
5182      The numerical value of the field must be LT than the value.
5183
5184 >
5185      The numerical value of the field must be GT than the value.
5186
5187 >=
5188      The numerical value of the field must be GE than the value.
5189
5190 -le
5191      The string value of the field must be less or equal than the value.
5192
5193 -lt
5194      The string value of the field must be less than the value.
5195
5196 -gt
5197      The string value of the field must be greater than the value.
5198
5199 -ge
5200      The string value of the field must be greater or equal than the
5201      value.
5202
5203 -n
5204      True if value is not empty (no value allowed).
5205
5206 -z
5207      True if value is empty (no value allowed).
5208
5209 -t
5210      Alias for "PROPNAME != 0" (no value allowed).
5211
5212 -f
5213      Alias for "PROPNAME == 0" (no value allowed).
5214
5215 Values for FLAG must be space separated.  The supported flags are:
5216
5217 -
5218      VALUE spans to the end of the expression.
5219 -c
5220      The string match in this part is done case-sensitive.
5221
5222    The filter options concatenate several specifications for a filter of
5223 the same type.  For example the four options in this example:
5224
5225       --import-option keep-uid="uid =~ Alfa"
5226       --import-option keep-uid="&& uid !~ Test"
5227       --import-option keep-uid="|| uid =~ Alpha"
5228       --import-option keep-uid="uid !~ Test"
5229
5230 which is equivalent to
5231
5232       --import-option \
5233        keep-uid="uid =~ Alfa" && uid !~ Test" || uid =~ Alpha" && "uid !~ Test"
5234
5235    imports only the user ids of a key containing the strings "Alfa" or
5236 "Alpha" but not the string "test".
5237
5238 RETURN VALUE
5239 ************
5240
5241 The program returns 0 if everything was fine, 1 if at least a signature
5242 was bad, and other error codes for fatal errors.
5243
5244 WARNINGS
5245 ********
5246
5247 Use a *good* password for your user account and a *good* passphrase to
5248 protect your secret key.  This passphrase is the weakest part of the
5249 whole system.  Programs to do dictionary attacks on your secret keyring
5250 are very easy to write and so you should protect your "~/.gnupg/"
5251 directory very well.
5252
5253    Keep in mind that, if this program is used over a network (telnet),
5254 it is *very* easy to spy out your passphrase!
5255
5256    If you are going to verify detached signatures, make sure that the
5257 program knows about it; either give both filenames on the command line
5258 or use '-' to specify STDIN.
5259
5260 INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS
5261 ********************************************
5262
5263 GnuPG tries to be a very flexible implementation of the OpenPGP
5264 standard.  In particular, GnuPG implements many of the optional parts of
5265 the standard, such as the SHA-512 hash, and the ZLIB and BZIP2
5266 compression algorithms.  It is important to be aware that not all
5267 OpenPGP programs implement these optional algorithms and that by forcing
5268 their use via the '--cipher-algo', '--digest-algo',
5269 '--cert-digest-algo', or '--compress-algo' options in GnuPG, it is
5270 possible to create a perfectly valid OpenPGP message, but one that
5271 cannot be read by the intended recipient.
5272
5273    There are dozens of variations of OpenPGP programs available, and
5274 each supports a slightly different subset of these optional algorithms.
5275 For example, until recently, no (unhacked) version of PGP supported the
5276 BLOWFISH cipher algorithm.  A message using BLOWFISH simply could not be
5277 read by a PGP user.  By default, GnuPG uses the standard OpenPGP
5278 preferences system that will always do the right thing and create
5279 messages that are usable by all recipients, regardless of which OpenPGP
5280 program they use.  Only override this safe default if you really know
5281 what you are doing.
5282
5283    If you absolutely must override the safe default, or if the
5284 preferences on a given key are invalid for some reason, you are far
5285 better off using the '--pgp6', '--pgp7', or '--pgp8' options.  These
5286 options are safe as they do not force any particular algorithms in
5287 violation of OpenPGP, but rather reduce the available algorithms to a
5288 "PGP-safe" list.
5289
5290 BUGS
5291 ****
5292
5293 On older systems this program should be installed as setuid(root).  This
5294 is necessary to lock memory pages.  Locking memory pages prevents the
5295 operating system from writing memory pages (which may contain
5296 passphrases or other sensitive material) to disk.  If you get no warning
5297 message about insecure memory your operating system supports locking
5298 without being root.  The program drops root privileges as soon as locked
5299 memory is allocated.
5300
5301    Note also that some systems (especially laptops) have the ability to
5302 "suspend to disk" (also known as "safe sleep" or "hibernate").  This
5303 writes all memory to disk before going into a low power or even powered
5304 off mode.  Unless measures are taken in the operating system to protect
5305 the saved memory, passphrases or other sensitive material may be
5306 recoverable from it later.
5307
5308    Before you report a bug you should first search the mailing list
5309 archives for similar problems and second check whether such a bug has
5310 already been reported to our bug tracker at http://bugs.gnupg.org .
5311
5312 \1f
5313 File: gnupg.info,  Node: Unattended Usage of GPG,  Prev: GPG Examples,  Up: Invoking GPG
5314
5315 4.5 Unattended Usage
5316 ====================
5317
5318 'gpg' is often used as a backend engine by other software.  To help with
5319 this a machine interface has been defined to have an unambiguous way to
5320 do this.  The options '--status-fd' and '--batch' are almost always
5321 required for this.
5322
5323 * Menu:
5324
5325 * Programmatic use of GnuPG:: Programmatic use of GnuPG
5326 * Ephemeral home directories:: Ephemeral home directories
5327 * The quick key manipulation interface:: The quick key manipulation interface
5328 * Unattended GPG key generation::  Unattended key generation
5329
5330 \1f
5331 File: gnupg.info,  Node: Programmatic use of GnuPG,  Next: Ephemeral home directories,  Up: Unattended Usage of GPG
5332
5333 4.5.1 Programmatic use of GnuPG
5334 -------------------------------
5335
5336 Please consider using GPGME instead of calling 'gpg' directly.  GPGME
5337 offers a stable, backend-independent interface for many cryptographic
5338 operations.  It supports OpenPGP and S/MIME, and also allows interaction
5339 with various GnuPG components.
5340
5341    GPGME provides a C-API, and comes with bindings for C++, Qt, and
5342 Python.  Bindings for other languages are available.
5343
5344 \1f
5345 File: gnupg.info,  Node: Ephemeral home directories,  Next: The quick key manipulation interface,  Prev: Programmatic use of GnuPG,  Up: Unattended Usage of GPG
5346
5347 4.5.2 Ephemeral home directories
5348 --------------------------------
5349
5350 Sometimes you want to contain effects of some operation, for example you
5351 want to import a key to inspect it, but you do not want this key to be
5352 added to your keyring.  In earlier versions of GnuPG, it was possible to
5353 specify alternate keyring files for both public and secret keys.  In
5354 modern GnuPG versions, however, we changed how secret keys are stored in
5355 order to better protect secret key material, and it was not possible to
5356 preserve this interface.
5357
5358    The preferred way to do this is to use ephemeral home directories.
5359 This technique works across all versions of GnuPG.
5360
5361    Create a temporary directory, create (or copy) a configuration that
5362 meets your needs, make 'gpg' use this directory either using the
5363 environment variable GNUPGHOME, or the option '--homedir'.  GPGME
5364 supports this too on a per-context basis, by modifying the engine info
5365 of contexts.  Now execute whatever operation you like, import and export
5366 key material as necessary.  Once finished, you can delete the directory.
5367 All GnuPG backend services that were started will detect this and shut
5368 down.
5369
5370 \1f
5371 File: gnupg.info,  Node: The quick key manipulation interface,  Next: Unattended GPG key generation,  Prev: Ephemeral home directories,  Up: Unattended Usage of GPG
5372
5373 4.5.3 The quick key manipulation interface
5374 ------------------------------------------
5375
5376 Recent versions of GnuPG have an interface to manipulate keys without
5377 using the interactive command '--edit-key'.  This interface was added
5378 mainly for the benefit of GPGME (please consider using GPGME, see the
5379 manual subsection "Programmatic use of GnuPG"). This interface is
5380 described in the subsection "How to manage your keys".
5381
5382 \1f
5383 File: gnupg.info,  Node: Unattended GPG key generation,  Prev: The quick key manipulation interface,  Up: Unattended Usage of GPG
5384
5385 4.5.4 Unattended key generation
5386 -------------------------------
5387
5388 The command '--generate-key' may be used along with the option '--batch'
5389 for unattended key generation.  This is the most flexible way of
5390 generating keys, but it is also the most complex one.  Consider using
5391 the quick key manipulation interface described in the previous
5392 subsection "The quick key manipulation interface".
5393
5394    The parameters for the key are either read from stdin or given as a
5395 file on the command line.  The format of the parameter file is as
5396 follows:
5397
5398    * Text only, line length is limited to about 1000 characters.
5399    * UTF-8 encoding must be used to specify non-ASCII characters.
5400    * Empty lines are ignored.
5401    * Leading and trailing while space is ignored.
5402    * A hash sign as the first non white space character indicates a
5403      comment line.
5404    * Control statements are indicated by a leading percent sign, the
5405      arguments are separated by white space from the keyword.
5406    * Parameters are specified by a keyword, followed by a colon.
5407      Arguments are separated by white space.
5408    * The first parameter must be 'Key-Type'; control statements may be
5409      placed anywhere.
5410    * The order of the parameters does not matter except for 'Key-Type'
5411      which must be the first parameter.  The parameters are only used
5412      for the generated keyblock (primary and subkeys); parameters from
5413      previous sets are not used.  Some syntactically checks may be
5414      performed.
5415    * Key generation takes place when either the end of the parameter
5416      file is reached, the next 'Key-Type' parameter is encountered or at
5417      the control statement '%commit' is encountered.
5418
5419 Control statements:
5420
5421 %echo TEXT
5422      Print TEXT as diagnostic.
5423
5424 %dry-run
5425      Suppress actual key generation (useful for syntax checking).
5426
5427 %commit
5428      Perform the key generation.  Note that an implicit commit is done
5429      at the next Key-Type parameter.
5430
5431 %pubring FILENAME
5432      Do not write the key to the default or commandline given keyring
5433      but to FILENAME.  This must be given before the first commit to
5434      take place, duplicate specification of the same filename is
5435      ignored, the last filename before a commit is used.  The filename
5436      is used until a new filename is used (at commit points) and all
5437      keys are written to that file.  If a new filename is given, this
5438      file is created (and overwrites an existing one).
5439
5440      See the previous subsection "Ephemeral home directories" for a more
5441      robust way to contain side-effects.
5442
5443 %secring FILENAME
5444      This option is a no-op for GnuPG 2.1 and later.
5445
5446      See the previous subsection "Ephemeral home directories".
5447
5448 %ask-passphrase
5449 %no-ask-passphrase
5450      This option is a no-op for GnuPG 2.1 and later.
5451
5452 %no-protection
5453      Using this option allows the creation of keys without any
5454      passphrase protection.  This option is mainly intended for
5455      regression tests.
5456
5457 %transient-key
5458      If given the keys are created using a faster and a somewhat less
5459      secure random number generator.  This option may be used for keys
5460      which are only used for a short time and do not require full
5461      cryptographic strength.  It takes only effect if used together with
5462      the control statement '%no-protection'.
5463
5464 General Parameters:
5465
5466 Key-Type: ALGO
5467      Starts a new parameter block by giving the type of the primary key.
5468      The algorithm must be capable of signing.  This is a required
5469      parameter.  ALGO may either be an OpenPGP algorithm number or a
5470      string with the algorithm name.  The special value 'default' may be
5471      used for ALGO to create the default key type; in this case a
5472      'Key-Usage' shall not be given and 'default' also be used for
5473      'Subkey-Type'.
5474
5475 Key-Length: NBITS
5476      The requested length of the generated key in bits.  The default is
5477      returned by running the command 'gpg --gpgconf-list'.
5478
5479 Key-Grip: HEXSTRING
5480      This is optional and used to generate a CSR or certificate for an
5481      already existing key.  Key-Length will be ignored when given.
5482
5483 Key-Usage: USAGE-LIST
5484      Space or comma delimited list of key usages.  Allowed values are
5485      'encrypt', 'sign', and 'auth'.  This is used to generate the key
5486      flags.  Please make sure that the algorithm is capable of this
5487      usage.  Note that OpenPGP requires that all primary keys are
5488      capable of certification, so no matter what usage is given here,
5489      the 'cert' flag will be on.  If no 'Key-Usage' is specified and the
5490      'Key-Type' is not 'default', all allowed usages for that particular
5491      algorithm are used; if it is not given but 'default' is used the
5492      usage will be 'sign'.
5493
5494 Subkey-Type: ALGO
5495      This generates a secondary key (subkey).  Currently only one subkey
5496      can be handled.  See also 'Key-Type' above.
5497
5498 Subkey-Length: NBITS
5499      Length of the secondary key (subkey) in bits.  The default is
5500      returned by running the command 'gpg --gpgconf-list'.
5501
5502 Subkey-Usage: USAGE-LIST
5503      Key usage lists for a subkey; similar to 'Key-Usage'.
5504
5505 Passphrase: STRING
5506      If you want to specify a passphrase for the secret key, enter it
5507      here.  Default is to use the Pinentry dialog to ask for a
5508      passphrase.
5509
5510 Name-Real: NAME
5511 Name-Comment: COMMENT
5512 Name-Email: EMAIL
5513      The three parts of a user name.  Remember to use UTF-8 encoding
5514      here.  If you don't give any of them, no user ID is created.
5515
5516 Expire-Date: ISO-DATE|(NUMBER[d|w|m|y])
5517      Set the expiration date for the key (and the subkey).  It may
5518      either be entered in ISO date format (e.g.  "20000815T145012") or
5519      as number of days, weeks, month or years after the creation date.
5520      The special notation "seconds=N" is also allowed to specify a
5521      number of seconds since creation.  Without a letter days are
5522      assumed.  Note that there is no check done on the overflow of the
5523      type used by OpenPGP for timestamps.  Thus you better make sure
5524      that the given value make sense.  Although OpenPGP works with time
5525      intervals, GnuPG uses an absolute value internally and thus the
5526      last year we can represent is 2105.
5527
5528 Creation-Date: ISO-DATE
5529      Set the creation date of the key as stored in the key information
5530      and which is also part of the fingerprint calculation.  Either a
5531      date like "1986-04-26" or a full timestamp like "19860426T042640"
5532      may be used.  The time is considered to be UTC. The special
5533      notation "seconds=N" may be used to directly specify a the number
5534      of seconds since Epoch (Unix time).  If it is not given the current
5535      time is used.
5536
5537 Preferences: STRING
5538      Set the cipher, hash, and compression preference values for this
5539      key.  This expects the same type of string as the sub-command
5540      'setpref' in the '--edit-key' menu.
5541
5542 Revoker: ALGO:FPR [sensitive]
5543      Add a designated revoker to the generated key.  Algo is the public
5544      key algorithm of the designated revoker (i.e.  RSA=1, DSA=17, etc.)
5545      FPR is the fingerprint of the designated revoker.  The optional
5546      'sensitive' flag marks the designated revoker as sensitive
5547      information.  Only v4 keys may be designated revokers.
5548
5549 Keyserver: STRING
5550      This is an optional parameter that specifies the preferred
5551      keyserver URL for the key.
5552
5553 Handle: STRING
5554      This is an optional parameter only used with the status lines
5555      KEY_CREATED and KEY_NOT_CREATED. STRING may be up to 100 characters
5556      and should not contain spaces.  It is useful for batch key
5557      generation to associate a key parameter block with a status line.
5558
5559 Here is an example on how to create a key in an ephemeral home
5560 directory:
5561      $ export GNUPGHOME="$(mktemp -d)"
5562      $ cat >foo <<EOF
5563           %echo Generating a basic OpenPGP key
5564           Key-Type: DSA
5565           Key-Length: 1024
5566           Subkey-Type: ELG-E
5567           Subkey-Length: 1024
5568           Name-Real: Joe Tester
5569           Name-Comment: with stupid passphrase
5570           Name-Email: joe@foo.bar
5571           Expire-Date: 0
5572           Passphrase: abc
5573           # Do a commit here, so that we can later print "done" :-)
5574           %commit
5575           %echo done
5576      EOF
5577      $ gpg --batch --generate-key foo
5578       [...]
5579      $ gpg --list-secret-keys
5580      /tmp/tmp.0NQxB74PEf/pubring.kbx
5581      -------------------------------
5582      sec   dsa1024 2016-12-16 [SCA]
5583            768E895903FC1C44045C8CB95EEBDB71E9E849D0
5584      uid           [ultimate] Joe Tester (with stupid passphrase) <joe@foo.bar>
5585      ssb   elg1024 2016-12-16 [E]
5586
5587 If you want to create a key with the default algorithms you would use
5588 these parameters:
5589           %echo Generating a default key
5590           Key-Type: default
5591           Subkey-Type: default
5592           Name-Real: Joe Tester
5593           Name-Comment: with stupid passphrase
5594           Name-Email: joe@foo.bar
5595           Expire-Date: 0
5596           Passphrase: abc
5597           # Do a commit here, so that we can later print "done" :-)
5598           %commit
5599           %echo done
5600
5601 \1f
5602 File: gnupg.info,  Node: Invoking GPGSM,  Next: Invoking SCDAEMON,  Prev: Invoking GPG,  Up: Top
5603
5604 5 Invoking GPGSM
5605 ****************
5606
5607 'gpgsm' is a tool similar to 'gpg' to provide digital encryption and
5608 signing services on X.509 certificates and the CMS protocol.  It is
5609 mainly used as a backend for S/MIME mail processing.  'gpgsm' includes a
5610 full featured certificate management and complies with all rules defined
5611 for the German Sphinx project.
5612
5613    *Note Option Index::, for an index to 'GPGSM''s commands and options.
5614
5615 * Menu:
5616
5617 * GPGSM Commands::        List of all commands.
5618 * GPGSM Options::         List of all options.
5619 * GPGSM Configuration::   Configuration files.
5620 * GPGSM Examples::        Some usage examples.
5621
5622 Developer information:
5623 * Unattended Usage::      Using 'gpgsm' from other programs.
5624 * GPGSM Protocol::        The protocol the server mode uses.
5625
5626 \1f
5627 File: gnupg.info,  Node: GPGSM Commands,  Next: GPGSM Options,  Up: Invoking GPGSM
5628
5629 5.1 Commands
5630 ============
5631
5632 Commands are not distinguished from options except for the fact that
5633 only one command is allowed.
5634
5635 * Menu:
5636
5637 * General GPGSM Commands::        Commands not specific to the functionality.
5638 * Operational GPGSM Commands::    Commands to select the type of operation.
5639 * Certificate Management::        How to manage certificates.
5640
5641 \1f
5642 File: gnupg.info,  Node: General GPGSM Commands,  Next: Operational GPGSM Commands,  Up: GPGSM Commands
5643
5644 5.1.1 Commands not specific to the function
5645 -------------------------------------------
5646
5647 '--version'
5648      Print the program version and licensing information.  Note that you
5649      cannot abbreviate this command.
5650
5651 '--help, -h'
5652      Print a usage message summarizing the most useful command-line
5653      options.  Note that you cannot abbreviate this command.
5654
5655 '--warranty'
5656      Print warranty information.  Note that you cannot abbreviate this
5657      command.
5658
5659 '--dump-options'
5660      Print a list of all available options and commands.  Note that you
5661      cannot abbreviate this command.
5662
5663 \1f
5664 File: gnupg.info,  Node: Operational GPGSM Commands,  Next: Certificate Management,  Prev: General GPGSM Commands,  Up: GPGSM Commands
5665
5666 5.1.2 Commands to select the type of operation
5667 ----------------------------------------------
5668
5669 '--encrypt'
5670      Perform an encryption.  The keys the data is encrypted to must be
5671      set using the option '--recipient'.
5672
5673 '--decrypt'
5674      Perform a decryption; the type of input is automatically
5675      determined.  It may either be in binary form or PEM encoded;
5676      automatic determination of base-64 encoding is not done.
5677
5678 '--sign'
5679      Create a digital signature.  The key used is either the fist one
5680      found in the keybox or those set with the '--local-user' option.
5681
5682 '--verify'
5683      Check a signature file for validity.  Depending on the arguments a
5684      detached signature may also be checked.
5685
5686 '--server'
5687      Run in server mode and wait for commands on the 'stdin'.
5688
5689 '--call-dirmngr COMMAND [ARGS]'
5690      Behave as a Dirmngr client issuing the request COMMAND with the
5691      optional list of ARGS.  The output of the Dirmngr is printed
5692      stdout.  Please note that file names given as arguments should have
5693      an absolute file name (i.e.  commencing with '/') because they are
5694      passed verbatim to the Dirmngr and the working directory of the
5695      Dirmngr might not be the same as the one of this client.  Currently
5696      it is not possible to pass data via stdin to the Dirmngr.  COMMAND
5697      should not contain spaces.
5698
5699      This is command is required for certain maintaining tasks of the
5700      dirmngr where a dirmngr must be able to call back to 'gpgsm'.  See
5701      the Dirmngr manual for details.
5702
5703 '--call-protect-tool ARGUMENTS'
5704      Certain maintenance operations are done by an external program call
5705      'gpg-protect-tool'; this is usually not installed in a directory
5706      listed in the PATH variable.  This command provides a simple
5707      wrapper to access this tool.  ARGUMENTS are passed verbatim to this
5708      command; use '--help' to get a list of supported operations.
5709
5710 \1f
5711 File: gnupg.info,  Node: Certificate Management,  Prev: Operational GPGSM Commands,  Up: GPGSM Commands
5712
5713 5.1.3 How to manage the certificates and keys
5714 ---------------------------------------------
5715
5716 '--generate-key'
5717 '--gen-key'
5718      This command allows the creation of a certificate signing request
5719      or a self-signed certificate.  It is commonly used along with the
5720      '--output' option to save the created CSR or certificate into a
5721      file.  If used with the '--batch' a parameter file is used to
5722      create the CSR or certificate and it is further possible to create
5723      non-self-signed certificates.
5724
5725 '--list-keys'
5726 '-k'
5727      List all available certificates stored in the local key database.
5728      Note that the displayed data might be reformatted for better human
5729      readability and illegal characters are replaced by safe
5730      substitutes.
5731
5732 '--list-secret-keys'
5733 '-K'
5734      List all available certificates for which a corresponding a secret
5735      key is available.
5736
5737 '--list-external-keys PATTERN'
5738      List certificates matching PATTERN using an external server.  This
5739      utilizes the 'dirmngr' service.
5740
5741 '--list-chain'
5742      Same as '--list-keys' but also prints all keys making up the chain.
5743
5744 '--dump-cert'
5745 '--dump-keys'
5746      List all available certificates stored in the local key database
5747      using a format useful mainly for debugging.
5748
5749 '--dump-chain'
5750      Same as '--dump-keys' but also prints all keys making up the chain.
5751
5752 '--dump-secret-keys'
5753      List all available certificates for which a corresponding a secret
5754      key is available using a format useful mainly for debugging.
5755
5756 '--dump-external-keys PATTERN'
5757      List certificates matching PATTERN using an external server.  This
5758      utilizes the 'dirmngr' service.  It uses a format useful mainly for
5759      debugging.
5760
5761 '--keydb-clear-some-cert-flags'
5762      This is a debugging aid to reset certain flags in the key database
5763      which are used to cache certain certificate stati.  It is
5764      especially useful if a bad CRL or a weird running OCSP responder
5765      did accidentally revoke certificate.  There is no security issue
5766      with this command because 'gpgsm' always make sure that the
5767      validity of a certificate is checked right before it is used.
5768
5769 '--delete-keys PATTERN'
5770      Delete the keys matching PATTERN.  Note that there is no command to
5771      delete the secret part of the key directly.  In case you need to do
5772      this, you should run the command 'gpgsm --dump-secret-keys KEYID'
5773      before you delete the key, copy the string of hex-digits in the
5774      "keygrip" line and delete the file consisting of these hex-digits
5775      and the suffix '.key' from the 'private-keys-v1.d' directory below
5776      our GnuPG home directory (usually '~/.gnupg').
5777
5778 '--export [PATTERN]'
5779      Export all certificates stored in the Keybox or those specified by
5780      the optional PATTERN.  Those pattern consist of a list of user ids
5781      (*note how-to-specify-a-user-id::).  When used along with the
5782      '--armor' option a few informational lines are prepended before
5783      each block.  There is one limitation: As there is no commonly
5784      agreed upon way to pack more than one certificate into an ASN.1
5785      structure, the binary export (i.e.  without using 'armor') works
5786      only for the export of one certificate.  Thus it is required to
5787      specify a PATTERN which yields exactly one certificate.  Ephemeral
5788      certificate are only exported if all PATTERN are given as
5789      fingerprints or keygrips.
5790
5791 '--export-secret-key-p12 KEY-ID'
5792      Export the private key and the certificate identified by KEY-ID in
5793      a PKCS#12 format.  When used with the '--armor' option a few
5794      informational lines are prepended to the output.  Note, that the
5795      PKCS#12 format is not very secure and this command is only provided
5796      if there is no other way to exchange the private key.  (*Note
5797      option --p12-charset::.)
5798
5799 '--export-secret-key-p8 KEY-ID'
5800 '--export-secret-key-raw KEY-ID'
5801      Export the private key of the certificate identified by KEY-ID with
5802      any encryption stripped.  The '...-raw' command exports in PKCS#1
5803      format; the '...-p8' command exports in PKCS#8 format.  When used
5804      with the '--armor' option a few informational lines are prepended
5805      to the output.  These commands are useful to prepare a key for use
5806      on a TLS server.
5807
5808 '--import [FILES]'
5809      Import the certificates from the PEM or binary encoded files as
5810      well as from signed-only messages.  This command may also be used
5811      to import a secret key from a PKCS#12 file.
5812
5813 '--learn-card'
5814      Read information about the private keys from the smartcard and
5815      import the certificates from there.  This command utilizes the
5816      'gpg-agent' and in turn the 'scdaemon'.
5817
5818 '--change-passphrase USER_ID'
5819 '--passwd USER_ID'
5820      Change the passphrase of the private key belonging to the
5821      certificate specified as USER_ID.  Note, that changing the
5822      passphrase/PIN of a smartcard is not yet supported.
5823
5824 \1f
5825 File: gnupg.info,  Node: GPGSM Options,  Next: GPGSM Configuration,  Prev: GPGSM Commands,  Up: Invoking GPGSM
5826
5827 5.2 Option Summary
5828 ==================
5829
5830 'GPGSM' features a bunch of options to control the exact behaviour and
5831 to change the default configuration.
5832
5833 * Menu:
5834
5835 * Configuration Options::   How to change the configuration.
5836 * Certificate Options::     Certificate related options.
5837 * Input and Output::        Input and Output.
5838 * CMS Options::             How to change how the CMS is created.
5839 * Esoteric Options::        Doing things one usually do not want to do.
5840
5841 \1f
5842 File: gnupg.info,  Node: Configuration Options,  Next: Certificate Options,  Up: GPGSM Options
5843
5844 5.2.1 How to change the configuration
5845 -------------------------------------
5846
5847 These options are used to change the configuration and are usually found
5848 in the option file.
5849
5850 '--options FILE'
5851      Reads configuration from FILE instead of from the default per-user
5852      configuration file.  The default configuration file is named
5853      'gpgsm.conf' and expected in the '.gnupg' directory directly below
5854      the home directory of the user.
5855
5856 '--homedir DIR'
5857      Set the name of the home directory to DIR.  If this option is not
5858      used, the home directory defaults to '~/.gnupg'.  It is only
5859      recognized when given on the command line.  It also overrides any
5860      home directory stated through the environment variable 'GNUPGHOME'
5861      or (on Windows systems) by means of the Registry entry
5862      HKCU\SOFTWARE\GNU\GNUPG:HOMEDIR.
5863
5864      On Windows systems it is possible to install GnuPG as a portable
5865      application.  In this case only this command line option is
5866      considered, all other ways to set a home directory are ignored.
5867
5868      To install GnuPG as a portable application under Windows, create an
5869      empty file named 'gpgconf.ctl' in the same directory as the tool
5870      'gpgconf.exe'.  The root of the installation is then that
5871      directory; or, if 'gpgconf.exe' has been installed directly below a
5872      directory named 'bin', its parent directory.  You also need to make
5873      sure that the following directories exist and are writable:
5874      'ROOT/home' for the GnuPG home and 'ROOT/usr/local/var/cache/gnupg'
5875      for internal cache files.
5876
5877 '-v'
5878 '--verbose'
5879      Outputs additional information while running.  You can increase the
5880      verbosity by giving several verbose commands to 'gpgsm', such as
5881      '-vv'.
5882
5883 '--policy-file FILENAME'
5884      Change the default name of the policy file to FILENAME.
5885
5886 '--agent-program FILE'
5887      Specify an agent program to be used for secret key operations.  The
5888      default value is determined by running the command 'gpgconf'.  Note
5889      that the pipe symbol ('|') is used for a regression test suite hack
5890      and may thus not be used in the file name.
5891
5892 '--dirmngr-program FILE'
5893      Specify a dirmngr program to be used for CRL checks.  The default
5894      value is '/usr/local/bin/dirmngr'.
5895
5896 '--prefer-system-dirmngr'
5897      If a system wide 'dirmngr' is running in daemon mode, first try to
5898      connect to this one.  Fallback to a pipe based server if this does
5899      not work.  Under Windows this option is ignored because the system
5900      dirmngr is always used.
5901
5902 '--disable-dirmngr'
5903      Entirely disable the use of the Dirmngr.
5904
5905 '--no-autostart'
5906      Do not start the gpg-agent or the dirmngr if it has not yet been
5907      started and its service is required.  This option is mostly useful
5908      on machines where the connection to gpg-agent has been redirected
5909      to another machines.  If dirmngr is required on the remote machine,
5910      it may be started manually using 'gpgconf --launch dirmngr'.
5911
5912 '--no-secmem-warning'
5913      Do not print a warning when the so called "secure memory" cannot be
5914      used.
5915
5916 '--log-file FILE'
5917      When running in server mode, append all logging output to FILE.
5918      Use 'socket://' to log to socket.
5919
5920 \1f
5921 File: gnupg.info,  Node: Certificate Options,  Next: Input and Output,  Prev: Configuration Options,  Up: GPGSM Options
5922
5923 5.2.2 Certificate related options
5924 ---------------------------------
5925
5926 '--enable-policy-checks'
5927 '--disable-policy-checks'
5928      By default policy checks are enabled.  These options may be used to
5929      change it.
5930
5931 '--enable-crl-checks'
5932 '--disable-crl-checks'
5933      By default the CRL checks are enabled and the DirMngr is used to
5934      check for revoked certificates.  The disable option is most useful
5935      with an off-line network connection to suppress this check.
5936
5937 '--enable-trusted-cert-crl-check'
5938 '--disable-trusted-cert-crl-check'
5939      By default the CRL for trusted root certificates are checked like
5940      for any other certificates.  This allows a CA to revoke its own
5941      certificates voluntary without the need of putting all ever issued
5942      certificates into a CRL. The disable option may be used to switch
5943      this extra check off.  Due to the caching done by the Dirmngr,
5944      there will not be any noticeable performance gain.  Note, that this
5945      also disables possible OCSP checks for trusted root certificates.
5946      A more specific way of disabling this check is by adding the
5947      "relax" keyword to the root CA line of the 'trustlist.txt'
5948
5949 '--force-crl-refresh'
5950      Tell the dirmngr to reload the CRL for each request.  For better
5951      performance, the dirmngr will actually optimize this by suppressing
5952      the loading for short time intervals (e.g.  30 minutes).  This
5953      option is useful to make sure that a fresh CRL is available for
5954      certificates hold in the keybox.  The suggested way of doing this
5955      is by using it along with the option '--with-validation' for a key
5956      listing command.  This option should not be used in a configuration
5957      file.
5958
5959 '--enable-ocsp'
5960 '--disable-ocsp'
5961      By default OCSP checks are disabled.  The enable option may be used
5962      to enable OCSP checks via Dirmngr.  If CRL checks are also enabled,
5963      CRLs will be used as a fallback if for some reason an OCSP request
5964      will not succeed.  Note, that you have to allow OCSP requests in
5965      Dirmngr's configuration too (option '--allow-ocsp') and configure
5966      Dirmngr properly.  If you do not do so you will get the error code
5967      'Not supported'.
5968
5969 '--auto-issuer-key-retrieve'
5970      If a required certificate is missing while validating the chain of
5971      certificates, try to load that certificate from an external
5972      location.  This usually means that Dirmngr is employed to search
5973      for the certificate.  Note that this option makes a "web bug" like
5974      behavior possible.  LDAP server operators can see which keys you
5975      request, so by sending you a message signed by a brand new key
5976      (which you naturally will not have on your local keybox), the
5977      operator can tell both your IP address and the time when you
5978      verified the signature.
5979
5980 '--validation-model NAME'
5981      This option changes the default validation model.  The only
5982      possible values are "shell" (which is the default), "chain" which
5983      forces the use of the chain model and "steed" for a new simplified
5984      model.  The chain model is also used if an option in the
5985      'trustlist.txt' or an attribute of the certificate requests it.
5986      However the standard model (shell) is in that case always tried
5987      first.
5988
5989 '--ignore-cert-extension OID'
5990      Add OID to the list of ignored certificate extensions.  The OID is
5991      expected to be in dotted decimal form, like '2.5.29.3'.  This
5992      option may be used more than once.  Critical flagged certificate
5993      extensions matching one of the OIDs in the list are treated as if
5994      they are actually handled and thus the certificate will not be
5995      rejected due to an unknown critical extension.  Use this option
5996      with care because extensions are usually flagged as critical for a
5997      reason.
5998
5999 \1f
6000 File: gnupg.info,  Node: Input and Output,  Next: CMS Options,  Prev: Certificate Options,  Up: GPGSM Options
6001
6002 5.2.3 Input and Output
6003 ----------------------
6004
6005 '--armor'
6006 '-a'
6007      Create PEM encoded output.  Default is binary output.
6008
6009 '--base64'
6010      Create Base-64 encoded output; i.e.  PEM without the header lines.
6011
6012 '--assume-armor'
6013      Assume the input data is PEM encoded.  Default is to autodetect the
6014      encoding but this is may fail.
6015
6016 '--assume-base64'
6017      Assume the input data is plain base-64 encoded.
6018
6019 '--assume-binary'
6020      Assume the input data is binary encoded.
6021
6022 '--p12-charset NAME'
6023      'gpgsm' uses the UTF-8 encoding when encoding passphrases for
6024      PKCS#12 files.  This option may be used to force the passphrase to
6025      be encoded in the specified encoding NAME.  This is useful if the
6026      application used to import the key uses a different encoding and
6027      thus will not be able to import a file generated by 'gpgsm'.
6028      Commonly used values for NAME are 'Latin1' and 'CP850'.  Note that
6029      'gpgsm' itself automagically imports any file with a passphrase
6030      encoded to the most commonly used encodings.
6031
6032 '--default-key USER_ID'
6033      Use USER_ID as the standard key for signing.  This key is used if
6034      no other key has been defined as a signing key.  Note, that the
6035      first '--local-users' option also sets this key if it has not yet
6036      been set; however '--default-key' always overrides this.
6037
6038 '--local-user USER_ID'
6039 '-u USER_ID'
6040      Set the user(s) to be used for signing.  The default is the first
6041      secret key found in the database.
6042
6043 '--recipient NAME'
6044 '-r'
6045      Encrypt to the user id NAME.  There are several ways a user id may
6046      be given (*note how-to-specify-a-user-id::).
6047
6048 '--output FILE'
6049 '-o FILE'
6050      Write output to FILE.  The default is to write it to stdout.
6051
6052 '--with-key-data'
6053      Displays extra information with the '--list-keys' commands.
6054      Especially a line tagged 'grp' is printed which tells you the
6055      keygrip of a key.  This string is for example used as the file name
6056      of the secret key.
6057
6058 '--with-validation'
6059      When doing a key listing, do a full validation check for each key
6060      and print the result.  This is usually a slow operation because it
6061      requires a CRL lookup and other operations.
6062
6063      When used along with '--import', a validation of the certificate to
6064      import is done and only imported if it succeeds the test.  Note
6065      that this does not affect an already available certificate in the
6066      DB. This option is therefore useful to simply verify a certificate.
6067
6068 '--with-md5-fingerprint'
6069      For standard key listings, also print the MD5 fingerprint of the
6070      certificate.
6071
6072 '--with-keygrip'
6073      Include the keygrip in standard key listings.  Note that the
6074      keygrip is always listed in '--with-colons' mode.
6075
6076 '--with-secret'
6077      Include info about the presence of a secret key in public key
6078      listings done with '--with-colons'.
6079
6080 \1f
6081 File: gnupg.info,  Node: CMS Options,  Next: Esoteric Options,  Prev: Input and Output,  Up: GPGSM Options
6082
6083 5.2.4 How to change how the CMS is created
6084 ------------------------------------------
6085
6086 '--include-certs N'
6087      Using N of -2 includes all certificate except for the root cert, -1
6088      includes all certs, 0 does not include any certs, 1 includes only
6089      the signers cert and all other positive values include up to N
6090      certificates starting with the signer cert.  The default is -2.
6091
6092 '--cipher-algo OID'
6093      Use the cipher algorithm with the ASN.1 object identifier OID for
6094      encryption.  For convenience the strings '3DES', 'AES' and 'AES256'
6095      may be used instead of their OIDs.  The default is 'AES'
6096      (2.16.840.1.101.3.4.1.2).
6097
6098 '--digest-algo name'
6099      Use 'name' as the message digest algorithm.  Usually this algorithm
6100      is deduced from the respective signing certificate.  This option
6101      forces the use of the given algorithm and may lead to severe
6102      interoperability problems.
6103
6104 \1f
6105 File: gnupg.info,  Node: Esoteric Options,  Prev: CMS Options,  Up: GPGSM Options
6106
6107 5.2.5 Doing things one usually do not want to do
6108 ------------------------------------------------
6109
6110 '--extra-digest-algo NAME'
6111      Sometimes signatures are broken in that they announce a different
6112      digest algorithm than actually used.  'gpgsm' uses a one-pass data
6113      processing model and thus needs to rely on the announced digest
6114      algorithms to properly hash the data.  As a workaround this option
6115      may be used to tell 'gpgsm' to also hash the data using the
6116      algorithm NAME; this slows processing down a little bit but allows
6117      verification of such broken signatures.  If 'gpgsm' prints an error
6118      like "digest algo 8 has not been enabled" you may want to try this
6119      option, with 'SHA256' for NAME.
6120
6121 '--faked-system-time EPOCH'
6122      This option is only useful for testing; it sets the system time
6123      back or forth to EPOCH which is the number of seconds elapsed since
6124      the year 1970.  Alternatively EPOCH may be given as a full ISO time
6125      string (e.g.  "20070924T154812").
6126
6127 '--with-ephemeral-keys'
6128      Include ephemeral flagged keys in the output of key listings.  Note
6129      that they are included anyway if the key specification for a
6130      listing is given as fingerprint or keygrip.
6131
6132 '--debug-level LEVEL'
6133      Select the debug level for investigating problems.  LEVEL may be a
6134      numeric value or by a keyword:
6135
6136      'none'
6137           No debugging at all.  A value of less than 1 may be used
6138           instead of the keyword.
6139      'basic'
6140           Some basic debug messages.  A value between 1 and 2 may be
6141           used instead of the keyword.
6142      'advanced'
6143           More verbose debug messages.  A value between 3 and 5 may be
6144           used instead of the keyword.
6145      'expert'
6146           Even more detailed messages.  A value between 6 and 8 may be
6147           used instead of the keyword.
6148      'guru'
6149           All of the debug messages you can get.  A value greater than 8
6150           may be used instead of the keyword.  The creation of hash
6151           tracing files is only enabled if the keyword is used.
6152
6153      How these messages are mapped to the actual debugging flags is not
6154      specified and may change with newer releases of this program.  They
6155      are however carefully selected to best aid in debugging.
6156
6157 '--debug FLAGS'
6158      This option is only useful for debugging and the behaviour may
6159      change at any time without notice; using '--debug-levels' is the
6160      preferred method to select the debug verbosity.  FLAGS are bit
6161      encoded and may be given in usual C-Syntax.  The currently defined
6162      bits are:
6163
6164      '0 (1)'
6165           X.509 or OpenPGP protocol related data
6166      '1 (2)'
6167           values of big number integers
6168      '2 (4)'
6169           low level crypto operations
6170      '5 (32)'
6171           memory allocation
6172      '6 (64)'
6173           caching
6174      '7 (128)'
6175           show memory statistics
6176      '9 (512)'
6177           write hashed data to files named 'dbgmd-000*'
6178      '10 (1024)'
6179           trace Assuan protocol
6180
6181      Note, that all flags set using this option may get overridden by
6182      '--debug-level'.
6183
6184 '--debug-all'
6185      Same as '--debug=0xffffffff'
6186
6187 '--debug-allow-core-dump'
6188      Usually 'gpgsm' tries to avoid dumping core by well written code
6189      and by disabling core dumps for security reasons.  However, bugs
6190      are pretty durable beasts and to squash them it is sometimes useful
6191      to have a core dump.  This option enables core dumps unless the Bad
6192      Thing happened before the option parsing.
6193
6194 '--debug-no-chain-validation'
6195      This is actually not a debugging option but only useful as such.
6196      It lets 'gpgsm' bypass all certificate chain validation checks.
6197
6198 '--debug-ignore-expiration'
6199      This is actually not a debugging option but only useful as such.
6200      It lets 'gpgsm' ignore all notAfter dates, this is used by the
6201      regression tests.
6202
6203 '--passphrase-fd n'
6204      Read the passphrase from file descriptor 'n'.  Only the first line
6205      will be read from file descriptor 'n'.  If you use 0 for 'n', the
6206      passphrase will be read from STDIN. This can only be used if only
6207      one passphrase is supplied.
6208
6209      Note that this passphrase is only used if the option '--batch' has
6210      also been given.
6211
6212 '--pinentry-mode mode'
6213      Set the pinentry mode to 'mode'.  Allowed values for 'mode' are:
6214      default
6215           Use the default of the agent, which is 'ask'.
6216      ask
6217           Force the use of the Pinentry.
6218      cancel
6219           Emulate use of Pinentry's cancel button.
6220      error
6221           Return a Pinentry error ("No Pinentry").
6222      loopback
6223           Redirect Pinentry queries to the caller.  Note that in
6224           contrast to Pinentry the user is not prompted again if he
6225           enters a bad password.
6226
6227 '--no-common-certs-import'
6228      Suppress the import of common certificates on keybox creation.
6229
6230    All the long options may also be given in the configuration file
6231 after stripping off the two leading dashes.
6232
6233 \1f
6234 File: gnupg.info,  Node: GPGSM Configuration,  Next: GPGSM Examples,  Prev: GPGSM Options,  Up: Invoking GPGSM
6235
6236 5.3 Configuration files
6237 =======================
6238
6239 There are a few configuration files to control certain aspects of
6240 'gpgsm''s operation.  Unless noted, they are expected in the current
6241 home directory (*note option --homedir::).
6242
6243 'gpgsm.conf'
6244      This is the standard configuration file read by 'gpgsm' on startup.
6245      It may contain any valid long option; the leading two dashes may
6246      not be entered and the option may not be abbreviated.  This default
6247      name may be changed on the command line (*note gpgsm-option
6248      --options::).  You should backup this file.
6249
6250 'policies.txt'
6251      This is a list of allowed CA policies.  This file should list the
6252      object identifiers of the policies line by line.  Empty lines and
6253      lines starting with a hash mark are ignored.  Policies missing in
6254      this file and not marked as critical in the certificate will print
6255      only a warning; certificates with policies marked as critical and
6256      not listed in this file will fail the signature verification.  You
6257      should backup this file.
6258
6259      For example, to allow only the policy 2.289.9.9, the file should
6260      look like this:
6261
6262           # Allowed policies
6263           2.289.9.9
6264
6265 'qualified.txt'
6266      This is the list of root certificates used for qualified
6267      certificates.  They are defined as certificates capable of creating
6268      legally binding signatures in the same way as handwritten
6269      signatures are.  Comments start with a hash mark and empty lines
6270      are ignored.  Lines do have a length limit but this is not a
6271      serious limitation as the format of the entries is fixed and
6272      checked by 'gpgsm': A non-comment line starts with optional
6273      whitespace, followed by exactly 40 hex characters, white space and
6274      a lowercased 2 letter country code.  Additional data delimited with
6275      by a white space is current ignored but might late be used for
6276      other purposes.
6277
6278      Note that even if a certificate is listed in this file, this does
6279      not mean that the certificate is trusted; in general the
6280      certificates listed in this file need to be listed also in
6281      'trustlist.txt'.
6282
6283      This is a global file an installed in the data directory (e.g.
6284      '/usr/local/share/gnupg/qualified.txt').  GnuPG installs a suitable
6285      file with root certificates as used in Germany.  As new Root-CA
6286      certificates may be issued over time, these entries may need to be
6287      updated; new distributions of this software should come with an
6288      updated list but it is still the responsibility of the
6289      Administrator to check that this list is correct.
6290
6291      Every time 'gpgsm' uses a certificate for signing or verification
6292      this file will be consulted to check whether the certificate under
6293      question has ultimately been issued by one of these CAs.  If this
6294      is the case the user will be informed that the verified signature
6295      represents a legally binding ("qualified") signature.  When
6296      creating a signature using such a certificate an extra prompt will
6297      be issued to let the user confirm that such a legally binding
6298      signature shall really be created.
6299
6300      Because this software has not yet been approved for use with such
6301      certificates, appropriate notices will be shown to indicate this
6302      fact.
6303
6304 'help.txt'
6305      This is plain text file with a few help entries used with
6306      'pinentry' as well as a large list of help items for 'gpg' and
6307      'gpgsm'.  The standard file has English help texts; to install
6308      localized versions use filenames like 'help.LL.txt' with LL
6309      denoting the locale.  GnuPG comes with a set of predefined help
6310      files in the data directory (e.g.
6311      '/usr/local/share/gnupg/gnupg/help.de.txt') and allows overriding
6312      of any help item by help files stored in the system configuration
6313      directory (e.g.  '/etc/gnupg/help.de.txt').  For a reference of the
6314      help file's syntax, please see the installed 'help.txt' file.
6315
6316 'com-certs.pem'
6317      This file is a collection of common certificates used to populated
6318      a newly created 'pubring.kbx'.  An administrator may replace this
6319      file with a custom one.  The format is a concatenation of PEM
6320      encoded X.509 certificates.  This global file is installed in the
6321      data directory (e.g.  '/usr/local/share/gnupg/com-certs.pem').
6322
6323    Note that on larger installations, it is useful to put predefined
6324 files into the directory '/etc/skel/.gnupg/' so that newly created users
6325 start up with a working configuration.  For existing users a small
6326 helper script is provided to create these files (*note addgnupghome::).
6327
6328    For internal purposes 'gpgsm' creates and maintains a few other
6329 files; they all live in in the current home directory (*note option
6330 --homedir::).  Only 'gpgsm' may modify these files.
6331
6332 'pubring.kbx'
6333      This a database file storing the certificates as well as meta
6334      information.  For debugging purposes the tool 'kbxutil' may be used
6335      to show the internal structure of this file.  You should backup
6336      this file.
6337
6338 'random_seed'
6339      This content of this file is used to maintain the internal state of
6340      the random number generator across invocations.  The same file is
6341      used by other programs of this software too.
6342
6343 'S.gpg-agent'
6344      If this file exists 'gpgsm' will first try to connect to this
6345      socket for accessing 'gpg-agent' before starting a new 'gpg-agent'
6346      instance.  Under Windows this socket (which in reality be a plain
6347      file describing a regular TCP listening port) is the standard way
6348      of connecting the 'gpg-agent'.
6349
6350 \1f
6351 File: gnupg.info,  Node: GPGSM Examples,  Next: Unattended Usage,  Prev: GPGSM Configuration,  Up: Invoking GPGSM
6352
6353 5.4 Examples
6354 ============
6355
6356      $ gpgsm -er goo@bar.net <plaintext >ciphertext
6357
6358 \1f
6359 File: gnupg.info,  Node: Unattended Usage,  Next: GPGSM Protocol,  Prev: GPGSM Examples,  Up: Invoking GPGSM
6360
6361 5.5 Unattended Usage
6362 ====================
6363
6364 'gpgsm' is often used as a backend engine by other software.  To help
6365 with this a machine interface has been defined to have an unambiguous
6366 way to do this.  This is most likely used with the '--server' command
6367 but may also be used in the standard operation mode by using the
6368 '--status-fd' option.
6369
6370 * Menu:
6371
6372 * Automated signature checking::  Automated signature checking.
6373 * CSR and certificate creation::  CSR and certificate creation.
6374
6375 \1f
6376 File: gnupg.info,  Node: Automated signature checking,  Next: CSR and certificate creation,  Up: Unattended Usage
6377
6378 5.5.1 Automated signature checking
6379 ----------------------------------
6380
6381 It is very important to understand the semantics used with signature
6382 verification.  Checking a signature is not as simple as it may sound and
6383 so the operation is a bit complicated.  In most cases it is required to
6384 look at several status lines.  Here is a table of all cases a signed
6385 message may have:
6386
6387 The signature is valid
6388      This does mean that the signature has been successfully verified,
6389      the certificates are all sane.  However there are two subcases with
6390      important information: One of the certificates may have expired or
6391      a signature of a message itself as expired.  It is a sound practise
6392      to consider such a signature still as valid but additional
6393      information should be displayed.  Depending on the subcase 'gpgsm'
6394      will issue these status codes:
6395      signature valid and nothing did expire
6396           'GOODSIG', 'VALIDSIG', 'TRUST_FULLY'
6397      signature valid but at least one certificate has expired
6398           'EXPKEYSIG', 'VALIDSIG', 'TRUST_FULLY'
6399      signature valid but expired
6400           'EXPSIG', 'VALIDSIG', 'TRUST_FULLY' Note, that this case is
6401           currently not implemented.
6402
6403 The signature is invalid
6404      This means that the signature verification failed (this is an
6405      indication of a transfer error, a program error or tampering with
6406      the message).  'gpgsm' issues one of these status codes sequences:
6407      'BADSIG'
6408      'GOODSIG, VALIDSIG TRUST_NEVER'
6409
6410 Error verifying a signature
6411      For some reason the signature could not be verified, i.e.  it
6412      cannot be decided whether the signature is valid or invalid.  A
6413      common reason for this is a missing certificate.
6414
6415 \1f
6416 File: gnupg.info,  Node: CSR and certificate creation,  Prev: Automated signature checking,  Up: Unattended Usage
6417
6418 5.5.2 CSR and certificate creation
6419 ----------------------------------
6420
6421 The command '--generate-key' may be used along with the option '--batch'
6422 to either create a certificate signing request (CSR) or an X.509
6423 certificate.  This is controlled by a parameter file; the format of this
6424 file is as follows:
6425
6426    * Text only, line length is limited to about 1000 characters.
6427    * UTF-8 encoding must be used to specify non-ASCII characters.
6428    * Empty lines are ignored.
6429    * Leading and trailing while space is ignored.
6430    * A hash sign as the first non white space character indicates a
6431      comment line.
6432    * Control statements are indicated by a leading percent sign, the
6433      arguments are separated by white space from the keyword.
6434    * Parameters are specified by a keyword, followed by a colon.
6435      Arguments are separated by white space.
6436    * The first parameter must be 'Key-Type', control statements may be
6437      placed anywhere.
6438    * The order of the parameters does not matter except for 'Key-Type'
6439      which must be the first parameter.  The parameters are only used
6440      for the generated CSR/certificate; parameters from previous sets
6441      are not used.  Some syntactically checks may be performed.
6442    * Key generation takes place when either the end of the parameter
6443      file is reached, the next 'Key-Type' parameter is encountered or at
6444      the control statement '%commit' is encountered.
6445
6446 Control statements:
6447
6448 %echo TEXT
6449      Print TEXT as diagnostic.
6450
6451 %dry-run
6452      Suppress actual key generation (useful for syntax checking).
6453
6454 %commit
6455      Perform the key generation.  Note that an implicit commit is done
6456      at the next Key-Type parameter.
6457
6458 General Parameters:
6459
6460 Key-Type: ALGO
6461      Starts a new parameter block by giving the type of the primary key.
6462      The algorithm must be capable of signing.  This is a required
6463      parameter.  The only supported value for ALGO is 'rsa'.
6464
6465 Key-Length: NBITS
6466      The requested length of a generated key in bits.  Defaults to 2048.
6467
6468 Key-Grip: HEXSTRING
6469      This is optional and used to generate a CSR or certificate for an
6470      already existing key.  Key-Length will be ignored when given.
6471
6472 Key-Usage: USAGE-LIST
6473      Space or comma delimited list of key usage, allowed values are
6474      'encrypt', 'sign' and 'cert'.  This is used to generate the
6475      keyUsage extension.  Please make sure that the algorithm is capable
6476      of this usage.  Default is to allow encrypt and sign.
6477
6478 Name-DN: SUBJECT-NAME
6479      This is the Distinguished Name (DN) of the subject in RFC-2253
6480      format.
6481
6482 Name-Email: STRING
6483      This is an email address for the altSubjectName.  This parameter is
6484      optional but may occur several times to add several email addresses
6485      to a certificate.
6486
6487 Name-DNS: STRING
6488      The is an DNS name for the altSubjectName.  This parameter is
6489      optional but may occur several times to add several DNS names to a
6490      certificate.
6491
6492 Name-URI: STRING
6493      This is an URI for the altSubjectName.  This parameter is optional
6494      but may occur several times to add several URIs to a certificate.
6495
6496 Additional parameters used to create a certificate (in contrast to a
6497 certificate signing request):
6498
6499 Serial: SN
6500      If this parameter is given an X.509 certificate will be generated.
6501      SN is expected to be a hex string representing an unsigned integer
6502      of arbitrary length.  The special value 'random' can be used to
6503      create a 64 bit random serial number.
6504
6505 Issuer-DN: ISSUER-NAME
6506      This is the DN name of the issuer in RFC-2253 format.  If it is not
6507      set it will default to the subject DN and a special GnuPG extension
6508      will be included in the certificate to mark it as a standalone
6509      certificate.
6510
6511 Creation-Date: ISO-DATE
6512 Not-Before: ISO-DATE
6513      Set the notBefore date of the certificate.  Either a date like
6514      '1986-04-26' or '1986-04-26 12:00' or a standard ISO timestamp like
6515      '19860426T042640' may be used.  The time is considered to be UTC.
6516      If it is not given the current date is used.
6517
6518 Expire-Date: ISO-DATE
6519 Not-After: ISO-DATE
6520      Set the notAfter date of the certificate.  Either a date like
6521      '2063-04-05' or '2063-04-05 17:00' or a standard ISO timestamp like
6522      '20630405T170000' may be used.  The time is considered to be UTC.
6523      If it is not given a default value in the not too far future is
6524      used.
6525
6526 Signing-Key: KEYGRIP
6527      This gives the keygrip of the key used to sign the certificate.  If
6528      it is not given a self-signed certificate will be created.  For
6529      compatibility with future versions, it is suggested to prefix the
6530      keygrip with a '&'.
6531
6532 Hash-Algo: HASH-ALGO
6533      Use HASH-ALGO for this CSR or certificate.  The supported hash
6534      algorithms are: 'sha1', 'sha256', 'sha384' and 'sha512'; they may
6535      also be specified with uppercase letters.  The default is 'sha256'.
6536
6537 \1f
6538 File: gnupg.info,  Node: GPGSM Protocol,  Prev: Unattended Usage,  Up: Invoking GPGSM
6539
6540 5.6 The Protocol the Server Mode Uses
6541 =====================================
6542
6543 Description of the protocol used to access 'GPGSM'.  'GPGSM' does
6544 implement the Assuan protocol and in addition provides a regular command
6545 line interface which exhibits a full client to this protocol (but uses
6546 internal linking).  To start 'gpgsm' as a server the command line the
6547 option '--server' must be used.  Additional options are provided to
6548 select the communication method (i.e.  the name of the socket).
6549
6550    We assume that the connection has already been established; see the
6551 Assuan manual for details.
6552
6553 * Menu:
6554
6555 * GPGSM ENCRYPT::         Encrypting a message.
6556 * GPGSM DECRYPT::         Decrypting a message.
6557 * GPGSM SIGN::            Signing a message.
6558 * GPGSM VERIFY::          Verifying a message.
6559 * GPGSM GENKEY::          Generating a key.
6560 * GPGSM LISTKEYS::        List available keys.
6561 * GPGSM EXPORT::          Export certificates.
6562 * GPGSM IMPORT::          Import certificates.
6563 * GPGSM DELETE::          Delete certificates.
6564 * GPGSM GETAUDITLOG::     Retrieve an audit log.
6565 * GPGSM GETINFO::         Information about the process
6566 * GPGSM OPTION::          Session options.
6567
6568 \1f
6569 File: gnupg.info,  Node: GPGSM ENCRYPT,  Next: GPGSM DECRYPT,  Up: GPGSM Protocol
6570
6571 5.6.1 Encrypting a Message
6572 --------------------------
6573
6574 Before encryption can be done the recipient must be set using the
6575 command:
6576
6577        RECIPIENT USERID
6578
6579    Set the recipient for the encryption.  USERID should be the internal
6580 representation of the key; the server may accept any other way of
6581 specification.  If this is a valid and trusted recipient the server does
6582 respond with OK, otherwise the return is an ERR with the reason why the
6583 recipient cannot be used, the encryption will then not be done for this
6584 recipient.  If the policy is not to encrypt at all if not all recipients
6585 are valid, the client has to take care of this.  All 'RECIPIENT'
6586 commands are cumulative until a 'RESET' or an successful 'ENCRYPT'
6587 command.
6588
6589        INPUT FD[=N] [--armor|--base64|--binary]
6590
6591    Set the file descriptor for the message to be encrypted to N.
6592 Obviously the pipe must be open at that point, the server establishes
6593 its own end.  If the server returns an error the client should consider
6594 this session failed.  If N is not given, this commands uses the last
6595 file descriptor passed to the application.  *Note the assuan_sendfd
6596 function: (assuan)fun-assuan_sendfd, on how to do descriptor passing.
6597
6598    The '--armor' option may be used to advice the server that the input
6599 data is in PEM format, '--base64' advices that a raw base-64 encoding is
6600 used, '--binary' advices of raw binary input (BER).  If none of these
6601 options is used, the server tries to figure out the used encoding, but
6602 this may not always be correct.
6603
6604        OUTPUT FD[=N] [--armor|--base64]
6605
6606    Set the file descriptor to be used for the output (i.e.  the
6607 encrypted message).  Obviously the pipe must be open at that point, the
6608 server establishes its own end.  If the server returns an error the
6609 client should consider this session failed.
6610
6611    The option '--armor' encodes the output in PEM format, the '--base64'
6612 option applies just a base-64 encoding.  No option creates binary output
6613 (BER).
6614
6615    The actual encryption is done using the command
6616
6617        ENCRYPT
6618
6619    It takes the plaintext from the 'INPUT' command, writes to the
6620 ciphertext to the file descriptor set with the 'OUTPUT' command, take
6621 the recipients from all the recipients set so far.  If this command
6622 fails the clients should try to delete all output currently done or
6623 otherwise mark it as invalid.  'GPGSM' does ensure that there will not
6624 be any security problem with leftover data on the output in this case.
6625
6626    This command should in general not fail, as all necessary checks have
6627 been done while setting the recipients.  The input and output pipes are
6628 closed.
6629
6630 \1f
6631 File: gnupg.info,  Node: GPGSM DECRYPT,  Next: GPGSM SIGN,  Prev: GPGSM ENCRYPT,  Up: GPGSM Protocol
6632
6633 5.6.2 Decrypting a message
6634 --------------------------
6635
6636 Input and output FDs are set the same way as in encryption, but 'INPUT'
6637 refers to the ciphertext and 'OUTPUT' to the plaintext.  There is no
6638 need to set recipients.  'GPGSM' automatically strips any S/MIME headers
6639 from the input, so it is valid to pass an entire MIME part to the INPUT
6640 pipe.
6641
6642    The decryption is done by using the command
6643
6644        DECRYPT
6645
6646    It performs the decrypt operation after doing some check on the
6647 internal state (e.g.  that all needed data has been set).  Because it
6648 utilizes the GPG-Agent for the session key decryption, there is no need
6649 to ask the client for a protecting passphrase - GpgAgent takes care of
6650 this by requesting this from the user.
6651
6652 \1f
6653 File: gnupg.info,  Node: GPGSM SIGN,  Next: GPGSM VERIFY,  Prev: GPGSM DECRYPT,  Up: GPGSM Protocol
6654
6655 5.6.3 Signing a Message
6656 -----------------------
6657
6658 Signing is usually done with these commands:
6659
6660        INPUT FD[=N] [--armor|--base64|--binary]
6661
6662    This tells 'GPGSM' to read the data to sign from file descriptor N.
6663
6664        OUTPUT FD[=M] [--armor|--base64]
6665
6666    Write the output to file descriptor M.  If a detached signature is
6667 requested, only the signature is written.
6668
6669        SIGN [--detached]
6670
6671    Sign the data set with the 'INPUT' command and write it to the sink
6672 set by 'OUTPUT'.  With '--detached', a detached signature is created
6673 (surprise).
6674
6675    The key used for signing is the default one or the one specified in
6676 the configuration file.  To get finer control over the keys, it is
6677 possible to use the command
6678
6679        SIGNER USERID
6680
6681    to set the signer's key.  USERID should be the internal
6682 representation of the key; the server may accept any other way of
6683 specification.  If this is a valid and trusted recipient the server does
6684 respond with OK, otherwise the return is an ERR with the reason why the
6685 key cannot be used, the signature will then not be created using this
6686 key.  If the policy is not to sign at all if not all keys are valid, the
6687 client has to take care of this.  All 'SIGNER' commands are cumulative
6688 until a 'RESET' is done.  Note that a 'SIGN' does not reset this list of
6689 signers which is in contrast to the 'RECIPIENT' command.
6690
6691 \1f
6692 File: gnupg.info,  Node: GPGSM VERIFY,  Next: GPGSM GENKEY,  Prev: GPGSM SIGN,  Up: GPGSM Protocol
6693
6694 5.6.4 Verifying a Message
6695 -------------------------
6696
6697 To verify a message the command:
6698
6699        VERIFY
6700
6701    is used.  It does a verify operation on the message send to the input
6702 FD. The result is written out using status lines.  If an output FD was
6703 given, the signed text will be written to that.  If the signature is a
6704 detached one, the server will inquire about the signed material and the
6705 client must provide it.
6706
6707 \1f
6708 File: gnupg.info,  Node: GPGSM GENKEY,  Next: GPGSM LISTKEYS,  Prev: GPGSM VERIFY,  Up: GPGSM Protocol
6709
6710 5.6.5 Generating a Key
6711 ----------------------
6712
6713 This is used to generate a new keypair, store the secret part in the PSE
6714 and the public key in the key database.  We will probably add optional
6715 commands to allow the client to select whether a hardware token is used
6716 to store the key.  Configuration options to 'GPGSM' can be used to
6717 restrict the use of this command.
6718
6719        GENKEY
6720
6721    'GPGSM' checks whether this command is allowed and then does an
6722 INQUIRY to get the key parameters, the client should then send the key
6723 parameters in the native format:
6724
6725          S: INQUIRE KEY_PARAM native
6726          C: D foo:fgfgfg
6727          C: D bar
6728          C: END
6729
6730    Please note that the server may send Status info lines while reading
6731 the data lines from the client.  After this the key generation takes
6732 place and the server eventually does send an ERR or OK response.  Status
6733 lines may be issued as a progress indicator.
6734
6735 \1f
6736 File: gnupg.info,  Node: GPGSM LISTKEYS,  Next: GPGSM EXPORT,  Prev: GPGSM GENKEY,  Up: GPGSM Protocol
6737
6738 5.6.6 List available keys
6739 -------------------------
6740
6741 To list the keys in the internal database or using an external key
6742 provider, the command:
6743
6744        LISTKEYS  PATTERN
6745
6746    is used.  To allow multiple patterns (which are ORed during the
6747 search) quoting is required: Spaces are to be translated into "+" or
6748 into "%20"; in turn this requires that the usual escape quoting rules
6749 are done.
6750
6751        LISTSECRETKEYS PATTERN
6752
6753    Lists only the keys where a secret key is available.
6754
6755    The list commands are affected by the option
6756
6757        OPTION list-mode=MODE
6758
6759    where mode may be:
6760 '0'
6761      Use default (which is usually the same as 1).
6762 '1'
6763      List only the internal keys.
6764 '2'
6765      List only the external keys.
6766 '3'
6767      List internal and external keys.
6768
6769    Note that options are valid for the entire session.
6770
6771 \1f
6772 File: gnupg.info,  Node: GPGSM EXPORT,  Next: GPGSM IMPORT,  Prev: GPGSM LISTKEYS,  Up: GPGSM Protocol
6773
6774 5.6.7 Export certificates
6775 -------------------------
6776
6777 To export certificate from the internal key database the command:
6778
6779        EXPORT [--data [--armor] [--base64]] [--] PATTERN
6780
6781    is used.  To allow multiple patterns (which are ORed) quoting is
6782 required: Spaces are to be translated into "+" or into "%20"; in turn
6783 this requires that the usual escape quoting rules are done.
6784
6785    If the '--data' option has not been given, the format of the output
6786 depends on what was set with the 'OUTPUT' command.  When using PEM
6787 encoding a few informational lines are prepended.
6788
6789    If the '--data' has been given, a target set via 'OUTPUT' is ignored
6790 and the data is returned inline using standard 'D'-lines.  This avoids
6791 the need for an extra file descriptor.  In this case the options
6792 '--armor' and '--base64' may be used in the same way as with the
6793 'OUTPUT' command.
6794
6795 \1f
6796 File: gnupg.info,  Node: GPGSM IMPORT,  Next: GPGSM DELETE,  Prev: GPGSM EXPORT,  Up: GPGSM Protocol
6797
6798 5.6.8 Import certificates
6799 -------------------------
6800
6801 To import certificates into the internal key database, the command
6802
6803        IMPORT [--re-import]
6804
6805    is used.  The data is expected on the file descriptor set with the
6806 'INPUT' command.  Certain checks are performed on the certificate.  Note
6807 that the code will also handle PKCS#12 files and import private keys; a
6808 helper program is used for that.
6809
6810    With the option '--re-import' the input data is expected to a be a
6811 linefeed separated list of fingerprints.  The command will re-import the
6812 corresponding certificates; that is they are made permanent by removing
6813 their ephemeral flag.
6814
6815 \1f
6816 File: gnupg.info,  Node: GPGSM DELETE,  Next: GPGSM GETAUDITLOG,  Prev: GPGSM IMPORT,  Up: GPGSM Protocol
6817
6818 5.6.9 Delete certificates
6819 -------------------------
6820
6821 To delete a certificate the command
6822
6823        DELKEYS PATTERN
6824
6825    is used.  To allow multiple patterns (which are ORed) quoting is
6826 required: Spaces are to be translated into "+" or into "%20"; in turn
6827 this requires that the usual escape quoting rules are done.
6828
6829    The certificates must be specified unambiguously otherwise an error
6830 is returned.
6831
6832 \1f
6833 File: gnupg.info,  Node: GPGSM GETAUDITLOG,  Next: GPGSM GETINFO,  Prev: GPGSM DELETE,  Up: GPGSM Protocol
6834
6835 5.6.10 Retrieve an audit log
6836 ----------------------------
6837
6838 This command is used to retrieve an audit log.
6839
6840      GETAUDITLOG [--data] [--html]
6841
6842    If '--data' is used, the audit log is send using D-lines instead of
6843 being sent to the file descriptor given by an 'OUTPUT' command.  If
6844 '--html' is used, the output is formatted as an XHTML block.  This is
6845 designed to be incorporated into a HTML document.
6846
6847 \1f
6848 File: gnupg.info,  Node: GPGSM GETINFO,  Next: GPGSM OPTION,  Prev: GPGSM GETAUDITLOG,  Up: GPGSM Protocol
6849
6850 5.6.11 Return information about the process
6851 -------------------------------------------
6852
6853 This is a multipurpose function to return a variety of information.
6854
6855      GETINFO WHAT
6856
6857    The value of WHAT specifies the kind of information returned:
6858 'version'
6859      Return the version of the program.
6860 'pid'
6861      Return the process id of the process.
6862 'agent-check'
6863      Return OK if the agent is running.
6864 'cmd_has_option CMD OPT'
6865      Return OK if the command CMD implements the option OPT.  The
6866      leading two dashes usually used with OPT shall not be given.
6867 'offline'
6868      Return OK if the connection is in offline mode.  This may be either
6869      due to a 'OPTION offline=1' or due to 'gpgsm' being started with
6870      option '--disable-dirmngr'.
6871
6872 \1f
6873 File: gnupg.info,  Node: GPGSM OPTION,  Prev: GPGSM GETINFO,  Up: GPGSM Protocol
6874
6875 5.6.12 Session options
6876 ----------------------
6877
6878 The standard Assuan option handler supports these options.
6879
6880      OPTION NAME[=VALUE]
6881
6882    These NAMEs are recognized:
6883
6884 'putenv'
6885      Change the session's environment to be passed via gpg-agent to
6886      Pinentry.  VALUE is a string of the form '<KEY>[=[<STRING>]]'.  If
6887      only '<KEY>' is given the environment variable '<KEY>' is removed
6888      from the session environment, if '<KEY>=' is given that environment
6889      variable is set to the empty string, and if '<STRING>' is given it
6890      is set to that string.
6891
6892 'display'
6893      Set the session environment variable 'DISPLAY' is set to VALUE.
6894 'ttyname'
6895      Set the session environment variable 'GPG_TTY' is set to VALUE.
6896 'ttytype'
6897      Set the session environment variable 'TERM' is set to VALUE.
6898 'lc-ctype'
6899      Set the session environment variable 'LC_CTYPE' is set to VALUE.
6900 'lc-messages'
6901      Set the session environment variable 'LC_MESSAGES' is set to VALUE.
6902 'xauthority'
6903      Set the session environment variable 'XAUTHORITY' is set to VALUE.
6904 'pinentry-user-data'
6905      Set the session environment variable 'PINENTRY_USER_DATA' is set to
6906      VALUE.
6907
6908 'include-certs'
6909      This option overrides the command line option '--include-certs'.  A
6910      VALUE of -2 includes all certificates except for the root
6911      certificate, -1 includes all certicates, 0 does not include any
6912      certicates, 1 includes only the signers certicate and all other
6913      positive values include up to VALUE certificates starting with the
6914      signer cert.
6915
6916 'list-mode'
6917      *Note gpgsm-cmd listkeys::.
6918
6919 'list-to-output'
6920      If VALUE is true the output of the list commands (*note gpgsm-cmd
6921      listkeys::) is written to the file descriptor set with the last
6922      'OUTPUT' command.  If VALUE is false the output is written via data
6923      lines; this is the default.
6924
6925 'with-validation'
6926      If VALUE is true for each listed certificate the validation status
6927      is printed.  This may result in the download of a CRL or the user
6928      being asked about the trustworthiness of a root certificate.  The
6929      default is given by a command line option (*note gpgsm-option
6930      --with-validation::).
6931
6932 'with-secret'
6933      If VALUE is true certificates with a corresponding private key are
6934      marked by the list commands.
6935
6936 'validation-model'
6937      This option overrides the command line option 'validation-model'
6938      for the session.  (*Note gpgsm-option --validation-model::.)
6939
6940 'with-key-data'
6941      This option globally enables the command line option
6942      '--with-key-data'.  (*Note gpgsm-option --with-key-data::.)
6943
6944 'enable-audit-log'
6945      If VALUE is true data to write an audit log is gathered.  (*Note
6946      gpgsm-cmd getauditlog::.)
6947
6948 'allow-pinentry-notify'
6949      If this option is used notifications about the launch of a Pinentry
6950      are passed back to the client.
6951
6952 'with-ephemeral-keys'
6953      If VALUE is true ephemeral certificates are included in the output
6954      of the list commands.
6955
6956 'no-encrypt-to'
6957      If this option is used all keys set by the command line option
6958      '--encrypt-to' are ignored.
6959
6960 'offline'
6961      If VALUE is true or VALUE is not given all network access is
6962      disabled for this session.  This is the same as the command line
6963      option '--disable-dirmngr'.
6964
6965 \1f
6966 File: gnupg.info,  Node: Invoking SCDAEMON,  Next: Specify a User ID,  Prev: Invoking GPGSM,  Up: Top
6967
6968 6 Invoking the SCDAEMON
6969 ***********************
6970
6971 The 'scdaemon' is a daemon to manage smartcards.  It is usually invoked
6972 by 'gpg-agent' and in general not used directly.
6973
6974    *Note Option Index::, for an index to 'scdaemon''s commands and
6975 options.
6976
6977 * Menu:
6978
6979 * Scdaemon Commands::      List of all commands.
6980 * Scdaemon Options::       List of all options.
6981 * Card applications::      Description of card applications.
6982 * Scdaemon Configuration:: Configuration files.
6983 * Scdaemon Examples::      Some usage examples.
6984 * Scdaemon Protocol::      The protocol the daemon uses.
6985
6986 \1f
6987 File: gnupg.info,  Node: Scdaemon Commands,  Next: Scdaemon Options,  Up: Invoking SCDAEMON
6988
6989 6.1 Commands
6990 ============
6991
6992 Commands are not distinguished from options except for the fact that
6993 only one command is allowed.
6994
6995 '--version'
6996      Print the program version and licensing information.  Note that you
6997      cannot abbreviate this command.
6998
6999 '--help, -h'
7000      Print a usage message summarizing the most useful command-line
7001      options.  Note that you cannot abbreviate this command.
7002
7003 '--dump-options'
7004      Print a list of all available options and commands.  Note that you
7005      cannot abbreviate this command.
7006
7007 '--server'
7008      Run in server mode and wait for commands on the 'stdin'.  The
7009      default mode is to create a socket and listen for commands there.
7010
7011 '--multi-server'
7012      Run in server mode and wait for commands on the 'stdin' as well as
7013      on an additional Unix Domain socket.  The server command 'GETINFO'
7014      may be used to get the name of that extra socket.
7015
7016 '--daemon'
7017      Run the program in the background.  This option is required to
7018      prevent it from being accidentally running in the background.
7019
7020 \1f
7021 File: gnupg.info,  Node: Scdaemon Options,  Next: Card applications,  Prev: Scdaemon Commands,  Up: Invoking SCDAEMON
7022
7023 6.2 Option Summary
7024 ==================
7025
7026 '--options FILE'
7027      Reads configuration from FILE instead of from the default per-user
7028      configuration file.  The default configuration file is named
7029      'scdaemon.conf' and expected in the '.gnupg' directory directly
7030      below the home directory of the user.
7031
7032 '--homedir DIR'
7033      Set the name of the home directory to DIR.  If this option is not
7034      used, the home directory defaults to '~/.gnupg'.  It is only
7035      recognized when given on the command line.  It also overrides any
7036      home directory stated through the environment variable 'GNUPGHOME'
7037      or (on Windows systems) by means of the Registry entry
7038      HKCU\SOFTWARE\GNU\GNUPG:HOMEDIR.
7039
7040      On Windows systems it is possible to install GnuPG as a portable
7041      application.  In this case only this command line option is
7042      considered, all other ways to set a home directory are ignored.
7043
7044      To install GnuPG as a portable application under Windows, create an
7045      empty file named 'gpgconf.ctl' in the same directory as the tool
7046      'gpgconf.exe'.  The root of the installation is then that
7047      directory; or, if 'gpgconf.exe' has been installed directly below a
7048      directory named 'bin', its parent directory.  You also need to make
7049      sure that the following directories exist and are writable:
7050      'ROOT/home' for the GnuPG home and 'ROOT/usr/local/var/cache/gnupg'
7051      for internal cache files.
7052
7053 '-v'
7054 '--verbose'
7055      Outputs additional information while running.  You can increase the
7056      verbosity by giving several verbose commands to 'gpgsm', such as
7057      '-vv'.
7058
7059 '--debug-level LEVEL'
7060      Select the debug level for investigating problems.  LEVEL may be a
7061      numeric value or a keyword:
7062
7063      'none'
7064           No debugging at all.  A value of less than 1 may be used
7065           instead of the keyword.
7066      'basic'
7067           Some basic debug messages.  A value between 1 and 2 may be
7068           used instead of the keyword.
7069      'advanced'
7070           More verbose debug messages.  A value between 3 and 5 may be
7071           used instead of the keyword.
7072      'expert'
7073           Even more detailed messages.  A value between 6 and 8 may be
7074           used instead of the keyword.
7075      'guru'
7076           All of the debug messages you can get.  A value greater than 8
7077           may be used instead of the keyword.  The creation of hash
7078           tracing files is only enabled if the keyword is used.
7079
7080      How these messages are mapped to the actual debugging flags is not
7081      specified and may change with newer releases of this program.  They
7082      are however carefully selected to best aid in debugging.
7083
7084           Note: All debugging options are subject to change and thus
7085           should not be used by any application program.  As the name
7086           says, they are only used as helpers to debug problems.
7087
7088 '--debug FLAGS'
7089      This option is only useful for debugging and the behavior may
7090      change at any time without notice.  FLAGS are bit encoded and may
7091      be given in usual C-Syntax.  The currently defined bits are:
7092
7093      '0 (1)'
7094           command I/O
7095      '1 (2)'
7096           values of big number integers
7097      '2 (4)'
7098           low level crypto operations
7099      '5 (32)'
7100           memory allocation
7101      '6 (64)'
7102           caching
7103      '7 (128)'
7104           show memory statistics
7105      '9 (512)'
7106           write hashed data to files named 'dbgmd-000*'
7107      '10 (1024)'
7108           trace Assuan protocol.  See also option
7109           '--debug-assuan-log-cats'.
7110      '11 (2048)'
7111           trace APDU I/O to the card.  This may reveal sensitive data.
7112      '12 (4096)'
7113           trace some card reader related function calls.
7114
7115 '--debug-all'
7116      Same as '--debug=0xffffffff'
7117
7118 '--debug-wait N'
7119      When running in server mode, wait N seconds before entering the
7120      actual processing loop and print the pid.  This gives time to
7121      attach a debugger.
7122
7123 '--debug-ccid-driver'
7124      Enable debug output from the included CCID driver for smartcards.
7125      Using this option twice will also enable some tracing of the T=1
7126      protocol.  Note that this option may reveal sensitive data.
7127
7128 '--debug-disable-ticker'
7129      This option disables all ticker functions like checking for card
7130      insertions.
7131
7132 '--debug-allow-core-dump'
7133      For security reasons we won't create a core dump when the process
7134      aborts.  For debugging purposes it is sometimes better to allow
7135      core dump.  This option enables it and also changes the working
7136      directory to '/tmp' when running in '--server' mode.
7137
7138 '--debug-log-tid'
7139      This option appends a thread ID to the PID in the log output.
7140
7141 '--debug-assuan-log-cats CATS'
7142      Changes the active Libassuan logging categories to CATS.  The value
7143      for CATS is an unsigned integer given in usual C-Syntax.  A value
7144      of of 0 switches to a default category.  If this option is not used
7145      the categories are taken from the environment variable
7146      'ASSUAN_DEBUG'.  Note that this option has only an effect if the
7147      Assuan debug flag has also been with the option '--debug'.  For a
7148      list of categories see the Libassuan manual.
7149
7150 '--no-detach'
7151      Don't detach the process from the console.  This is mainly useful
7152      for debugging.
7153
7154 '--log-file FILE'
7155      Append all logging output to FILE.  This is very helpful in seeing
7156      what the agent actually does.  Use 'socket://' to log to socket.
7157
7158 '--pcsc-driver LIBRARY'
7159      Use LIBRARY to access the smartcard reader.  The current default is
7160      'libpcsclite.so'.  Instead of using this option you might also want
7161      to install a symbolic link to the default file name (e.g.  from
7162      'libpcsclite.so.1').
7163
7164 '--ctapi-driver LIBRARY'
7165      Use LIBRARY to access the smartcard reader.  The current default is
7166      'libtowitoko.so'.  Note that the use of this interface is
7167      deprecated; it may be removed in future releases.
7168
7169 '--disable-ccid'
7170      Disable the integrated support for CCID compliant readers.  This
7171      allows falling back to one of the other drivers even if the
7172      internal CCID driver can handle the reader.  Note, that CCID
7173      support is only available if libusb was available at build time.
7174
7175 '--reader-port NUMBER_OR_STRING'
7176      This option may be used to specify the port of the card terminal.
7177      A value of 0 refers to the first serial device; add 32768 to access
7178      USB devices.  The default is 32768 (first USB device).  PC/SC or
7179      CCID readers might need a string here; run the program in verbose
7180      mode to get a list of available readers.  The default is then the
7181      first reader found.
7182
7183      To get a list of available CCID readers you may use this command:
7184             echo scd getinfo reader_list \
7185               | gpg-connect-agent --decode | awk '/^D/ {print $2}'
7186
7187 '--card-timeout N'
7188      If N is not 0 and no client is actively using the card, the card
7189      will be powered down after N seconds.  Powering down the card
7190      avoids a potential risk of damaging a card when used with certain
7191      cheap readers.  This also allows applications that are not aware of
7192      Scdaemon to access the card.  The disadvantage of using a card
7193      timeout is that accessing the card takes longer and that the user
7194      needs to enter the PIN again after the next power up.
7195
7196      Note that with the current version of Scdaemon the card is powered
7197      down immediately at the next timer tick for any value of N other
7198      than 0.
7199
7200 '--enable-pinpad-varlen'
7201      Please specify this option when the card reader supports variable
7202      length input for pinpad (default is no).  For known readers (listed
7203      in ccid-driver.c and apdu.c), this option is not needed.  Note that
7204      if your card reader doesn't supports variable length input but you
7205      want to use it, you need to specify your pinpad request on your
7206      card.
7207
7208 '--disable-pinpad'
7209      Even if a card reader features a pinpad, do not try to use it.
7210
7211 '--deny-admin'
7212      This option disables the use of admin class commands for card
7213      applications where this is supported.  Currently we support it for
7214      the OpenPGP card.  This option is useful to inhibit accidental
7215      access to admin class command which could ultimately lock the card
7216      through wrong PIN numbers.  Note that GnuPG versions older than
7217      2.0.11 featured an '--allow-admin' option which was required to use
7218      such admin commands.  This option has no more effect today because
7219      the default is now to allow admin commands.
7220
7221 '--disable-application NAME'
7222      This option disables the use of the card application named NAME.
7223      This is mainly useful for debugging or if a application with lower
7224      priority should be used by default.
7225
7226    All the long options may also be given in the configuration file
7227 after stripping off the two leading dashes.
7228
7229 \1f
7230 File: gnupg.info,  Node: Card applications,  Next: Scdaemon Configuration,  Prev: Scdaemon Options,  Up: Invoking SCDAEMON
7231
7232 6.3 Description of card applications
7233 ====================================
7234
7235 'scdaemon' supports the card applications as described below.
7236
7237 * Menu:
7238
7239 * OpenPGP Card::          The OpenPGP card application
7240 * NKS Card::              The Telesec NetKey card application
7241 * DINSIG Card::           The DINSIG card application
7242 * PKCS#15 Card::          The PKCS#15 card application
7243 * Geldkarte Card::        The Geldkarte application
7244 * SmartCard-HSM::         The SmartCard-HSM application
7245 * Undefined Card::        The Undefined stub application
7246
7247 \1f
7248 File: gnupg.info,  Node: OpenPGP Card,  Next: NKS Card,  Up: Card applications
7249
7250 6.3.1 The OpenPGP card application "openpgp"
7251 --------------------------------------------
7252
7253 This application is currently only used by 'gpg' but may in future also
7254 be useful with 'gpgsm'.  Version 1 and version 2 of the card is
7255 supported.
7256
7257 The specifications for these cards are available at
7258 <http://g10code.com/docs/openpgp-card-1.0.pdf> and
7259 <http://g10code.com/docs/openpgp-card-2.0.pdf>.
7260
7261 \1f
7262 File: gnupg.info,  Node: NKS Card,  Next: DINSIG Card,  Prev: OpenPGP Card,  Up: Card applications
7263
7264 6.3.2 The Telesec NetKey card "nks"
7265 -----------------------------------
7266
7267 This is the main application of the Telesec cards as available in
7268 Germany.  It is a superset of the German DINSIG card.  The card is used
7269 by 'gpgsm'.
7270
7271 \1f
7272 File: gnupg.info,  Node: DINSIG Card,  Next: PKCS#15 Card,  Prev: NKS Card,  Up: Card applications
7273
7274 6.3.3 The DINSIG card application "dinsig"
7275 ------------------------------------------
7276
7277 This is an application as described in the German draft standard _DIN V
7278 66291-1_.  It is intended to be used by cards supporting the German
7279 signature law and its bylaws (SigG and SigV).
7280
7281 \1f
7282 File: gnupg.info,  Node: PKCS#15 Card,  Next: Geldkarte Card,  Prev: DINSIG Card,  Up: Card applications
7283
7284 6.3.4 The PKCS#15 card application "p15"
7285 ----------------------------------------
7286
7287 This is common framework for smart card applications.  It is used by
7288 'gpgsm'.
7289
7290 \1f
7291 File: gnupg.info,  Node: Geldkarte Card,  Next: SmartCard-HSM,  Prev: PKCS#15 Card,  Up: Card applications
7292
7293 6.3.5 The Geldkarte card application "geldkarte"
7294 ------------------------------------------------
7295
7296 This is a simple application to display information of a German
7297 Geldkarte.  The Geldkarte is a small amount debit card application which
7298 comes with almost all German banking cards.
7299