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