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