chiark / gitweb /
Import gnupg2_2.1.17.orig.tar.bz2
[gnupg2.git] / doc / DETAILS
1 # doc/DETAILS                                                -*- org -*-
2 #+TITLE: GnuPG Details
3 # Globally disable superscripts and subscripts:
4 #+OPTIONS: ^:{}
5 #
6
7 # Note: This file uses org-mode; it should be easy to read as plain
8 # text but be aware of some markup peculiarities: Verbatim code is
9 # enclosed in #+begin-example, #+end-example blocks or marked by a
10 # colon as the first non-white-space character, words bracketed with
11 # equal signs indicate a monospace font, and the usual /italics/,
12 # *bold*, and _underline_ conventions are recognized.
13
14 This is the DETAILS file for GnuPG which specifies some internals and
15 parts of the external API for GPG and GPGSM.
16
17 * Format of the colon listings
18
19   The format is a based on colon separated record, each recods starts
20   with a tag string and extends to the end of the line.  Here is an
21   example:
22 #+begin_example
23 $ gpg --with-colons --list-keys \
24       --with-fingerprint --with-fingerprint wk@gnupg.org
25 pub:f:1024:17:6C7EE1B8621CC013:899817715:1055898235::m:::scESC:
26 fpr:::::::::ECAF7590EB3443B5C7CF3ACB6C7EE1B8621CC013:
27 uid:f::::::::Werner Koch <wk@g10code.com>:
28 uid:f::::::::Werner Koch <wk@gnupg.org>:
29 sub:f:1536:16:06AD222CADF6A6E1:919537416:1036177416:::::e:
30 fpr:::::::::CF8BCC4B18DE08FCD8A1615906AD222CADF6A6E1:
31 sub:r:1536:20:5CE086B5B5A18FF4:899817788:1025961788:::::esc:
32 fpr:::::::::AB059359A3B81F410FCFF97F5CE086B5B5A18FF4:
33 #+end_example
34
35 Note that new version of GnuPG or the use of certain options may add
36 new fields to the output.  Parsers should not assume a limit on the
37 number of fields per line.  Some fields are not yet used or only used
38 with certain record types; parsers should ignore fields they are not
39 aware of.  New versions of GnuPG or the use of certain options may add
40 new types of records as well.  Parsers should ignore any record whose
41 type they do not recognize for forward-compatibility.
42
43 The double =--with-fingerprint= prints the fingerprint for the subkeys
44 too.  Old versions of gpg used a slightly different format and required
45 the use of the option =--fixed-list-mode= to conform to the format
46 described here.
47
48
49 ** Description of the fields
50 *** Field 1 - Type of record
51
52     - pub :: Public key
53     - crt :: X.509 certificate
54     - crs :: X.509 certificate and private key available
55     - sub :: Subkey (secondary key)
56     - sec :: Secret key
57     - ssb :: Secret subkey (secondary key)
58     - uid :: User id
59     - uat :: User attribute (same as user id except for field 10).
60     - sig :: Signature
61     - rev :: Revocation signature
62     - fpr :: Fingerprint (fingerprint is in field 10)
63     - pkd :: Public key data [*]
64     - grp :: Keygrip
65     - rvk :: Revocation key
66     - tfs :: TOFU statistics [*]
67     - tru :: Trust database information [*]
68     - spk :: Signature subpacket [*]
69     - cfg :: Configuration data [*]
70
71     Records marked with an asterisk are described at [[*Special%20field%20formats][*Special fields]].
72
73 *** Field 2 - Validity
74
75     This is a letter describing the computed validity of a key.
76     Currently this is a single letter, but be prepared that additional
77     information may follow in some future versions. Note that GnuPG <
78     2.1 does not set this field for secret key listings.
79
80     - o :: Unknown (this key is new to the system)
81     - i :: The key is invalid (e.g. due to a missing self-signature)
82     - d :: The key has been disabled
83            (deprecated - use the 'D' in field 12 instead)
84     - r :: The key has been revoked
85     - e :: The key has expired
86     - - :: Unknown validity (i.e. no value assigned)
87     - q :: Undefined validity.  '-' and 'q' may safely be treated as
88            the same value for most purposes
89     - n :: The key is not valid
90     - m :: The key is marginal valid.
91     - f :: The key is fully valid
92     - u :: The key is ultimately valid.  This often means that the
93            secret key is available, but any key may be marked as
94            ultimately valid.
95     - w :: The key has a well known private part.
96     - s :: The key has special validity.  This means that it might be
97            self-signed and expected to be used in the STEED system.
98
99     If the validity information is given for a UID or UAT record, it
100     describes the validity calculated based on this user ID.  If given
101     for a key record it describes the validity taken from the best
102     rated user ID.
103
104     For X.509 certificates a 'u' is used for a trusted root
105     certificate (i.e. for the trust anchor) and an 'f' for all other
106     valid certificates.
107
108 *** Field 3 - Key length
109
110     The length of key in bits.
111
112 *** Field 4 - Public key algorithm
113
114     The values here are those from the OpenPGP specs or if they are
115     greather than 255 the algorithm ids as used by Libgcrypt.
116
117 *** Field 5 - KeyID
118
119     This is the 64 bit keyid as specified by OpenPGP and the last 64
120     bit of the SHA-1 fingerprint of an X.509 certifciate.
121
122 *** Field 6 - Creation date
123
124     The creation date of the key is given in UTC.  For UID and UAT
125     records, this is used for the self-signature date.  Note that the
126     date is usually printed in seconds since epoch, however, we are
127     migrating to an ISO 8601 format (e.g. "19660205T091500").  This is
128     currently only relevant for X.509.  A simple way to detect the new
129     format is to scan for the 'T'.  Note that old versions of gpg
130     without using the =--fixed-list-mode= option used a "yyyy-mm-tt"
131     format.
132
133 *** Field 7 - Expiration date
134
135     Key or UID/UAT expiration date or empty if it does not expire.
136
137 *** Field 8 - Certificate S/N, UID hash, trust signature info
138
139     Used for serial number in crt records.  For UID and UAT records,
140     this is a hash of the user ID contents used to represent that
141     exact user ID.  For trust signatures, this is the trust depth
142     separated by the trust value by a space.
143
144 *** Field 9 -  Ownertrust
145
146     This is only used on primary keys.  This is a single letter, but
147     be prepared that additional information may follow in future
148     versions.  For trust signatures with a regular expression, this is
149     the regular expression value, quoted as in field 10.
150
151 *** Field 10 - User-ID
152     The value is quoted like a C string to avoid control characters
153     (the colon is quoted =\x3a=).  For a "pub" record this field is
154     not used on --fixed-list-mode.  A UAT record puts the attribute
155     subpacket count here, a space, and then the total attribute
156     subpacket size.  In gpgsm the issuer name comes here.  A FPR
157     record stores the fingerprint here.  The fingerprint of a
158     revocation key is stored here.
159 *** Field 11 - Signature class
160
161     Signature class as per RFC-4880.  This is a 2 digit hexnumber
162     followed by either the letter 'x' for an exportable signature or
163     the letter 'l' for a local-only signature.  The class byte of an
164     revocation key is also given here, 'x' and 'l' is used the same
165     way.  This field if not used for X.509.
166
167 *** Field 12 - Key capabilities
168
169     The defined capabilities are:
170
171     - e :: Encrypt
172     - s :: Sign
173     - c :: Certify
174     - a :: Authentication
175     - ? :: Unknown capability
176
177     A key may have any combination of them in any order.  In addition
178     to these letters, the primary key has uppercase versions of the
179     letters to denote the _usable_ capabilities of the entire key, and
180     a potential letter 'D' to indicate a disabled key.
181
182 *** Field 13 - Issuer certificate fingerprint or other info
183
184     Used in FPR records for S/MIME keys to store the fingerprint of
185     the issuer certificate.  This is useful to build the certificate
186     path based on certificates stored in the local key database it is
187     only filled if the issuer certificate is available. The root has
188     been reached if this is the same string as the fingerprint. The
189     advantage of using this value is that it is guaranteed to have
190     been been build by the same lookup algorithm as gpgsm uses.
191
192     For "uid" records this field lists the preferences in the same way
193     gpg's --edit-key menu does.
194
195     For "sig" records, this is the fingerprint of the key that issued
196     the signature.  Note that this is only filled in if the signature
197     verified correctly.  Note also that for various technical reasons,
198     this fingerprint is only available if --no-sig-cache is used.
199
200 *** Field 14 - Flag field
201
202     Flag field used in the --edit menu output
203
204 *** Field 15 - S/N of a token
205
206     Used in sec/ssb to print the serial number of a token (internal
207     protect mode 1002) or a '#' if that key is a simple stub (internal
208     protect mode 1001).  If the option --with-secret is used and a
209     secret key is available for the public key, a '+' indicates this.
210
211 *** Field 16 - Hash algorithm
212
213     For sig records, this is the used hash algorithm.  For example:
214     2 = SHA-1, 8 = SHA-256.
215
216 *** Field 17 - Curve name
217
218     For pub, sub, sec, and ssb records this field is used for the ECC
219     curve name.
220
221 ** Special fields
222
223 *** PKD - Public key data
224
225     If field 1 has the tag "pkd", a listing looks like this:
226 #+begin_example
227 pkd:0:1024:B665B1435F4C2 .... FF26ABB:
228     !  !   !-- the value
229     !  !------ for information number of bits in the value
230     !--------- index (eg. DSA goes from 0 to 3: p,q,g,y)
231 #+end_example
232
233 *** TFS - TOFU statistics
234
235     This field may follows a UID record to convey information about
236     the TOFU database.  The information is similar to a TOFU_STATS
237     status line.
238
239     - Field 2 :: tfs record version (must be 1)
240     - Field 3 :: validity -  A number with validity code.
241     - Field 4 :: signcount - The number of signatures seen.
242     - Field 5 :: encrcount - The number of encryptions done.
243     - Field 6 :: policy - A string with the policy
244     - Field 7 :: signture-first-seen - a timestamp or 0 if not known.
245     - Field 8 :: signature-most-recent-seen - a timestamp or 0 if not known.
246     - Field 9 :: encryption-first-done - a timestamp or 0 if not known.
247     - Field 10 :: encryption-most-recent-done - a timestamp or 0 if not known.
248
249 *** TRU - Trust database information
250     Example for a "tru" trust base record:
251 #+begin_example
252     tru:o:0:1166697654:1:3:1:5
253 #+end_example
254
255     - Field 2 :: Reason for staleness of trust.  If this field is
256                  empty, then the trustdb is not stale.  This field may
257                  have multiple flags in it:
258
259                  - o :: Trustdb is old
260                  - t :: Trustdb was built with a different trust model
261                         than the one we are using now.
262
263     - Field 3 :: Trust model
264
265                  - 0 :: Classic trust model, as used in PGP 2.x.
266                  - 1 :: PGP trust model, as used in PGP 6 and later.
267                         This is the same as the classic trust model,
268                         except for the addition of trust signatures.
269
270                  GnuPG before version 1.4 used the classic trust model
271                  by default. GnuPG 1.4 and later uses the PGP trust
272                  model by default.
273
274     - Field 4 :: Date trustdb was created in seconds since Epoch.
275     - Field 5 :: Date trustdb will expire in seconds since Epoch.
276     - Field 6 :: Number of marginally trusted users to introduce a new
277                  key signer (gpg's option --marginals-needed).
278     - Field 7 :: Number of completely trusted users to introduce a new
279                  key signer.  (gpg's option --completes-needed)
280
281     - Field 8 :: Maximum depth of a certification chain. (gpg's option
282                  --max-cert-depth)
283
284 *** SPK - Signature subpacket records
285
286     - Field 2 :: Subpacket number as per RFC-4880 and later.
287     - Field 3 :: Flags in hex.  Currently the only two bits assigned
288                  are 1, to indicate that the subpacket came from the
289                  hashed part of the signature, and 2, to indicate the
290                  subpacket was marked critical.
291     - Field 4 :: Length of the subpacket.  Note that this is the
292                  length of the subpacket, and not the length of field
293                  5 below.  Due to the need for %-encoding, the length
294                  of field 5 may be up to 3x this value.
295     - Field 5 :: The subpacket data.  Printable ASCII is shown as
296                  ASCII, but other values are rendered as %XX where XX
297                  is the hex value for the byte.
298
299 *** CFG - Configuration data
300
301     --list-config outputs information about the GnuPG configuration
302     for the benefit of frontends or other programs that call GnuPG.
303     There are several list-config items, all colon delimited like the
304     rest of the --with-colons output.  The first field is always "cfg"
305     to indicate configuration information.  The second field is one of
306     (with examples):
307
308     - version :: The third field contains the version of GnuPG.
309
310                  : cfg:version:1.3.5
311
312     - pubkey :: The third field contains the public key algorithms
313                 this version of GnuPG supports, separated by
314                 semicolons.  The algorithm numbers are as specified in
315                 RFC-4880.  Note that in contrast to the --status-fd
316                 interface these are _not_ the Libgcrypt identifiers.
317                 Using =pubkeyname= prints names instead of numbers.
318
319                  : cfg:pubkey:1;2;3;16;17
320
321     - cipher :: The third field contains the symmetric ciphers this
322                 version of GnuPG supports, separated by semicolons.
323                 The cipher numbers are as specified in RFC-4880.
324                 Using =ciphername= prints names instead of numbers.
325
326                  : cfg:cipher:2;3;4;7;8;9;10
327
328     - digest :: The third field contains the digest (hash) algorithms
329                 this version of GnuPG supports, separated by
330                 semicolons.  The digest numbers are as specified in
331                 RFC-4880.  Using =digestname= prints names instead of
332                 numbers.
333
334                  : cfg:digest:1;2;3;8;9;10
335
336     - compress :: The third field contains the compression algorithms
337                   this version of GnuPG supports, separated by
338                   semicolons.  The algorithm numbers are as specified
339                   in RFC-4880.
340
341                  : cfg:compress:0;1;2;3
342
343     - group :: The third field contains the name of the group, and the
344                fourth field contains the values that the group expands
345                to, separated by semicolons.
346
347                For example, a group of:
348                  : group mynames = paige 0x12345678 joe patti
349                would result in:
350                  : cfg:group:mynames:patti;joe;0x12345678;paige
351
352     - curve :: The third field contains the curve names this version
353                of GnuPG supports, separated by semicolons. Using
354                =curveoid= prints OIDs instead of numbers.
355
356                  : cfg:curve:ed25519;nistp256;nistp384;nistp521
357
358
359 * Format of the --status-fd output
360
361   Every line is prefixed with "[GNUPG:] ", followed by a keyword with
362   the type of the status line and some arguments depending on the type
363   (maybe none); an application should always be willing to ignore
364   unknown keywords that may be emitted by future versions of GnuPG.
365   Also, new versions of GnuPG may add arguments to existing keywords.
366   Any additional arguments should be ignored for forward-compatibility.
367
368 ** General status codes
369 *** NEWSIG [<signers_uid>]
370     Is issued right before a signature verification starts.  This is
371     useful to define a context for parsing ERROR status messages.
372     arguments are currently defined.  If SIGNERS_UID is given and is
373     not "-" this is the percent escape value of the OpenPGP Signer's
374     User ID signature sub-packet.
375
376 *** GOODSIG  <long_keyid_or_fpr>  <username>
377     The signature with the keyid is good.  For each signature only one
378     of the codes GOODSIG, BADSIG, EXPSIG, EXPKEYSIG, REVKEYSIG or
379     ERRSIG will be emitted.  In the past they were used as a marker
380     for a new signature; new code should use the NEWSIG status
381     instead.  The username is the primary one encoded in UTF-8 and %XX
382     escaped. The fingerprint may be used instead of the long keyid if
383     it is available.  This is the case with CMS and might eventually
384     also be available for OpenPGP.
385
386 *** EXPSIG  <long_keyid_or_fpr>  <username>
387     The signature with the keyid is good, but the signature is
388     expired. The username is the primary one encoded in UTF-8 and %XX
389     escaped. The fingerprint may be used instead of the long keyid if
390     it is available.  This is the case with CMS and might eventually
391     also be available for OpenPGP.
392
393 *** EXPKEYSIG  <long_keyid_or_fpr> <username>
394     The signature with the keyid is good, but the signature was made
395     by an expired key. The username is the primary one encoded in
396     UTF-8 and %XX escaped.  The fingerprint may be used instead of the
397     long keyid if it is available.  This is the case with CMS and
398     might eventually also be available for OpenPGP.
399
400 *** REVKEYSIG  <long_keyid_or_fpr>  <username>
401     The signature with the keyid is good, but the signature was made
402     by a revoked key. The username is the primary one encoded in UTF-8
403     and %XX escaped. The fingerprint may be used instead of the long
404     keyid if it is available.  This is the case with CMS and might
405     eventually also beñ available for OpenPGP.
406
407 *** BADSIG  <long_keyid_or_fpr>  <username>
408     The signature with the keyid has not been verified okay.  The
409     username is the primary one encoded in UTF-8 and %XX escaped. The
410     fingerprint may be used instead of the long keyid if it is
411     available.  This is the case with CMS and might eventually also be
412     available for OpenPGP.
413
414 *** ERRSIG  <keyid>  <pkalgo> <hashalgo> <sig_class> <time> <rc>
415     It was not possible to check the signature.  This may be caused by
416     a missing public key or an unsupported algorithm.  A RC of 4
417     indicates unknown algorithm, a 9 indicates a missing public
418     key. The other fields give more information about this signature.
419     sig_class is a 2 byte hex-value.  The fingerprint may be used
420     instead of the keyid if it is available.  This is the case with
421     gpgsm and might eventually also be available for OpenPGP.
422
423     Note, that TIME may either be the number of seconds since Epoch or
424     an ISO 8601 string.  The latter can be detected by the presence of
425     the letter 'T'.
426
427 *** VALIDSIG <args>
428
429     The args are:
430
431     - <fingerprint_in_hex>
432     - <sig_creation_date>
433     - <sig-timestamp>
434     - <expire-timestamp>
435     - <sig-version>
436     - <reserved>
437     - <pubkey-algo>
438     - <hash-algo>
439     - <sig-class>
440     - [ <primary-key-fpr> ]
441
442     This status indicates that the signature is cryptographically
443     valid. This is similar to GOODSIG, EXPSIG, EXPKEYSIG, or REVKEYSIG
444     (depending on the date and the state of the signature and signing
445     key) but has the fingerprint as the argument. Multiple status
446     lines (VALIDSIG and the other appropriate *SIG status) are emitted
447     for a valid signature.  All arguments here are on one long line.
448     sig-timestamp is the signature creation time in seconds after the
449     epoch. expire-timestamp is the signature expiration time in
450     seconds after the epoch (zero means "does not
451     expire"). sig-version, pubkey-algo, hash-algo, and sig-class (a
452     2-byte hex value) are all straight from the signature packet.
453     PRIMARY-KEY-FPR is the fingerprint of the primary key or identical
454     to the first argument.  This is useful to get back to the primary
455     key without running gpg again for this purpose.
456
457     The primary-key-fpr parameter is used for OpenPGP and not
458     available for CMS signatures.  The sig-version as well as the sig
459     class is not defined for CMS and currently set to 0 and 00.
460
461     Note, that *-TIMESTAMP may either be a number of seconds since
462     Epoch or an ISO 8601 string which can be detected by the presence
463     of the letter 'T'.
464
465 *** SIG_ID  <radix64_string>  <sig_creation_date>  <sig-timestamp>
466     This is emitted only for signatures of class 0 or 1 which have
467     been verified okay.  The string is a signature id and may be used
468     in applications to detect replay attacks of signed messages.  Note
469     that only DLP algorithms give unique ids - others may yield
470     duplicated ones when they have been created in the same second.
471
472     Note, that SIG-TIMESTAMP may either be a number of seconds since
473     Epoch or an ISO 8601 string which can be detected by the presence
474     of the letter 'T'.
475
476 *** ENC_TO  <long_keyid>  <keytype>  <keylength>
477     The message is encrypted to this LONG_KEYID.  KEYTYPE is the
478     numerical value of the public key algorithm or 0 if it is not
479     known, KEYLENGTH is the length of the key or 0 if it is not known
480     (which is currently always the case).  Gpg prints this line
481     always; Gpgsm only if it knows the certificate.
482
483 *** BEGIN_DECRYPTION
484     Mark the start of the actual decryption process.  This is also
485     emitted when in --list-only mode.
486 *** END_DECRYPTION
487     Mark the end of the actual decryption process.  This are also
488     emitted when in --list-only mode.
489 *** DECRYPTION_INFO <mdc_method> <sym_algo>
490     Print information about the symmetric encryption algorithm and the
491     MDC method.  This will be emitted even if the decryption fails.
492
493 *** DECRYPTION_FAILED
494     The symmetric decryption failed - one reason could be a wrong
495     passphrase for a symmetrical encrypted message.
496
497 *** DECRYPTION_OKAY
498     The decryption process succeeded.  This means, that either the
499     correct secret key has been used or the correct passphrase for a
500     symmetric encrypted message was given.  The program itself may
501     return an errorcode because it may not be possible to verify a
502     signature for some reasons.
503
504 *** SESSION_KEY <algo>:<hexdigits>
505     The session key used to decrypt the message.  This message will
506     only be emitted if the option --show-session-key is used.  The
507     format is suitable to be passed as value for the option
508     --override-session-key.  It is not an indication that the
509     decryption will or has succeeded.
510
511 *** BEGIN_ENCRYPTION  <mdc_method> <sym_algo>
512     Mark the start of the actual encryption process.
513
514 *** END_ENCRYPTION
515     Mark the end of the actual encryption process.
516
517 *** FILE_START <what> <filename>
518     Start processing a file <filename>.  <what> indicates the performed
519     operation:
520     - 1 :: verify
521     - 2 :: encrypt
522     - 3 :: decrypt
523
524 *** FILE_DONE
525     Marks the end of a file processing which has been started
526     by FILE_START.
527
528 *** BEGIN_SIGNING
529     Mark the start of the actual signing process. This may be used as
530     an indication that all requested secret keys are ready for use.
531
532 *** ALREADY_SIGNED <long-keyid>
533     Warning: This is experimental and might be removed at any time.
534
535 *** SIG_CREATED <type> <pk_algo> <hash_algo> <class> <timestamp> <keyfpr>
536     A signature has been created using these parameters.
537     Values for type <type> are:
538       - D :: detached
539       - C :: cleartext
540       - S :: standard
541     (only the first character should be checked)
542
543     <class> are 2 hex digits with the OpenPGP signature class.
544
545     Note, that TIMESTAMP may either be a number of seconds since Epoch
546     or an ISO 8601 string which can be detected by the presence of the
547     letter 'T'.
548
549 *** NOTATION_
550     There are actually three related status codes to convey notation
551     data:
552
553     - NOTATION_NAME <name>
554     - NOTATION_FLAGS <critical> <human_readable>
555     - NOTATION_DATA <string>
556
557     <name> and <string> are %XX escaped.  The data may be split among
558     several NOTATION_DATA lines.  NOTATION_FLAGS is emitted after
559     NOTATION_NAME and gives the critical and human readable flags;
560     the flag values are either 0 or 1.
561
562 *** POLICY_URL <string>
563     Note that URL in <string> is %XX escaped.
564
565 *** PLAINTEXT <format> <timestamp> <filename>
566     This indicates the format of the plaintext that is about to be
567     written.  The format is a 1 byte hex code that shows the format of
568     the plaintext: 62 ('b') is binary data, 74 ('t') is text data with
569     no character set specified, and 75 ('u') is text data encoded in
570     the UTF-8 character set.  The timestamp is in seconds since the
571     epoch.  If a filename is available it gets printed as the third
572     argument, percent-escaped as usual.
573
574 *** PLAINTEXT_LENGTH <length>
575     This indicates the length of the plaintext that is about to be
576     written.  Note that if the plaintext packet has partial length
577     encoding it is not possible to know the length ahead of time.  In
578     that case, this status tag does not appear.
579
580 *** ATTRIBUTE <arguments>
581     The list or arguments are:
582     - <fpr>
583     - <octets>
584     - <type>
585     - <index>
586     - <count>
587     - <timestamp>
588     - <expiredate>
589     - <flags>
590
591     This is one long line issued for each attribute subpacket when an
592     attribute packet is seen during key listing.  <fpr> is the
593     fingerprint of the key.  <octets> is the length of the attribute
594     subpacket.  <type> is the attribute type (e.g. 1 for an image).
595     <index> and <count> indicate that this is the N-th indexed
596     subpacket of count total subpackets in this attribute packet.
597     <timestamp> and <expiredate> are from the self-signature on the
598     attribute packet.  If the attribute packet does not have a valid
599     self-signature, then the timestamp is 0.  <flags> are a bitwise OR
600     of:
601     - 0x01 :: this attribute packet is a primary uid
602     - 0x02 :: this attribute packet is revoked
603     - 0x04 :: this attribute packet is expired
604
605 *** SIG_SUBPACKET <type> <flags> <len> <data>
606     This indicates that a signature subpacket was seen.  The format is
607     the same as the "spk" record above.
608
609 ** Key related
610 *** INV_RECP, INV_SGNR
611     The two similar status codes:
612
613     - INV_RECP <reason> <requested_recipient>
614     - INV_SGNR <reason> <requested_sender>
615
616     are issued for each unusable recipient/sender. The reasons codes
617     currently in use are:
618
619        -  0 :: No specific reason given
620        -  1 :: Not Found
621        -  2 :: Ambigious specification
622        -  3 :: Wrong key usage
623        -  4 :: Key revoked
624        -  5 :: Key expired
625        -  6 :: No CRL known
626        -  7 :: CRL too old
627        -  8 :: Policy mismatch
628        -  9 :: Not a secret key
629        - 10 :: Key not trusted
630        - 11 :: Missing certificate
631        - 12 :: Missing issuer certificate
632        - 13 :: Key disabled
633        - 14 :: Syntax error in specification
634
635     If no specific reason was given a previously emitted status code
636     KEY_CONSIDERED may be used to analyzed the problem.
637
638     Note that for historical reasons the INV_RECP status is also used
639     for gpgsm's SIGNER command where it relates to signer's of course.
640     Newer GnuPG versions are using INV_SGNR; applications should
641     ignore the INV_RECP during the sender's command processing once
642     they have seen an INV_SGNR.  Different codes are used so that they
643     can be distinguish while doing an encrypt+sign operation.
644
645 *** NO_RECP <reserved>
646     Issued if no recipients are usable.
647
648 *** NO_SGNR <reserved>
649     Issued if no senders are usable.
650
651 *** KEY_CONSIDERED <fpr> <flags>
652     Issued to explian the lookup of a key.  FPR is the hexified
653     fingerprint of the primary key.  The bit values for FLAGS are:
654
655     - 1 :: The key has not been selected.
656     - 2 :: All subkeys of the key are expired or have been revoked.
657
658 *** KEYEXPIRED <expire-timestamp>
659     The key has expired.  expire-timestamp is the expiration time in
660     seconds since Epoch.  This status line is not very useful because
661     it will also be emitted for expired subkeys even if this subkey is
662     not used.  To check whether a key used to sign a message has
663     expired, the EXPKEYSIG status line is to be used.
664
665     Note, that the TIMESTAMP may either be a number of seconds since
666     Epoch or an ISO 8601 string which can be detected by the presence
667     of the letter 'T'.
668
669 *** KEYREVOKED
670     The used key has been revoked by its owner.  No arguments yet.
671
672 *** NO_PUBKEY  <long keyid>
673     The public key is not available
674
675 *** NO_SECKEY  <long keyid>
676     The secret key is not available
677
678 *** KEY_CREATED <type> <fingerprint> [<handle>]
679     A key has been created.  Values for <type> are:
680       - B :: primary and subkey
681       - P :: primary
682       - S :: subkey
683     The fingerprint is one of the primary key for type B and P and the
684     one of the subkey for S.  Handle is an arbitrary non-whitespace
685     string used to match key parameters from batch key creation run.
686
687 *** KEY_NOT_CREATED [<handle>]
688     The key from batch run has not been created due to errors.
689
690 *** TRUST_
691     These are several similar status codes:
692
693     - TRUST_UNDEFINED <error_token>
694     - TRUST_NEVER     <error_token>
695     - TRUST_MARGINAL  [0  [<validation_model>]]
696     - TRUST_FULLY     [0  [<validation_model>]]
697     - TRUST_ULTIMATE  [0  [<validation_model>]]
698
699     For good signatures one of these status lines are emitted to
700     indicate the validity of the key used to create the signature.
701     The error token values are currently only emitted by gpgsm.
702
703     VALIDATION_MODEL describes the algorithm used to check the
704     validity of the key.  The defaults are the standard Web of Trust
705     model for gpg and the the standard X.509 model for gpgsm.  The
706     defined values are
707
708        - pgp   :: The standard PGP WoT.
709        - shell :: The standard X.509 model.
710        - chain :: The chain model.
711        - steed :: The STEED model.
712        - tofu  :: The TOFU model
713
714     Note that the term =TRUST_= in the status names is used for
715     historic reasons; we now speak of validity.
716
717 *** TOFU_USER <fingerprint_in_hex> <mbox>
718
719     This status identifies the key and the userid for all following
720     Tofu information.  The fingerprint is the fingerprint of the
721     primary key and the mbox is in general the addr-spec part of the
722     userid encoded in UTF-8 and percent escaped.  The fingerprint is
723     identical for all TOFU_USER lines up to a NEWSIG line.
724
725 *** TOFU_STATS <MANY_ARGS>
726
727     Statistics for the current user id.
728
729     The <MANY_ARGS> are the usual space delimited arguments.  Here we
730     have too many of them to fit on one printed line and thus they are
731     given on 3 printed lines:
732
733     : <summary> <sign-count> <encryption-count>
734     : [<policy> [<tm1> <tm2> <tm3> <tm4>
735     : [<validity> [<sign-days> <encrypt-days>]]]]
736
737     Values for SUMMARY are:
738     - 0 :: attention, an interaction with the user is required (conflict)
739     - 1 :: key with no verification/encryption history
740     - 2 :: key with little history
741     - 3 :: key with enough history for basic trust
742     - 4 :: key with a lot of history
743
744     Values for POLICY are:
745     - none    :: No Policy set
746     - auto    :: Policy is "auto"
747     - good    :: Policy is "good"
748     - bad     :: Policy is "bad"
749     - ask     :: Policy is "ask"
750     - unknown :: Policy is "unknown" (TOFU information does not
751                  contribute to the key's validity)
752
753     TM1 is the time the first message was verified.  TM2 is the time
754     the most recent message was verified.  TM3 is the time the first
755     message was encrypted.  TM4 is the most recent encryption. All may
756     either be seconds since Epoch or an ISO time string
757     (yyyymmddThhmmss).
758
759     VALIDITY is the same as SUMMARY with the exception that VALIDITY
760     doesn't reflect whether the key needs attention.  That is it never
761     takes on value 0.  Instead, if there is a conflict, VALIDITY still
762     reflects the key's validity (values: 1-4).
763
764     SIGN-COUNT and ENCRYPTION-COUNT are the number of messages that we
765     have seen that have been signed by this key / encryption to this
766     key.
767
768     SIGN-DAYS and ENCRYPTION-DAYS are similar, but the number of days
769     (in UTC) on which we have seen messages signed by this key /
770     encrypted to this key.
771
772 *** TOFU_STATS_SHORT <long_string>
773
774     Information about the TOFU binding for the signature.
775     Example: "15 signatures verified. 10 messages encrypted"
776
777 *** TOFU_STATS_LONG <long_string>
778
779     Information about the TOFU binding for the signature in verbose
780     format.  The LONG_STRING is percent escaped.
781     Example: 'Verified 9 messages signed by "Werner Koch
782     (dist sig)" in the past 3 minutes, 40 seconds.  The most
783     recent message was verified 4 seconds ago.'
784
785 *** PKA_TRUST_
786     This is is one:
787
788     - PKA_TRUST_GOOD <addr-spec>
789     - PKA_TRUST_BAD  <addr-spec>
790
791     Depending on the outcome of the PKA check one of the above status
792     codes is emitted in addition to a =TRUST_*= status.
793
794 ** Remote control
795 *** GET_BOOL, GET_LINE, GET_HIDDEN, GOT_IT
796
797     These status line are used with --command-fd for interactive
798     control of the process.
799
800 *** USERID_HINT <long main keyid> <string>
801     Give a hint about the user ID for a certain keyID.
802
803 *** NEED_PASSPHRASE <long keyid> <long main keyid> <keytype> <keylength>
804     Issued whenever a passphrase is needed.  KEYTYPE is the numerical
805     value of the public key algorithm or 0 if this is not applicable,
806     KEYLENGTH is the length of the key or 0 if it is not known (this
807     is currently always the case).
808
809 *** NEED_PASSPHRASE_SYM <cipher_algo> <s2k_mode> <s2k_hash>
810     Issued whenever a passphrase for symmetric encryption is needed.
811
812 *** NEED_PASSPHRASE_PIN <card_type> <chvno> [<serialno>]
813     Issued whenever a PIN is requested to unlock a card.
814
815 *** MISSING_PASSPHRASE
816     No passphrase was supplied.  An application which encounters this
817     message may want to stop parsing immediately because the next
818     message will probably be a BAD_PASSPHRASE.  However, if the
819     application is a wrapper around the key edit menu functionality it
820     might not make sense to stop parsing but simply ignoring the
821     following BAD_PASSPHRASE.
822
823 *** BAD_PASSPHRASE <long keyid>
824     The supplied passphrase was wrong or not given.  In the latter
825     case you may have seen a MISSING_PASSPHRASE.
826
827 *** GOOD_PASSPHRASE
828     The supplied passphrase was good and the secret key material
829     is therefore usable.
830
831 ** Import/Export
832 *** IMPORT_CHECK <long keyid> <fingerprint> <user ID>
833     This status is emitted in interactive mode right before
834     the "import.okay" prompt.
835
836 *** IMPORTED   <long keyid>  <username>
837     The keyid and name of the signature just imported
838
839 *** IMPORT_OK  <reason> [<fingerprint>]
840     The key with the primary key's FINGERPRINT has been imported.
841     REASON flags are:
842
843     - 0 :: Not actually changed
844     - 1 :: Entirely new key.
845     - 2 :: New user IDs
846     - 4 :: New signatures
847     - 8 :: New subkeys
848     - 16 :: Contains private key.
849
850     The flags may be ORed.
851
852 *** IMPORT_PROBLEM <reason> [<fingerprint>]
853     Issued for each import failure.  Reason codes are:
854
855     - 0 :: No specific reason given.
856     - 1 :: Invalid Certificate.
857     - 2 :: Issuer Certificate missing.
858     - 3 :: Certificate Chain too long.
859     - 4 :: Error storing certificate.
860
861 *** IMPORT_RES <args>
862     Final statistics on import process (this is one long line). The
863     args are a list of unsigned numbers separated by white space:
864
865     - <count>
866     - <no_user_id>
867     - <imported>
868     - always 0 (formerly used for the number of RSA keys)
869     - <unchanged>
870     - <n_uids>
871     - <n_subk>
872     - <n_sigs>
873     - <n_revoc>
874     - <sec_read>
875     - <sec_imported>
876     - <sec_dups>
877     - <skipped_new_keys>
878     - <not_imported>
879     - <skipped_v3_keys>
880
881 *** EXPORTED  <fingerprint>
882     The key with <fingerprint> has been exported.  The fingerprint is
883     the fingerprint of the primary key even if the primary key has
884     been replaced by a stub key during secret key export.
885
886 *** EXPORT_RES <args>
887
888     Final statistics on export process (this is one long line). The
889     args are a list of unsigned numbers separated by white space:
890
891     - <count>
892     - <secret_count>
893     - <exported>
894
895
896 ** Smartcard related
897 *** CARDCTRL <what> [<serialno>]
898     This is used to control smartcard operations.  Defined values for
899     WHAT are:
900
901       - 1 :: Request insertion of a card.  Serialnumber may be given
902              to request a specific card.  Used by gpg 1.4 w/o
903              scdaemon
904       - 2 :: Request removal of a card.  Used by gpg 1.4 w/o scdaemon.
905       - 3 :: Card with serialnumber detected
906       - 4 :: No card available
907       - 5 :: No card reader available
908       - 6 :: No card support available
909       - 7 :: Card is in termination state
910
911 *** SC_OP_FAILURE [<code>]
912     An operation on a smartcard definitely failed.  Currently there is
913     no indication of the actual error code, but application should be
914     prepared to later accept more arguments.  Defined values for
915     <code> are:
916
917       - 0 :: unspecified error (identically to a missing CODE)
918       - 1 :: canceled
919       - 2 :: bad PIN
920
921 *** SC_OP_SUCCESS
922     A smart card operaion succeeded.  This status is only printed for
923     certain operation and is mostly useful to check whether a PIN
924     change really worked.
925
926 ** Miscellaneous status codes
927 *** NODATA  <what>
928     No data has been found.  Codes for WHAT are:
929
930     - 1 :: No armored data.
931     - 2 :: Expected a packet but did not found one.
932     - 3 :: Invalid packet found, this may indicate a non OpenPGP
933            message.
934     - 4 :: Signature expected but not found
935
936     You may see more than one of these status lines.
937
938 *** UNEXPECTED <what>
939     Unexpected data has been encountered.  Codes for WHAT are:
940     - 0 :: Not further specified
941     - 1 :: Corrupted message structure
942
943 *** TRUNCATED <maxno>
944     The output was truncated to MAXNO items.  This status code is
945     issued for certain external requests.
946
947 *** ERROR <error location> <error code> [<more>]
948     This is a generic error status message, it might be followed by
949     error location specific data. <error code> and <error_location>
950     should not contain spaces.  The error code is a either a string
951     commencing with a letter or such a string prefixed with a
952     numerical error code and an underscore; e.g.: "151011327_EOF".
953 *** WARNING <location> <error code> [<text>]
954     This is a generic warning status message, it might be followed by
955     error location specific data. <error code> and <location>
956     should not contain spaces.  The error code is a either a string
957     commencing with a letter or such a string prefixed with a
958     numerical error code and an underscore; e.g.: "151011327_EOF".
959 *** SUCCESS [<location>]
960     Positive confirmation that an operation succeeded.  It is used
961     similar to ISO-C's EXIT_SUCCESS.  <location> is optional but if
962     given should not contain spaces.  Used only with a few commands.
963
964 *** FAILURE <location> <error_code>
965     This is the counterpart to SUCCESS and used to indicate a program
966     failure.  It is used similar to ISO-C's EXIT_FAILURE but allows
967     conveying more information, in particular a gpg-error error code.
968     That numerical error code may optionally have a suffix made of an
969     underscore and a string with an error symbol like "151011327_EOF".
970     A dash may be used instead of <location>.
971
972 *** BADARMOR
973     The ASCII armor is corrupted.  No arguments yet.
974
975 *** DELETE_PROBLEM <reason_code>
976     Deleting a key failed.  Reason codes are:
977     - 1 :: No such key
978     - 2 :: Must delete secret key first
979     - 3 :: Ambigious specification
980     - 4 :: Key is stored on a smartcard.
981
982 *** PROGRESS <what> <char> <cur> <total> [<units>]
983     Used by the primegen and Public key functions to indicate
984     progress.  <char> is the character displayed with no --status-fd
985     enabled, with the linefeed replaced by an 'X'.  <cur> is the
986     current amount done and <total> is amount to be done; a <total> of
987     0 indicates that the total amount is not known. The condition
988       :       TOTAL && CUR == TOTAL
989     may be used to detect the end of an operation.
990
991     Well known values for WHAT are:
992
993            - pk_dsa   :: DSA key generation
994            - pk_elg   :: Elgamal key generation
995            - primegen :: Prime generation
996            - need_entropy :: Waiting for new entropy in the RNG
997            - tick :: Generic tick without any special meaning - useful
998                      for letting clients know that the server is still
999                      working.
1000            - starting_agent :: A gpg-agent was started because it is not
1001                                 running as a daemon.
1002            - learncard :: Send by the agent and gpgsm while learing
1003                           the data of a smartcard.
1004            - card_busy :: A smartcard is still working
1005
1006     <units> is sometines used to describe the units for <current> and
1007     <total>.  For example "B", "KiB", or "MiB".
1008
1009 *** BACKUP_KEY_CREATED <fingerprint> <fname>
1010     A backup of a key identified by <fingerprint> has been writte to
1011     the file <fname>; <fname> is percent-escaped.
1012
1013 *** MOUNTPOINT <name>
1014     <name> is a percent-plus escaped filename describing the
1015     mountpoint for the current operation (e.g. used by "g13 --mount").
1016     This may either be the specified mountpoint or one randomly
1017     chosen by g13.
1018
1019 *** PINENTRY_LAUNCHED <pid>[:<extra>]
1020     This status line is emitted by gpg to notify a client that a
1021     Pinentry has been launched.  <pid> is the PID of the Pinentry.  It
1022     may be used to display a hint to the user but can't be used to
1023     synchronize with Pinentry.  Note that there is also an Assuan
1024     inquiry line with the same name used internally or, if enabled,
1025     send to the client instead of this status line.  Such an inquiry
1026     may be used to sync with Pinentry
1027
1028 ** Obsolete status codes
1029 *** SIGEXPIRED
1030     Removed on 2011-02-04.  This is deprecated in favor of KEYEXPIRED.
1031 *** RSA_OR_IDEA
1032     Obsolete.  This status message used to be emitted for requests to
1033     use the IDEA or RSA algorithms.  It has been dropped from GnuPG
1034     2.1 after the respective patents expired.
1035 *** SHM_INFO, SHM_GET, SHM_GET_BOOL, SHM_GET_HIDDEN
1036     These were used for the ancient shared memory based co-processing.
1037 *** BEGIN_STREAM, END_STREAM
1038     Used to issued by the experimental pipemode.
1039
1040
1041 * Format of the --attribute-fd output
1042
1043   When --attribute-fd is set, during key listings (--list-keys,
1044   --list-secret-keys) GnuPG dumps each attribute packet to the file
1045   descriptor specified.  --attribute-fd is intended for use with
1046   --status-fd as part of the required information is carried on the
1047   ATTRIBUTE status tag (see above).
1048
1049   The contents of the attribute data is specified by RFC 4880.  For
1050   convenience, here is the Photo ID format, as it is currently the
1051   only attribute defined:
1052
1053   - Byte 0-1 :: The length of the image header.  Due to a historical
1054                 accident (i.e. oops!) back in the NAI PGP days, this
1055                 is a little-endian number.  Currently 16 (0x10 0x00).
1056
1057   - Byte 2 :: The image header version.  Currently 0x01.
1058
1059   - Byte 3 :: Encoding format.  0x01 == JPEG.
1060
1061   - Byte 4-15 :: Reserved, and currently unused.
1062
1063   All other data after this header is raw image (JPEG) data.
1064
1065
1066 * Layout of the TrustDB
1067
1068   The TrustDB is built from fixed length records, where the first byte
1069   describes the record type.  All numeric values are stored in network
1070   byte order.  The length of each record is 40 bytes.  The first
1071   record of the DB is always of type 1 and this is the only record of
1072   this type.
1073
1074   The record types: directory(2), key(3), uid(4), pref(5), sigrec(6),
1075   and shadow directory(8) are not anymore used by version 2 of the
1076   TrustDB.
1077
1078 ** Record type 0
1079
1080    Unused record or deleted, can be reused for any purpose.  Such
1081    records should in general not exist because deleted records are of
1082    type 254 and kept in a linked list.
1083
1084 ** Version info (RECTYPE_VER, 1)
1085
1086    Version information for this TrustDB.  This is always the first
1087    record of the DB and the only one of this type.
1088
1089    - 1 u8 :: Record type (value: 1).
1090    - 3 byte :: Magic value ("gpg")
1091    - 1 u8 :: TrustDB version (value: 2).
1092    - 1 u8 :: =marginals=. How many marginal trusted keys are required.
1093    - 1 u8 :: =completes=. How many completely trusted keys are
1094              required.
1095    - 1 u8 :: =max_cert_depth=.  How deep is the WoT evaluated.  Along
1096              with =marginals= and =completes=, this value is used to
1097              check whether the cached validity value from a [FIXME
1098              dir] record can be used.
1099    - 1 u8 :: =trust_model=
1100    - 1 u8 :: =min_cert_level=
1101    - 2 byte :: Not used
1102    - 1 u32 :: =created=. Timestamp of trustdb creation.
1103    - 1 u32 :: =nextcheck=. Timestamp of last modification which may
1104               affect the validity of keys in the trustdb.  This value
1105               is checked against the validity timestamp in the dir
1106               records.
1107    - 1 u32 :: =reserved=.  Not used.
1108    - 1 u32 :: =reserved2=. Not used.
1109    - 1 u32 :: =firstfree=. Number of the record with the head record
1110               of the RECTYPE_FREE linked list.
1111    - 1 u32 :: =reserved3=. Not used.
1112    - 1 u32 :: =trusthashtbl=. Record number of the trusthashtable.
1113
1114
1115 ** Hash table (RECTYPE_HTBL, 10)
1116
1117    Due to the fact that we use fingerprints to lookup keys, we can
1118    implement quick access by some simple hash methods, and avoid the
1119    overhead of gdbm.  A property of fingerprints is that they can be
1120    used directly as hash values.  What we use is a dynamic multilevel
1121    architecture, which combines hash tables, record lists, and linked
1122    lists.
1123
1124    This record is a hash table of 256 entries with the property that
1125    all these records are stored consecutively to make one big
1126    table. The hash value is simple the 1st, 2nd, ... byte of the
1127    fingerprint (depending on the indirection level).
1128
1129    - 1 u8 :: Record type (value: 10).
1130    - 1 u8 :: Reserved
1131    - n u32 :: =recnum=.  A table with the hash table items fitting into
1132               this record.  =n= depends on the record length:
1133               $n=(reclen-2)/4$ which yields 9 for oure current record
1134               length of 40 bytes.
1135
1136    The total number of hash table records to form the table is:
1137    $m=(256+n-1)/n$.  This is 29 for our record length of 40.
1138
1139    To look up a key we use the first byte of the fingerprint to get
1140    the recnum from this hash table and then look up the addressed
1141    record:
1142
1143    - If that record is another hash table, we use 2nd byte to index
1144      that hash table and so on;
1145    - if that record is a hash list, we walk all entries until we find
1146      a matching one; or
1147    - if that record is a key record, we compare the fingerprint to
1148      decide whether it is the requested key;
1149
1150
1151 ** Hash list (RECTYPE_HLST, 11)
1152
1153    See hash table above on how it is used.  It may also be used for
1154    other purposes.
1155
1156    - 1 u8 :: Record type (value: 11).
1157    - 1 u8 :: Reserved.
1158    - 1 u32 :: =next=.  Record number of the next hash list record or 0
1159               if none.
1160    - n u32 :: =rnum=.  Array with record numbers to values.  With
1161               $n=(reclen-5)/5$ and our record length of 40, n is 7.
1162
1163 ** Trust record (RECTYPE_TRUST, 12)
1164
1165    - 1 u8 :: Record type (value: 12).
1166    - 1 u8 :: Reserved.
1167    - 20 byte :: =fingerprint=.
1168    - 1 u8 :: =ownertrust=.
1169    - 1 u8 :: =depth=.
1170    - 1 u8 :: =min_ownertrust=.
1171    - 1 byte :: Not used.
1172    - 1 u32 :: =validlist=.
1173    - 10 byte :: Not used.
1174
1175 ** Validity record (RECTYPE_VALID, 13)
1176
1177    - 1 u8 :: Record type (value: 13).
1178    - 1 u8 :: Reserved.
1179    - 20 byte :: =namehash=.
1180    - 1 u8 :: =validity=
1181    - 1 u32 :: =next=.
1182    - 1 u8 :: =full_count=.
1183    - 1 u8 :: =marginal_count=.
1184    - 11 byte :: Not used.
1185
1186 ** Free record (RECTYPE_FREE, 254)
1187
1188    All these records form a linked list of unused records in the TrustDB.
1189
1190    - 1 u8 :: Record type (value: 254)
1191    - 1 u8 :: Reserved.
1192    - 1 u32 :: =next=.  Record number of the next rcord of this type.
1193               The record number to the head of this linked list is
1194               stored in the version info record.
1195
1196
1197 * Database scheme for the TOFU info
1198
1199 #+begin_src sql
1200 --
1201 -- The VERSION table holds the version of our TOFU data structures.
1202 --
1203 CREATE TABLE version (
1204   version integer -- As of now this is always 1
1205 );
1206
1207 --
1208 -- The BINDINGS table associates mail addresses with keys.
1209 --
1210 CREATE TABLE bindings (
1211   oid integer primary key autoincrement,
1212   fingerprint text, -- The key's fingerprint in hex
1213   email text,       -- The normalized mail address destilled from user_id
1214   user_id text,     -- The unmodified user id
1215   time integer,     -- The time this binding was first observed.
1216   policy boolean check
1217        (policy in (1, 2, 3, 4, 5)), -- The trust policy with the values:
1218                                     --   1 := Auto
1219                                     --   2 := Good
1220                                     --   3 := Unknown
1221                                     --   4 := Bad
1222                                     --   5 := Ask
1223   conflict string,  -- NULL or a hex formatted fingerprint.
1224   unique (fingerprint, email)
1225 );
1226
1227 CREATE INDEX bindings_fingerprint_email on bindings (fingerprint, email);
1228 CREATE INDEX bindings_email on bindings (email);
1229
1230 --
1231 -- The SIGNATURES table records all data signatures we verified
1232 --
1233 CREATE TABLE signatures (
1234   binding integer not null, -- Link to bindings table,
1235                             -- references bindings.oid.
1236   sig_digest text,          -- The digest of the signed message.
1237   origin text,              -- String describing who initially fed
1238                             -- the signature to gpg (e.g. "email:claws").
1239   sig_time integer,         -- Timestamp from the signature.
1240   time integer,             -- Time this record was created.
1241   primary key (binding, sig_digest, origin)
1242 );
1243 #+end_src
1244
1245
1246 * GNU extensions to the S2K algorithm
1247
1248   1 octet  - S2K Usage: either 254 or 255.
1249   1 octet  - S2K Cipher Algo: 0
1250   1 octet  - S2K Specifier: 101
1251   3 octets - "GNU"
1252   1 octet  - GNU S2K Extension Number.
1253
1254   If such a GNU extension is used neither an IV nor any kind of
1255   checksum is used.  The defined GNU S2K Extension Numbers are:
1256
1257   - 1 :: Do not store the secret part at all.  No specific data
1258          follows.
1259
1260   - 2 :: A stub to access smartcards.  This data follows:
1261          - One octet with the length of the following serial number.
1262          - The serial number. Regardless of what the length octet
1263            indicates no more than 16 octets are stored.
1264
1265   Note that gpg stores the GNU S2K Extension Number internally as an
1266   S2K Specifier with an offset of 1000.
1267
1268
1269 * Keyserver helper message format
1270
1271   *This information is obsolete*
1272   (Keyserver helpers have been replaced by dirmngr)
1273
1274   The keyserver may be contacted by a Unix Domain socket or via TCP.
1275
1276   The format of a request is:
1277 #+begin_example
1278   command-tag
1279   "Content-length:" digits
1280   CRLF
1281 #+end_example
1282
1283   Where command-tag is
1284
1285 #+begin_example
1286   NOOP
1287   GET <user-name>
1288   PUT
1289   DELETE <user-name>
1290 #+end_example
1291
1292 The format of a response is:
1293
1294 #+begin_example
1295   "GNUPG/1.0" status-code status-text
1296   "Content-length:" digits
1297   CRLF
1298 #+end_example
1299 followed by <digits> bytes of data
1300
1301 Status codes are:
1302
1303   - 1xx :: Informational - Request received, continuing process
1304
1305   - 2xx :: Success - The action was successfully received, understood,
1306            and accepted
1307
1308   - 4xx :: Client Error - The request contains bad syntax or cannot be
1309            fulfilled
1310
1311   - 5xx :: Server Error - The server failed to fulfill an apparently
1312            valid request
1313
1314
1315 * Object identifiers
1316
1317   OIDs below the GnuPG arc:
1318
1319 #+begin_example
1320   1.3.6.1.4.1.11591.2          GnuPG
1321   1.3.6.1.4.1.11591.2.1          notation
1322   1.3.6.1.4.1.11591.2.1.1          pkaAddress
1323   1.3.6.1.4.1.11591.2.2          X.509 extensions
1324   1.3.6.1.4.1.11591.2.2.1          standaloneCertificate
1325   1.3.6.1.4.1.11591.2.2.2          wellKnownPrivateKey
1326   1.3.6.1.4.1.11591.2.12242973   invalid encoded OID
1327 #+end_example
1328
1329
1330
1331 * Debug flags
1332
1333 This tables gives the flag values for the --debug option along with
1334 the alternative names used by the components.
1335
1336 |       | gpg     | gpgsm   | agent   | scd     | dirmngr | g13     | wks     |
1337 |-------+---------+---------+---------+---------+---------+---------+---------|
1338 |     1 | packet  | x509    |         |         | x509    | mount   | mime    |
1339 |     2 | mpi     | mpi     | mpi     | mpi     |         |         | parser  |
1340 |     4 | crypto  | crypto  | crypto  | crypto  | crypto  | crypto  | crypto  |
1341 |     8 | filter  |         |         |         |         |         |         |
1342 |    16 | iobuf   |         |         |         | dns     |         |         |
1343 |    32 | memory  | memory  | memory  | memory  | memory  | memory  | memory  |
1344 |    64 | cache   | cache   | cache   | cache   | cache   |         |         |
1345 |   128 | memstat | memstat | memstat | memstat | memstat | memstat | memstat |
1346 |   256 | trust   |         |         |         |         |         |         |
1347 |   512 | hashing | hashing | hashing | hashing | hashing |         |         |
1348 |  1024 | ipc     | ipc     | ipc     | ipc     | ipc     | ipc     | ipc     |
1349 |  2048 |         |         |         | cardio  | network |         |         |
1350 |  4096 | clock   |         |         | reader  |         |         |         |
1351 |  8192 | lookup  |         |         |         | lookup  |         |         |
1352 | 16384 | extprog |         |         |         |         |         | extprog |
1353
1354 Description of some debug flags:
1355
1356   - cardio :: Used by scdaemon to trace the APDUs exchange with the
1357               card.
1358   - clock  :: Show execution times of certain functions.
1359   - crypto :: Trace crypto operations.
1360   - hashing :: Create files with the hashed data.
1361   - ipc :: Trace the Assuan commands.
1362   - mpi :: Show the values of the MPIs.
1363   - reader :: Used by scdaemon to trace card reader related code.  For
1364               example: Open and close reader.
1365
1366
1367
1368 * Miscellaneous notes
1369
1370 ** v3 fingerprints
1371    For packet version 3 we calculate the keyids this way:
1372     - RSA :: Low 64 bits of n
1373     - ELGAMAL :: Build a v3 pubkey packet (with CTB 0x99) and
1374                  calculate a RMD160 hash value from it. This is used
1375                  as the fingerprint and the low 64 bits are the keyid.
1376
1377 ** Simplified revocation certificates
1378   Revocation certificates consist only of the signature packet;
1379   "--import" knows how to handle this.  The rationale behind it is to
1380   keep them small.
1381
1382 ** Documentation on HKP (the http keyserver protocol):
1383
1384    A minimalistic HTTP server on port 11371 recognizes a GET for
1385    /pks/lookup.  The standard http URL encoded query parameters are
1386    this (always key=value):
1387
1388    - op=index (like pgp -kv), op=vindex (like pgp -kvv) and op=get (like
1389      pgp -kxa)
1390
1391    - search=<stringlist>. This is a list of words that must occur in the key.
1392      The words are delimited with space, points, @ and so on. The delimiters
1393      are not searched for and the order of the words doesn't matter (but see
1394      next option).
1395
1396    - exact=on. This switch tells the hkp server to only report exact matching
1397      keys back. In this case the order and the "delimiters" are important.
1398
1399    - fingerprint=on. Also reports the fingerprints when used with 'index' or
1400      'vindex'
1401
1402    The keyserver also recognizes http-POSTs to /pks/add. Use this to upload
1403    keys.
1404
1405
1406    A better way to do this would be a request like:
1407
1408       /pks/lookup/<gnupg_formatierte_user_id>?op=<operation>
1409
1410    This can be implemented using Hurd's translator mechanism.
1411    However, I think the whole keyserver stuff has to be re-thought;
1412    I have some ideas and probably create a white paper.
1413 ** Algorithm names for the "keygen.algo" prompt
1414
1415   When using a --command-fd controlled key generation or "addkey"
1416   there is way to know the number to enter on the "keygen.algo"
1417   prompt.  The displayed numbers are for human reception and may
1418   change with releases.  To provide a stable way to enter a desired
1419   algorithm choice the prompt also accepts predefined names for the
1420   algorithms, which will not change.
1421
1422    | Name    | No | Description                     |
1423    |---------+----+---------------------------------|
1424    | rsa+rsa |  1 | RSA and RSA (default)           |
1425    | dsa+elg |  2 | DSA and Elgamal                 |
1426    | dsa     |  3 | DSA (sign only)                 |
1427    | rsa/s   |  4 | RSA (sign only)                 |
1428    | elg     |  5 | Elgamal (encrypt only)          |
1429    | rsa/e   |  6 | RSA (encrypt only)              |
1430    | dsa/*   |  7 | DSA (set your own capabilities) |
1431    | rsa/*   |  8 | RSA (set your own capabilities) |
1432    | ecc+ecc |  9 | ECC and ECC                     |
1433    | ecc/s   | 10 | ECC (sign only)                 |
1434    | ecc/*   | 11 | ECC (set your own capabilities) |
1435    | ecc/e   | 12 | ECC (encrypt only)              |
1436    | keygrip | 13 | Existing key                    |
1437
1438    If one of the "foo/*" names are used a "keygen.flags" prompt needs
1439    to be answered as well.  Instead of toggling the predefined flags,
1440    it is also possible to set them direct: Use a "=" character
1441    directly followed by a comination of "a" (for authentication), "s"
1442    (for signing), or "c" (for certification).