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