1 # doc/DETAILS -*- org -*-
3 # Globally disable superscripts and subscripts:
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.
14 This is the DETAILS file for GnuPG which specifies some internals and
15 parts of the external API for GPG and GPGSM.
17 * Format of the colon listings
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
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:
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.
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
49 ** Description of the fields
50 *** Field 1 - Type of record
53 - crt :: X.509 certificate
54 - crs :: X.509 certificate and private key available
55 - sub :: Subkey (secondary key)
57 - ssb :: Secret subkey (secondary key)
59 - uat :: User attribute (same as user id except for field 10).
61 - rev :: Revocation signature
62 - rvs :: Revocation signature (standalone) [since 2.2.9]
63 - fpr :: Fingerprint (fingerprint is in field 10)
64 - fp2 :: SHA-256 fingerprint (fingerprint is in field 10)
65 - pkd :: Public key data [*]
67 - rvk :: Revocation key
68 - tfs :: TOFU statistics [*]
69 - tru :: Trust database information [*]
70 - spk :: Signature subpacket [*]
71 - cfg :: Configuration data [*]
73 Records marked with an asterisk are described at [[*Special%20field%20formats][*Special fields]].
75 *** Field 2 - Validity
77 This is a letter describing the computed validity of a key.
78 Currently this is a single letter, but be prepared that additional
79 information may follow in some future versions. Note that GnuPG <
80 2.1 does not set this field for secret key listings.
82 - o :: Unknown (this key is new to the system)
83 - i :: The key is invalid (e.g. due to a missing self-signature)
84 - d :: The key has been disabled
85 (deprecated - use the 'D' in field 12 instead)
86 - r :: The key has been revoked
87 - e :: The key has expired
88 - - :: Unknown validity (i.e. no value assigned)
89 - q :: Undefined validity. '-' and 'q' may safely be treated as
90 the same value for most purposes
91 - n :: The key is not valid
92 - m :: The key is marginal valid.
93 - f :: The key is fully valid
94 - u :: The key is ultimately valid. This often means that the
95 secret key is available, but any key may be marked as
97 - w :: The key has a well known private part.
98 - s :: The key has special validity. This means that it might be
99 self-signed and expected to be used in the STEED system.
101 If the validity information is given for a UID or UAT record, it
102 describes the validity calculated based on this user ID. If given
103 for a key record it describes the validity taken from the best
106 For X.509 certificates a 'u' is used for a trusted root
107 certificate (i.e. for the trust anchor) and an 'f' for all other
110 In "sig" records, this field may have one of these values as first
113 - ! :: Signature is good.
114 - - :: Signature is bad.
115 - ? :: No public key to verify signature or public key is not usable.
116 - % :: Other error verifying a signature
118 More values may be added later. The field may also be empty if
119 gpg has been invoked in a non-checking mode (--list-sigs) or in a
120 fast checking mode. Since 2.2.7 '?' will also be printed by the
121 command --list-sigs if the key is not in the local keyring.
123 *** Field 3 - Key length
125 The length of key in bits.
127 *** Field 4 - Public key algorithm
129 The values here are those from the OpenPGP specs or if they are
130 greater than 255 the algorithm ids as used by Libgcrypt.
134 This is the 64 bit keyid as specified by OpenPGP and the last 64
135 bit of the SHA-1 fingerprint of an X.509 certifciate.
137 *** Field 6 - Creation date
139 The creation date of the key is given in UTC. For UID and UAT
140 records, this is used for the self-signature date. Note that the
141 date is usually printed in seconds since epoch, however, we are
142 migrating to an ISO 8601 format (e.g. "19660205T091500"). This is
143 currently only relevant for X.509. A simple way to detect the new
144 format is to scan for the 'T'. Note that old versions of gpg
145 without using the =--fixed-list-mode= option used a "yyyy-mm-tt"
148 *** Field 7 - Expiration date
150 Key or UID/UAT expiration date or empty if it does not expire.
152 *** Field 8 - Certificate S/N, UID hash, trust signature info
154 Used for serial number in crt records. For UID and UAT records,
155 this is a hash of the user ID contents used to represent that
156 exact user ID. For trust signatures, this is the trust depth
157 separated by the trust value by a space.
159 *** Field 9 - Ownertrust
161 This is only used on primary keys. This is a single letter, but
162 be prepared that additional information may follow in future
163 versions. For trust signatures with a regular expression, this is
164 the regular expression value, quoted as in field 10.
166 *** Field 10 - User-ID
168 The value is quoted like a C string to avoid control characters
169 (the colon is quoted =\x3a=). For a "pub" record this field is
170 not used on --fixed-list-mode. A UAT record puts the attribute
171 subpacket count here, a space, and then the total attribute
172 subpacket size. In gpgsm the issuer name comes here. The FPR and FP2
173 records store the fingerprints here. The fingerprint of a
174 revocation key is stored here.
176 *** Field 11 - Signature class
178 Signature class as per RFC-4880. This is a 2 digit hexnumber
179 followed by either the letter 'x' for an exportable signature or
180 the letter 'l' for a local-only signature. The class byte of an
181 revocation key is also given here, by a 2 digit hexnumber and
182 optionally followed by the letter 's' for the "sensitive"
183 flag. This field is not used for X.509.
185 "rev" and "rvs" may be followed by a comma and a 2 digit hexnumber
186 with the revocation reason.
188 *** Field 12 - Key capabilities
190 The defined capabilities are:
195 - a :: Authentication
196 - ? :: Unknown capability
198 A key may have any combination of them in any order. In addition
199 to these letters, the primary key has uppercase versions of the
200 letters to denote the _usable_ capabilities of the entire key, and
201 a potential letter 'D' to indicate a disabled key.
203 *** Field 13 - Issuer certificate fingerprint or other info
205 Used in FPR records for S/MIME keys to store the fingerprint of
206 the issuer certificate. This is useful to build the certificate
207 path based on certificates stored in the local key database it is
208 only filled if the issuer certificate is available. The root has
209 been reached if this is the same string as the fingerprint. The
210 advantage of using this value is that it is guaranteed to have
211 been built by the same lookup algorithm as gpgsm uses.
213 For "uid" records this field lists the preferences in the same way
214 gpg's --edit-key menu does.
216 For "sig", "rev" and "rvs" records, this is the fingerprint of the
217 key that issued the signature. Note that this may only be filled
218 if the signature verified correctly. Note also that for various
219 technical reasons, this fingerprint is only available if
220 --no-sig-cache is used. Since 2.2.7 this field will also be set
221 if the key is missing but the signature carries an issuer
222 fingerprint as meta data.
224 *** Field 14 - Flag field
226 Flag field used in the --edit-key menu output
228 *** Field 15 - S/N of a token
230 Used in sec/ssb to print the serial number of a token (internal
231 protect mode 1002) or a '#' if that key is a simple stub (internal
232 protect mode 1001). If the option --with-secret is used and a
233 secret key is available for the public key, a '+' indicates this.
235 *** Field 16 - Hash algorithm
237 For sig records, this is the used hash algorithm. For example:
238 2 = SHA-1, 8 = SHA-256.
240 *** Field 17 - Curve name
242 For pub, sub, sec, ssb, crt, and crs records this field is used
243 for the ECC curve name.
245 *** Field 18 - Compliance flags
247 Space separated list of asserted compliance modes and
248 screening result for this key.
252 - 8 :: The key is compliant with RFC4880bis
253 - 23 :: The key is compliant with compliance mode "de-vs".
254 - 6001 :: Screening hit on the ROCA vulnerability.
256 *** Field 19 - Last update
258 The timestamp of the last update of a key or user ID. The update
259 time of a key is defined a lookup of the key via its unique
260 identifier (fingerprint); the field is empty if not known. The
261 update time of a user ID is defined by a lookup of the key using a
262 trusted mapping from mail address to key.
264 *** Field 20 - Origin
266 The origin of the key or the user ID. This is an integer
267 optionally followed by a space and an URL. This goes along with
268 the previous field. The URL is quoted in C style.
270 *** Field 21 - Comment
272 This is currently only used in "rev" and "rvs" records to carry
273 the the comment field of the recocation reason. The value is
278 *** PKD - Public key data
280 If field 1 has the tag "pkd", a listing looks like this:
282 pkd:0:1024:B665B1435F4C2 .... FF26ABB:
284 ! !------ for information number of bits in the value
285 !--------- index (eg. DSA goes from 0 to 3: p,q,g,y)
288 *** TFS - TOFU statistics
290 This field may follows a UID record to convey information about
291 the TOFU database. The information is similar to a TOFU_STATS
294 - Field 2 :: tfs record version (must be 1)
295 - Field 3 :: validity - A number with validity code.
296 - Field 4 :: signcount - The number of signatures seen.
297 - Field 5 :: encrcount - The number of encryptions done.
298 - Field 6 :: policy - A string with the policy
299 - Field 7 :: signture-first-seen - a timestamp or 0 if not known.
300 - Field 8 :: signature-most-recent-seen - a timestamp or 0 if not known.
301 - Field 9 :: encryption-first-done - a timestamp or 0 if not known.
302 - Field 10 :: encryption-most-recent-done - a timestamp or 0 if not known.
304 *** TRU - Trust database information
305 Example for a "tru" trust base record:
307 tru:o:0:1166697654:1:3:1:5
310 - Field 2 :: Reason for staleness of trust. If this field is
311 empty, then the trustdb is not stale. This field may
312 have multiple flags in it:
314 - o :: Trustdb is old
315 - t :: Trustdb was built with a different trust model
316 than the one we are using now.
318 - Field 3 :: Trust model
320 - 0 :: Classic trust model, as used in PGP 2.x.
321 - 1 :: PGP trust model, as used in PGP 6 and later.
322 This is the same as the classic trust model,
323 except for the addition of trust signatures.
325 GnuPG before version 1.4 used the classic trust model
326 by default. GnuPG 1.4 and later uses the PGP trust
329 - Field 4 :: Date trustdb was created in seconds since Epoch.
330 - Field 5 :: Date trustdb will expire in seconds since Epoch.
331 - Field 6 :: Number of marginally trusted users to introduce a new
332 key signer (gpg's option --marginals-needed).
333 - Field 7 :: Number of completely trusted users to introduce a new
334 key signer. (gpg's option --completes-needed)
336 - Field 8 :: Maximum depth of a certification chain. (gpg's option
339 *** SPK - Signature subpacket records
341 - Field 2 :: Subpacket number as per RFC-4880 and later.
342 - Field 3 :: Flags in hex. Currently the only two bits assigned
343 are 1, to indicate that the subpacket came from the
344 hashed part of the signature, and 2, to indicate the
345 subpacket was marked critical.
346 - Field 4 :: Length of the subpacket. Note that this is the
347 length of the subpacket, and not the length of field
348 5 below. Due to the need for %-encoding, the length
349 of field 5 may be up to 3x this value.
350 - Field 5 :: The subpacket data. Printable ASCII is shown as
351 ASCII, but other values are rendered as %XX where XX
352 is the hex value for the byte.
354 *** CFG - Configuration data
356 --list-config outputs information about the GnuPG configuration
357 for the benefit of frontends or other programs that call GnuPG.
358 There are several list-config items, all colon delimited like the
359 rest of the --with-colons output. The first field is always "cfg"
360 to indicate configuration information. The second field is one of
363 - version :: The third field contains the version of GnuPG.
367 - pubkey :: The third field contains the public key algorithms
368 this version of GnuPG supports, separated by
369 semicolons. The algorithm numbers are as specified in
370 RFC-4880. Note that in contrast to the --status-fd
371 interface these are _not_ the Libgcrypt identifiers.
372 Using =pubkeyname= prints names instead of numbers.
374 : cfg:pubkey:1;2;3;16;17
376 - cipher :: The third field contains the symmetric ciphers this
377 version of GnuPG supports, separated by semicolons.
378 The cipher numbers are as specified in RFC-4880.
379 Using =ciphername= prints names instead of numbers.
381 : cfg:cipher:2;3;4;7;8;9;10
383 - digest :: The third field contains the digest (hash) algorithms
384 this version of GnuPG supports, separated by
385 semicolons. The digest numbers are as specified in
386 RFC-4880. Using =digestname= prints names instead of
389 : cfg:digest:1;2;3;8;9;10
391 - compress :: The third field contains the compression algorithms
392 this version of GnuPG supports, separated by
393 semicolons. The algorithm numbers are as specified
396 : cfg:compress:0;1;2;3
398 - group :: The third field contains the name of the group, and the
399 fourth field contains the values that the group expands
400 to, separated by semicolons.
402 For example, a group of:
403 : group mynames = paige 0x12345678 joe patti
405 : cfg:group:mynames:patti;joe;0x12345678;paige
407 - curve :: The third field contains the curve names this version
408 of GnuPG supports, separated by semicolons. Using
409 =curveoid= prints OIDs instead of numbers.
411 : cfg:curve:ed25519;nistp256;nistp384;nistp521
414 * Format of the --status-fd output
416 Every line is prefixed with "[GNUPG:] ", followed by a keyword with
417 the type of the status line and some arguments depending on the type
418 (maybe none); an application should always be willing to ignore
419 unknown keywords that may be emitted by future versions of GnuPG.
420 Also, new versions of GnuPG may add arguments to existing keywords.
421 Any additional arguments should be ignored for forward-compatibility.
423 ** General status codes
424 *** NEWSIG [<signers_uid>]
425 Is issued right before a signature verification starts. This is
426 useful to define a context for parsing ERROR status messages.
427 If SIGNERS_UID is given and is not "-" this is the percent-escaped
428 value of the OpenPGP Signer's User ID signature sub-packet.
430 *** GOODSIG <long_keyid_or_fpr> <username>
431 The signature with the keyid is good. For each signature only one
432 of the codes GOODSIG, BADSIG, EXPSIG, EXPKEYSIG, REVKEYSIG or
433 ERRSIG will be emitted. In the past they were used as a marker
434 for a new signature; new code should use the NEWSIG status
435 instead. The username is the primary one encoded in UTF-8 and %XX
436 escaped. The fingerprint may be used instead of the long keyid if
437 it is available. This is the case with CMS and might eventually
438 also be available for OpenPGP.
440 *** EXPSIG <long_keyid_or_fpr> <username>
441 The signature with the keyid is good, but the signature is
442 expired. The username is the primary one encoded in UTF-8 and %XX
443 escaped. The fingerprint may be used instead of the long keyid if
444 it is available. This is the case with CMS and might eventually
445 also be available for OpenPGP.
447 *** EXPKEYSIG <long_keyid_or_fpr> <username>
448 The signature with the keyid is good, but the signature was made
449 by an expired key. The username is the primary one encoded in
450 UTF-8 and %XX escaped. The fingerprint may be used instead of the
451 long keyid if it is available. This is the case with CMS and
452 might eventually also be available for OpenPGP.
454 *** REVKEYSIG <long_keyid_or_fpr> <username>
455 The signature with the keyid is good, but the signature was made
456 by a revoked key. The username is the primary one encoded in UTF-8
457 and %XX escaped. The fingerprint may be used instead of the long
458 keyid if it is available. This is the case with CMS and might
459 eventually also beñ available for OpenPGP.
461 *** BADSIG <long_keyid_or_fpr> <username>
462 The signature with the keyid has not been verified okay. The
463 username is the primary one encoded in UTF-8 and %XX escaped. The
464 fingerprint may be used instead of the long keyid if it is
465 available. This is the case with CMS and might eventually also be
466 available for OpenPGP.
468 *** ERRSIG <keyid> <pkalgo> <hashalgo> <sig_class> <time> <rc> <fpr>
469 It was not possible to check the signature. This may be caused by
470 a missing public key or an unsupported algorithm. A RC of 4
471 indicates unknown algorithm, a 9 indicates a missing public
472 key. The other fields give more information about this signature.
473 sig_class is a 2 byte hex-value. The fingerprint may be used
474 instead of the long_keyid_or_fpr if it is available. This is the
475 case with gpgsm and might eventually also be available for
476 OpenPGP. The ERRSIG line has FPR filed which is only available
477 since 2.2.7; that FPR may either be missing or - if the signature
478 has no fingerprint as meta data.
480 Note, that TIME may either be the number of seconds since Epoch or
481 an ISO 8601 string. The latter can be detected by the presence of
488 - <fingerprint_in_hex>
489 - <sig_creation_date>
497 - [ <primary-key-fpr> ]
499 This status indicates that the signature is cryptographically
500 valid. This is similar to GOODSIG, EXPSIG, EXPKEYSIG, or REVKEYSIG
501 (depending on the date and the state of the signature and signing
502 key) but has the fingerprint as the argument. Multiple status
503 lines (VALIDSIG and the other appropriate *SIG status) are emitted
504 for a valid signature. All arguments here are on one long line.
505 sig-timestamp is the signature creation time in seconds after the
506 epoch. expire-timestamp is the signature expiration time in
507 seconds after the epoch (zero means "does not
508 expire"). sig-version, pubkey-algo, hash-algo, and sig-class (a
509 2-byte hex value) are all straight from the signature packet.
510 PRIMARY-KEY-FPR is the fingerprint of the primary key or identical
511 to the first argument. This is useful to get back to the primary
512 key without running gpg again for this purpose.
514 The primary-key-fpr parameter is used for OpenPGP and not
515 available for CMS signatures. The sig-version as well as the sig
516 class is not defined for CMS and currently set to 0 and 00.
518 Note, that *-TIMESTAMP may either be a number of seconds since
519 Epoch or an ISO 8601 string which can be detected by the presence
522 *** SIG_ID <radix64_string> <sig_creation_date> <sig-timestamp>
523 This is emitted only for signatures of class 0 or 1 which have
524 been verified okay. The string is a signature id and may be used
525 in applications to detect replay attacks of signed messages. Note
526 that only DLP algorithms give unique ids - others may yield
527 duplicated ones when they have been created in the same second.
529 Note, that SIG-TIMESTAMP may either be a number of seconds since
530 Epoch or an ISO 8601 string which can be detected by the presence
533 *** ENC_TO <long_keyid> <keytype> <keylength>
534 The message is encrypted to this LONG_KEYID. KEYTYPE is the
535 numerical value of the public key algorithm or 0 if it is not
536 known, KEYLENGTH is the length of the key or 0 if it is not known
537 (which is currently always the case). Gpg prints this line
538 always; Gpgsm only if it knows the certificate.
541 Mark the start of the actual decryption process. This is also
542 emitted when in --list-only mode.
544 Mark the end of the actual decryption process. This is also
545 emitted when in --list-only mode.
546 *** DECRYPTION_KEY <fpr> <fpr2> <otrust>
547 This line is emitted when a public key decryption succeeded in
548 providing a session key. <fpr> is the hexified fingerprint of the
549 actual key used for decryption. <fpr2> is the fingerprint of the
550 primary key. <otrust> is the letter with the ownertrust; this is
551 in general a 'u' which stands for ultimately trusted.
552 *** DECRYPTION_INFO <mdc_method> <sym_algo> [<aead_algo>]
553 Print information about the symmetric encryption algorithm and the
554 MDC method. This will be emitted even if the decryption fails.
555 For an AEAD algorithm AEAD_ALGO is not 0. GPGSM currently does
556 not print such a status.
558 *** DECRYPTION_FAILED
559 The symmetric decryption failed - one reason could be a wrong
560 passphrase for a symmetrical encrypted message.
563 The decryption process succeeded. This means, that either the
564 correct secret key has been used or the correct passphrase for a
565 symmetric encrypted message was given. The program itself may
566 return an errorcode because it may not be possible to verify a
567 signature for some reasons.
569 *** SESSION_KEY <algo>:<hexdigits>
570 The session key used to decrypt the message. This message will
571 only be emitted if the option --show-session-key is used. The
572 format is suitable to be passed as value for the option
573 --override-session-key. It is not an indication that the
574 decryption will or has succeeded.
576 *** BEGIN_ENCRYPTION <mdc_method> <sym_algo> [<aead_algo>]
577 Mark the start of the actual encryption process.
578 MDC_METHOD shall be 0 if an AEAD_ALGO is not 0. Users should
579 however ignore MDC_METHOD if AEAD_ALGO is not 0.
582 Mark the end of the actual encryption process.
584 *** FILE_START <what> <filename>
585 Start processing a file <filename>. <what> indicates the performed
592 Marks the end of a file processing which has been started
596 Mark the start of the actual signing process. This may be used as
597 an indication that all requested secret keys are ready for use.
599 *** ALREADY_SIGNED <long-keyid>
600 Warning: This is experimental and might be removed at any time.
602 *** SIG_CREATED <type> <pk_algo> <hash_algo> <class> <timestamp> <keyfpr>
603 A signature has been created using these parameters.
604 Values for type <type> are:
608 (only the first character should be checked)
610 <class> are 2 hex digits with the OpenPGP signature class.
612 Note, that TIMESTAMP may either be a number of seconds since Epoch
613 or an ISO 8601 string which can be detected by the presence of the
617 There are actually three related status codes to convey notation
620 - NOTATION_NAME <name>
621 - NOTATION_FLAGS <critical> <human_readable>
622 - NOTATION_DATA <string>
624 <name> and <string> are %XX escaped. The data may be split among
625 several NOTATION_DATA lines. NOTATION_FLAGS is emitted after
626 NOTATION_NAME and gives the critical and human readable flags;
627 the flag values are either 0 or 1.
629 *** POLICY_URL <string>
630 Note that URL in <string> is %XX escaped.
632 *** PLAINTEXT <format> <timestamp> <filename>
633 This indicates the format of the plaintext that is about to be
634 written. The format is a 1 byte hex code that shows the format of
635 the plaintext: 62 ('b') is binary data, 74 ('t') is text data with
636 no character set specified, and 75 ('u') is text data encoded in
637 the UTF-8 character set. The timestamp is in seconds since the
638 epoch. If a filename is available it gets printed as the third
639 argument, percent-escaped as usual.
641 *** PLAINTEXT_LENGTH <length>
642 This indicates the length of the plaintext that is about to be
643 written. Note that if the plaintext packet has partial length
644 encoding it is not possible to know the length ahead of time. In
645 that case, this status tag does not appear. The length is only
646 exact for binary formats; other formats ('t', 'u') may do post
647 processing like line ending conversion so that the actual number
648 of bytes written may be differ.
650 *** ATTRIBUTE <arguments>
651 The list or arguments are:
661 This is one long line issued for each attribute subpacket when an
662 attribute packet is seen during key listing. <fpr> is the
663 fingerprint of the key. <octets> is the length of the attribute
664 subpacket. <type> is the attribute type (e.g. 1 for an image).
665 <index> and <count> indicate that this is the N-th indexed
666 subpacket of count total subpackets in this attribute packet.
667 <timestamp> and <expiredate> are from the self-signature on the
668 attribute packet. If the attribute packet does not have a valid
669 self-signature, then the timestamp is 0. <flags> are a bitwise OR
671 - 0x01 :: this attribute packet is a primary uid
672 - 0x02 :: this attribute packet is revoked
673 - 0x04 :: this attribute packet is expired
675 *** SIG_SUBPACKET <type> <flags> <len> <data>
676 This indicates that a signature subpacket was seen. The format is
677 the same as the "spk" record above.
679 *** ENCRYPTION_COMPLIANCE_MODE <flags>
680 Indicates that the current encryption operation was in compliance
681 with the given set of modes for all recipients. "flags" is a
682 space separated list of numerical flags, see "Field 18 -
683 Compliance flags" above.
685 *** DECRYPTION_COMPLIANCE_MODE <flags>
686 Indicates that the current decryption operation is in compliance
687 with the given set of modes. "flags" is a space separated list of
688 numerical flags, see "Field 18 - Compliance flags" above.
690 *** VERIFICATION_COMPLIANCE_MODE <flags>
691 Indicates that the current signature verification operation is in
692 compliance with the given set of modes. "flags" is a space
693 separated list of numerical flags, see "Field 18 - Compliance
697 *** INV_RECP, INV_SGNR
698 The two similar status codes:
700 - INV_RECP <reason> <requested_recipient>
701 - INV_SGNR <reason> <requested_sender>
703 are issued for each unusable recipient/sender. The reasons codes
704 currently in use are:
706 - 0 :: No specific reason given
708 - 2 :: Ambiguous specification
709 - 3 :: Wrong key usage
714 - 8 :: Policy mismatch
715 - 9 :: Not a secret key
716 - 10 :: Key not trusted
717 - 11 :: Missing certificate
718 - 12 :: Missing issuer certificate
720 - 14 :: Syntax error in specification
722 If no specific reason was given a previously emitted status code
723 KEY_CONSIDERED may be used to analyzed the problem.
725 Note that for historical reasons the INV_RECP status is also used
726 for gpgsm's SIGNER command where it relates to signer's of course.
727 Newer GnuPG versions are using INV_SGNR; applications should
728 ignore the INV_RECP during the sender's command processing once
729 they have seen an INV_SGNR. Different codes are used so that they
730 can be distinguish while doing an encrypt+sign operation.
732 *** NO_RECP <reserved>
733 Issued if no recipients are usable.
735 *** NO_SGNR <reserved>
736 Issued if no senders are usable.
738 *** KEY_CONSIDERED <fpr> <flags>
739 Issued to explain the lookup of a key. FPR is the hexified
740 fingerprint of the primary key. The bit values for FLAGS are:
742 - 1 :: The key has not been selected.
743 - 2 :: All subkeys of the key are expired or have been revoked.
745 *** KEYEXPIRED <expire-timestamp>
746 The key has expired. expire-timestamp is the expiration time in
747 seconds since Epoch. This status line is not very useful because
748 it will also be emitted for expired subkeys even if this subkey is
749 not used. To check whether a key used to sign a message has
750 expired, the EXPKEYSIG status line is to be used.
752 Note, that the TIMESTAMP may either be a number of seconds since
753 Epoch or an ISO 8601 string which can be detected by the presence
757 The used key has been revoked by its owner. No arguments yet.
759 *** NO_PUBKEY <long keyid>
760 The public key is not available. Note the arg should in general
761 not be used because it is better to take it from the ERRSIG
762 status line which is printed right before this one.
764 *** NO_SECKEY <long keyid>
765 The secret key is not available
767 *** KEY_CREATED <type> <fingerprint> [<handle>]
768 A key has been created. Values for <type> are:
769 - B :: primary and subkey
772 The fingerprint is one of the primary key for type B and P and the
773 one of the subkey for S. Handle is an arbitrary non-whitespace
774 string used to match key parameters from batch key creation run.
776 *** KEY_NOT_CREATED [<handle>]
777 The key from batch run has not been created due to errors.
780 These are several similar status codes:
783 - TRUST_UNDEFINED <error_token> [<validation_model> [<mbox>]]
784 - TRUST_NEVER <error_token> [<validation_model> [<mbox>]]
785 - TRUST_MARGINAL 0 [<validation_model> [<mbox>]]
786 - TRUST_FULLY 0 [<validation_model> [<mbox>]]
787 - TRUST_ULTIMATE 0 [<validation_model> [<mbox>]]
790 For good signatures one of these status lines are emitted to
791 indicate the validity of the key used to create the signature.
792 <error_token> values other that a literal zero are currently only
795 VALIDATION_MODEL describes the algorithm used to check the
796 validity of the key. The defaults are the standard Web of Trust
797 model for gpg and the standard X.509 model for gpgsm. The
800 - classic :: The classic PGP WoT model.
801 - pgp :: The standard PGP WoT.
802 - external :: The external PGP trust model.
803 - tofu :: The GPG Trust-On-First-Use model.
804 - tofu+pgp :: Ditto but combined with mopdel "pgp".
805 - always :: The Always trust model.
806 - direct :: The Direct Trust model.
807 - shell :: The Standard X.509 model.
808 - chain :: The Chain model.
809 - steed :: The STEED model.
810 - unknown :: An unknown trust model.
812 Note that the term =TRUST_= in the status names is used for
813 historic reasons; we now speak of validity.
815 MBOX is the UTF-8 encoded and percent escaped addr-spec of the
816 User ID used to compute the validity of a signature. If this is
817 not known the validity is computed on the key with no specific
818 User ID. Note that MBOX is always the addr-spec of the User ID;
819 for User IDs without a proper addr-spec a dash is used to
820 distinguish this from the case that no User ID at all is known.
821 The MBOX is either taken from the Signer's User ID signature
822 sub-packet or from the addr-spec passed to gpg using the --sender
823 option. If both are available and they don't match
824 TRUST_UNDEFINED along with an error code is emitted. MBOX is not
827 *** TOFU_USER <fingerprint_in_hex> <mbox>
829 This status identifies the key and the userid for all following
830 Tofu information. The fingerprint is the fingerprint of the
831 primary key and the mbox is in general the addr-spec part of the
832 userid encoded in UTF-8 and percent escaped. The fingerprint is
833 identical for all TOFU_USER lines up to a NEWSIG line.
835 *** TOFU_STATS <MANY_ARGS>
837 Statistics for the current user id.
839 The <MANY_ARGS> are the usual space delimited arguments. Here we
840 have too many of them to fit on one printed line and thus they are
841 given on 3 printed lines:
843 : <summary> <sign-count> <encryption-count>
844 : [<policy> [<tm1> <tm2> <tm3> <tm4>
845 : [<validity> [<sign-days> <encrypt-days>]]]]
847 Values for SUMMARY are:
848 - 0 :: attention, an interaction with the user is required (conflict)
849 - 1 :: key with no verification/encryption history
850 - 2 :: key with little history
851 - 3 :: key with enough history for basic trust
852 - 4 :: key with a lot of history
854 Values for POLICY are:
855 - none :: No Policy set
856 - auto :: Policy is "auto"
857 - good :: Policy is "good"
858 - bad :: Policy is "bad"
859 - ask :: Policy is "ask"
860 - unknown :: Policy is "unknown" (TOFU information does not
861 contribute to the key's validity)
863 TM1 is the time the first message was verified. TM2 is the time
864 the most recent message was verified. TM3 is the time the first
865 message was encrypted. TM4 is the most recent encryption. All may
866 either be seconds since Epoch or an ISO time string
869 VALIDITY is the same as SUMMARY with the exception that VALIDITY
870 doesn't reflect whether the key needs attention. That is it never
871 takes on value 0. Instead, if there is a conflict, VALIDITY still
872 reflects the key's validity (values: 1-4).
874 SUMMARY values use the euclidean distance (m = sqrt(a² + b²)) rather
875 then the sum of the magnitudes (m = a + b) to ensure a balance between
876 verified signatures and encrypted messages.
878 Values are calculated based on the number of days where a key was used
879 for verifying a signature or to encrypt to it.
880 The ranges for the values are:
882 - 1 :: signature_days + encryption_days == 0
883 - 2 :: 1 <= sqrt(signature_days² + encryption_days²) < 8
884 - 3 :: 8 <= sqrt(signature_days² + encryption_days²) < 42
885 - 4 :: sqrt(signature_days² + encryption_days²) >= 42
887 SIGN-COUNT and ENCRYPTION-COUNT are the number of messages that we
888 have seen that have been signed by this key / encryption to this
891 SIGN-DAYS and ENCRYPTION-DAYS are similar, but the number of days
892 (in UTC) on which we have seen messages signed by this key /
893 encrypted to this key.
895 *** TOFU_STATS_SHORT <long_string>
897 Information about the TOFU binding for the signature.
898 Example: "15 signatures verified. 10 messages encrypted"
900 *** TOFU_STATS_LONG <long_string>
902 Information about the TOFU binding for the signature in verbose
903 format. The LONG_STRING is percent escaped.
904 Example: 'Verified 9 messages signed by "Werner Koch
905 (dist sig)" in the past 3 minutes, 40 seconds. The most
906 recent message was verified 4 seconds ago.'
911 - PKA_TRUST_GOOD <addr-spec>
912 - PKA_TRUST_BAD <addr-spec>
914 Depending on the outcome of the PKA check one of the above status
915 codes is emitted in addition to a =TRUST_*= status.
918 *** GET_BOOL, GET_LINE, GET_HIDDEN, GOT_IT
920 These status line are used with --command-fd for interactive
921 control of the process.
923 *** USERID_HINT <long main keyid> <string>
924 Give a hint about the user ID for a certain keyID.
926 *** NEED_PASSPHRASE <long keyid> <long main keyid> <keytype> <keylength>
927 Issued whenever a passphrase is needed. KEYTYPE is the numerical
928 value of the public key algorithm or 0 if this is not applicable,
929 KEYLENGTH is the length of the key or 0 if it is not known (this
930 is currently always the case).
932 *** NEED_PASSPHRASE_SYM <cipher_algo> <s2k_mode> <s2k_hash>
933 Issued whenever a passphrase for symmetric encryption is needed.
935 *** NEED_PASSPHRASE_PIN <card_type> <chvno> [<serialno>]
936 Issued whenever a PIN is requested to unlock a card.
938 *** MISSING_PASSPHRASE
939 No passphrase was supplied. An application which encounters this
940 message may want to stop parsing immediately because the next
941 message will probably be a BAD_PASSPHRASE. However, if the
942 application is a wrapper around the key edit menu functionality it
943 might not make sense to stop parsing but simply ignoring the
944 following BAD_PASSPHRASE.
946 *** BAD_PASSPHRASE <long keyid>
947 The supplied passphrase was wrong or not given. In the latter
948 case you may have seen a MISSING_PASSPHRASE.
951 The supplied passphrase was good and the secret key material
955 *** IMPORT_CHECK <long keyid> <fingerprint> <user ID>
956 This status is emitted in interactive mode right before
957 the "import.okay" prompt.
959 *** IMPORTED <long keyid> <username>
960 The keyid and name of the signature just imported
962 *** IMPORT_OK <reason> [<fingerprint>]
963 The key with the primary key's FINGERPRINT has been imported.
966 - 0 :: Not actually changed
967 - 1 :: Entirely new key.
969 - 4 :: New signatures
971 - 16 :: Contains private key.
973 The flags may be ORed.
975 *** IMPORT_PROBLEM <reason> [<fingerprint>]
976 Issued for each import failure. Reason codes are:
978 - 0 :: No specific reason given.
979 - 1 :: Invalid Certificate.
980 - 2 :: Issuer Certificate missing.
981 - 3 :: Certificate Chain too long.
982 - 4 :: Error storing certificate.
984 *** IMPORT_RES <args>
985 Final statistics on import process (this is one long line). The
986 args are a list of unsigned numbers separated by white space:
991 - always 0 (formerly used for the number of RSA keys)
1000 - <skipped_new_keys>
1004 *** EXPORTED <fingerprint>
1005 The key with <fingerprint> has been exported. The fingerprint is
1006 the fingerprint of the primary key even if the primary key has
1007 been replaced by a stub key during secret key export.
1009 *** EXPORT_RES <args>
1011 Final statistics on export process (this is one long line). The
1012 args are a list of unsigned numbers separated by white space:
1019 ** Smartcard related
1020 *** CARDCTRL <what> [<serialno>]
1021 This is used to control smartcard operations. Defined values for
1024 - 1 :: Request insertion of a card. Serialnumber may be given
1025 to request a specific card. Used by gpg 1.4 w/o
1027 - 2 :: Request removal of a card. Used by gpg 1.4 w/o scdaemon.
1028 - 3 :: Card with serialnumber detected
1029 - 4 :: No card available
1030 - 5 :: No card reader available
1031 - 6 :: No card support available
1032 - 7 :: Card is in termination state
1034 *** SC_OP_FAILURE [<code>]
1035 An operation on a smartcard definitely failed. Currently there is
1036 no indication of the actual error code, but application should be
1037 prepared to later accept more arguments. Defined values for
1040 - 0 :: unspecified error (identically to a missing CODE)
1045 A smart card operation succeeded. This status is only printed for
1046 certain operation and is mostly useful to check whether a PIN
1047 change really worked.
1049 ** Miscellaneous status codes
1051 No data has been found. Codes for WHAT are:
1053 - 1 :: No armored data.
1054 - 2 :: Expected a packet but did not found one.
1055 - 3 :: Invalid packet found, this may indicate a non OpenPGP
1057 - 4 :: Signature expected but not found
1059 You may see more than one of these status lines.
1061 *** UNEXPECTED <what>
1062 Unexpected data has been encountered. Codes for WHAT are:
1063 - 0 :: Not further specified
1064 - 1 :: Corrupted message structure
1066 *** TRUNCATED <maxno>
1067 The output was truncated to MAXNO items. This status code is
1068 issued for certain external requests.
1070 *** ERROR <error location> <error code> [<more>]
1071 This is a generic error status message, it might be followed by
1072 error location specific data. <error code> and <error_location>
1073 should not contain spaces. The error code is a either a string
1074 commencing with a letter or such a string prefixed with a
1075 numerical error code and an underscore; e.g.: "151011327_EOF".
1077 Some of the error locations are:
1079 - decryption.early_plaintext :: The OpenPGP message contains more
1081 - genkey :: Problem generating a key. The error code further
1082 describes the problem.
1083 - get_passphrase :: Problem getting the passphrase from the
1085 - keyedit.passwd :: Changing the password failed.
1086 - nomdc_with_legacy_cipher :: The message was not MDC protected.
1087 Use the command line to lern about a workaround.
1088 - random-compliance :: The random number generator or the used
1089 version of Libgcrypt do not fulfill the requirements of the
1090 current compliance setting. The error code is often
1092 - set_expire :: Changing the expiration time failed.
1094 *** WARNING <location> <error code> [<text>]
1095 This is a generic warning status message, it might be followed by
1096 error location specific data. <location> and <error code> may not
1097 contain spaces. The <location> may be used to indicate a class of
1098 warnings. The error code is a either a string commencing with a
1099 letter or such a string prefixed with a numerical error code and
1100 an underscore; e.g.: "151011327_EOF".
1101 *** NOTE <location> <error code> [<text>]
1102 This is a generic info status message the same syntax as for
1103 WARNING messages is used.
1104 *** SUCCESS [<location>]
1105 Positive confirmation that an operation succeeded. It is used
1106 similar to ISO-C's EXIT_SUCCESS. <location> is optional but if
1107 given should not contain spaces. Used only with a few commands.
1109 *** FAILURE <location> <error_code>
1110 This is the counterpart to SUCCESS and used to indicate a program
1111 failure. It is used similar to ISO-C's EXIT_FAILURE but allows
1112 conveying more information, in particular a gpg-error error code.
1113 That numerical error code may optionally have a suffix made of an
1114 underscore and a string with an error symbol like "151011327_EOF".
1115 A dash may be used instead of <location>.
1118 The ASCII armor is corrupted. No arguments yet.
1120 *** DELETE_PROBLEM <reason_code>
1121 Deleting a key failed. Reason codes are:
1123 - 2 :: Must delete secret key first
1124 - 3 :: Ambiguous specification
1125 - 4 :: Key is stored on a smartcard.
1127 *** PROGRESS <what> <char> <cur> <total> [<units>]
1128 Used by the primegen and public key functions to indicate
1129 progress. <char> is the character displayed with no --status-fd
1130 enabled, with the linefeed replaced by an 'X'. <cur> is the
1131 current amount done and <total> is amount to be done; a <total> of
1132 0 indicates that the total amount is not known. Both are
1133 non-negative integers. The condition
1134 : TOTAL && CUR == TOTAL
1135 may be used to detect the end of an operation.
1137 Well known values for <what> are:
1139 - pk_dsa :: DSA key generation
1140 - pk_elg :: Elgamal key generation
1141 - primegen :: Prime generation
1142 - need_entropy :: Waiting for new entropy in the RNG
1143 - tick :: Generic tick without any special meaning - useful
1144 for letting clients know that the server is still
1146 - starting_agent :: A gpg-agent was started because it is not
1147 running as a daemon.
1148 - learncard :: Send by the agent and gpgsm while learing
1149 the data of a smartcard.
1150 - card_busy :: A smartcard is still working
1151 - scd_locked :: Waiting for other clients to unlock the scdaemon
1153 When <what> refers to a file path, it may be truncated.
1155 <units> is sometimes used to describe the units for <current> and
1156 <total>. For example "B", "KiB", or "MiB".
1158 *** BACKUP_KEY_CREATED <fingerprint> <fname>
1159 A backup of a key identified by <fingerprint> has been writte to
1160 the file <fname>; <fname> is percent-escaped.
1162 *** MOUNTPOINT <name>
1163 <name> is a percent-plus escaped filename describing the
1164 mountpoint for the current operation (e.g. used by "g13 --mount").
1165 This may either be the specified mountpoint or one randomly
1168 *** PINENTRY_LAUNCHED <pid>[:<extra>]
1169 This status line is emitted by gpg to notify a client that a
1170 Pinentry has been launched. <pid> is the PID of the Pinentry. It
1171 may be used to display a hint to the user but can't be used to
1172 synchronize with Pinentry. Note that there is also an Assuan
1173 inquiry line with the same name used internally or, if enabled,
1174 send to the client instead of this status line. Such an inquiry
1175 may be used to sync with Pinentry
1177 ** Obsolete status codes
1179 Removed on 2011-02-04. This is deprecated in favor of KEYEXPIRED.
1181 Obsolete. This status message used to be emitted for requests to
1182 use the IDEA or RSA algorithms. It has been dropped from GnuPG
1183 2.1 after the respective patents expired.
1184 *** SHM_INFO, SHM_GET, SHM_GET_BOOL, SHM_GET_HIDDEN
1185 These were used for the ancient shared memory based co-processing.
1186 *** BEGIN_STREAM, END_STREAM
1187 Used to issued by the experimental pipemode.
1189 This is not anymore needed. Checking the DECRYPTION_OKAY status is
1192 This is not anymore needed.
1194 ** Inter-component codes
1195 Status codes are also used between the components of the GnuPG
1196 system via the Assuan S lines. Some of them are documented here:
1198 *** PUBKEY_INFO <n> <ubid> <flags> <uidno> <pkno>
1199 The type of the public key in the following D-lines or
1200 communicated via a pipe. <n> is the value of =enum pubkey_types=
1201 and <ubid> the Unique Blob ID (UBID) which is the fingerprint of
1202 the primary key truncated to 20 octets and formatted in hex. Note
1203 that the keyboxd SEARCH command can be used to lookup the public
1204 key using the <ubid> prefixed with a caret (^).
1206 <flags> is a string extra information about the blob. The first
1207 byte is either '-' for standard key or 'e' for an ephemeral key.
1208 The second byte is either '-' or 'r' for a known revoked key.
1210 <uidno> and <pkno> are the ordinal numbers for the the user id or
1211 public key which matches the search criteria. A value of 0 means
1214 *** KEYPAIRINFO <grip> <keyref> [<usage>] [<keytime>] [<algostr>]
1216 This status is emitted by scdaemon and gpg-agent to convey brief
1217 information about keypairs stored on tokens. <grip> is the
1218 hexified keygrip of the key or, if no key is stored, an "X".
1219 <keyref> is the ID of a card's key; for example "OPENPGP.2" for
1220 the second key slot of an OpenPGP card. <usage> is optional and
1221 returns technically possible key usages, this is a string of
1222 single letters describing the usage ('c' for certify, 'e' for
1223 encryption, 's' for signing, 'a' for authentication). A '-' can be
1224 used to tell that usage flags are not conveyed. <keytime> is used
1225 by OpenPGP cards for the stored key creation time. A '-' means no
1226 info available. The format is the usual ISO string or a number
1227 with the seconds since Epoch. <algostr> is the algorithm or curve
1228 this key uses (e.g. "rsa2048") or a "-" if not known.
1230 *** CERTINFO <certtype> <certref> [<label>]
1232 This status is mettited for X.509 certifcates.
1233 CERTTYPE is a number indicating the type of the certificate:
1235 100 := Regular X.509 cert
1236 101 := Trusted X.509 cert
1237 102 := Useful X.509 cert
1238 110 := Root CA cert in a special format (e.g. DINSIG)
1239 111 := Root CA cert as standard X509 cert
1241 CERTREF identifies the certificate uniquely on the card and may be
1242 used to match it with a key's KEYREF. LABEL is an optional human
1243 readable decription of the certificate; it won't have any space in
1244 it and is percent encoded.
1246 *** MANUFACTURER <n> [<string>]
1248 This status returns the Manufactorer ID as the unsigned number N.
1249 For OpenPGP this is well defined; for other cards this is 0. The
1250 name of the manufacturer is also given as <string>; spaces are not
1251 escaped. For PKCS#15 cards <string> is TokenInfo.manufactorerID.
1253 *** KEY-STATUS <keyref> <status>
1254 This is the response from scdaemon on GETATTR KEY-STATUS for
1255 OpenPGP cards. <keyref> is the usual keyref (e.g. OPENPGP.1 or
1256 OPENPGP.129) and <status> is an integer describing the status of
1257 the key: 0 = key is not present, 1 = key generated on card, 2 =
1258 key imported. See section 4.4.3.8 of the OpenPGP Smart Card
1261 *** KEY-ATTR-INFO <keyref> <string>
1262 This is the response from scdaemon on GETATTR KEY-ATTR-INFO for
1263 OpenPGP cards. <keyref> is the usual keyref (e.g. OPENPGP.1 or
1264 OPENPGP.129) and <string> is the algoritm or curve name, which
1265 is available for the key.
1267 *** KEY-TIME <n> <timestamp>
1268 This is a response from scdaemon on GETATTR KEY-TIME. A keyref N
1269 of 1 gives the timestamp for the standard OpenPGP signing key, 2
1270 for the encryption key, and 3 for an authentication key. Note
1271 that a KEYPAIRINFO status lines carries the same information and
1272 should be preferred.
1274 *** KEY-LABEL <keyref> <label>
1275 This returns the human readbable label for the keys given by
1276 KEYREF. LABEL won't have any space in it and is percent encoded.
1277 This info shall only be used for dispaly purposes.
1279 * Format of the --attribute-fd output
1281 When --attribute-fd is set, during key listings (--list-keys,
1282 --list-secret-keys) GnuPG dumps each attribute packet to the file
1283 descriptor specified. --attribute-fd is intended for use with
1284 --status-fd as part of the required information is carried on the
1285 ATTRIBUTE status tag (see above).
1287 The contents of the attribute data is specified by RFC 4880. For
1288 convenience, here is the Photo ID format, as it is currently the
1289 only attribute defined:
1291 - Byte 0-1 :: The length of the image header. Due to a historical
1292 accident (i.e. oops!) back in the NAI PGP days, this
1293 is a little-endian number. Currently 16 (0x10 0x00).
1295 - Byte 2 :: The image header version. Currently 0x01.
1297 - Byte 3 :: Encoding format. 0x01 == JPEG.
1299 - Byte 4-15 :: Reserved, and currently unused.
1301 All other data after this header is raw image (JPEG) data.
1304 * Layout of the TrustDB
1306 The TrustDB is built from fixed length records, where the first byte
1307 describes the record type. All numeric values are stored in network
1308 byte order. The length of each record is 40 bytes. The first
1309 record of the DB is always of type 1 and this is the only record of
1312 The record types: directory(2), key(3), uid(4), pref(5), sigrec(6),
1313 and shadow directory(8) are not anymore used by version 2 of the
1318 Unused record or deleted, can be reused for any purpose. Such
1319 records should in general not exist because deleted records are of
1320 type 254 and kept in a linked list.
1322 ** Version info (RECTYPE_VER, 1)
1324 Version information for this TrustDB. This is always the first
1325 record of the DB and the only one of this type.
1327 - 1 u8 :: Record type (value: 1).
1328 - 3 byte :: Magic value ("gpg")
1329 - 1 u8 :: TrustDB version (value: 2).
1330 - 1 u8 :: =marginals=. How many marginal trusted keys are required.
1331 - 1 u8 :: =completes=. How many completely trusted keys are
1333 - 1 u8 :: =max_cert_depth=. How deep is the WoT evaluated. Along
1334 with =marginals= and =completes=, this value is used to
1335 check whether the cached validity value from a [FIXME
1336 dir] record can be used.
1337 - 1 u8 :: =trust_model=
1338 - 1 u8 :: =min_cert_level=
1339 - 2 byte :: Not used
1340 - 1 u32 :: =created=. Timestamp of trustdb creation.
1341 - 1 u32 :: =nextcheck=. Timestamp of last modification which may
1342 affect the validity of keys in the trustdb. This value
1343 is checked against the validity timestamp in the dir
1345 - 1 u32 :: =reserved=. Not used.
1346 - 1 u32 :: =reserved2=. Not used.
1347 - 1 u32 :: =firstfree=. Number of the record with the head record
1348 of the RECTYPE_FREE linked list.
1349 - 1 u32 :: =reserved3=. Not used.
1350 - 1 u32 :: =trusthashtbl=. Record number of the trusthashtable.
1353 ** Hash table (RECTYPE_HTBL, 10)
1355 Due to the fact that we use fingerprints to lookup keys, we can
1356 implement quick access by some simple hash methods, and avoid the
1357 overhead of gdbm. A property of fingerprints is that they can be
1358 used directly as hash values. What we use is a dynamic multilevel
1359 architecture, which combines hash tables, record lists, and linked
1362 This record is a hash table of 256 entries with the property that
1363 all these records are stored consecutively to make one big
1364 table. The hash value is simple the 1st, 2nd, ... byte of the
1365 fingerprint (depending on the indirection level).
1367 - 1 u8 :: Record type (value: 10).
1369 - n u32 :: =recnum=. A table with the hash table items fitting into
1370 this record. =n= depends on the record length:
1371 $n=(reclen-2)/4$ which yields 9 for oure current record
1374 The total number of hash table records to form the table is:
1375 $m=(256+n-1)/n$. This is 29 for our record length of 40.
1377 To look up a key we use the first byte of the fingerprint to get
1378 the recnum from this hash table and then look up the addressed
1381 - If that record is another hash table, we use 2nd byte to index
1382 that hash table and so on;
1383 - if that record is a hash list, we walk all entries until we find
1385 - if that record is a key record, we compare the fingerprint to
1386 decide whether it is the requested key;
1389 ** Hash list (RECTYPE_HLST, 11)
1391 See hash table above on how it is used. It may also be used for
1394 - 1 u8 :: Record type (value: 11).
1396 - 1 u32 :: =next=. Record number of the next hash list record or 0
1398 - n u32 :: =rnum=. Array with record numbers to values. With
1399 $n=(reclen-5)/5$ and our record length of 40, n is 7.
1401 ** Trust record (RECTYPE_TRUST, 12)
1403 - 1 u8 :: Record type (value: 12).
1405 - 20 byte :: =fingerprint=.
1406 - 1 u8 :: =ownertrust=.
1408 - 1 u8 :: =min_ownertrust=.
1409 - 1 byte :: Not used.
1410 - 1 u32 :: =validlist=.
1411 - 10 byte :: Not used.
1413 ** Validity record (RECTYPE_VALID, 13)
1415 - 1 u8 :: Record type (value: 13).
1417 - 20 byte :: =namehash=.
1418 - 1 u8 :: =validity=
1420 - 1 u8 :: =full_count=.
1421 - 1 u8 :: =marginal_count=.
1422 - 11 byte :: Not used.
1424 ** Free record (RECTYPE_FREE, 254)
1426 All these records form a linked list of unused records in the TrustDB.
1428 - 1 u8 :: Record type (value: 254)
1430 - 1 u32 :: =next=. Record number of the next rcord of this type.
1431 The record number to the head of this linked list is
1432 stored in the version info record.
1435 * Database scheme for the TOFU info
1439 -- The VERSION table holds the version of our TOFU data structures.
1441 CREATE TABLE version (
1442 version integer -- As of now this is always 1
1446 -- The BINDINGS table associates mail addresses with keys.
1448 CREATE TABLE bindings (
1449 oid integer primary key autoincrement,
1450 fingerprint text, -- The key's fingerprint in hex
1451 email text, -- The normalized mail address destilled from user_id
1452 user_id text, -- The unmodified user id
1453 time integer, -- The time this binding was first observed.
1454 policy boolean check
1455 (policy in (1, 2, 3, 4, 5)), -- The trust policy with the values:
1461 conflict string, -- NULL or a hex formatted fingerprint.
1462 unique (fingerprint, email)
1465 CREATE INDEX bindings_fingerprint_email on bindings (fingerprint, email);
1466 CREATE INDEX bindings_email on bindings (email);
1469 -- The SIGNATURES table records all data signatures we verified
1471 CREATE TABLE signatures (
1472 binding integer not null, -- Link to bindings table,
1473 -- references bindings.oid.
1474 sig_digest text, -- The digest of the signed message.
1475 origin text, -- String describing who initially fed
1476 -- the signature to gpg (e.g. "email:claws").
1477 sig_time integer, -- Timestamp from the signature.
1478 time integer, -- Time this record was created.
1479 primary key (binding, sig_digest, origin)
1484 * GNU extensions to the S2K algorithm
1486 1 octet - S2K Usage: either 254 or 255.
1487 1 octet - S2K Cipher Algo: 0
1488 1 octet - S2K Specifier: 101
1490 1 octet - GNU S2K Extension Number.
1492 If such a GNU extension is used neither an IV nor any kind of
1493 checksum is used. The defined GNU S2K Extension Numbers are:
1495 - 1 :: Do not store the secret part at all. No specific data
1498 - 2 :: A stub to access smartcards. This data follows:
1499 - One octet with the length of the following serial number.
1500 - The serial number. Regardless of what the length octet
1501 indicates no more than 16 octets are stored.
1503 Note that gpg stores the GNU S2K Extension Number internally as an
1504 S2K Specifier with an offset of 1000.
1507 * Format of the OpenPGP TRUST packet
1509 According to RFC4880 (5.10), the trust packet (aka ring trust) is
1510 only used within keyrings and contains data that records the user's
1511 specifications of which key holds trusted introducers. The RFC also
1512 states that the format of this packet is implementation defined and
1513 SHOULD NOT be emitted to output streams or should be ignored on
1514 import. GnuPG uses this packet in several additional ways:
1516 - 1 octet :: Trust-Value (only used by Subtype SIG)
1517 - 1 octet :: Signature-Cache (only used by Subtype SIG; value must
1519 - 3 octets :: Fixed value: "gpg"
1520 - 1 octet :: Subtype
1521 - 0 :: Signature cache (SIG)
1522 - 1 :: Key source on the primary key (KEY)
1523 - 2 :: Key source on a user id (UID)
1524 - 1 octet :: Key Source; i.e. the origin of the key:
1525 - 0 :: Unknown source.
1526 - 1 :: Public keyserver.
1527 - 2 :: Preferred keyserver.
1528 - 3 :: OpenPGP DANE.
1529 - 4 :: Web Key Directory.
1530 - 5 :: Import from a trusted URL.
1531 - 6 :: Import from a trusted file.
1532 - 7 :: Self generated.
1533 - 4 octets :: Time of last update. This is a four-octet scalar
1534 with the seconds since Epoch.
1535 - 1 octet :: Scalar with the length of the following field.
1536 - N octets :: String with the URL of the source. This may be a
1539 If the packets contains only two octets a Subtype of 0 is assumed;
1540 this is the only format recognized by GnuPG versions < 2.1.18.
1541 Trust-Value and Signature-Cache must be zero for all subtypes other
1545 * Keyserver helper message format
1547 *This information is obsolete*
1548 (Keyserver helpers have been replaced by dirmngr)
1550 The keyserver may be contacted by a Unix Domain socket or via TCP.
1552 The format of a request is:
1555 "Content-length:" digits
1559 Where command-tag is
1568 The format of a response is:
1571 "GNUPG/1.0" status-code status-text
1572 "Content-length:" digits
1575 followed by <digits> bytes of data
1579 - 1xx :: Informational - Request received, continuing process
1581 - 2xx :: Success - The action was successfully received, understood,
1584 - 4xx :: Client Error - The request contains bad syntax or cannot be
1587 - 5xx :: Server Error - The server failed to fulfill an apparently
1591 * Object identifiers
1593 OIDs below the GnuPG arc:
1596 1.3.6.1.4.1.11591.2 GnuPG
1597 1.3.6.1.4.1.11591.2.1 notation
1598 1.3.6.1.4.1.11591.2.1.1 pkaAddress
1599 1.3.6.1.4.1.11591.2.2 X.509 extensions
1600 1.3.6.1.4.1.11591.2.2.1 standaloneCertificate
1601 1.3.6.1.4.1.11591.2.2.2 wellKnownPrivateKey
1602 1.3.6.1.4.1.11591.2.3 CMS contentType
1603 1.3.6.1.4.1.11591.2.3.1 OpenPGP keyblock (as octet string)
1604 1.3.6.1.4.1.11591.2.4 LDAP stuff
1605 1.3.6.1.4.1.11591.2.4.1 attributes
1606 1.3.6.1.4.1.11591.2.4.1.1 gpgFingerprint attribute
1607 1.3.6.1.4.1.11591.2.4.1.2 gpgSubFingerprint attribute
1608 1.3.6.1.4.1.11591.2.4.1.3 gpgMailbox attribute
1609 1.3.6.1.4.1.11591.2.4.1.4 gpgSubCertID attribute
1610 1.3.6.1.4.1.11591.2.5 LDAP URL extensions
1611 1.3.6.1.4.1.11591.2.5.1 gpgNtds=1 (auth. with current AD user)
1612 1.3.6.1.4.1.11591.2.6 GnuPG extended key usage
1613 1.3.6.1.4.1.11591.2.6.1 use for certification key
1614 1.3.6.1.4.1.11591.2.6.2 use for signing key
1615 1.3.6.1.4.1.11591.2.6.3 use for encryption key
1616 1.3.6.1.4.1.11591.2.6.4 use for authentication key
1617 1.3.6.1.4.1.11591.2.12242973 invalid encoded OID
1624 This tables gives the flag values for the --debug option along with
1625 the alternative names used by the components.
1627 | | gpg | gpgsm | agent | scd | dirmngr | g13 | wks |
1628 |-------+---------+---------+---------+---------+---------+---------+---------|
1629 | 1 | packet | x509 | | | x509 | mount | mime |
1630 | 2 | mpi | mpi | mpi | mpi | | | parser |
1631 | 4 | crypto | crypto | crypto | crypto | crypto | crypto | crypto |
1632 | 8 | filter | | | | | | |
1633 | 16 | iobuf | | | | dns | | |
1634 | 32 | memory | memory | memory | memory | memory | memory | memory |
1635 | 64 | cache | cache | cache | cache | cache | | |
1636 | 128 | memstat | memstat | memstat | memstat | memstat | memstat | memstat |
1637 | 256 | trust | | | | | | |
1638 | 512 | hashing | hashing | hashing | hashing | hashing | | |
1639 | 1024 | ipc | ipc | ipc | ipc | ipc | ipc | ipc |
1640 | 2048 | | | | cardio | network | | |
1641 | 4096 | clock | | | reader | | | |
1642 | 8192 | lookup | | | | lookup | | |
1643 | 16384 | extprog | | | | | | extprog |
1645 Description of some debug flags:
1647 - cardio :: Used by scdaemon to trace the APDUs exchange with the
1649 - clock :: Show execution times of certain functions.
1650 - crypto :: Trace crypto operations.
1651 - hashing :: Create files with the hashed data.
1652 - ipc :: Trace the Assuan commands.
1653 - mpi :: Show the values of the MPIs.
1654 - reader :: Used by scdaemon to trace card reader related code. For
1655 example: Open and close reader.
1659 * Miscellaneous notes
1660 ** List of useful RFCs
1661 - RFC-3447 :: PKCS #1: RSA Cryptography Specifications Version 2.1
1662 - RFC-4880 :: OpenPGP
1663 - RFC-5280 :: X.509 PKI Certificate and CRL Profile
1664 - RFC-6818 :: Updates to the X.509 PKI Certificate and CRL Profile
1665 - RFC-8398 :: Internationalized Email Addresses in X.509 Certificates.
1666 - RFC-8399 :: Internationalization Updates to RFC 5280
1667 - RFC-5480 :: ECC Subject Public Key Information
1668 - RFC-8813 :: Clarifications for ECC Subject Public Key
1669 - RFC-5915 :: Elliptic Curve Private Key Structure
1670 - RFC-5958 :: Asymmetric Key Packages
1671 - RFC-7292 :: PKCS #12: Personal Information Exchange Syntax v1.1
1672 - RFC-8351 :: The PKCS #8 EncryptedPrivateKeyInfo Media Type
1675 For packet version 3 we calculate the keyids this way:
1676 - RSA :: Low 64 bits of n
1677 - ELGAMAL :: Build a v3 pubkey packet (with CTB 0x99) and
1678 calculate a RMD160 hash value from it. This is used
1679 as the fingerprint and the low 64 bits are the keyid.
1681 ** Simplified revocation certificates
1682 Revocation certificates consist only of the signature packet;
1683 "--import" knows how to handle this. The rationale behind it is to
1686 ** Documentation on HKP (the http keyserver protocol):
1688 A minimalistic HTTP server on port 11371 recognizes a GET for
1689 /pks/lookup. The standard http URL encoded query parameters are
1690 this (always key=value):
1692 - op=index (like pgp -kv), op=vindex (like pgp -kvv) and op=get (like
1695 - search=<stringlist>. This is a list of words that must occur in the key.
1696 The words are delimited with space, points, @ and so on. The delimiters
1697 are not searched for and the order of the words doesn't matter (but see
1700 - exact=on. This switch tells the hkp server to only report exact matching
1701 keys back. In this case the order and the "delimiters" are important.
1703 - fingerprint=on. Also reports the fingerprints when used with 'index' or
1706 The keyserver also recognizes http-POSTs to /pks/add. Use this to upload
1710 A better way to do this would be a request like:
1712 /pks/lookup/<gnupg_formatierte_user_id>?op=<operation>
1714 This can be implemented using Hurd's translator mechanism.
1715 However, I think the whole keyserver stuff has to be re-thought;
1716 I have some ideas and probably create a white paper.
1717 ** Algorithm names for the "keygen.algo" prompt
1719 When using a --command-fd controlled key generation or "addkey"
1720 there is way to know the number to enter on the "keygen.algo"
1721 prompt. The displayed numbers are for human reception and may
1722 change with releases. To provide a stable way to enter a desired
1723 algorithm choice the prompt also accepts predefined names for the
1724 algorithms, which will not change.
1726 | Name | No | Description |
1727 |---------+----+---------------------------------|
1728 | rsa+rsa | 1 | RSA and RSA (default) |
1729 | dsa+elg | 2 | DSA and Elgamal |
1730 | dsa | 3 | DSA (sign only) |
1731 | rsa/s | 4 | RSA (sign only) |
1732 | elg | 5 | Elgamal (encrypt only) |
1733 | rsa/e | 6 | RSA (encrypt only) |
1734 | dsa/* | 7 | DSA (set your own capabilities) |
1735 | rsa/* | 8 | RSA (set your own capabilities) |
1736 | ecc+ecc | 9 | ECC and ECC |
1737 | ecc/s | 10 | ECC (sign only) |
1738 | ecc/* | 11 | ECC (set your own capabilities) |
1739 | ecc/e | 12 | ECC (encrypt only) |
1740 | keygrip | 13 | Existing key |
1741 | cardkey | 14 | Existing key from card |
1743 If one of the "foo/*" names are used a "keygen.flags" prompt needs
1744 to be answered as well. Instead of toggling the predefined flags,
1745 it is also possible to set them direct: Use a "=" character
1746 directly followed by a combination of "a" (for authentication), "s"
1747 (for signing), or "c" (for certification).