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