1 @c Copyright (C) 2004 Free Software Foundation, Inc.
2 @c This is part of the GnuPG manual.
3 @c For copying conditions, see the file GnuPG.texi.
8 GnuPG comes with a couple of smaller tools:
11 * watchgnupg:: Read logs from a socket.
12 * gpgv:: Verify OpenPGP signatures.
13 * addgnupghome:: Create .gnupg home directories.
14 * gpgconf:: Modify .gnupg home directories.
15 * gpgsm-gencert.sh:: Generate an X.509 certificate request.
16 * gpg-preset-passphrase:: Put a passphrase into the cache.
17 * gpg-connect-agent:: Communicate with a running agent.
18 * gpgparsemail:: Parse a mail message into an annotated format
19 * symcryptrun:: Call a simple symmetric encryption tool.
27 @section Read logs from a socket
30 \- Read and print logs from a socket
42 Most of the main utilities are able to write there log files to a
43 Unix Domain socket if configured that way. @command{watchgnupg} is a simple
44 listener for such a socket. It ameliorates the output with a time
45 stamp and makes sure that long lines are not interspersed with log
46 output from other utilities.
49 @command{watchgnupg} is commonly invoked as
52 watchgnupg --force ~/.gnupg/S.log
57 This starts it on the current terminal for listening on the socket
58 @file{~/.gnupg/S.log}.
62 @command{watchgnupg} understands these options:
68 Delete an already existing socket file.
72 Enable extra informational output.
76 print version of the program and exit
80 Display a brief help page and exit
87 @command{gpg-agent}(1),
89 @include see-also-note.texi
101 @manpage addgnupghome.8
103 @section Create .gnupg home directories.
106 \- Create .gnupg home directories
113 .IR account_2 ... account_n
117 If GnuPG is installed on a system with existing user accounts, it is
118 sometimes required to populate the GnuPG home directory with existing
119 files. Especially a @file{trustlist.txt} and a keybox with some
120 initial certificates are often desired. This scripts help to do this
121 by copying all files from @file{/etc/skel/.gnupg} to the home
122 directories of the accounts given on the command line. It takes care
123 not to overwrite existing GnuPG home directories.
126 @command{addgnupghome} is invoked by root as:
129 addgnupghome account1 account2 ... accountn
138 @section Modify .gnupg home directories.
141 \- Modify .gnupg home directories
148 .B \-\-list-components
157 .B \-\-change-options
163 The @command{gpgconf} is a utility to automatically and reasonable
164 safely query and modify configuration files in the @file{.gnupg} home
165 directory. It is designed not to be invoked manually by the user, but
166 automatically by graphical user interfaces (GUI).@footnote{Please note
167 that currently no locking is done, so concurrent access should be
168 avoided. There are some precautions to avoid corruption with
169 concurrent usage, but results may be inconsistent and some changes may
170 get lost. The stateless design makes it difficult to provide more
173 @command{gpgconf} provides access to the configuration of one or more
174 components of the GnuPG system. These components correspond more or
175 less to the programs that exist in the GnuPG framework, like GnuPG,
176 GPGSM, DirMngr, etc. But this is not a strict one-to-one
177 relationship. Not all configuration options are available through
178 @command{gpgconf}. @command{gpgconf} provides a generic and abstract
179 method to access the most important configuration options that can
180 feasibly be controlled via such a mechanism.
182 @command{gpgconf} can be used to gather and change the options
183 available in each component, and can also provide their default
184 values. @command{gpgconf} will give detailed type information that
185 can be used to restrict the user's input without making an attempt to
188 @command{gpgconf} provides the backend of a configuration editor. The
189 configuration editor would usually be a graphical user interface
190 program, that allows to display the current options, their default
191 values, and allows the user to make changes to the options. These
192 changes can then be made active with @command{gpgconf} again. Such a
193 program that uses @command{gpgconf} in this way will be called GUI
194 throughout this section.
197 * Invoking gpgconf:: List of all commands and options.
198 * Format conventions:: Formatting conventions relevant for all commands.
199 * Listing components:: List all gpgconf components.
200 * Listing options:: List all options of a component.
201 * Changing options:: Changing options of a component.
205 @node Invoking gpgconf
206 @subsection Invoking gpgconf
209 One of the following commands must be given:
213 @item --list-components
214 List all components. This is the default command used if none is
217 @item --list-options @var{component}
218 List all options of the component @var{component}.
220 @item --change-options @var{component}
221 Change the options of the component @var{component}.
226 The following options may be used:
229 @c FIXME: Not yet supported.
230 @c @item -o @var{file}
231 @c @itemx --output @var{file}
232 @c Use @var{file} as output file.
236 Outputs additional information while running. Specifically, this
237 extends numerical field values by human-readable descriptions.
239 @c FIXME: Not yet supported.
242 @c Do not actually change anything. Useful together with
243 @c @code{--change-options} for testing purposes.
247 Only used together with @code{--change-options}. If one of the
248 modified options can be changed in a running daemon process, signal
249 the running daemon to ask it to reparse its configuration file after
252 This means that the changes will take effect at run-time, as far as
253 this is possible. Otherwise, they will take effect at the next start
254 of the respective backend programs.
259 @node Format conventions
260 @subsection Format conventions
262 Some lines in the output of @command{gpgconf} contain a list of
263 colon-separated fields. The following conventions apply:
267 The GUI program is required to strip off trailing newline and/or
268 carriage return characters from the output.
271 @command{gpgconf} will never leave out fields. If a certain version
272 provides a certain field, this field will always be present in all
273 @command{gpgconf} versions from that time on.
276 Future versions of @command{gpgconf} might append fields to the list.
277 New fields will always be separated from the previously last field by
278 a colon separator. The GUI should be prepared to parse the last field
279 it knows about up until a colon or end of line.
282 Not all fields are defined under all conditions. You are required to
283 ignore the content of undefined fields.
286 There are several standard types for the content of a field:
290 Some fields contain strings that are not escaped in any way. Such
291 fields are described to be used @emph{verbatim}. These fields will
292 never contain a colon character (for obvious reasons). No de-escaping
293 or other formatting is required to use the field content. This is for
294 easy parsing of the output, when it is known that the content can
295 never contain any special characters.
297 @item percent-escaped
298 Some fields contain strings that are described to be
299 @emph{percent-escaped}. Such strings need to be de-escaped before
300 their content can be presented to the user. A percent-escaped string
301 is de-escaped by replacing all occurences of @code{%XY} by the byte
302 that has the hexadecimal value @code{XY}. @code{X} and @code{Y} are
303 from the set @code{0-9a-f}.
306 Some fields contain strings that are described to be @emph{localised}.
307 Such strings are translated to the active language and formatted in
308 the active character set.
310 @item @w{unsigned number}
311 Some fields contain an @emph{unsigned number}. This number will
312 always fit into a 32-bit unsigned integer variable. The number may be
313 followed by a space, followed by a human readable description of that
314 value (if the verbose option is used). You should ignore everything
315 in the field that follows the number.
317 @item @w{signed number}
318 Some fields contain a @emph{signed number}. This number will always
319 fit into a 32-bit signed integer variable. The number may be followed
320 by a space, followed by a human readable description of that value (if
321 the verbose option is used). You should ignore everything in the
322 field that follows the number.
325 Some fields contain an @emph{option} argument. The format of an
326 option argument depends on the type of the option and on some flags:
330 The simplest case is that the option does not take an argument at all
331 (@var{type} @code{0}). Then the option argument is an unsigned number
332 that specifies how often the option occurs. If the @code{list} flag
333 is not set, then the only valid number is @code{1}. Options that do
334 not take an argument never have the @code{default} or @code{optional
338 If the option takes a number argument (@var{alt-type} is @code{2} or
339 @code{3}), and it can only occur once (@code{list} flag is not set),
340 then the option argument is either empty (only allowed if the argument
341 is optional), or it is a number. A number is a string that begins
342 with an optional minus character, followed by one or more digits. The
343 number must fit into an integer variable (unsigned or signed,
344 depending on @var{alt-type}).
347 If the option takes a number argument and it can occur more than once,
348 then the option argument is either empty, or it is a comma-separated
349 list of numbers as described above.
352 If the option takes a string argument (@var{alt-type} is 1), and it
353 can only occur once (@code{list} flag is not set) then the option
354 argument is either empty (only allowed if the argument is optional),
355 or it starts with a double quote character (@code{"}) followed by a
356 percent-escaped string that is the argument value. Note that there is
357 only a leading double quote character, no trailing one. The double
358 quote character is only needed to be able to differentiate between no
359 value and the empty string as value.
362 If the option takes a number argument and it can occur more than once,
363 then the option argument is either empty, or it is a comma-separated
364 list of string arguments as described above.
368 The active language and character set are currently determined from
369 the locale environment of the @command{gpgconf} program.
371 @c FIXME: Document the active language and active character set. Allow
372 @c to change it via the command line?
376 @node Listing components
377 @subsection Listing components
379 The command @code{--list-components} will list all components that can
380 be configured with @command{gpgconf}. Usually, one component will
381 correspond to one GnuPG-related program and contain the options of
382 that programs configuration file that can be modified using
383 @command{gpgconf}. However, this is not necessarily the case. A
384 component might also be a group of selected options from several
385 programs, or contain entirely virtual options that have a special
386 effect rather than changing exactly one option in one configuration
389 A component is a set of configuration options that semantically belong
390 together. Furthermore, several changes to a component can be made in
391 an atomic way with a single operation. The GUI could for example
392 provide a menu with one entry for each component, or a window with one
393 tabulator sheet per component.
395 The command argument @code{--list-components} lists all available
396 components, one per line. The format of each line is:
398 @code{@var{name}:@var{description}}
402 This field contains a name tag of the component. The name tag is used
403 to specify the component in all communication with @command{gpgconf}.
404 The name tag is to be used @emph{verbatim}. It is thus not in any
408 The @emph{string} in this field contains a human-readable description
409 of the component. It can be displayed to the user of the GUI for
410 informational purposes. It is @emph{percent-escaped} and
416 $ gpgconf --list-components
419 scdaemon:Smartcard Daemon
421 dirmngr:Directory Manager
425 @node Listing options
426 @subsection Listing options
428 Every component contains one or more options. Options may be gathered
429 into option groups to allow the GUI to give visual hints to the user
430 about which options are related.
432 The command argument @code{@w{--list-options @var{component}}} lists
433 all options (and the groups they belong to) in the component
434 @var{component}, one per line. @var{component} must be the string in
435 the field @var{name} in the output of the @code{--list-components}
438 There is one line for each option and each group. First come all
439 options that are not in any group. Then comes a line describing a
440 group. Then come all options that belong into each group. Then comes
441 the next group and so on. There does not need to be any group (and in
442 this case the output will stop after the last non-grouped option).
444 The format of each line is:
446 @code{@var{name}:@var{flags}:@var{level}:@var{description}:@var{type}:@var{alt-type}:@var{argname}:@var{default}:@var{argdef}:@var{value}}
450 This field contains a name tag for the group or option. The name tag
451 is used to specify the group or option in all communication with
452 @command{gpgconf}. The name tag is to be used @emph{verbatim}. It is
453 thus not in any escaped format.
456 The flags field contains an @emph{unsigned number}. Its value is the
457 OR-wise combination of the following flag values:
461 If this flag is set, this is a line describing a group and not an
465 The following flag values are only defined for options (that is, if
466 the @code{group} flag is not used).
469 @item optional arg (2)
470 If this flag is set, the argument is optional. This is never set for
471 @var{type} @code{0} (none) options.
474 If this flag is set, the option can be given multiple times.
477 If this flag is set, the option can be changed at runtime.
480 If this flag is set, a default value is available.
482 @item default desc (32)
483 If this flag is set, a (runtime) default is available. This and the
484 @code{default} flag are mutually exclusive.
486 @item no arg desc (64)
487 If this flag is set, and the @code{optional arg} flag is set, then the
488 option has a special meaning if no argument is given.
492 This field is defined for options and for groups. It contains an
493 @emph{unsigned number} that specifies the expert level under which
494 this group or option should be displayed. The following expert levels
495 are defined for options (they have analogous meaning for groups):
499 This option should always be offered to the user.
502 This option may be offered to advanced users.
505 This option should only be offered to expert users.
508 This option should normally never be displayed, not even to expert
512 This option is for internal use only. Ignore it.
515 The level of a group will always be the lowest level of all options it
519 This field is defined for options and groups. The @emph{string} in
520 this field contains a human-readable description of the option or
521 group. It can be displayed to the user of the GUI for informational
522 purposes. It is @emph{percent-escaped} and @emph{localized}.
525 This field is only defined for options. It contains an @emph{unsigned
526 number} that specifies the type of the option's argument, if any. The
527 following types are defined:
536 An @emph{unformatted string}.
539 A @emph{signed number}.
542 An @emph{unsigned number}.
549 A @emph{string} that describes the pathname of a file. The file does
550 not necessarily need to exist.
552 @item ldap server (33)
553 A @emph{string} that describes an LDAP server in the format:
555 @code{@var{hostname}:@var{port}:@var{username}:@var{password}:@var{base_dn}}
558 More types will be added in the future. Please see the @var{alt-type}
559 field for information on how to cope with unknown types.
562 This field is identical to @var{type}, except that only the types
563 @code{0} to @code{31} are allowed. The GUI is expected to present the
564 user the option in the format specified by @var{type}. But if the
565 argument type @var{type} is not supported by the GUI, it can still
566 display the option in the more generic basic type @var{alt-type}. The
567 GUI must support all the defined basic types to be able to display all
568 options. More basic types may be added in future versions. If the
569 GUI encounters a basic type it doesn't support, it should report an
570 error and abort the operation.
573 This field is only defined for options with an argument type
574 @var{type} that is not @code{0}. In this case it may contain a
575 @emph{percent-escaped} and @emph{localised string} that gives a short
576 name for the argument. The field may also be empty, though, in which
577 case a short name is not known.
580 This field is defined only for options. Its format is that of an
581 @emph{option argument} (@xref{Format conventions}, for details). If
582 the default value is empty, then no default is known. Otherwise, the
583 value specifies the default value for this option. Note that this
584 field is also meaningful if the option itself does not take a real
588 This field is defined only for options for which the @code{optional
589 arg} flag is set. If the @code{no arg desc} flag is not set, its
590 format is that of an @emph{option argument} (@xref{Format
591 conventions}, for details). If the default value is empty, then no
592 default is known. Otherwise, the value specifies the default value
593 for this option. If the @code{no arg desc} flag is set, the field is
594 either empty or contains a description of the effect of this option if
595 no argument is given. Note that this field is also meaningful if the
596 option itself does not take a real argument.
599 This field is defined only for options. Its format is that of an
600 @emph{option argument}. If it is empty, then the option is not
601 explicitely set in the current configuration, and the default applies
602 (if any). Otherwise, it contains the current value of the option.
603 Note that this field is also meaningful if the option itself does not
604 take a real argument.
608 @node Changing options
609 @subsection Changing options
611 The command @w{@code{--change-options @var{component}}} will attempt
612 to change the options of the component @var{component} to the
613 specified values. @var{component} must be the string in the field
614 @var{name} in the output of the @code{--list-components} command. You
615 have to provide the options that shall be changed in the following
616 format on standard input:
618 @code{@var{name}:@var{flags}:@var{new-value}}
622 This is the name of the option to change. @var{name} must be the
623 string in the field @var{name} in the output of the
624 @code{--list-options} command.
627 The flags field contains an @emph{unsigned number}. Its value is the
628 OR-wise combination of the following flag values:
632 If this flag is set, the option is deleted and the default value is
633 used instead (if applicable).
637 The new value for the option. This field is only defined if the
638 @code{default} flag is not set. The format is that of an @emph{option
639 argument}. If it is empty (or the field is omitted), the default
640 argument is used (only allowed if the argument is optional for this
641 option). Otherwise, the option will be set to the specified value.
646 To set the force option, which is of basic type @code{none (0)}:
649 $ echo 'force:0:1' | gpgconf --change-options dirmngr
652 To delete the force option:
655 $ echo 'force:16:' | gpgconf --change-options dirmngr
658 The @code{--runtime} option can influence when the changes take
664 @command{gpg-agent}(1),
665 @command{scdaemon}(1),
667 @include see-also-note.texi
674 @node gpgsm-gencert.sh
675 @section Generate an X.509 certificate request
676 @manpage gpgsm-gencert.sh.1
679 \- Generate an X.509 certificate request
688 This is a simple tool to interactivly generate a certificate request
689 which will be printed to stdout.
693 @command{gpgsm-gencert.sh} is invoked as:
695 @samp{gpgsm-cencert.sh}
699 @command{gpg-agent}(1),
700 @command{scdaemon}(1)
701 @include see-also-note.texi
706 @c GPG-PRESET-PASSPHRASE
708 @node gpg-preset-passphrase
709 @section Put a passphrase into the cache.
710 @manpage gpg-preset-passphrase.1
712 .B gpg-preset-passphrase
713 \- Put a passphrase into gpg-agent's cache
718 .B gpg-preset-passphrase
725 The @command{gpg-preset-passphrase} is a utility to seed the internal
726 cache of a running @command{gpg-agent} with passphrases. It is mainly
727 useful for unattended machines, where the usual @command{pinentry} tool
728 may not be used and the passphrases for the to be used keys are given at
731 Passphrases set with this utility don't expire unless the
732 @option{--forget} option is used to explicitly clear them from the cache
733 --- or @command{gpg-agent} is either restarted or reloaded (by sending a
734 SIGHUP to it). It is necessary to allow this passphrase presetting by
735 starting @command{gpg-agent} with the
736 @option{--allow-preset-passphrase}.
739 * Invoking gpg-preset-passphrase:: List of all commands and options.
743 @node Invoking gpg-preset-passphrase
744 @subsection List of all commands and options.
748 @command{gpg-preset-passphrase} is invoked this way:
751 gpg-preset-passphrase [options] [command] @var{keygrip}
754 @var{keygrip} is a 40 character string of hexadecimal characters
755 identifying the key for which the passphrase should be set or cleared.
756 This keygrip is listed along with the key when running the command:
757 @code{gpgsm --dump-secret-keys}. One of the following command options
763 Preset a passphrase. This is what you usually will
764 use. @command{gpg-preset-passphrase} will then read the passphrase from
769 Flush the passphrase for the given keygrip from the cache.
774 The following additional options may be used:
780 Output additional information while running.
782 @item -P @var{string}
783 @itemx --passphrase @var{string}
785 Instead of reading the passphrase from @code{stdin}, use the supplied
786 @var{string} as passphrase. Note that this makes the passphrase visible
793 @command{gpg-agent}(1),
794 @command{scdaemon}(1)
795 @include see-also-note.texi
803 @node gpg-connect-agent
804 @section Communicate with a running agent.
805 @manpage gpg-connect-agent.1
808 \- Communicate with a running agent
818 The @command{gpg-connect-agent} is a utility to communicate with a
819 running @command{gpg-agent}. It is useful to check out the commands
820 gpg-agent provides using the Assuan interface. It might also be useful
821 for scripting simple applications. Inputis expected at stdin and out
822 put gets printed to stdout.
824 It is very similar to running @command{gpg-agent} in server mode; but
825 here we connect to a running instance.
828 * Invoking gpg-connect-agent:: List of all options.
829 * Controlling gpg-connect-agent:: Control commands.
833 @node Invoking gpg-connect-agent
834 @subsection List of all options.
837 @command{gpg-connect-agent} is invoked this way:
840 gpg-connect-agent [options]
845 The following options may be used:
851 Output additional information while running.
857 Try to be as quiet as possible.
859 @include opt-homedir.texi
862 @itemx --raw-socket @var{name}
865 Connect to socket @var{name} assuming this is an Assuan style server.
866 Do not run any special initializations or environment checks. This may
867 be used to directly connect to any Assuan style socket server.
872 Take the rest of the command line as a program and it's arguments and
873 execute it as an assuan server. Here is how you would run @command{gpgsm}:
875 gpg-connect-agent --exec gpgsm --server
879 @item --no-ext-connect
880 @opindex no-ext-connect
881 When using @option{-S} or @option{--exec}, @command{gpg-connect-agent}
882 connects to the assuan server in extended mode to allow descriptor
883 passing. This option makes it use the old mode.
887 @mansect control commands
888 @node Controlling gpg-connect-agent
889 @subsection Control commands.
891 While reading Assuan commands, gpg-agent also allows a few special
892 commands to control its operation. These control commands all start
893 with a slash (@code{/}).
898 @item /echo @var{args}
899 Just print @var{args}.
901 @item /definqfile @var{name} @var{file}
903 Use content of @var{file} for inquiries with @var{name}.
904 @var{name} may be an asterisk (@code{*} to match any inquiry.
906 @item /definqprog @var{name} @var{prog}
907 Run @var{prog} for inquiries matching @var{name} and pass the
908 entire line to it as command line arguments
911 Print all definitions
914 Delete all definitions
916 @item /sendfd @var{file} @var{mode}
917 Open @var{file} in @var{mode} (which needs to be a valid @code{fopen}
918 mode string) and send the file descriptor to the server. This is
919 usually followed by a command like @code{INPUT FD} to set the
920 input source for other commands.
926 Print a list of available control commands.
933 @command{gpg-agent}(1),
934 @command{scdaemon}(1)
935 @include see-also-note.texi
943 @section Parse a mail message into an annotated format
945 @manpage gpgparsemail.1
948 \- Parse a mail message into an annotated format
959 The @command{gpgparsemail} is a utility currently only useful for
960 debugging. Run it with @code{--help} for usage information.
968 @section Call a simple symmetric encryption tool.
969 @manpage symcryptrun.1
972 \- Call a simple symmetric encryption tool
984 .RB [ --decrypt | --encrypt ]
989 Sometimes simple encryption tools are already in use for a long time and
990 there might be a desire to integrate them into the GnuPG framework. The
991 protocols and encryption methods might be non-standard or not even
992 properly documented, so that a full-fledged encryption tool with an
993 interface like gpg is not doable. @command{symcryptrun} provides a
994 solution: It operates by calling the external encryption/decryption
995 module and provides a passphrase for a key using the standard
996 @command{pinentry} based mechanism through @command{gpg-agent}.
998 Note, that @command{symcryptrun} is only available if GnuPG has been
999 configured with @samp{--enable-symcryptrun} at build time.
1002 * Invoking symcryptrun:: List of all commands and options.
1006 @node Invoking symcryptrun
1007 @subsection List of all commands and options.
1010 @command{symcryptrun} is invoked this way:
1013 symcryptrun --class CLASS --program PROGRAM --keyfile KEYFILE
1014 [--decrypt | --encrypt] [inputfile]
1018 For encryption, the plain text must be provided on STDIN or as the
1019 argument @var{inputfile}, and the ciphertext will be output to STDOUT.
1020 For decryption vice versa.
1022 @var{CLASS} describes the calling conventions of the external tool.
1023 Currently it must be given as @samp{confucius}. @var{PROGRAM} is the
1024 the full filename of that external tool.
1026 For the class @samp{confucius} the option @option{--keyfile} is
1027 required; @var{keyfile} is the name of a file containing the secret key,
1028 which may be protected by a passphrase. For detailed calling
1029 conventions, see the source code.
1032 Note, that @command{gpg-agent} must be running before starting
1033 @command{symcryptrun}.
1036 The following additional options may be used:
1042 Output additional information while running.
1048 Try to be as quiet as possible.
1050 @include opt-homedir.texi
1053 @item --log-file @var{file}
1055 Append all logging output to @var{file}. Default is to write logging
1056 informaton to STDERR.
1061 The possible exit status codes of @command{symcryptrun} are:
1069 No valid passphrase was provided.
1071 The operation was canceled by the user.
1078 @command{gpg-agent}(1),
1079 @include see-also-note.texi