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