chiark / gitweb /
gnupg2 (2.1.17-3) unstable; urgency=medium
[gnupg2.git] / doc / tools.texi
1 @c Copyright (C) 2004, 2008 Free Software Foundation, Inc.
2 @c This is part of the GnuPG manual.
3 @c For copying conditions, see the file GnuPG.texi.
4
5 @include defs.inc
6
7 @node Helper Tools
8 @chapter Helper Tools
9
10 GnuPG comes with a couple of smaller tools:
11
12 @menu
13 * watchgnupg::            Read logs from a socket.
14 * gpgv::                  Verify OpenPGP signatures.
15 * addgnupghome::          Create .gnupg home directories.
16 * gpgconf::               Modify .gnupg home directories.
17 * applygnupgdefaults::    Run gpgconf for all users.
18 * gpg-preset-passphrase:: Put a passphrase into the cache.
19 * gpg-connect-agent::     Communicate with a running agent.
20 * dirmngr-client::        How to use the Dirmngr client tool.
21 * gpgparsemail::          Parse a mail message into an annotated format
22 * symcryptrun::           Call a simple symmetric encryption tool.
23 * gpg-zip::               Encrypt or sign files into an archive.
24 @end menu
25
26 @c
27 @c  WATCHGNUPG
28 @c
29 @manpage watchgnupg.1
30 @node watchgnupg
31 @section Read logs from a socket
32 @ifset manverb
33 .B watchgnupg
34 \- Read and print logs from a socket
35 @end ifset
36
37 @mansect synopsis
38 @ifset manverb
39 .B  watchgnupg
40 .RB [ \-\-force ]
41 .RB [ \-\-verbose ]
42 .I socketname
43 @end ifset
44
45 @mansect description
46 Most of the main utilities are able to write their log files to a Unix
47 Domain socket if configured that way.  @command{watchgnupg} is a simple
48 listener for such a socket.  It ameliorates the output with a time stamp
49 and makes sure that long lines are not interspersed with log output from
50 other utilities.  This tool is not available for Windows.
51
52
53 @noindent
54 @command{watchgnupg} is commonly invoked as
55
56 @example
57 watchgnupg --force ~/.gnupg/S.log
58 @end example
59 @manpause
60
61 @noindent
62 This starts it on the current terminal for listening on the socket
63 @file{~/.gnupg/S.log}.
64
65 @mansect options
66 @noindent
67 @command{watchgnupg} understands these options:
68
69 @table @gnupgtabopt
70
71 @item --force
72 @opindex force
73 Delete an already existing socket file.
74
75 @anchor{option watchgnupg --tcp}
76 @item --tcp @var{n}
77 Instead of reading from a local socket, listen for connects on TCP port
78 @var{n}.
79
80 @item --verbose
81 @opindex verbose
82 Enable extra informational output.
83
84 @item --version
85 @opindex version
86 Print version of the program and exit.
87
88 @item --help
89 @opindex help
90 Display a brief help page and exit.
91
92 @end table
93
94 @noindent
95 @mansect examples
96 @chapheading Examples
97
98 @example
99 $ watchgnupg --force /home/foo/.gnupg/S.log
100 @end example
101
102 This waits for connections on the local socket
103 @file{/home/foo/.gnupg/S.log} and shows all log entries.  To make this
104 work the option @option{log-file} needs to be used with all modules
105 which logs are to be shown.  The value for that option must be given
106 with a special prefix (e.g. in the conf files):
107
108 @example
109 log-file socket:///home/foo/.gnupg/S.log
110 @end example
111
112 If only @code{socket://} is used a default socket file named
113 @file{S.log} in the standard socket directory is used.
114 For debugging purposes it is also possible to do remote logging.  Take
115 care if you use this feature because the information is send in the
116 clear over the network.  Use this syntax in the conf files:
117
118 @example
119 log-file tcp://192.168.1.1:4711
120 @end example
121
122 You may use any port and not just 4711 as shown above; only IP addresses
123 are supported (v4 and v6) and no host names.  You need to start
124 @command{watchgnupg} with the @option{tcp} option.  Note that under
125 Windows the registry entry @var{HKCU\Software\GNU\GnuPG:DefaultLogFile}
126 can be used to change the default log output from @code{stderr} to
127 whatever is given by that entry.  However the only useful entry is a TCP
128 name for remote debugging.
129
130
131 @mansect see also
132 @ifset isman
133 @command{gpg}(1),
134 @command{gpgsm}(1),
135 @command{gpg-agent}(1),
136 @command{scdaemon}(1)
137 @end ifset
138 @include see-also-note.texi
139
140
141 @c
142 @c  GPGV
143 @c
144 @include gpgv.texi
145
146
147 @c
148 @c    ADDGNUPGHOME
149 @c
150 @manpage addgnupghome.8
151 @node addgnupghome
152 @section Create .gnupg home directories
153 @ifset manverb
154 .B addgnupghome
155 \- Create .gnupg home directories
156 @end ifset
157
158 @mansect synopsis
159 @ifset manverb
160 .B  addgnupghome
161 .I account_1
162 .IR account_2 ... account_n
163 @end ifset
164
165 @mansect description
166 If GnuPG is installed on a system with existing user accounts, it is
167 sometimes required to populate the GnuPG home directory with existing
168 files.  Especially a @file{trustlist.txt} and a keybox with some
169 initial certificates are often desired.  This script helps to do this
170 by copying all files from @file{/etc/skel/.gnupg} to the home
171 directories of the accounts given on the command line.  It takes care
172 not to overwrite existing GnuPG home directories.
173
174 @noindent
175 @command{addgnupghome} is invoked by root as:
176
177 @example
178 addgnupghome account1 account2 ... accountn
179 @end example
180
181
182 @c
183 @c   GPGCONF
184 @c
185 @manpage gpgconf.1
186 @node gpgconf
187 @section Modify .gnupg home directories
188 @ifset manverb
189 .B gpgconf
190 \- Modify .gnupg home directories
191 @end ifset
192
193 @mansect synopsis
194 @ifset manverb
195 .B gpgconf
196 .RI [ options ]
197 .B \-\-list-components
198 .br
199 .B gpgconf
200 .RI [ options ]
201 .B \-\-list-options
202 .I component
203 .br
204 .B gpgconf
205 .RI [ options ]
206 .B \-\-change-options
207 .I component
208 @end ifset
209
210
211 @mansect description
212 The @command{gpgconf} is a utility to automatically and reasonable
213 safely query and modify configuration files in the @file{.gnupg} home
214 directory.  It is designed not to be invoked manually by the user, but
215 automatically by graphical user interfaces (GUI).@footnote{Please note
216 that currently no locking is done, so concurrent access should be
217 avoided.  There are some precautions to avoid corruption with
218 concurrent usage, but results may be inconsistent and some changes may
219 get lost.  The stateless design makes it difficult to provide more
220 guarantees.}
221
222 @command{gpgconf} provides access to the configuration of one or more
223 components of the GnuPG system.  These components correspond more or
224 less to the programs that exist in the GnuPG framework, like GPG,
225 GPGSM, DirMngr, etc.  But this is not a strict one-to-one
226 relationship.  Not all configuration options are available through
227 @command{gpgconf}.  @command{gpgconf} provides a generic and abstract
228 method to access the most important configuration options that can
229 feasibly be controlled via such a mechanism.
230
231 @command{gpgconf} can be used to gather and change the options
232 available in each component, and can also provide their default
233 values.  @command{gpgconf} will give detailed type information that
234 can be used to restrict the user's input without making an attempt to
235 commit the changes.
236
237 @command{gpgconf} provides the backend of a configuration editor.  The
238 configuration editor would usually be a graphical user interface
239 program that displays the current options, their default
240 values, and allows the user to make changes to the options.  These
241 changes can then be made active with @command{gpgconf} again.  Such a
242 program that uses @command{gpgconf} in this way will be called GUI
243 throughout this section.
244
245 @menu
246 * Invoking gpgconf::       List of all commands and options.
247 * Format conventions::     Formatting conventions relevant for all commands.
248 * Listing components::     List all gpgconf components.
249 * Checking programs::      Check all programs known to gpgconf.
250 * Listing options::        List all options of a component.
251 * Changing options::       Changing options of a component.
252 * Listing global options:: List all global options.
253 * Querying versions::      Get and compare software versions.
254 * Files used by gpgconf::  What files are used by gpgconf.
255 @end menu
256
257 @manpause
258 @node Invoking gpgconf
259 @subsection Invoking gpgconf
260
261 @mansect commands
262 One of the following commands must be given:
263
264 @table @gnupgtabopt
265
266 @item --list-components
267 List all components.  This is the default command used if none is
268 specified.
269
270 @item --check-programs
271 List all available backend programs and test whether they are runnable.
272
273 @item --list-options @var{component}
274 List all options of the component @var{component}.
275
276 @item --change-options @var{component}
277 Change the options of the component @var{component}.
278
279 @item --check-options @var{component}
280 Check the options for the component @var{component}.
281
282 @item --apply-profile @var{file}
283 Apply the configuration settings listed in @var{file} to the
284 configuration files.  If @var{file} has no suffix and no slashes the
285 command first tries to read a file with the suffix @code{.prf} from
286 the the data directory (@code{gpgconf --list-dirs datadir}) before it
287 reads the file verbatim.  A profile is divided into sections using the
288 bracketed  component name.  Each section then lists the option which
289 shall go into the respective configuration file.
290
291 @item --apply-defaults
292 Update all configuration files with values taken from the global
293 configuration file (usually @file{/etc/gnupg/gpgconf.conf}).
294
295 @item --list-dirs [@var{names}]
296 Lists the directories used by @command{gpgconf}.  One directory is
297 listed per line, and each line consists of a colon-separated list where
298 the first field names the directory type (for example @code{sysconfdir})
299 and the second field contains the percent-escaped directory.  Although
300 they are not directories, the socket file names used by
301 @command{gpg-agent} and @command{dirmngr} are printed as well.  Note
302 that the socket file names and the @code{homedir} lines are the default
303 names and they may be overridden by command line switches.  If
304 @var{names} are given only the directories or file names specified by
305 the list names are printed without any escaping.
306
307 @item --list-config [@var{filename}]
308 List the global configuration file in a colon separated format.  If
309 @var{filename} is given, check that file instead.
310
311 @item --check-config [@var{filename}]
312 Run a syntax check on the global configuration file.  If @var{filename}
313 is given, check that file instead.
314
315
316 @item --query-swdb @var{package_name} [@var{version_string}]
317 Returns the current version for @var{package_name} and if
318 @var{version_string} is given also an indicator on whether an update
319 is available.  The actual file with the software version is
320 automatically downloaded and checked by @command{dirmngr}.
321 @command{dirmngr} uses a thresholds to avoid download the file too
322 often and it does this by default only if it can be done via Tor.  To
323 force an update of that file this command can be used:
324
325 @example
326        gpg-connect-agent --dirmngr 'loadswdb --force' /bye
327 @end example
328
329
330 @item --reload [@var{component}]
331 @opindex reload
332 Reload all or the given component. This is basically the same as sending
333 a SIGHUP to the component.  Components which don't support reloading are
334 ignored.
335
336 @item --launch [@var{component}]
337 @opindex launch
338 If the @var{component} is not already running, start it.
339 @command{component} must be a daemon.  This is in general not required
340 because the system starts these daemons as needed.  However, external
341 software making direct use of @command{gpg-agent} or @command{dirmngr}
342 may use this command to ensure that they are started.
343
344 @item --kill [@var{component}]
345 @opindex kill
346 Kill the given component.  Components which support killing are
347 @command{gpg-agent} and @command{scdaemon}.  Components which don't
348 support reloading are ignored.  Note that as of now reload and kill
349 have the same effect for @command{scdaemon}.
350
351 @item --create-socketdir
352 @opindex create-socketdir
353 Create a directory for sockets below /run/user or /var/run/user.  This
354 is command is only required if a non default home directory is used
355 and the /run based sockets shall be used.  For the default home
356 directory GnUPG creates a directory on the fly.
357
358 @item --remove-socketdir
359 @opindex remove-socketdir
360 Remove a directory created with command @option{--create-socketdir}.
361
362 @end table
363
364
365 @mansect options
366
367 The following options may be used:
368
369 @table @gnupgtabopt
370
371 @item -o @var{file}
372 @itemx --output @var{file}
373 Write output to @var{file}.  Default is to write to stdout.
374
375 @item -v
376 @itemx --verbose
377 Outputs additional information while running.  Specifically, this
378 extends numerical field values by human-readable descriptions.
379
380 @item -q
381 @itemx --quiet
382 @opindex quiet
383 Try to be as quiet as possible.
384
385 @item -n
386 @itemx --dry-run
387 Do not actually change anything.  This is currently only implemented
388 for @code{--change-options} and can be used for testing purposes.
389
390 @item -r
391 @itemx --runtime
392 Only used together with @code{--change-options}.  If one of the
393 modified options can be changed in a running daemon process, signal
394 the running daemon to ask it to reparse its configuration file after
395 changing.
396
397 This means that the changes will take effect at run-time, as far as
398 this is possible.  Otherwise, they will take effect at the next start
399 of the respective backend programs.
400 @manpause
401 @end table
402
403
404 @node Format conventions
405 @subsection Format conventions
406
407 Some lines in the output of @command{gpgconf} contain a list of
408 colon-separated fields.  The following conventions apply:
409
410 @itemize @bullet
411 @item
412 The GUI program is required to strip off trailing newline and/or
413 carriage return characters from the output.
414
415 @item
416 @command{gpgconf} will never leave out fields.  If a certain version
417 provides a certain field, this field will always be present in all
418 @command{gpgconf} versions from that time on.
419
420 @item
421 Future versions of @command{gpgconf} might append fields to the list.
422 New fields will always be separated from the previously last field by
423 a colon separator.  The GUI should be prepared to parse the last field
424 it knows about up until a colon or end of line.
425
426 @item
427 Not all fields are defined under all conditions.  You are required to
428 ignore the content of undefined fields.
429 @end itemize
430
431 There are several standard types for the content of a field:
432
433 @table @asis
434 @item verbatim
435 Some fields contain strings that are not escaped in any way.  Such
436 fields are described to be used @emph{verbatim}.  These fields will
437 never contain a colon character (for obvious reasons).  No de-escaping
438 or other formatting is required to use the field content.  This is for
439 easy parsing of the output, when it is known that the content can
440 never contain any special characters.
441
442 @item percent-escaped
443 Some fields contain strings that are described to be
444 @emph{percent-escaped}.  Such strings need to be de-escaped before
445 their content can be presented to the user.  A percent-escaped string
446 is de-escaped by replacing all occurrences of @code{%XY} by the byte
447 that has the hexadecimal value @code{XY}.  @code{X} and @code{Y} are
448 from the set @code{0-9a-f}.
449
450 @item localized
451 Some fields contain strings that are described to be @emph{localized}.
452 Such strings are translated to the active language and formatted in
453 the active character set.
454
455 @item @w{unsigned number}
456 Some fields contain an @emph{unsigned number}.  This number will
457 always fit into a 32-bit unsigned integer variable.  The number may be
458 followed by a space, followed by a human readable description of that
459 value (if the verbose option is used).  You should ignore everything
460 in the field that follows the number.
461
462 @item @w{signed number}
463 Some fields contain a @emph{signed number}.  This number will always
464 fit into a 32-bit signed integer variable.  The number may be followed
465 by a space, followed by a human readable description of that value (if
466 the verbose option is used).  You should ignore everything in the
467 field that follows the number.
468
469 @item @w{boolean value}
470 Some fields contain a @emph{boolean value}.  This is a number with
471 either the value 0 or 1.  The number may be followed by a space,
472 followed by a human readable description of that value (if the verbose
473 option is used).  You should ignore everything in the field that follows
474 the number; checking just the first character is sufficient in this
475 case.
476
477 @item option
478 Some fields contain an @emph{option} argument.  The format of an
479 option argument depends on the type of the option and on some flags:
480
481 @table @asis
482 @item no argument
483 The simplest case is that the option does not take an argument at all
484 (@var{type} @code{0}).  Then the option argument is an unsigned number
485 that specifies how often the option occurs.  If the @code{list} flag
486 is not set, then the only valid number is @code{1}.  Options that do
487 not take an argument never have the @code{default} or @code{optional
488 arg} flag set.
489
490 @item number
491 If the option takes a number argument (@var{alt-type} is @code{2} or
492 @code{3}), and it can only occur once (@code{list} flag is not set),
493 then the option argument is either empty (only allowed if the argument
494 is optional), or it is a number.  A number is a string that begins
495 with an optional minus character, followed by one or more digits.  The
496 number must fit into an integer variable (unsigned or signed,
497 depending on @var{alt-type}).
498
499 @item number list
500 If the option takes a number argument and it can occur more than once,
501 then the option argument is either empty, or it is a comma-separated
502 list of numbers as described above.
503
504 @item string
505 If the option takes a string argument (@var{alt-type} is 1), and it
506 can only occur once (@code{list} flag is not set) then the option
507 argument is either empty (only allowed if the argument is optional),
508 or it starts with a double quote character (@code{"}) followed by a
509 percent-escaped string that is the argument value.  Note that there is
510 only a leading double quote character, no trailing one.  The double
511 quote character is only needed to be able to differentiate between no
512 value and the empty string as value.
513
514 @item string list
515 If the option takes a string argument and it can occur more than once,
516 then the option argument is either empty, or it is a comma-separated
517 list of string arguments as described above.
518 @end table
519 @end table
520
521 The active language and character set are currently determined from
522 the locale environment of the @command{gpgconf} program.
523
524 @c FIXME: Document the active language and active character set.  Allow
525 @c to change it via the command line?
526
527
528 @mansect usage
529 @node Listing components
530 @subsection Listing components
531
532 The command @code{--list-components} will list all components that can
533 be configured with @command{gpgconf}.  Usually, one component will
534 correspond to one GnuPG-related program and contain the options of
535 that program's configuration file that can be modified using
536 @command{gpgconf}.  However, this is not necessarily the case.  A
537 component might also be a group of selected options from several
538 programs, or contain entirely virtual options that have a special
539 effect rather than changing exactly one option in one configuration
540 file.
541
542 A component is a set of configuration options that semantically belong
543 together.  Furthermore, several changes to a component can be made in
544 an atomic way with a single operation.  The GUI could for example
545 provide a menu with one entry for each component, or a window with one
546 tabulator sheet per component.
547
548 The command @code{--list-components} lists all available
549 components, one per line.  The format of each line is:
550
551 @code{@var{name}:@var{description}:@var{pgmname}:}
552
553 @table @var
554 @item name
555 This field contains a name tag of the component.  The name tag is used
556 to specify the component in all communication with @command{gpgconf}.
557 The name tag is to be used @emph{verbatim}.  It is thus not in any
558 escaped format.
559
560 @item description
561 The @emph{string} in this field contains a human-readable description
562 of the component.  It can be displayed to the user of the GUI for
563 informational purposes.  It is @emph{percent-escaped} and
564 @emph{localized}.
565
566 @item pgmname
567 The @emph{string} in this field contains the absolute name of the
568 program's file.  It can be used to unambiguously invoke that program.
569 It is @emph{percent-escaped}.
570 @end table
571
572 Example:
573 @example
574 $ gpgconf --list-components
575 gpg:GPG for OpenPGP:/usr/local/bin/gpg2:
576 gpg-agent:GPG Agent:/usr/local/bin/gpg-agent:
577 scdaemon:Smartcard Daemon:/usr/local/bin/scdaemon:
578 gpgsm:GPG for S/MIME:/usr/local/bin/gpgsm:
579 dirmngr:Directory Manager:/usr/local/bin/dirmngr:
580 @end example
581
582
583
584 @node Checking programs
585 @subsection Checking programs
586
587 The command @code{--check-programs} is similar to
588 @code{--list-components} but works on backend programs and not on
589 components.  It runs each program to test whether it is installed and
590 runnable.  This also includes a syntax check of all config file options
591 of the program.
592
593 The command @code{--check-programs} lists all available
594 programs, one per line.  The format of each line is:
595
596 @code{@var{name}:@var{description}:@var{pgmname}:@var{avail}:@var{okay}:@var{cfgfile}:@var{line}:@var{error}:}
597
598 @table @var
599 @item name
600 This field contains a name tag of the program which is identical to the
601 name of the component.  The name tag is to be used @emph{verbatim}.  It
602 is thus not in any escaped format.  This field may be empty to indicate
603 a continuation of error descriptions for the last name.  The description
604 and pgmname fields are then also empty.
605
606 @item description
607 The @emph{string} in this field contains a human-readable description
608 of the component.  It can be displayed to the user of the GUI for
609 informational purposes.  It is @emph{percent-escaped} and
610 @emph{localized}.
611
612 @item pgmname
613 The @emph{string} in this field contains the absolute name of the
614 program's file.  It can be used to unambiguously invoke that program.
615 It is @emph{percent-escaped}.
616
617 @item avail
618 The @emph{boolean value} in this field indicates whether the program is
619 installed and runnable.
620
621 @item okay
622 The @emph{boolean value} in this field indicates whether the program's
623 config file is syntactically okay.
624
625 @item cfgfile
626 If an error occurred in the configuration file (as indicated by a false
627 value in the field @code{okay}), this field has the name of the failing
628 configuration file.  It is @emph{percent-escaped}.
629
630 @item line
631 If an error occurred in the configuration file, this field has the line
632 number of the failing statement in the configuration file.
633 It is an @emph{unsigned number}.
634
635 @item error
636 If an error occurred in the configuration file, this field has the error
637 text of the failing statement in the configuration file.  It is
638 @emph{percent-escaped} and @emph{localized}.
639
640 @end table
641
642 @noindent
643 In the following example the @command{dirmngr} is not runnable and the
644 configuration file of @command{scdaemon} is not okay.
645
646 @example
647 $ gpgconf --check-programs
648 gpg:GPG for OpenPGP:/usr/local/bin/gpg2:1:1:
649 gpg-agent:GPG Agent:/usr/local/bin/gpg-agent:1:1:
650 scdaemon:Smartcard Daemon:/usr/local/bin/scdaemon:1:0:
651 gpgsm:GPG for S/MIME:/usr/local/bin/gpgsm:1:1:
652 dirmngr:Directory Manager:/usr/local/bin/dirmngr:0:0:
653 @end example
654
655 @noindent
656 The command @w{@code{--check-options @var{component}}} will verify the
657 configuration file in the same manner as @code{--check-programs}, but
658 only for the component @var{component}.
659
660
661 @node Listing options
662 @subsection Listing options
663
664 Every component contains one or more options.  Options may be gathered
665 into option groups to allow the GUI to give visual hints to the user
666 about which options are related.
667
668 The command @code{@w{--list-options @var{component}}} lists
669 all options (and the groups they belong to) in the component
670 @var{component}, one per line.  @var{component} must be the string in
671 the field @var{name} in the output of the @code{--list-components}
672 command.
673
674 There is one line for each option and each group.  First come all
675 options that are not in any group.  Then comes a line describing a
676 group.  Then come all options that belong into each group.  Then comes
677 the next group and so on.  There does not need to be any group (and in
678 this case the output will stop after the last non-grouped option).
679
680 The format of each line is:
681
682 @code{@var{name}:@var{flags}:@var{level}:@var{description}:@var{type}:@var{alt-type}:@var{argname}:@var{default}:@var{argdef}:@var{value}}
683
684 @table @var
685 @item name
686 This field contains a name tag for the group or option.  The name tag
687 is used to specify the group or option in all communication with
688 @command{gpgconf}.  The name tag is to be used @emph{verbatim}.  It is
689 thus not in any escaped format.
690
691 @item flags
692 The flags field contains an @emph{unsigned number}.  Its value is the
693 OR-wise combination of the following flag values:
694
695 @table @code
696 @item group (1)
697 If this flag is set, this is a line describing a group and not an
698 option.
699 @end table
700
701 The following flag values are only defined for options (that is, if
702 the @code{group} flag is not used).
703
704 @table @code
705 @item optional arg (2)
706 If this flag is set, the argument is optional.  This is never set for
707 @var{type} @code{0} (none) options.
708
709 @item list (4)
710 If this flag is set, the option can be given multiple times.
711
712 @item runtime (8)
713 If this flag is set, the option can be changed at runtime.
714
715 @item default (16)
716 If this flag is set, a default value is available.
717
718 @item default desc (32)
719 If this flag is set, a (runtime) default is available.  This and the
720 @code{default} flag are mutually exclusive.
721
722 @item no arg desc (64)
723 If this flag is set, and the @code{optional arg} flag is set, then the
724 option has a special meaning if no argument is given.
725
726 @item no change (128)
727 If this flag is set, @command{gpgconf} ignores requests to change the
728 value.  GUI frontends should grey out this option.  Note, that manual
729 changes of the configuration files are still possible.
730 @end table
731
732 @item level
733 This field is defined for options and for groups.  It contains an
734 @emph{unsigned number} that specifies the expert level under which
735 this group or option should be displayed.  The following expert levels
736 are defined for options (they have analogous meaning for groups):
737
738 @table @code
739 @item basic (0)
740 This option should always be offered to the user.
741
742 @item advanced (1)
743 This option may be offered to advanced users.
744
745 @item expert (2)
746 This option should only be offered to expert users.
747
748 @item invisible (3)
749 This option should normally never be displayed, not even to expert
750 users.
751
752 @item internal (4)
753 This option is for internal use only.  Ignore it.
754 @end table
755
756 The level of a group will always be the lowest level of all options it
757 contains.
758
759 @item description
760 This field is defined for options and groups.  The @emph{string} in
761 this field contains a human-readable description of the option or
762 group.  It can be displayed to the user of the GUI for informational
763 purposes.  It is @emph{percent-escaped} and @emph{localized}.
764
765 @item type
766 This field is only defined for options.  It contains an @emph{unsigned
767 number} that specifies the type of the option's argument, if any.  The
768 following types are defined:
769
770 Basic types:
771
772 @table @code
773 @item none (0)
774 No argument allowed.
775
776 @item string (1)
777 An @emph{unformatted string}.
778
779 @item int32 (2)
780 A @emph{signed number}.
781
782 @item uint32 (3)
783 An @emph{unsigned number}.
784 @end table
785
786 Complex types:
787
788 @table @code
789 @item pathname (32)
790 A @emph{string} that describes the pathname of a file.  The file does
791 not necessarily need to exist.
792
793 @item ldap server (33)
794 A @emph{string} that describes an LDAP server in the format:
795
796 @code{@var{hostname}:@var{port}:@var{username}:@var{password}:@var{base_dn}}
797
798 @item key fingerprint (34)
799 A @emph{string} with a 40 digit fingerprint specifying a certificate.
800
801 @item pub key (35)
802 A @emph{string} that describes a certificate by user ID, key ID or
803 fingerprint.
804
805 @item sec key (36)
806 A @emph{string} that describes a certificate with a key by user ID,
807 key ID or fingerprint.
808
809 @item alias list (37)
810 A @emph{string} that describes an alias list, like the one used with
811 gpg's group option.  The list consists of a key, an equal sign and space
812 separated values.
813 @end table
814
815 More types will be added in the future.  Please see the @var{alt-type}
816 field for information on how to cope with unknown types.
817
818 @item alt-type
819 This field is identical to @var{type}, except that only the types
820 @code{0} to @code{31} are allowed.  The GUI is expected to present the
821 user the option in the format specified by @var{type}.  But if the
822 argument type @var{type} is not supported by the GUI, it can still
823 display the option in the more generic basic type @var{alt-type}.  The
824 GUI must support all the defined basic types to be able to display all
825 options.  More basic types may be added in future versions.  If the
826 GUI encounters a basic type it doesn't support, it should report an
827 error and abort the operation.
828
829 @item argname
830 This field is only defined for options with an argument type
831 @var{type} that is not @code{0}.  In this case it may contain a
832 @emph{percent-escaped} and @emph{localized string} that gives a short
833 name for the argument.  The field may also be empty, though, in which
834 case a short name is not known.
835
836 @item default
837 This field is defined only for options for which the @code{default} or
838 @code{default desc} flag is set.  If the @code{default} flag is set,
839 its format is that of an @emph{option argument} (@pxref{Format
840 conventions}, for details).  If the default value is empty, then no
841 default is known.  Otherwise, the value specifies the default value
842 for this option.  If the @code{default desc} flag is set, the field is
843 either empty or contains a description of the effect if the option is
844 not given.
845
846 @item argdef
847 This field is defined only for options for which the @code{optional
848 arg} flag is set.  If the @code{no arg desc} flag is not set, its
849 format is that of an @emph{option argument} (@pxref{Format
850 conventions}, for details).  If the default value is empty, then no
851 default is known.  Otherwise, the value specifies the default argument
852 for this option.  If the @code{no arg desc} flag is set, the field is
853 either empty or contains a description of the effect of this option if
854 no argument is given.
855
856 @item value
857 This field is defined only for options.  Its format is that of an
858 @emph{option argument}.  If it is empty, then the option is not
859 explicitly set in the current configuration, and the default applies
860 (if any).  Otherwise, it contains the current value of the option.
861 Note that this field is also meaningful if the option itself does not
862 take a real argument (in this case, it contains the number of times
863 the option appears).
864 @end table
865
866
867 @node Changing options
868 @subsection Changing options
869
870 The command @w{@code{--change-options @var{component}}} will attempt
871 to change the options of the component @var{component} to the
872 specified values.  @var{component} must be the string in the field
873 @var{name} in the output of the @code{--list-components} command.  You
874 have to provide the options that shall be changed in the following
875 format on standard input:
876
877 @code{@var{name}:@var{flags}:@var{new-value}}
878
879 @table @var
880 @item name
881 This is the name of the option to change.  @var{name} must be the
882 string in the field @var{name} in the output of the
883 @code{--list-options} command.
884
885 @item flags
886 The flags field contains an @emph{unsigned number}.  Its value is the
887 OR-wise combination of the following flag values:
888
889 @table @code
890 @item default (16)
891 If this flag is set, the option is deleted and the default value is
892 used instead (if applicable).
893 @end table
894
895 @item new-value
896 The new value for the option.  This field is only defined if the
897 @code{default} flag is not set.  The format is that of an @emph{option
898 argument}.  If it is empty (or the field is omitted), the default
899 argument is used (only allowed if the argument is optional for this
900 option).  Otherwise, the option will be set to the specified value.
901 @end table
902
903 @noindent
904 The output of the command is the same as that of
905 @code{--check-options} for the modified configuration file.
906
907 Examples:
908
909 To set the force option, which is of basic type @code{none (0)}:
910
911 @example
912 $ echo 'force:0:1' | gpgconf --change-options dirmngr
913 @end example
914
915 To delete the force option:
916
917 @example
918 $ echo 'force:16:' | gpgconf --change-options dirmngr
919 @end example
920
921 The @code{--runtime} option can influence when the changes take
922 effect.
923
924
925 @node Listing global options
926 @subsection Listing global options
927
928 Sometimes it is useful for applications to look at the global options
929 file @file{gpgconf.conf}.
930 The colon separated listing format is record oriented and uses the first
931 field to identify the record type:
932
933 @table @code
934 @item k
935 This describes a key record to start the definition of a new ruleset for
936 a user/group.  The format of a key record is:
937
938   @code{k:@var{user}:@var{group}:}
939
940 @table @var
941 @item user
942 This is the user field of the key.  It is percent escaped.  See the
943 definition of the gpgconf.conf format for details.
944
945 @item group
946 This is the group field of the key.  It is percent escaped.
947 @end table
948
949 @item r
950 This describes a rule record. All rule records up to the next key record
951 make up a rule set for that key.  The format of a rule record is:
952
953   @code{r:::@var{component}:@var{option}:@var{flag}:@var{value}:}
954
955 @table @var
956 @item component
957 This is the component part of a rule.  It is a plain string.
958
959 @item option
960 This is the option part of a rule.  It is a plain string.
961
962 @item flag
963 This is the flags part of a rule.  There may be only one flag per rule
964 but by using the same component and option, several flags may be
965 assigned to an option.  It is a plain string.
966
967 @item value
968 This is the optional value for the option.  It is a percent escaped
969 string with a single quotation mark to indicate a string.  The quotation
970 mark is only required to distinguish between no value specified and an
971 empty string.
972 @end table
973
974 @end table
975
976 @noindent
977 Unknown record types should be ignored.  Note that there is intentionally
978 no feature to change the global option file through @command{gpgconf}.
979
980
981 @node Querying versions
982 @subsection Get and compare software versions.
983
984 The GnuPG Project operates a server to query the current versions of
985 software packages related to GnuPG.  @command{gpgconf} can be used to
986 access this online database.  To allow for offline operations, this
987 feature works by having @command{dirmngr} download a file from
988 @code{https://versions.gnupg.org}, checking the signature of that file
989 and storing the file in the GnuPG home directory.  If
990 @command{gpgconf} is used and @command{dirmngr} is running, it may ask
991 @command{dirmngr} to refresh that file before itself uses the file.
992
993 The command @option{--query-swdb} returns information for the given
994 package in a colon delimited format:
995
996 @table @var
997
998 @item name
999 This is the name of the package as requested.  Note that "gnupg" is a
1000 special name which is replaced by the actual package implementing this
1001 version of GnuPG.  For this name it is also not required to specify a
1002 version because @command{gpgconf} takes its own version in this case.
1003
1004 @item iversion
1005 The currently installed version or an empty string.  The value is
1006 taken from the command line argument but may be provided by gpg
1007 if not given.
1008
1009 @item status
1010 The status of the software package according to this table:
1011 @table @code
1012 @item -
1013 No information available.  This is either because no current version
1014 has been specified or due to an error.
1015 @item ?
1016 The given name is not known in the online database.
1017 @item u
1018 An update of the software is available.
1019 @item c
1020 The installed version of the software is current.
1021 @item n
1022 The installed version is already newer than the released version.
1023 @end table
1024
1025 @item urgency
1026 If the value (the empty string should be considered as zero) is
1027 greater than zero an important update is available.
1028
1029 @item error
1030 This returns an @command{gpg-error} error code to distinguish between
1031 various failure modes.
1032
1033 @item filedate
1034 This gives the date of the file with the version numbers in standard
1035 ISO format (@code{yyyymmddThhmmss}).  The date has been extracted by
1036 @command{dirmngr} from the signature of the file.
1037
1038 @item verified
1039 This gives the date in ISO format the file was downloaded.  This value
1040 can be used to evaluate the freshness of the information.
1041
1042 @item version
1043 This returns the version string for the requested software from the
1044 file.
1045
1046 @item reldate
1047 This returns the release date in ISO format.
1048
1049 @item size
1050 This returns the size of the package as decimal number of bytes.
1051
1052 @item hash
1053 This returns a hexified SHA-2 hash of the package.
1054
1055 @end table
1056
1057 @noindent
1058 More fields may be added in future to the output.
1059
1060
1061 @mansect files
1062 @node Files used by gpgconf
1063 @subsection Files used by gpgconf
1064
1065 @table @file
1066
1067 @item /etc/gnupg/gpgconf.conf
1068 @cindex gpgconf.conf
1069   If this file exists, it is processed as a global configuration file.
1070   A commented example can be found in the @file{examples} directory of
1071   the distribution.
1072
1073 @item @var{GNUPGHOME}/swdb.lst
1074 @cindex swdb.lst
1075   A file with current software versions.  @command{dirmngr} creates
1076   this file on demand from an online resource.
1077
1078 @end table
1079
1080
1081 @mansect see also
1082 @ifset isman
1083 @command{gpg}(1),
1084 @command{gpgsm}(1),
1085 @command{gpg-agent}(1),
1086 @command{scdaemon}(1),
1087 @command{dirmngr}(1)
1088 @end ifset
1089 @include see-also-note.texi
1090
1091
1092
1093 @c
1094 @c    APPLYGNUPGDEFAULTS
1095 @c
1096 @manpage applygnupgdefaults.8
1097 @node applygnupgdefaults
1098 @section Run gpgconf for all users
1099 @ifset manverb
1100 .B applygnupgdefaults
1101 \- Run gpgconf --apply-defaults for all users.
1102 @end ifset
1103
1104 @mansect synopsis
1105 @ifset manverb
1106 .B  applygnupgdefaults
1107 @end ifset
1108
1109 @mansect description
1110 This script is a wrapper around @command{gpgconf} to run it with the
1111 command @code{--apply-defaults} for all real users with an existing
1112 GnuPG home directory.  Admins might want to use this script to update he
1113 GnuPG configuration files for all users after
1114 @file{/etc/gnupg/gpgconf.conf} has been changed.  This allows enforcing
1115 certain policies for all users.  Note, that this is not a bulletproof way to
1116 force a user to use certain options.  A user may always directly edit
1117 the configuration files and bypass gpgconf.
1118
1119 @noindent
1120 @command{applygnupgdefaults} is invoked by root as:
1121
1122 @example
1123 applygnupgdefaults
1124 @end example
1125
1126
1127 @c
1128 @c   GPG-PRESET-PASSPHRASE
1129 @c
1130 @node gpg-preset-passphrase
1131 @section Put a passphrase into the cache
1132 @manpage gpg-preset-passphrase.1
1133 @ifset manverb
1134 .B gpg-preset-passphrase
1135 \- Put a passphrase into gpg-agent's cache
1136 @end ifset
1137
1138 @mansect synopsis
1139 @ifset manverb
1140 .B  gpg-preset-passphrase
1141 .RI [ options ]
1142 .RI [ command ]
1143 .I cache-id
1144 @end ifset
1145
1146 @mansect description
1147 The @command{gpg-preset-passphrase} is a utility to seed the internal
1148 cache of a running @command{gpg-agent} with passphrases.  It is mainly
1149 useful for unattended machines, where the usual @command{pinentry} tool
1150 may not be used and the passphrases for the to be used keys are given at
1151 machine startup.
1152
1153 Passphrases set with this utility don't expire unless the
1154 @option{--forget} option is used to explicitly clear them from the
1155 cache --- or @command{gpg-agent} is either restarted or reloaded (by
1156 sending a SIGHUP to it).  Note that the maximum cache time as set with
1157 @option{--max-cache-ttl} is still honored.  It is necessary to allow
1158 this passphrase presetting by starting @command{gpg-agent} with the
1159 @option{--allow-preset-passphrase}.
1160
1161 @menu
1162 * Invoking gpg-preset-passphrase::   List of all commands and options.
1163 @end menu
1164
1165 @manpause
1166 @node Invoking gpg-preset-passphrase
1167 @subsection List of all commands and options
1168 @mancont
1169
1170 @noindent
1171 @command{gpg-preset-passphrase} is invoked this way:
1172
1173 @example
1174 gpg-preset-passphrase [options] [command] @var{cacheid}
1175 @end example
1176
1177 @var{cacheid} is either a 40 character keygrip of hexadecimal
1178 characters identifying the key for which the passphrase should be set
1179 or cleared.  The keygrip is listed along with the key when running the
1180 command: @code{gpgsm --dump-secret-keys}.  Alternatively an arbitrary
1181 string may be used to identify a passphrase; it is suggested that such
1182 a string is prefixed with the name of the application (e.g
1183 @code{foo:12346}).
1184
1185 @noindent
1186 One of the following command options must be given:
1187
1188 @table @gnupgtabopt
1189 @item --preset
1190 @opindex preset
1191 Preset a passphrase. This is what you usually will
1192 use. @command{gpg-preset-passphrase} will then read the passphrase from
1193 @code{stdin}.
1194
1195 @item --forget
1196 @opindex forget
1197 Flush the passphrase for the given cache ID from the cache.
1198
1199 @end table
1200
1201 @noindent
1202 The following additional options may be used:
1203
1204 @table @gnupgtabopt
1205 @item -v
1206 @itemx --verbose
1207 @opindex verbose
1208 Output additional information while running.
1209
1210 @item -P @var{string}
1211 @itemx --passphrase @var{string}
1212 @opindex passphrase
1213 Instead of reading the passphrase from @code{stdin}, use the supplied
1214 @var{string} as passphrase.  Note that this makes the passphrase visible
1215 for other users.
1216 @end table
1217
1218 @mansect see also
1219 @ifset isman
1220 @command{gpg}(1),
1221 @command{gpgsm}(1),
1222 @command{gpg-agent}(1),
1223 @command{scdaemon}(1)
1224 @end ifset
1225 @include see-also-note.texi
1226
1227
1228
1229
1230 @c
1231 @c   GPG-CONNECT-AGENT
1232 @c
1233 @node gpg-connect-agent
1234 @section Communicate with a running agent
1235 @manpage gpg-connect-agent.1
1236 @ifset manverb
1237 .B gpg-connect-agent
1238 \- Communicate with a running agent
1239 @end ifset
1240
1241 @mansect synopsis
1242 @ifset manverb
1243 .B  gpg-connect-agent
1244 .RI [ options ] [commands]
1245 @end ifset
1246
1247 @mansect description
1248 The @command{gpg-connect-agent} is a utility to communicate with a
1249 running @command{gpg-agent}.  It is useful to check out the commands
1250 @command{gpg-agent} provides using the Assuan interface.  It might
1251 also be useful for scripting simple applications.  Input is expected
1252 at stdin and output gets printed to stdout.
1253
1254 It is very similar to running @command{gpg-agent} in server mode; but
1255 here we connect to a running instance.
1256
1257 @menu
1258 * Invoking gpg-connect-agent::       List of all options.
1259 * Controlling gpg-connect-agent::    Control commands.
1260 @end menu
1261
1262 @manpause
1263 @node Invoking gpg-connect-agent
1264 @subsection List of all options
1265
1266 @noindent
1267 @command{gpg-connect-agent} is invoked this way:
1268
1269 @example
1270 gpg-connect-agent [options] [commands]
1271 @end example
1272 @mancont
1273
1274 @noindent
1275 The following options may be used:
1276
1277 @table @gnupgtabopt
1278 @item -v
1279 @itemx --verbose
1280 @opindex verbose
1281 Output additional information while running.
1282
1283 @item -q
1284 @item --quiet
1285 @opindex q
1286 @opindex quiet
1287 Try to be as quiet as possible.
1288
1289 @include opt-homedir.texi
1290
1291 @item --agent-program @var{file}
1292 @opindex agent-program
1293 Specify the agent program to be started if none is running.  The
1294 default value is determined by running @command{gpgconf} with the
1295 option @option{--list-dirs}.  Note that the pipe symbol (@code{|}) is
1296 used for a regression test suite hack and may thus not be used in the
1297 file name.
1298
1299 @item --dirmngr-program @var{file}
1300 @opindex dirmngr-program
1301 Specify the directory manager (keyserver client) program to be started
1302 if none is running.  This has only an effect if used together with the
1303 option @option{--dirmngr}.
1304
1305 @item --dirmngr
1306 @opindex dirmngr
1307 Connect to a running directory manager (keyserver client) instead of
1308 to the gpg-agent.  If a dirmngr is not running, start it.
1309
1310 @item -S
1311 @itemx --raw-socket @var{name}
1312 @opindex raw-socket
1313 Connect to socket @var{name} assuming this is an Assuan style server.
1314 Do not run any special initializations or environment checks.  This may
1315 be used to directly connect to any Assuan style socket server.
1316
1317 @item -E
1318 @itemx --exec
1319 @opindex exec
1320 Take the rest of the command line as a program and it's arguments and
1321 execute it as an Assuan server. Here is how you would run @command{gpgsm}:
1322 @smallexample
1323  gpg-connect-agent --exec gpgsm --server
1324 @end smallexample
1325 Note that you may not use options on the command line in this case.
1326
1327 @item --no-ext-connect
1328 @opindex no-ext-connect
1329 When using @option{-S} or @option{--exec}, @command{gpg-connect-agent}
1330 connects to the Assuan server in extended mode to allow descriptor
1331 passing.  This option makes it use the old mode.
1332
1333 @item --no-autostart
1334 @opindex no-autostart
1335 Do not start the gpg-agent or the dirmngr if it has not yet been
1336 started.
1337
1338 @item -r @var{file}
1339 @itemx --run @var{file}
1340 @opindex run
1341 Run the commands from @var{file} at startup and then continue with the
1342 regular input method.  Note, that commands given on the command line are
1343 executed after this file.
1344
1345 @item -s
1346 @itemx --subst
1347 @opindex subst
1348 Run the command @code{/subst} at startup.
1349
1350 @item --hex
1351 @opindex hex
1352 Print data lines in a hex format and the ASCII representation of
1353 non-control characters.
1354
1355 @item --decode
1356 @opindex decode
1357 Decode data lines.  That is to remove percent escapes but make sure that
1358 a new line always starts with a D and a space.
1359
1360 @end table
1361
1362 @mansect control commands
1363 @node Controlling gpg-connect-agent
1364 @subsection Control commands
1365
1366 While reading Assuan commands, gpg-agent also allows a few special
1367 commands to control its operation.  These control commands all start
1368 with a slash (@code{/}).
1369
1370 @table @code
1371
1372 @item /echo @var{args}
1373 Just print @var{args}.
1374
1375 @item /let @var{name} @var{value}
1376 Set the variable @var{name} to @var{value}.  Variables are only
1377 substituted on the input if the @command{/subst} has been used.
1378 Variables are referenced by prefixing the name with a dollar sign and
1379 optionally include the name in curly braces.  The rules for a valid name
1380 are identically to those of the standard bourne shell.  This is not yet
1381 enforced but may be in the future.  When used with curly braces no
1382 leading or trailing white space is allowed.
1383
1384 If a variable is not found, it is searched in the environment and if
1385 found copied to the table of variables.
1386
1387 Variable functions are available: The name of the function must be
1388 followed by at least one space and the at least one argument.  The
1389 following functions are available:
1390
1391 @table @code
1392 @item get
1393 Return a value described by the argument.  Available arguments are:
1394
1395 @table @code
1396 @item cwd
1397 The current working directory.
1398 @item homedir
1399 The gnupg homedir.
1400 @item sysconfdir
1401 GnuPG's system configuration directory.
1402 @item bindir
1403 GnuPG's binary directory.
1404 @item libdir
1405 GnuPG's library directory.
1406 @item libexecdir
1407 GnuPG's library directory for executable files.
1408 @item datadir
1409 GnuPG's data directory.
1410 @item serverpid
1411 The PID of the current server. Command @command{/serverpid} must
1412 have been given to return a useful value.
1413 @end table
1414
1415 @item unescape @var{args}
1416 Remove C-style escapes from @var{args}.  Note that @code{\0} and
1417 @code{\x00} terminate the returned string implicitly.  The string to be
1418 converted are the entire arguments right behind the delimiting space of
1419 the function name.
1420
1421 @item unpercent @var{args}
1422 @itemx unpercent+ @var{args}
1423 Remove percent style escaping from @var{args}.  Note that @code{%00}
1424 terminates the string implicitly.  The string to be converted are the
1425 entire arguments right behind the delimiting space of the function
1426 name. @code{unpercent+} also maps plus signs to a spaces.
1427
1428 @item percent @var{args}
1429 @itemx percent+ @var{args}
1430 Escape the @var{args} using percent style escaping.  Tabs, formfeeds,
1431 linefeeds, carriage returns and colons are escaped. @code{percent+} also
1432 maps spaces to plus signs.
1433
1434 @item errcode @var{arg}
1435 @itemx errsource @var{arg}
1436 @itemx errstring @var{arg}
1437 Assume @var{arg} is an integer and evaluate it using @code{strtol}.  Return
1438 the gpg-error error code, error source or a formatted string with the
1439 error code and error source.
1440
1441
1442 @item +
1443 @itemx -
1444 @itemx *
1445 @itemx /
1446 @itemx %
1447 Evaluate all arguments as long integers using @code{strtol} and apply
1448 this operator.  A division by zero yields an empty string.
1449
1450 @item !
1451 @itemx |
1452 @itemx &
1453 Evaluate all arguments as long integers using @code{strtol} and apply
1454 the logical operators NOT, OR or AND.  The NOT operator works on the
1455 last argument only.
1456
1457
1458 @end table
1459
1460
1461 @item /definq @var{name} @var{var}
1462 Use content of the variable @var{var} for inquiries with @var{name}.
1463 @var{name} may be an asterisk (@code{*}) to match any inquiry.
1464
1465
1466 @item /definqfile @var{name} @var{file}
1467 Use content of @var{file} for inquiries with @var{name}.
1468 @var{name} may be an asterisk (@code{*}) to match any inquiry.
1469
1470 @item /definqprog @var{name} @var{prog}
1471 Run @var{prog} for inquiries matching @var{name} and pass the
1472 entire line to it as command line arguments.
1473
1474 @item /datafile @var{name}
1475 Write all data lines from the server to the file @var{name}.  The file
1476 is opened for writing and created if it does not exists.  An existing
1477 file is first truncated to 0.  The data written to the file fully
1478 decoded.  Using a single dash for @var{name} writes to stdout.  The
1479 file is kept open until a new file is set using this command or this
1480 command is used without an argument.
1481
1482 @item /showdef
1483 Print all definitions
1484
1485 @item /cleardef
1486 Delete all definitions
1487
1488 @item /sendfd @var{file} @var{mode}
1489 Open @var{file} in @var{mode} (which needs to be a valid @code{fopen}
1490 mode string) and send the file descriptor to the server.  This is
1491 usually followed by a command like @code{INPUT FD} to set the
1492 input source for other commands.
1493
1494 @item /recvfd
1495 Not yet implemented.
1496
1497 @item /open @var{var} @var{file} [@var{mode}]
1498 Open @var{file} and assign the file descriptor to @var{var}.  Warning:
1499 This command is experimental and might change in future versions.
1500
1501 @item /close @var{fd}
1502 Close the file descriptor @var{fd}.  Warning: This command is
1503 experimental and might change in future versions.
1504
1505 @item /showopen
1506 Show a list of open files.
1507
1508 @item /serverpid
1509 Send the Assuan command @command{GETINFO pid} to the server and store
1510 the returned PID for internal purposes.
1511
1512 @item /sleep
1513 Sleep for a second.
1514
1515 @item /hex
1516 @itemx /nohex
1517 Same as the command line option @option{--hex}.
1518
1519 @item /decode
1520 @itemx /nodecode
1521 Same as the command line option @option{--decode}.
1522
1523 @item /subst
1524 @itemx /nosubst
1525 Enable and disable variable substitution.  It defaults to disabled
1526 unless the command line option @option{--subst} has been used.
1527 If /subst as been enabled once, leading whitespace is removed from
1528 input lines which makes scripts easier to read.
1529
1530 @item /while @var{condition}
1531 @itemx /end
1532 These commands provide a way for executing loops.  All lines between
1533 the @code{while} and the corresponding @code{end} are executed as long
1534 as the evaluation of @var{condition} yields a non-zero value or is the
1535 string @code{true} or @code{yes}.  The evaluation is done by passing
1536 @var{condition} to the @code{strtol} function.  Example:
1537
1538 @smallexample
1539   /subst
1540   /let i 3
1541   /while $i
1542     /echo loop couter is $i
1543     /let i $@{- $i 1@}
1544   /end
1545 @end smallexample
1546
1547 @item /if @var{condition}
1548 @itemx /end
1549 These commands provide a way for conditional execution.  All lines between
1550 the @code{if} and the corresponding @code{end} are executed only if
1551 the evaluation of @var{condition} yields a non-zero value or is the
1552 string @code{true} or @code{yes}.  The evaluation is done by passing
1553 @var{condition} to the @code{strtol} function.
1554
1555 @item /run @var{file}
1556 Run commands from @var{file}.
1557
1558 @item /bye
1559 Terminate the connection and the program.
1560
1561 @item /help
1562 Print a list of available control commands.
1563
1564 @end table
1565
1566
1567 @ifset isman
1568 @mansect see also
1569 @command{gpg-agent}(1),
1570 @command{scdaemon}(1)
1571 @include see-also-note.texi
1572 @end ifset
1573
1574 @c
1575 @c   DIRMNGR-CLIENT
1576 @c
1577 @node dirmngr-client
1578 @section The Dirmngr Client Tool
1579
1580 @manpage dirmngr-client.1
1581 @ifset manverb
1582 .B dirmngr-client
1583 \- Tool to access the Dirmngr services
1584 @end ifset
1585
1586 @mansect synopsis
1587 @ifset manverb
1588 .B  dirmngr-client
1589 .RI [ options ]
1590 .RI [ certfile | pattern ]
1591 @end ifset
1592
1593 @mansect description
1594 The @command{dirmngr-client} is a simple tool to contact a running
1595 dirmngr and test whether a certificate has been revoked --- either by
1596 being listed in the corresponding CRL or by running the OCSP protocol.
1597 If no dirmngr is running, a new instances will be started but this is
1598 in general not a good idea due to the huge performance overhead.
1599
1600 @noindent
1601 The usual way to run this tool is either:
1602
1603 @example
1604 dirmngr-client @var{acert}
1605 @end example
1606
1607 @noindent
1608 or
1609
1610 @example
1611 dirmngr-client <@var{acert}
1612 @end example
1613
1614 Where @var{acert} is one DER encoded (binary) X.509 certificates to be
1615 tested.
1616 @ifclear isman
1617 The return value of this command is
1618 @end ifclear
1619
1620 @mansect return value
1621 @ifset isman
1622 @command{dirmngr-client} returns these values:
1623 @end ifset
1624 @table @code
1625
1626 @item 0
1627 The certificate under question is valid; i.e. there is a valid CRL
1628 available and it is not listed there or the OCSP request returned that
1629 that certificate is valid.
1630
1631 @item 1
1632 The certificate has been revoked
1633
1634 @item 2 (and other values)
1635 There was a problem checking the revocation state of the certificate.
1636 A message to stderr has given more detailed information.  Most likely
1637 this is due to a missing or expired CRL or due to a network problem.
1638
1639 @end table
1640
1641 @mansect options
1642 @noindent
1643 @command{dirmngr-client} may be called with the following options:
1644
1645
1646 @table @gnupgtabopt
1647 @item --version
1648 @opindex version
1649 Print the program version and licensing information.  Note that you cannot
1650 abbreviate this command.
1651
1652 @item --help, -h
1653 @opindex help
1654 Print a usage message summarizing the most useful command-line options.
1655 Note that you cannot abbreviate this command.
1656
1657 @item --quiet, -q
1658 @opindex quiet
1659 Make the output extra brief by suppressing any informational messages.
1660
1661 @item -v
1662 @item --verbose
1663 @opindex v
1664 @opindex verbose
1665 Outputs additional information while running.
1666 You can increase the verbosity by giving several
1667 verbose commands to @sc{dirmngr}, such as @samp{-vv}.
1668
1669 @item --pem
1670 @opindex pem
1671 Assume that the given certificate is in PEM (armored) format.
1672
1673 @item --ocsp
1674 @opindex ocsp
1675 Do the check using the OCSP protocol and ignore any CRLs.
1676
1677 @item --force-default-responder
1678 @opindex force-default-responder
1679 When checking using the OCSP protocol, force the use of the default OCSP
1680 responder.  That is not to use the Reponder as given by the certificate.
1681
1682 @item --ping
1683 @opindex ping
1684 Check whether the dirmngr daemon is up and running.
1685
1686 @item --cache-cert
1687 @opindex cache-cert
1688 Put the given certificate into the cache of a running dirmngr.  This is
1689 mainly useful for debugging.
1690
1691 @item --validate
1692 @opindex validate
1693 Validate the given certificate using dirmngr's internal validation code.
1694 This is mainly useful for debugging.
1695
1696 @item --load-crl
1697 @opindex load-crl
1698 This command expects a list of filenames with DER encoded CRL files.
1699 With the option @option{--url} URLs are expected in place of filenames
1700 and they are loaded directly from the given location.  All CRLs will be
1701 validated and then loaded into dirmngr's cache.
1702
1703 @item --lookup
1704 @opindex lookup
1705 Take the remaining arguments and run a lookup command on each of them.
1706 The results are Base-64 encoded outputs (without header lines).  This
1707 may be used to retrieve certificates from a server. However the output
1708 format is not very well suited if more than one certificate is returned.
1709
1710 @item --url
1711 @itemx -u
1712 @opindex url
1713 Modify the @command{lookup} and @command{load-crl} commands to take an URL.
1714
1715 @item --local
1716 @itemx -l
1717 @opindex url
1718 Let the @command{lookup} command only search the local cache.
1719
1720 @item --squid-mode
1721 @opindex squid-mode
1722 Run @sc{dirmngr-client} in a mode suitable as a helper program for
1723 Squid's @option{external_acl_type} option.
1724
1725
1726 @end table
1727
1728 @ifset isman
1729 @mansect see also
1730 @command{dirmngr}(8),
1731 @command{gpgsm}(1)
1732 @include see-also-note.texi
1733 @end ifset
1734
1735
1736 @c
1737 @c   GPGPARSEMAIL
1738 @c
1739 @node gpgparsemail
1740 @section Parse a mail message into an annotated format
1741
1742 @manpage gpgparsemail.1
1743 @ifset manverb
1744 .B gpgparsemail
1745 \- Parse a mail message into an annotated format
1746 @end ifset
1747
1748 @mansect synopsis
1749 @ifset manverb
1750 .B  gpgparsemail
1751 .RI [ options ]
1752 .RI [ file ]
1753 @end ifset
1754
1755 @mansect description
1756 The @command{gpgparsemail} is a utility currently only useful for
1757 debugging.  Run it with @code{--help} for usage information.
1758
1759
1760
1761 @c
1762 @c   SYMCRYPTRUN
1763 @c
1764 @node symcryptrun
1765 @section Call a simple symmetric encryption tool
1766 @manpage symcryptrun.1
1767 @ifset manverb
1768 .B symcryptrun
1769 \- Call a simple symmetric encryption tool
1770 @end ifset
1771
1772 @mansect synopsis
1773 @ifset manverb
1774 .B  symcryptrun
1775 .B \-\-class
1776 .I class
1777 .B \-\-program
1778 .I program
1779 .B \-\-keyfile
1780 .I keyfile
1781 .RB [ --decrypt | --encrypt ]
1782 .RI [ inputfile ]
1783 @end ifset
1784
1785 @mansect description
1786 Sometimes simple encryption tools are already in use for a long time
1787 and there might be a desire to integrate them into the GnuPG
1788 framework.  The protocols and encryption methods might be non-standard
1789 or not even properly documented, so that a full-fledged encryption
1790 tool with an interface like @command{gpg} is not doable.
1791 @command{symcryptrun} provides a solution: It operates by calling the
1792 external encryption/decryption module and provides a passphrase for a
1793 key using the standard @command{pinentry} based mechanism through
1794 @command{gpg-agent}.
1795
1796 Note, that @command{symcryptrun} is only available if GnuPG has been
1797 configured with @samp{--enable-symcryptrun} at build time.
1798
1799 @menu
1800 * Invoking symcryptrun::   List of all commands and options.
1801 @end menu
1802
1803 @manpause
1804 @node Invoking symcryptrun
1805 @subsection List of all commands and options
1806
1807 @noindent
1808 @command{symcryptrun} is invoked this way:
1809
1810 @example
1811 symcryptrun --class CLASS --program PROGRAM --keyfile KEYFILE
1812    [--decrypt | --encrypt] [inputfile]
1813 @end example
1814 @mancont
1815
1816 For encryption, the plain text must be provided on STDIN or as the
1817 argument @var{inputfile}, and the ciphertext will be output to STDOUT.
1818 For decryption vice versa.
1819
1820 @var{CLASS} describes the calling conventions of the external tool.
1821 Currently it must be given as @samp{confucius}.  @var{PROGRAM} is
1822 the full filename of that external tool.
1823
1824 For the class @samp{confucius} the option @option{--keyfile} is
1825 required; @var{keyfile} is the name of a file containing the secret key,
1826 which may be protected by a passphrase.  For detailed calling
1827 conventions, see the source code.
1828
1829 @noindent
1830 Note, that @command{gpg-agent} must be running before starting
1831 @command{symcryptrun}.
1832
1833 @noindent
1834 The following additional options may be used:
1835
1836 @table @gnupgtabopt
1837 @item -v
1838 @itemx --verbose
1839 @opindex verbose
1840 Output additional information while running.
1841
1842 @item -q
1843 @item --quiet
1844 @opindex q
1845 @opindex quiet
1846 Try to be as quiet as possible.
1847
1848 @include opt-homedir.texi
1849
1850
1851 @item --log-file @var{file}
1852 @opindex log-file
1853 Append all logging output to @var{file}.  Use @file{socket://} to log
1854 to socket.  Default is to write logging information to STDERR.
1855
1856 @end table
1857
1858 @noindent
1859 The possible exit status codes of @command{symcryptrun} are:
1860
1861 @table @code
1862 @item 0
1863         Success.
1864 @item 1
1865         Some error occurred.
1866 @item 2
1867         No valid passphrase was provided.
1868 @item 3
1869         The operation was canceled by the user.
1870
1871 @end table
1872
1873 @mansect see also
1874 @ifset isman
1875 @command{gpg}(1),
1876 @command{gpgsm}(1),
1877 @command{gpg-agent}(1),
1878 @end ifset
1879 @include see-also-note.texi
1880
1881
1882 @c
1883 @c  GPG-ZIP
1884 @c
1885 @c The original manpage on which this section is based was written
1886 @c by Colin Tuckley  <colin@tuckley.org> and Daniel Leidert
1887 @c <daniel.leidert@wgdd.de> for the Debian distribution (but may be used by
1888 @c others).
1889 @manpage gpg-zip.1
1890 @node gpg-zip
1891 @section Encrypt or sign files into an archive
1892 @ifset manverb
1893 .B gpg-zip
1894 \- Encrypt or sign files into an archive
1895 @end ifset
1896
1897 @mansect synopsis
1898 @ifset manverb
1899 .B  gpg-zip
1900 .RI [ options ]
1901 .I filename1
1902 .I [ filename2, ... ]
1903 .I directory1
1904 .I [ directory2, ... ]
1905 @end ifset
1906
1907 @mansect description
1908 @command{gpg-zip} encrypts or signs files into an archive.  It is an
1909 gpg-ized tar using the same format as used by PGP's PGP Zip.
1910
1911 @manpause
1912 @noindent
1913 @command{gpg-zip} is invoked this way:
1914
1915 @example
1916 gpg-zip [options] @var{filename1} [@var{filename2}, ...] @var{directory} [@var{directory2}, ...]
1917 @end example
1918
1919 @mansect options
1920 @noindent
1921 @command{gpg-zip} understands these options:
1922
1923 @table @gnupgtabopt
1924
1925 @item --encrypt
1926 @itemx -e
1927 @opindex encrypt
1928 Encrypt data.  This option may be combined with @option{--symmetric} (for  output that may be decrypted via a secret key or a passphrase).
1929
1930 @item --decrypt
1931 @itemx -d
1932 @opindex decrypt
1933 Decrypt data.
1934
1935 @item --symmetric
1936 @itemx -c
1937 Encrypt with a symmetric cipher using a passphrase.  The default
1938 symmetric cipher used is CAST5, but may be chosen with the
1939 @option{--cipher-algo} option to @command{gpg}.
1940
1941 @item --sign
1942 @itemx -s
1943 Make a signature.  See @command{gpg}.
1944
1945 @item --recipient @var{user}
1946 @itemx -r @var{user}
1947 @opindex recipient
1948 Encrypt for user id @var{user}. See @command{gpg}.
1949
1950 @item --local-user @var{user}
1951 @itemx -u @var{user}
1952 @opindex local-user
1953 Use @var{user} as the key to sign with.  See @command{gpg}.
1954
1955 @item --list-archive
1956 @opindex list-archive
1957 List the contents of the specified archive.
1958
1959 @item --output @var{file}
1960 @itemx -o @var{file}
1961 @opindex output
1962 Write output to specified file @var{file}.
1963
1964 @item --gpg @var{gpgcmd}
1965 @opindex gpg
1966 Use the specified command @var{gpgcmd} instead of @command{gpg}.
1967
1968 @item --gpg-args @var{args}
1969 @opindex gpg-args
1970 Pass the specified options to @command{gpg}.
1971
1972 @item --tar @var{tarcmd}
1973 @opindex tar
1974 Use the specified command @var{tarcmd} instead of @command{tar}.
1975
1976 @item --tar-args @var{args}
1977 @opindex tar-args
1978 Pass the specified options to @command{tar}.
1979
1980 @item --version
1981 @opindex version
1982 Print version of the program and exit.
1983
1984 @item --help
1985 @opindex help
1986 Display a brief help page and exit.
1987
1988 @end table
1989
1990 @mansect diagnostics
1991 @noindent
1992 The program returns 0 if everything was fine, 1 otherwise.
1993
1994
1995 @mansect examples
1996 @ifclear isman
1997 @noindent
1998 Some examples:
1999
2000 @end ifclear
2001 @noindent
2002 Encrypt the contents of directory @file{mydocs} for user Bob to file
2003 @file{test1}:
2004
2005 @example
2006 gpg-zip --encrypt --output test1 --gpg-args  -r Bob mydocs
2007 @end example
2008
2009 @noindent
2010 List the contents of archive @file{test1}:
2011
2012 @example
2013 gpg-zip --list-archive test1
2014 @end example
2015
2016
2017 @mansect see also
2018 @ifset isman
2019 @command{gpg}(1),
2020 @command{tar}(1),
2021 @end ifset
2022 @include see-also-note.texi