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