chiark / gitweb /
gpg agent lockup fix: Interrupt main loop when active_connections_value==0
[gnupg2.git] / doc / gpg-agent.texi
1 @c Copyright (C) 2002 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 Invoking GPG-AGENT
8 @chapter Invoking GPG-AGENT
9 @cindex GPG-AGENT command options
10 @cindex command options
11 @cindex options, GPG-AGENT command
12
13 @manpage gpg-agent.1
14 @ifset manverb
15 .B gpg-agent
16 \- Secret key management for GnuPG
17 @end ifset
18
19 @mansect synopsis
20 @ifset manverb
21 .B  gpg-agent
22 .RB [ \-\-homedir
23 .IR dir ]
24 .RB [ \-\-options
25 .IR file ]
26 .RI [ options ]
27 .br
28 .B  gpg-agent
29 .RB [ \-\-homedir
30 .IR dir ]
31 .RB [ \-\-options
32 .IR file ]
33 .RI [ options ]
34 .B  \-\-server
35 .br
36 .B  gpg-agent
37 .RB [ \-\-homedir
38 .IR dir ]
39 .RB [ \-\-options
40 .IR file ]
41 .RI [ options ]
42 .B  \-\-daemon
43 .RI [ command_line ]
44 @end ifset
45
46 @mansect description
47 @command{gpg-agent} is a daemon to manage secret (private) keys
48 independently from any protocol.  It is used as a backend for
49 @command{gpg} and @command{gpgsm} as well as for a couple of other
50 utilities.
51
52 The agent is automatically started on demand by @command{gpg},
53 @command{gpgsm}, @command{gpgconf}, or @command{gpg-connect-agent}.
54 Thus there is no reason to start it manually.  In case you want to use
55 the included Secure Shell Agent you may start the agent using:
56
57 @c From dkg on gnupg-devel on 2016-04-21:
58 @c
59 @c Here's an attempt at writing a short description of the goals of an
60 @c isolated cryptographic agent:
61 @c
62 @c   A cryptographic agent should control access to secret key material.
63 @c   The agent permits use of the secret key material by a supplicant
64 @c   without providing a copy of the secret key material to the supplicant.
65 @c
66 @c   An isolated cryptographic agent separates the request for use of
67 @c   secret key material from permission for use of secret key material.
68 @c   That is, the system or process requesting use of the key (the
69 @c   "supplicant") can be denied use of the key by the owner/operator of
70 @c   the agent (the "owner"), which the supplicant has no control over.
71 @c
72 @c   One way of enforcing this split is a per-key or per-session
73 @c   passphrase, known only by the owner, which must be supplied to the
74 @c   agent to permit the use of the secret key material.  Another way is
75 @c   with an out-of-band permission mechanism (e.g. a button or GUI
76 @c   interface that the owner has access to, but the supplicant does not).
77 @c
78 @c   The rationale for this separation is that it allows access to the
79 @c   secret key to be tightly controlled and audited, and it doesn't permit
80 @c   the the supplicant to either copy the key or to override the owner's
81 @c   intentions.
82
83 @example
84 gpg-connect-agent /bye
85 @end example
86
87 @noindent
88 If you want to manually terminate the currently-running agent, you can
89 safely do so with:
90
91 @example
92 gpgconf --kill gpg-agent
93 @end example
94
95 @noindent
96 @efindex GPG_TTY
97 You should always add the following lines to your @code{.bashrc} or
98 whatever initialization file is used for all shell invocations:
99
100 @smallexample
101 GPG_TTY=$(tty)
102 export GPG_TTY
103 @end smallexample
104
105 @noindent
106 It is important that this environment variable always reflects the
107 output of the @code{tty} command.  For W32 systems this option is not
108 required.
109
110 Please make sure that a proper pinentry program has been installed
111 under the default filename (which is system dependent) or use the
112 option @option{pinentry-program} to specify the full name of that program.
113 It is often useful to install a symbolic link from the actual used
114 pinentry (e.g. @file{@value{BINDIR}/pinentry-gtk}) to the expected
115 one (e.g. @file{@value{BINDIR}/pinentry}).
116
117 @manpause
118 @noindent
119 @xref{Option Index}, for an index to @command{GPG-AGENT}'s commands and options.
120 @mancont
121
122 @menu
123 * Agent Commands::      List of all commands.
124 * Agent Options::       List of all options.
125 * Agent Configuration:: Configuration files.
126 * Agent Signals::       Use of some signals.
127 * Agent Examples::      Some usage examples.
128 * Agent Protocol::      The protocol the agent uses.
129 @end menu
130
131 @mansect commands
132 @node Agent Commands
133 @section Commands
134
135 Commands are not distinguished from options except for the fact that
136 only one command is allowed.
137
138 @table @gnupgtabopt
139 @item --version
140 @opindex version
141 Print the program version and licensing information.  Note that you cannot
142 abbreviate this command.
143
144 @item --help
145 @itemx -h
146 @opindex help
147 Print a usage message summarizing the most useful command-line options.
148 Note that you cannot abbreviate this command.
149
150 @item --dump-options
151 @opindex dump-options
152 Print a list of all available options and commands.  Note that you cannot
153 abbreviate this command.
154
155 @item --server
156 @opindex server
157 Run in server mode and wait for commands on the @code{stdin}.  The
158 default mode is to create a socket and listen for commands there.
159
160 @item --daemon [@var{command line}]
161 @opindex daemon
162 Start the gpg-agent as a daemon; that is, detach it from the console
163 and run it in the background.
164
165 As an alternative you may create a new process as a child of
166 gpg-agent: @code{gpg-agent --daemon /bin/sh}.  This way you get a new
167 shell with the environment setup properly; after you exit from this
168 shell, gpg-agent terminates within a few seconds.
169
170 @item --supervised
171 @opindex supervised
172 Run in the foreground, sending logs by default to stderr, and
173 listening on provided file descriptors, which must already be bound to
174 listening sockets.  This command is useful when running under systemd
175 or other similar process supervision schemes.  This option is not
176 supported on Windows.
177
178 In --supervised mode, different file descriptors can be provided for
179 use as different socket types (e.g. ssh, extra) as long as they are
180 identified in the environment variable @code{LISTEN_FDNAMES} (see
181 sd_listen_fds(3) on some Linux distributions for more information on
182 this convention).
183 @end table
184
185 @mansect options
186 @node Agent Options
187 @section Option Summary
188
189 @table @gnupgtabopt
190
191 @anchor{option --options}
192 @item --options @var{file}
193 @opindex options
194 Reads configuration from @var{file} instead of from the default
195 per-user configuration file.  The default configuration file is named
196 @file{gpg-agent.conf} and expected in the @file{.gnupg} directory directly
197 below the home directory of the user.
198
199 @anchor{option --homedir}
200 @include opt-homedir.texi
201
202
203 @item -v
204 @item --verbose
205 @opindex verbose
206 Outputs additional information while running.
207 You can increase the verbosity by giving several
208 verbose commands to @command{gpgsm}, such as @samp{-vv}.
209
210 @item -q
211 @item --quiet
212 @opindex quiet
213 Try to be as quiet as possible.
214
215 @item --batch
216 @opindex batch
217 Don't invoke a pinentry or do any other thing requiring human interaction.
218
219 @item --faked-system-time @var{epoch}
220 @opindex faked-system-time
221 This option is only useful for testing; it sets the system time back or
222 forth to @var{epoch} which is the number of seconds elapsed since the year
223 1970.
224
225 @item --debug-level @var{level}
226 @opindex debug-level
227 Select the debug level for investigating problems. @var{level} may be
228 a numeric value or a keyword:
229
230 @table @code
231 @item none
232 No debugging at all.  A value of less than 1 may be used instead of
233 the keyword.
234 @item basic
235 Some basic debug messages.  A value between 1 and 2 may be used
236 instead of the keyword.
237 @item advanced
238 More verbose debug messages.  A value between 3 and 5 may be used
239 instead of the keyword.
240 @item expert
241 Even more detailed messages.  A value between 6 and 8 may be used
242 instead of the keyword.
243 @item guru
244 All of the debug messages you can get. A value greater than 8 may be
245 used instead of the keyword.  The creation of hash tracing files is
246 only enabled if the keyword is used.
247 @end table
248
249 How these messages are mapped to the actual debugging flags is not
250 specified and may change with newer releases of this program. They are
251 however carefully selected to best aid in debugging.
252
253 @item --debug @var{flags}
254 @opindex debug
255 This option is only useful for debugging and the behavior may change at
256 any time without notice.  FLAGS are bit encoded and may be given in
257 usual C-Syntax. The currently defined bits are:
258
259 @table @code
260 @item 0  (1)
261 X.509 or OpenPGP protocol related data
262 @item 1  (2)
263 values of big number integers
264 @item 2  (4)
265 low level crypto operations
266 @item 5  (32)
267 memory allocation
268 @item 6  (64)
269 caching
270 @item 7  (128)
271 show memory statistics
272 @item 9  (512)
273 write hashed data to files named @code{dbgmd-000*}
274 @item 10 (1024)
275 trace Assuan protocol
276 @item 12 (4096)
277 bypass all certificate validation
278 @end table
279
280 @item --debug-all
281 @opindex debug-all
282 Same as @code{--debug=0xffffffff}
283
284 @item --debug-wait @var{n}
285 @opindex debug-wait
286 When running in server mode, wait @var{n} seconds before entering the
287 actual processing loop and print the pid.  This gives time to attach a
288 debugger.
289
290 @item --debug-quick-random
291 @opindex debug-quick-random
292 This option inhibits the use of the very secure random quality level
293 (Libgcrypt’s @code{GCRY_VERY_STRONG_RANDOM}) and degrades all request
294 down to standard random quality.  It is only used for testing and
295 should not be used for any production quality keys.  This option is
296 only effective when given on the command line.
297
298 On GNU/Linux, another way to quickly generate insecure keys is to use
299 @command{rngd} to fill the kernel's entropy pool with lower quality
300 random data.  @command{rngd} is typically provided by the
301 @command{rng-tools} package.  It can be run as follows: @samp{sudo
302 rngd -f -r /dev/urandom}.
303
304 @item --debug-pinentry
305 @opindex debug-pinentry
306 This option enables extra debug information pertaining to the
307 Pinentry.  As of now it is only useful when used along with
308 @code{--debug 1024}.
309
310 @item --no-detach
311 @opindex no-detach
312 Don't detach the process from the console.  This is mainly useful for
313 debugging.
314
315 @item -s
316 @itemx --sh
317 @itemx -c
318 @itemx --csh
319 @opindex sh
320 @opindex csh
321 @efindex SHELL
322 Format the info output in daemon mode for use with the standard Bourne
323 shell or the C-shell respectively.  The default is to guess it based on
324 the environment variable @code{SHELL} which is correct in almost all
325 cases.
326
327
328 @item --no-grab
329 @opindex no-grab
330 Tell the pinentry not to grab the keyboard and mouse.  This option
331 should in general not be used to avoid X-sniffing attacks.
332
333 @anchor{option --log-file}
334 @item --log-file @var{file}
335 @opindex log-file
336 @efindex HKCU\Software\GNU\GnuPG:DefaultLogFile
337 Append all logging output to @var{file}.  This is very helpful in
338 seeing what the agent actually does. Use @file{socket://} to log to
339 socket.  If neither a log file nor a log file descriptor has been set
340 on a Windows platform, the Registry entry
341 @code{HKCU\Software\GNU\GnuPG:DefaultLogFile}, if set, is used to
342 specify the logging output.
343
344
345 @anchor{option --no-allow-mark-trusted}
346 @item --no-allow-mark-trusted
347 @opindex no-allow-mark-trusted
348 Do not allow clients to mark keys as trusted, i.e. put them into the
349 @file{trustlist.txt} file.  This makes it harder for users to inadvertently
350 accept Root-CA keys.
351
352 @anchor{option --allow-preset-passphrase}
353 @item --allow-preset-passphrase
354 @opindex allow-preset-passphrase
355 This option allows the use of @command{gpg-preset-passphrase} to seed the
356 internal cache of @command{gpg-agent} with passphrases.
357
358 @anchor{option --no-allow-loopback-pinentry}
359 @item --no-allow-loopback-pinentry
360 @item --allow-loopback-pinentry
361 @opindex no-allow-loopback-pinentry
362 @opindex allow-loopback-pinentry
363 Disallow or allow clients to use the loopback pinentry features; see
364 the option @option{pinentry-mode} for details.  Allow is the default.
365
366 The @option{--force} option of the Assuan command @command{DELETE_KEY}
367 is also controlled by this option: The option is ignored if a loopback
368 pinentry is disallowed.
369
370 @item --no-allow-external-cache
371 @opindex no-allow-external-cache
372 Tell Pinentry not to enable features which use an external cache for
373 passphrases.
374
375 Some desktop environments prefer to unlock all
376 credentials with one master password and may have installed a Pinentry
377 which employs an additional external cache to implement such a policy.
378 By using this option the Pinentry is advised not to make use of such a
379 cache and instead always ask the user for the requested passphrase.
380
381 @item --allow-emacs-pinentry
382 @opindex allow-emacs-pinentry
383 Tell Pinentry to allow features to divert the passphrase entry to a
384 running Emacs instance.  How this is exactly handled depends on the
385 version of the used Pinentry.
386
387 @item --ignore-cache-for-signing
388 @opindex ignore-cache-for-signing
389 This option will let @command{gpg-agent} bypass the passphrase cache for all
390 signing operation.  Note that there is also a per-session option to
391 control this behavior but this command line option takes precedence.
392
393 @item --default-cache-ttl @var{n}
394 @opindex default-cache-ttl
395 Set the time a cache entry is valid to @var{n} seconds.  The default
396 is 600 seconds.  Each time a cache entry is accessed, the entry's
397 timer is reset.  To set an entry's maximum lifetime, use
398 @command{max-cache-ttl}.
399
400 @item --default-cache-ttl-ssh @var{n}
401 @opindex default-cache-ttl
402 Set the time a cache entry used for SSH keys is valid to @var{n}
403 seconds.  The default is 1800 seconds.  Each time a cache entry is
404 accessed, the entry's timer is reset.  To set an entry's maximum
405 lifetime, use @command{max-cache-ttl-ssh}.
406
407 @item --max-cache-ttl @var{n}
408 @opindex max-cache-ttl
409 Set the maximum time a cache entry is valid to @var{n} seconds.  After
410 this time a cache entry will be expired even if it has been accessed
411 recently or has been set using @command{gpg-preset-passphrase}.  The
412 default is 2 hours (7200 seconds).
413
414 @item --max-cache-ttl-ssh @var{n}
415 @opindex max-cache-ttl-ssh
416 Set the maximum time a cache entry used for SSH keys is valid to
417 @var{n} seconds.  After this time a cache entry will be expired even
418 if it has been accessed recently or has been set using
419 @command{gpg-preset-passphrase}.  The default is 2 hours (7200
420 seconds).
421
422 @item --enforce-passphrase-constraints
423 @opindex enforce-passphrase-constraints
424 Enforce the passphrase constraints by not allowing the user to bypass
425 them using the ``Take it anyway'' button.
426
427 @item --min-passphrase-len @var{n}
428 @opindex min-passphrase-len
429 Set the minimal length of a passphrase.  When entering a new passphrase
430 shorter than this value a warning will be displayed.  Defaults to 8.
431
432 @item --min-passphrase-nonalpha @var{n}
433 @opindex min-passphrase-nonalpha
434 Set the minimal number of digits or special characters required in a
435 passphrase.  When entering a new passphrase with less than this number
436 of digits or special characters a warning will be displayed.  Defaults
437 to 1.
438
439 @item --check-passphrase-pattern @var{file}
440 @opindex check-passphrase-pattern
441 Check the passphrase against the pattern given in @var{file}.  When
442 entering a new passphrase matching one of these pattern a warning will
443 be displayed. @var{file} should be an absolute filename.  The default is
444 not to use any pattern file.
445
446 Security note: It is known that checking a passphrase against a list of
447 pattern or even against a complete dictionary is not very effective to
448 enforce good passphrases.  Users will soon figure up ways to bypass such
449 a policy.  A better policy is to educate users on good security
450 behavior and optionally to run a passphrase cracker regularly on all
451 users passphrases to catch the very simple ones.
452
453 @item --max-passphrase-days @var{n}
454 @opindex max-passphrase-days
455 Ask the user to change the passphrase if @var{n} days have passed since
456 the last change.  With @option{--enforce-passphrase-constraints} set the
457 user may not bypass this check.
458
459 @item --enable-passphrase-history
460 @opindex enable-passphrase-history
461 This option does nothing yet.
462
463 @item --pinentry-invisible-char @var{char}
464 @opindex pinentry-invisible-char
465 This option asks the Pinentry to use @var{char} for displaying hidden
466 characters.  @var{char} must be one character UTF-8 string.  A
467 Pinentry may or may not honor this request.
468
469 @item --pinentry-timeout @var{n}
470 @opindex pinentry-timeout
471 This option asks the Pinentry to timeout after @var{n} seconds with no
472 user input.  The default value of 0 does not ask the pinentry to
473 timeout, however a Pinentry may use its own default timeout value in
474 this case.  A Pinentry may or may not honor this request.
475
476 @item --pinentry-program @var{filename}
477 @opindex pinentry-program
478 Use program @var{filename} as the PIN entry.  The default is
479 installation dependent.  With the default configuration the name of
480 the default pinentry is @file{pinentry}; if that file does not exist
481 but a @file{pinentry-basic} exist the latter is used.
482
483 On a Windows platform the default is to use the first existing program
484 from this list:
485 @file{bin\pinentry.exe},
486 @file{..\Gpg4win\bin\pinentry.exe},
487 @file{..\Gpg4win\pinentry.exe},
488 @file{..\GNU\GnuPG\pinentry.exe},
489 @file{..\GNU\bin\pinentry.exe},
490 @file{bin\pinentry-basic.exe}
491 where the file names are relative to the GnuPG installation directory.
492
493
494 @item --pinentry-touch-file @var{filename}
495 @opindex pinentry-touch-file
496 By default the filename of the socket gpg-agent is listening for
497 requests is passed to Pinentry, so that it can touch that file before
498 exiting (it does this only in curses mode).  This option changes the
499 file passed to Pinentry to @var{filename}.  The special name
500 @code{/dev/null} may be used to completely disable this feature.  Note
501 that Pinentry will not create that file, it will only change the
502 modification and access time.
503
504
505 @item --scdaemon-program @var{filename}
506 @opindex scdaemon-program
507 Use program @var{filename} as the Smartcard daemon.  The default is
508 installation dependent and can be shown with the @command{gpgconf}
509 command.
510
511 @item --disable-scdaemon
512 @opindex disable-scdaemon
513 Do not make use of the scdaemon tool.  This option has the effect of
514 disabling the ability to do smartcard operations.  Note, that enabling
515 this option at runtime does not kill an already forked scdaemon.
516
517 @item --disable-check-own-socket
518 @opindex disable-check-own-socket
519 @command{gpg-agent} employs a periodic self-test to detect a stolen
520 socket.  This usually means a second instance of @command{gpg-agent}
521 has taken over the socket and @command{gpg-agent} will then terminate
522 itself.  This option may be used to disable this self-test for
523 debugging purposes.
524
525 @item --use-standard-socket
526 @itemx --no-use-standard-socket
527 @itemx --use-standard-socket-p
528 @opindex use-standard-socket
529 @opindex no-use-standard-socket
530 @opindex use-standard-socket-p
531 Since GnuPG 2.1 the standard socket is always used.  These options
532 have no more effect.  The command @code{gpg-agent
533 --use-standard-socket-p} will thus always return success.
534
535 @item --display @var{string}
536 @itemx --ttyname @var{string}
537 @itemx --ttytype @var{string}
538 @itemx --lc-ctype @var{string}
539 @itemx --lc-messages @var{string}
540 @itemx --xauthority @var{string}
541 @opindex display
542 @opindex ttyname
543 @opindex ttytype
544 @opindex lc-ctype
545 @opindex lc-messages
546 @opindex xauthority
547 These options are used with the server mode to pass localization
548 information.
549
550 @item --keep-tty
551 @itemx --keep-display
552 @opindex keep-tty
553 @opindex keep-display
554 Ignore requests to change the current @code{tty} or X window system's
555 @code{DISPLAY} variable respectively.  This is useful to lock the
556 pinentry to pop up at the @code{tty} or display you started the agent.
557
558
559 @anchor{option --extra-socket}
560 @item --extra-socket @var{name}
561 @opindex extra-socket
562 The extra socket is created by default, you may use this option to
563 change the name of the socket.  To disable the creation of the socket
564 use ``none'' or ``/dev/null'' for @var{name}.
565
566 Also listen on native gpg-agent connections on the given socket.  The
567 intended use for this extra socket is to setup a Unix domain socket
568 forwarding from a remote machine to this socket on the local machine.
569 A @command{gpg} running on the remote machine may then connect to the
570 local gpg-agent and use its private keys.  This enables decrypting or
571 signing data on a remote machine without exposing the private keys to the
572 remote machine.
573
574
575 @anchor{option --enable-ssh-support}
576 @item --enable-ssh-support
577 @itemx --enable-putty-support
578 @opindex enable-ssh-support
579 @opindex enable-putty-support
580
581 The OpenSSH Agent protocol is always enabled, but @command{gpg-agent}
582 will only set the @code{SSH_AUTH_SOCK} variable if this flag is given.
583
584 In this mode of operation, the agent does not only implement the
585 gpg-agent protocol, but also the agent protocol used by OpenSSH
586 (through a separate socket).  Consequently, it should be possible to use
587 the gpg-agent as a drop-in replacement for the well known ssh-agent.
588
589 SSH Keys, which are to be used through the agent, need to be added to
590 the gpg-agent initially through the ssh-add utility.  When a key is
591 added, ssh-add will ask for the password of the provided key file and
592 send the unprotected key material to the agent; this causes the
593 gpg-agent to ask for a passphrase, which is to be used for encrypting
594 the newly received key and storing it in a gpg-agent specific
595 directory.
596
597 Once a key has been added to the gpg-agent this way, the gpg-agent
598 will be ready to use the key.
599
600 Note: in case the gpg-agent receives a signature request, the user might
601 need to be prompted for a passphrase, which is necessary for decrypting
602 the stored key.  Since the ssh-agent protocol does not contain a
603 mechanism for telling the agent on which display/terminal it is running,
604 gpg-agent's ssh-support will use the TTY or X display where gpg-agent
605 has been started.  To switch this display to the current one, the
606 following command may be used:
607
608 @smallexample
609 gpg-connect-agent updatestartuptty /bye
610 @end smallexample
611
612 Although all GnuPG components try to start the gpg-agent as needed, this
613 is not possible for the ssh support because ssh does not know about it.
614 Thus if no GnuPG tool which accesses the agent has been run, there is no
615 guarantee that ssh is able to use gpg-agent for authentication.  To fix
616 this you may start gpg-agent if needed using this simple command:
617
618 @smallexample
619 gpg-connect-agent /bye
620 @end smallexample
621
622 Adding the @option{--verbose} shows the progress of starting the agent.
623
624 The @option{--enable-putty-support} is only available under Windows
625 and allows the use of gpg-agent with the ssh implementation
626 @command{putty}.  This is similar to the regular ssh-agent support but
627 makes use of Windows message queue as required by @command{putty}.
628
629
630 @end table
631
632 All the long options may also be given in the configuration file after
633 stripping off the two leading dashes.
634
635
636 @mansect files
637 @node Agent Configuration
638 @section Configuration
639
640 There are a few configuration files needed for the operation of the
641 agent. By default they may all be found in the current home directory
642 (@pxref{option --homedir}).
643
644 @table @file
645
646 @item gpg-agent.conf
647 @efindex gpg-agent.conf
648   This is the standard configuration file read by @command{gpg-agent} on
649   startup.  It may contain any valid long option; the leading
650   two dashes may not be entered and the option may not be abbreviated.
651   This file is also read after a @code{SIGHUP} however only a few
652   options will actually have an effect.  This default name may be
653   changed on the command line (@pxref{option --options}).
654   You should backup this file.
655
656 @item trustlist.txt
657 @efindex trustlist.txt
658   This is the list of trusted keys.  You should backup this file.
659
660   Comment lines, indicated by a leading hash mark, as well as empty
661   lines are ignored.  To mark a key as trusted you need to enter its
662   fingerprint followed by a space and a capital letter @code{S}.  Colons
663   may optionally be used to separate the bytes of a fingerprint; this
664   enables cutting and pasting the fingerprint from a key listing output.  If
665   the line is prefixed with a @code{!} the key is explicitly marked as
666   not trusted.
667
668   Here is an example where two keys are marked as ultimately trusted
669   and one as not trusted:
670
671   @cartouche
672   @smallexample
673   # CN=Wurzel ZS 3,O=Intevation GmbH,C=DE
674   A6935DD34EF3087973C706FC311AA2CCF733765B S
675
676   # CN=PCA-1-Verwaltung-02/O=PKI-1-Verwaltung/C=DE
677   DC:BD:69:25:48:BD:BB:7E:31:6E:BB:80:D3:00:80:35:D4:F8:A6:CD S
678
679   # CN=Root-CA/O=Schlapphuete/L=Pullach/C=DE
680   !14:56:98:D3:FE:9C:CA:5A:31:6E:BC:81:D3:11:4E:00:90:A3:44:C2 S
681   @end smallexample
682   @end cartouche
683
684 Before entering a key into this file, you need to ensure its
685 authenticity.  How to do this depends on your organisation; your
686 administrator might have already entered those keys which are deemed
687 trustworthy enough into this file.  Places where to look for the
688 fingerprint of a root certificate are letters received from the CA or
689 the website of the CA (after making 100% sure that this is indeed the
690 website of that CA).  You may want to consider disallowing interactive
691 updates of this file by using the @ref{option --no-allow-mark-trusted}.
692 It might even be advisable to change the permissions to read-only so
693 that this file can't be changed inadvertently.
694
695 As a special feature a line @code{include-default} will include a global
696 list of trusted certificates (e.g. @file{@value{SYSCONFDIR}/trustlist.txt}).
697 This global list is also used if the local list is not available.
698
699 It is possible to add further flags after the @code{S} for use by the
700 caller:
701
702 @table @code
703
704 @item relax
705 @cindex relax
706 Relax checking of some root certificate requirements.  As of now this
707 flag allows the use of root certificates with a missing basicConstraints
708 attribute (despite that it is a MUST for CA certificates) and disables
709 CRL checking for the root certificate.
710
711 @item cm
712 If validation of a certificate finally issued by a CA with this flag set
713 fails, try again using the chain validation model.
714
715 @end table
716
717
718 @item sshcontrol
719 @efindex sshcontrol
720 This file is used when support for the secure shell agent protocol has
721 been enabled (@pxref{option --enable-ssh-support}). Only keys present in
722 this file are used in the SSH protocol.  You should backup this file.
723
724 The @command{ssh-add} tool may be used to add new entries to this file;
725 you may also add them manually.  Comment lines, indicated by a leading
726 hash mark, as well as empty lines are ignored.  An entry starts with
727 optional whitespace, followed by the keygrip of the key given as 40 hex
728 digits, optionally followed by the caching TTL in seconds and another
729 optional field for arbitrary flags.  A non-zero TTL overrides the global
730 default as set by @option{--default-cache-ttl-ssh}.
731
732 The only flag support is @code{confirm}.  If this flag is found for a
733 key, each use of the key will pop up a pinentry to confirm the use of
734 that key.  The flag is automatically set if a new key was loaded into
735 @code{gpg-agent} using the option @option{-c} of the @code{ssh-add}
736 command.
737
738 The keygrip may be prefixed with a @code{!} to disable an entry.
739
740 The following example lists exactly one key.  Note that keys available
741 through a OpenPGP smartcard in the active smartcard reader are
742 implicitly added to this list; i.e. there is no need to list them.
743
744 @cartouche
745 @smallexample
746        # Key added on: 2011-07-20 20:38:46
747        # Fingerprint:  5e:8d:c4:ad:e7:af:6e:27:8a:d6:13:e4:79:ad:0b:81
748        34B62F25E277CF13D3C6BCEBFD3F85D08F0A864B 0 confirm
749 @end smallexample
750 @end cartouche
751
752 @item private-keys-v1.d/
753 @efindex private-keys-v1.d
754
755   This is the directory where gpg-agent stores the private keys.  Each
756   key is stored in a file with the name made up of the keygrip and the
757   suffix @file{key}.  You should backup all files in this directory
758   and take great care to keep this backup closed away.
759
760
761 @end table
762
763 Note that on larger installations, it is useful to put predefined
764 files into the directory @file{@value{SYSCONFSKELDIR}} so that newly created
765 users start up with a working configuration.  For existing users the
766 a small helper script is provided to create these files (@pxref{addgnupghome}).
767
768
769
770 @c
771 @c Agent Signals
772 @c
773 @mansect signals
774 @node Agent Signals
775 @section Use of some signals
776 A running @command{gpg-agent} may be controlled by signals, i.e. using
777 the @command{kill} command to send a signal to the process.
778
779 Here is a list of supported signals:
780
781 @table @gnupgtabopt
782
783 @item SIGHUP
784 @cpindex SIGHUP
785 This signal flushes all cached passphrases and if the program has been
786 started with a configuration file, the configuration file is read
787 again.  Only certain options are honored: @code{quiet},
788 @code{verbose}, @code{debug}, @code{debug-all}, @code{debug-level},
789 @code{debug-pinentry},
790 @code{no-grab},
791 @code{pinentry-program},
792 @code{pinentry-invisible-char},
793 @code{default-cache-ttl},
794 @code{max-cache-ttl}, @code{ignore-cache-for-signing},
795 @code{no-allow-external-cache}, @code{allow-emacs-pinentry},
796 @code{no-allow-mark-trusted}, @code{disable-scdaemon}, and
797 @code{disable-check-own-socket}.  @code{scdaemon-program} is also
798 supported but due to the current implementation, which calls the
799 scdaemon only once, it is not of much use unless you manually kill the
800 scdaemon.
801
802
803 @item SIGTERM
804 @cpindex SIGTERM
805 Shuts down the process but waits until all current requests are
806 fulfilled.  If the process has received 3 of these signals and requests
807 are still pending, a shutdown is forced.
808
809 @item SIGINT
810 @cpindex SIGINT
811 Shuts down the process immediately.
812
813 @item SIGUSR1
814 @cpindex SIGUSR1
815 Dump internal information to the log file.
816
817 @item SIGUSR2
818 @cpindex SIGUSR2
819 This signal is used for internal purposes.
820
821 @end table
822
823 @c
824 @c  Examples
825 @c
826 @mansect examples
827 @node Agent Examples
828 @section Examples
829
830 It is important to set the environment variable @code{GPG_TTY} in
831 your login shell, for example in the @file{~/.bashrc} init script:
832
833 @cartouche
834 @example
835   export GPG_TTY=$(tty)
836 @end example
837 @end cartouche
838
839 If you enabled the Ssh Agent Support, you also need to tell ssh about
840 it by adding this to your init script:
841
842 @cartouche
843 @example
844 unset SSH_AGENT_PID
845 if [ "$@{gnupg_SSH_AUTH_SOCK_by:-0@}" -ne $$ ]; then
846   export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
847 fi
848 @end example
849 @end cartouche
850
851
852 @c
853 @c  Assuan Protocol
854 @c
855 @manpause
856 @node Agent Protocol
857 @section Agent's Assuan Protocol
858
859 Note: this section does only document the protocol, which is used by
860 GnuPG components; it does not deal with the ssh-agent protocol.  To
861 see the full specification of each command, use
862
863 @example
864   gpg-connect-agent 'help COMMAND' /bye
865 @end example
866
867 @noindent
868 or just 'help' to list all available commands.
869
870 @noindent
871 The @command{gpg-agent} daemon is started on demand by the GnuPG
872 components.
873
874 To identify a key we use a thing called keygrip which is the SHA-1 hash
875 of an canonical encoded S-Expression of the public key as used in
876 Libgcrypt.  For the purpose of this interface the keygrip is given as a
877 hex string.  The advantage of using this and not the hash of a
878 certificate is that it will be possible to use the same keypair for
879 different protocols, thereby saving space on the token used to keep the
880 secret keys.
881
882 The @command{gpg-agent} may send status messages during a command or when
883 returning from a command to inform a client about the progress or result of an
884 operation.  For example, the @var{INQUIRE_MAXLEN} status message may be sent
885 during a server inquire to inform the client of the maximum usable length of
886 the inquired data (which should not be exceeded).
887
888 @menu
889 * Agent PKDECRYPT::       Decrypting a session key
890 * Agent PKSIGN::          Signing a Hash
891 * Agent GENKEY::          Generating a Key
892 * Agent IMPORT::          Importing a Secret Key
893 * Agent EXPORT::          Exporting a Secret Key
894 * Agent ISTRUSTED::       Importing a Root Certificate
895 * Agent GET_PASSPHRASE::  Ask for a passphrase
896 * Agent CLEAR_PASSPHRASE:: Expire a cached passphrase
897 * Agent PRESET_PASSPHRASE:: Set a passphrase for a keygrip
898 * Agent GET_CONFIRMATION:: Ask for confirmation
899 * Agent HAVEKEY::         Check whether a key is available
900 * Agent LEARN::           Register a smartcard
901 * Agent PASSWD::          Change a Passphrase
902 * Agent UPDATESTARTUPTTY:: Change the Standard Display
903 * Agent GETEVENTCOUNTER:: Get the Event Counters
904 * Agent GETINFO::         Return information about the process
905 * Agent OPTION::          Set options for the session
906 @end menu
907
908 @node Agent PKDECRYPT
909 @subsection Decrypting a session key
910
911 The client asks the server to decrypt a session key.  The encrypted
912 session key should have all information needed to select the
913 appropriate secret key or to delegate it to a smartcard.
914
915 @example
916   SETKEY <keyGrip>
917 @end example
918
919 Tell the server about the key to be used for decryption.  If this is
920 not used, @command{gpg-agent} may try to figure out the key by trying to
921 decrypt the message with each key available.
922
923 @example
924   PKDECRYPT
925 @end example
926
927 The agent checks whether this command is allowed and then does an
928 INQUIRY to get the ciphertext the client should then send the cipher
929 text.
930
931 @example
932     S: INQUIRE CIPHERTEXT
933     C: D (xxxxxx
934     C: D xxxx)
935     C: END
936 @end example
937
938 Please note that the server may send status info lines while reading the
939 data lines from the client.  The data send is a SPKI like S-Exp with
940 this structure:
941
942 @example
943      (enc-val
944        (<algo>
945          (<param_name1> <mpi>)
946            ...
947          (<param_namen> <mpi>)))
948 @end example
949
950 Where algo is a string with the name of the algorithm; see the libgcrypt
951 documentation for a list of valid algorithms.  The number and names of
952 the parameters depend on the algorithm.  The agent does return an error
953 if there is an inconsistency.
954
955 If the decryption was successful the decrypted data is returned by
956 means of "D" lines.
957
958 Here is an example session:
959 @cartouche
960 @smallexample
961    C: PKDECRYPT
962    S: INQUIRE CIPHERTEXT
963    C: D (enc-val elg (a 349324324)
964    C: D    (b 3F444677CA)))
965    C: END
966    S: # session key follows
967    S: S PADDING 0
968    S: D (value 1234567890ABCDEF0)
969    S: OK decryption successful
970 @end smallexample
971 @end cartouche
972
973 The “PADDING” status line is only send if gpg-agent can tell what kind
974 of padding is used.  As of now only the value 0 is used to indicate
975 that the padding has been removed.
976
977
978 @node Agent PKSIGN
979 @subsection Signing a Hash
980
981 The client asks the agent to sign a given hash value.  A default key
982 will be chosen if no key has been set.  To set a key a client first
983 uses:
984
985 @example
986    SIGKEY <keyGrip>
987 @end example
988
989 This can be used multiple times to create multiple signature, the list
990 of keys is reset with the next PKSIGN command or a RESET.  The server
991 tests whether the key is a valid key to sign something and responds with
992 okay.
993
994 @example
995    SETHASH --hash=<name>|<algo> <hexstring>
996 @end example
997
998 The client can use this command to tell the server about the data <hexstring>
999 (which usually is a hash) to be signed. <algo> is the decimal encoded hash
1000 algorithm number as used by Libgcrypt.  Either <algo> or --hash=<name>
1001 must be given.  Valid names for <name> are:
1002
1003 @table @code
1004 @item sha1
1005 The SHA-1 hash algorithm
1006 @item sha256
1007 The SHA-256 hash algorithm
1008 @item rmd160
1009 The RIPE-MD160 hash algorithm
1010 @item md5
1011 The old and broken MD5 hash algorithm
1012 @item tls-md5sha1
1013 A combined hash algorithm as used by the TLS protocol.
1014 @end table
1015
1016 @noindent
1017 The actual signing is done using
1018
1019 @example
1020    PKSIGN <options>
1021 @end example
1022
1023 Options are not yet defined, but may later be used to choose among
1024 different algorithms.  The agent does then some checks, asks for the
1025 passphrase and as a result the server returns the signature as an SPKI
1026 like S-expression in "D" lines:
1027
1028 @example
1029      (sig-val
1030        (<algo>
1031          (<param_name1> <mpi>)
1032            ...
1033          (<param_namen> <mpi>)))
1034 @end example
1035
1036
1037 The operation is affected by the option
1038
1039 @example
1040    OPTION use-cache-for-signing=0|1
1041 @end example
1042
1043 The default of @code{1} uses the cache.  Setting this option to @code{0}
1044 will lead @command{gpg-agent} to ignore the passphrase cache.  Note, that there is
1045 also a global command line option for @command{gpg-agent} to globally disable the
1046 caching.
1047
1048
1049 Here is an example session:
1050 @cartouche
1051 @smallexample
1052    C: SIGKEY <keyGrip>
1053    S: OK key available
1054    C: SIGKEY <keyGrip>
1055    S: OK key available
1056    C: PKSIGN
1057    S: # I did ask the user whether he really wants to sign
1058    S: # I did ask the user for the passphrase
1059    S: INQUIRE HASHVAL
1060    C: D ABCDEF012345678901234
1061    C: END
1062    S: # signature follows
1063    S: D (sig-val rsa (s 45435453654612121212))
1064    S: OK
1065 @end smallexample
1066 @end cartouche
1067
1068 @node Agent GENKEY
1069 @subsection Generating a Key
1070
1071 This is used to create a new keypair and store the secret key inside the
1072 active PSE --- which is in most cases a Soft-PSE.  A not-yet-defined
1073 option allows choosing the storage location.  To get the secret key out
1074 of the PSE, a special export tool has to be used.
1075
1076 @example
1077    GENKEY [--no-protection] [--preset] [<cache_nonce>]
1078 @end example
1079
1080 Invokes the key generation process and the server will then inquire
1081 on the generation parameters, like:
1082
1083 @example
1084    S: INQUIRE KEYPARM
1085    C: D (genkey (rsa (nbits  1024)))
1086    C: END
1087 @end example
1088
1089 The format of the key parameters which depends on the algorithm is of
1090 the form:
1091
1092 @example
1093     (genkey
1094       (algo
1095         (parameter_name_1 ....)
1096           ....
1097         (parameter_name_n ....)))
1098 @end example
1099
1100 If everything succeeds, the server returns the *public key* in a SPKI
1101 like S-Expression like this:
1102
1103 @example
1104      (public-key
1105        (rsa
1106          (n <mpi>)
1107          (e <mpi>)))
1108 @end example
1109
1110 Here is an example session:
1111 @cartouche
1112 @smallexample
1113    C: GENKEY
1114    S: INQUIRE KEYPARM
1115    C: D (genkey (rsa (nbits  1024)))
1116    C: END
1117    S: D (public-key
1118    S: D   (rsa (n 326487324683264) (e 10001)))
1119    S  OK key created
1120 @end smallexample
1121 @end cartouche
1122
1123 The @option{--no-protection} option may be used to prevent prompting for a
1124 passphrase to protect the secret key while leaving the secret key unprotected.
1125 The @option{--preset} option may be used to add the passphrase to the cache
1126 using the default cache parameters.
1127
1128 The @option{--inq-passwd} option may be used to create the key with a
1129 supplied passphrase.  When used the agent does an inquiry with the
1130 keyword @code{NEWPASSWD} to retrieve that passphrase.  This option
1131 takes precedence over @option{--no-protection}; however if the client
1132 sends a empty (zero-length) passphrase, this is identical to
1133 @option{--no-protection}.
1134
1135 @node Agent IMPORT
1136 @subsection Importing a Secret Key
1137
1138 This operation is not yet supported by GpgAgent.  Specialized tools
1139 are to be used for this.
1140
1141 There is no actual need because we can expect that secret keys
1142 created by a 3rd party are stored on a smartcard.  If we have
1143 generated the key ourselves, we do not need to import it.
1144
1145 @node Agent EXPORT
1146 @subsection Export a Secret Key
1147
1148 Not implemented.
1149
1150 Should be done by an extra tool.
1151
1152 @node Agent ISTRUSTED
1153 @subsection Importing a Root Certificate
1154
1155 Actually we do not import a Root Cert but provide a way to validate
1156 any piece of data by storing its Hash along with a description and
1157 an identifier in the PSE.  Here is the interface description:
1158
1159 @example
1160     ISTRUSTED <fingerprint>
1161 @end example
1162
1163 Check whether the OpenPGP primary key or the X.509 certificate with the
1164 given fingerprint is an ultimately trusted key or a trusted Root CA
1165 certificate.  The fingerprint should be given as a hexstring (without
1166 any blanks or colons or whatever in between) and may be left padded with
1167 00 in case of an MD5 fingerprint.  GPGAgent will answer with:
1168
1169 @example
1170     OK
1171 @end example
1172
1173 The key is in the table of trusted keys.
1174
1175 @example
1176     ERR 304 (Not Trusted)
1177 @end example
1178
1179 The key is not in this table.
1180
1181 Gpg needs the entire list of trusted keys to maintain the web of
1182 trust; the following command is therefore quite helpful:
1183
1184 @example
1185     LISTTRUSTED
1186 @end example
1187
1188 GpgAgent returns a list of trusted keys line by line:
1189
1190 @example
1191     S: D 000000001234454556565656677878AF2F1ECCFF P
1192     S: D 340387563485634856435645634856438576457A P
1193     S: D FEDC6532453745367FD83474357495743757435D S
1194     S: OK
1195 @end example
1196
1197 The first item on a line is the hexified fingerprint where MD5
1198 fingerprints are @code{00} padded to the left and the second item is a
1199 flag to indicate the type of key (so that gpg is able to only take care
1200 of PGP keys).  P = OpenPGP, S = S/MIME.  A client should ignore the rest
1201 of the line, so that we can extend the format in the future.
1202
1203 Finally a client should be able to mark a key as trusted:
1204
1205 @example
1206    MARKTRUSTED @var{fingerprint} "P"|"S"
1207 @end example
1208
1209 The server will then pop up a window to ask the user whether she
1210 really trusts this key. For this it will probably ask for a text to
1211 be displayed like this:
1212
1213 @example
1214    S: INQUIRE TRUSTDESC
1215    C: D Do you trust the key with the fingerprint @@FPR@@
1216    C: D bla fasel blurb.
1217    C: END
1218    S: OK
1219 @end example
1220
1221 Known sequences with the pattern @@foo@@ are replaced according to this
1222 table:
1223
1224 @table @code
1225 @item @@FPR16@@
1226 Format the fingerprint according to gpg rules for a v3 keys.
1227 @item @@FPR20@@
1228 Format the fingerprint according to gpg rules for a v4 keys.
1229 @item @@FPR@@
1230 Choose an appropriate format to format the fingerprint.
1231 @item @@@@
1232 Replaced by a single @code{@@}.
1233 @end table
1234
1235 @node Agent GET_PASSPHRASE
1236 @subsection Ask for a passphrase
1237
1238 This function is usually used to ask for a passphrase to be used for
1239 symmetric encryption, but may also be used by programs which need
1240 special handling of passphrases.  This command uses a syntax which helps
1241 clients to use the agent with minimum effort.
1242
1243 @example
1244   GET_PASSPHRASE [--data] [--check] [--no-ask] [--repeat[=N]] \
1245                  [--qualitybar] @var{cache_id}                \
1246                  [@var{error_message} @var{prompt} @var{description}]
1247 @end example
1248
1249 @var{cache_id} is expected to be a string used to identify a cached
1250 passphrase.  Use a @code{X} to bypass the cache.  With no other
1251 arguments the agent returns a cached passphrase or an error.  By
1252 convention either the hexified fingerprint of the key shall be used for
1253 @var{cache_id} or an arbitrary string prefixed with the name of the
1254 calling application and a colon: Like @code{gpg:somestring}.
1255
1256 @var{error_message} is either a single @code{X} for no error message or
1257 a string to be shown as an error message like (e.g. "invalid
1258 passphrase").  Blanks must be percent escaped or replaced by @code{+}'.
1259
1260 @var{prompt} is either a single @code{X} for a default prompt or the
1261 text to be shown as the prompt.  Blanks must be percent escaped or
1262 replaced by @code{+}.
1263
1264 @var{description} is a text shown above the entry field.  Blanks must be
1265 percent escaped or replaced by @code{+}.
1266
1267 The agent either returns with an error or with a OK followed by the hex
1268 encoded passphrase.  Note that the length of the strings is implicitly
1269 limited by the maximum length of a command.  If the option
1270 @option{--data} is used, the passphrase is not returned on the OK line
1271 but by regular data lines; this is the preferred method.
1272
1273 If the option @option{--check} is used, the standard passphrase
1274 constraints checks are applied.  A check is not done if the passphrase
1275 has been found in the cache.
1276
1277 If the option @option{--no-ask} is used and the passphrase is not in the
1278 cache the user will not be asked to enter a passphrase but the error
1279 code @code{GPG_ERR_NO_DATA} is returned.
1280
1281 If the option @option{--qualitybar} is used and a minimum passphrase
1282 length has been configured, a visual indication of the entered
1283 passphrase quality is shown.
1284
1285 @example
1286   CLEAR_PASSPHRASE @var{cache_id}
1287 @end example
1288
1289 may be used to invalidate the cache entry for a passphrase.  The
1290 function returns with OK even when there is no cached passphrase.
1291
1292
1293
1294 @node Agent CLEAR_PASSPHRASE
1295 @subsection Remove a cached passphrase
1296
1297 Use this command to remove a cached passphrase.
1298
1299 @example
1300   CLEAR_PASSPHRASE [--mode=normal] <cache_id>
1301 @end example
1302
1303 The @option{--mode=normal} option can be used to clear a @var{cache_id} that
1304 was set by gpg-agent.
1305
1306
1307 @node Agent PRESET_PASSPHRASE
1308 @subsection Set a passphrase for a keygrip
1309
1310 This command adds a passphrase to the cache for the specified @var{keygrip}.
1311
1312 @example
1313   PRESET_PASSPHRASE [--inquire] <string_or_keygrip> <timeout> [<hexstring>]
1314 @end example
1315
1316 The passphrase is a hexidecimal string when specified. When not specified, the
1317 passphrase will be retrieved from the pinentry module unless the
1318 @option{--inquire} option was specified in which case the passphrase will be
1319 retrieved from the client.
1320
1321 The @var{timeout} parameter keeps the passphrase cached for the specified
1322 number of seconds. A value of @code{-1} means infinite while @code{0} means
1323 the default (currently only a timeout of -1 is allowed, which means to never
1324 expire it).
1325
1326
1327 @node Agent GET_CONFIRMATION
1328 @subsection Ask for confirmation
1329
1330 This command may be used to ask for a simple confirmation by
1331 presenting a text and 2 buttons: Okay and Cancel.
1332
1333 @example
1334   GET_CONFIRMATION @var{description}
1335 @end example
1336
1337 @var{description}is displayed along with a Okay and Cancel
1338 button. Blanks must be percent escaped or replaced by @code{+}.  A
1339 @code{X} may be used to display confirmation dialog with a default
1340 text.
1341
1342 The agent either returns with an error or with a OK.  Note, that the
1343 length of @var{description} is implicitly limited by the maximum
1344 length of a command.
1345
1346
1347
1348 @node Agent HAVEKEY
1349 @subsection Check whether a key is available
1350
1351 This can be used to see whether a secret key is available.  It does
1352 not return any information on whether the key is somehow protected.
1353
1354 @example
1355   HAVEKEY @var{keygrips}
1356 @end example
1357
1358 The agent answers either with OK or @code{No_Secret_Key} (208).  The
1359 caller may want to check for other error codes as well.  More than one
1360 keygrip may be given.  In this case the command returns success if at
1361 least one of the keygrips corresponds to an available secret key.
1362
1363
1364 @node Agent LEARN
1365 @subsection Register a smartcard
1366
1367 @example
1368   LEARN [--send]
1369 @end example
1370
1371 This command is used to register a smartcard.  With the @option{--send}
1372 option given the certificates are sent back.
1373
1374
1375 @node Agent PASSWD
1376 @subsection Change a Passphrase
1377
1378 @example
1379   PASSWD [--cache-nonce=<c>] [--passwd-nonce=<s>] [--preset] @var{keygrip}
1380 @end example
1381
1382 This command is used to interactively change the passphrase of the key
1383 identified by the hex string @var{keygrip}.  The @option{--preset}
1384 option may be used to add the new passphrase to the cache using the
1385 default cache parameters.
1386
1387
1388 @node Agent UPDATESTARTUPTTY
1389 @subsection Change the standard display
1390
1391 @example
1392   UPDATESTARTUPTTY
1393 @end example
1394
1395 Set the startup TTY and X-DISPLAY variables to the values of this
1396 session.  This command is useful to direct future pinentry invocations
1397 to another screen.  It is only required because there is no way in the
1398 ssh-agent protocol to convey this information.
1399
1400
1401 @node Agent GETEVENTCOUNTER
1402 @subsection Get the Event Counters
1403
1404 @example
1405   GETEVENTCOUNTER
1406 @end example
1407
1408 This function return one status line with the current values of the
1409 event counters.  The event counters are useful to avoid polling by
1410 delaying a poll until something has changed.  The values are decimal
1411 numbers in the range @code{0} to @code{UINT_MAX} and wrapping around to
1412 0.  The actual values should not be relied upon; they shall only be used
1413 to detect a change.
1414
1415 The currently defined counters are are:
1416 @table @code
1417 @item ANY
1418 Incremented with any change of any of the other counters.
1419 @item KEY
1420 Incremented for added or removed private keys.
1421 @item CARD
1422 Incremented for changes of the card readers stati.
1423 @end table
1424
1425 @node Agent GETINFO
1426 @subsection  Return information about the process
1427
1428 This is a multipurpose function to return a variety of information.
1429
1430 @example
1431 GETINFO @var{what}
1432 @end example
1433
1434 The value of @var{what} specifies the kind of information returned:
1435 @table @code
1436 @item version
1437 Return the version of the program.
1438 @item pid
1439 Return the process id of the process.
1440 @item socket_name
1441 Return the name of the socket used to connect the agent.
1442 @item ssh_socket_name
1443 Return the name of the socket used for SSH connections.  If SSH support
1444 has not been enabled the error @code{GPG_ERR_NO_DATA} will be returned.
1445 @end table
1446
1447 @node Agent OPTION
1448 @subsection Set options for the session
1449
1450 Here is a list of session options which are not yet described with
1451 other commands.  The general syntax for an Assuan option is:
1452
1453 @smallexample
1454 OPTION  @var{key}=@var{value}
1455 @end smallexample
1456
1457 @noindent
1458 Supported @var{key}s are:
1459
1460 @table @code
1461 @item agent-awareness
1462 This may be used to tell gpg-agent of which gpg-agent version the
1463 client is aware of.  gpg-agent uses this information to enable
1464 features which might break older clients.
1465
1466 @item putenv
1467 Change the session's environment to be used for the
1468 Pinentry.  Valid values are:
1469
1470   @table @code
1471   @item @var{name}
1472   Delete envvar @var{name}
1473   @item @var{name}=
1474   Set envvar @var{name} to the empty string
1475   @item @var{name}=@var{value}
1476   Set envvar @var{name} to the string @var{value}.
1477   @end table
1478
1479 @item use-cache-for-signing
1480 See Assuan command @code{PKSIGN}.
1481
1482 @item allow-pinentry-notify
1483 This does not need any value.  It is used to enable the
1484 PINENTRY_LAUNCHED inquiry.
1485
1486 @item pinentry-mode
1487 This option is used to change the operation mode of the pinentry.  The
1488 following values are defined:
1489
1490   @table @code
1491   @item ask
1492   This is the default mode which pops up a pinentry as needed.
1493
1494   @item cancel
1495   Instead of popping up a pinentry, return the error code
1496   @code{GPG_ERR_CANCELED}.
1497
1498   @item error
1499   Instead of popping up a pinentry, return the error code
1500   @code{GPG_ERR_NO_PIN_ENTRY}.
1501
1502   @item loopback
1503   Use a loopback pinentry.  This fakes a pinentry by using inquiries
1504   back to the caller to ask for a passphrase.  This option may only be
1505   set if the agent has been configured for that.
1506   To disable this feature use @ref{option --no-allow-loopback-pinentry}.
1507   @end table
1508
1509 @item cache-ttl-opt-preset
1510 This option sets the cache TTL for new entries created by GENKEY and
1511 PASSWD commands when using the @option{--preset} option.  It it is not
1512 used a default value is used.
1513
1514 @item s2k-count
1515 Instead of using the standard S2K count (which is computed on the
1516 fly), the given S2K count is used for new keys or when changing the
1517 passphrase of a key.  Values below 65536 are considered to be 0.  This
1518 option is valid for the entire session or until reset to 0.  This
1519 option is useful if the key is later used on boxes which are either
1520 much slower or faster than the actual box.
1521
1522 @end table
1523
1524
1525 @mansect see also
1526 @ifset isman
1527 @command{@gpgname}(1),
1528 @command{gpgsm}(1),
1529 @command{gpgconf}(1),
1530 @command{gpg-connect-agent}(1),
1531 @command{scdaemon}(1)
1532 @end ifset
1533 @include see-also-note.texi