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