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