2 Format of colon listings
3 ========================
6 $ gpg --fixed-list-mode --with-colons --list-keys \
7 --with-fingerprint --with-fingerprint wk@gnupg.org
9 pub:f:1024:17:6C7EE1B8621CC013:899817715:1055898235::m:::scESC:
10 fpr:::::::::ECAF7590EB3443B5C7CF3ACB6C7EE1B8621CC013:
11 uid:f::::::::Werner Koch <wk@g10code.com>:
12 uid:f::::::::Werner Koch <wk@gnupg.org>:
13 sub:f:1536:16:06AD222CADF6A6E1:919537416:1036177416:::::e:
14 fpr:::::::::CF8BCC4B18DE08FCD8A1615906AD222CADF6A6E1:
15 sub:r:1536:20:5CE086B5B5A18FF4:899817788:1025961788:::::esc:
16 fpr:::::::::AB059359A3B81F410FCFF97F5CE086B5B5A18FF4:
18 The double --with-fingerprint prints the fingerprint for the subkeys
19 too. --fixed-list-mode is the modern listing way printing dates in
20 seconds since Epoch and does not merge the first userID with the pub
21 record; gpg2 does this by default and the option is a dummy.
24 1. Field: Type of record
26 crt = X.509 certificate
27 crs = X.509 certificate and private key available
28 sub = subkey (secondary key)
30 ssb = secret subkey (secondary key)
31 uid = user id (only field 10 is used).
32 uat = user attribute (same as user id except for field 10).
34 rev = revocation signature
35 fpr = fingerprint: (fingerprint is in field 10)
36 pkd = public key data (special field format, see below)
37 grp = reserved for gpgsm
39 tru = trust database information
40 spk = signature subpacket
42 2. Field: A letter describing the calculated validity. This is a single
43 letter, but be prepared that additional information may follow
44 in some future versions. (not used for secret keys)
45 o = Unknown (this key is new to the system)
46 i = The key is invalid (e.g. due to a missing self-signature)
47 d = The key has been disabled
48 (deprecated - use the 'D' in field 12 instead)
49 r = The key has been revoked
50 e = The key has expired
51 - = Unknown validity (i.e. no value assigned)
52 q = Undefined validity
53 '-' and 'q' may safely be treated as the same
54 value for most purposes
56 m = The key is marginal valid.
57 f = The key is fully valid
58 u = The key is ultimately valid. This often means
59 that the secret key is available, but any key may
60 be marked as ultimately valid.
62 If the validity information is given for a UID or UAT
63 record, it describes the validity calculated based on this
64 user ID. If given for a key record it describes the best
65 validity taken from the best rated user ID.
67 For X.509 certificates a 'u' is used for a trusted root
68 certificate (i.e. for the trust anchor) and an 'f' for all
69 other valid certificates.
71 3. Field: length of key in bits.
73 4. Field: Algorithm: 1 = RSA
74 16 = Elgamal (encrypt only)
75 17 = DSA (sometimes called DH, sign only)
76 20 = Elgamal (sign and encrypt - don't use them!)
77 (for other id's see include/cipher.h)
81 6. Field: Creation Date (in UTC). For UID and UAT records, this is
82 the self-signature date. Note that the date is usally
83 printed in seconds since epoch, however, we are migrating
84 to an ISO 8601 format (e.g. "19660205T091500"). This is
85 currently only relevant for X.509. A simple way to detect
86 the new format is to scan for the 'T'.
88 7. Field: Key or user ID/user attribute expiration date or empty if none.
90 8. Field: Used for serial number in crt records (used to be the Local-ID).
91 For UID and UAT records, this is a hash of the user ID contents
92 used to represent that exact user ID. For trust signatures,
93 this is the trust depth seperated by the trust value by a
96 9. Field: Ownertrust (primary public keys only)
97 This is a single letter, but be prepared that additional
98 information may follow in some future versions. For trust
99 signatures with a regular expression, this is the regular
100 expression value, quoted as in field 10.
102 10. Field: User-ID. The value is quoted like a C string to avoid
103 control characters (the colon is quoted "\x3a").
104 For a "pub" record this field is not used on --fixed-list-mode.
105 A UAT record puts the attribute subpacket count here, a
106 space, and then the total attribute subpacket size.
107 In gpgsm the issuer name comes here
108 An FPR record stores the fingerprint here.
109 The fingerprint of an revocation key is stored here.
111 11. Field: Signature class as per RFC-4880. This is a 2 digit
112 hexnumber followed by either the letter 'x' for an
113 exportable signature or the letter 'l' for a local-only
114 signature. The class byte of an revocation key is also
115 given here, 'x' and 'l' is used the same way. IT is not
118 12. Field: Key capabilities:
123 A key may have any combination of them in any order. In
124 addition to these letters, the primary key has uppercase
125 versions of the letters to denote the _usable_
126 capabilities of the entire key, and a potential letter 'D'
127 to indicate a disabled key.
129 13. Field: Used in FPR records for S/MIME keys to store the
130 fingerprint of the issuer certificate. This is useful to
131 build the certificate path based on certificates stored in
132 the local keyDB; it is only filled if the issuer
133 certificate is available. The root has been reached if
134 this is the same string as the fingerprint. The advantage
135 of using this value is that it is guaranteed to have been
136 been build by the same lookup algorithm as gpgsm uses.
137 For "uid" records this lists the preferences in the same
138 way the gpg's --edit-key menu does.
139 For "sig" records, this is the fingerprint of the key that
140 issued the signature. Note that this is only filled in if
141 the signature verified correctly. Note also that for
142 various technical reasons, this fingerprint is only
143 available if --no-sig-cache is used.
145 14. Field Flag field used in the --edit menu output:
147 15. Field Used in sec/sbb to print the serial number of a token
148 (internal protect mode 1002) or a '#' if that key is a
149 simple stub (internal protect mode 1001)
151 All dates are displayed in the format yyyy-mm-dd unless you use the
152 option --fixed-list-mode in which case they are displayed as seconds
153 since Epoch. More fields may be added later, so parsers should be
154 prepared for this. When parsing a number the parser should stop at the
155 first non-number character so that additional information can later be
158 If field 1 has the tag "pkd", a listing looks like this:
159 pkd:0:1024:B665B1435F4C2 .... FF26ABB:
161 ! !------ for information number of bits in the value
162 !--------- index (eg. DSA goes from 0 to 3: p,q,g,y)
165 Example for a "tru" trust base record:
167 tru:o:0:1166697654:1:3:1:5
171 2: Reason for staleness of trust. If this field is empty, then the
172 trustdb is not stale. This field may have multiple flags in it:
175 t: Trustdb was built with a different trust model than the one we
179 0: Classic trust model, as used in PGP 2.x.
180 1: PGP trust model, as used in PGP 6 and later. This is the same
181 as the classic trust model, except for the addition of trust
184 GnuPG before version 1.4 used the classic trust model by default.
185 GnuPG 1.4 and later uses the PGP trust model by default.
187 4: Date trustdb was created in seconds since 1970-01-01.
188 5: Date trustdb will expire in seconds since 1970-01-01.
189 6: Number of marginally trusted users to introduce a new key signer
190 (gpg's option --marginals-needed)
191 7: Number of completely trusted users to introduce a new key signer.
192 (gpg's option --completes-needed)
193 8: Maximum depth of a certification chain.
194 *gpg's option --max-cert-depth)
196 The "spk" signature subpacket records have the fields:
198 2: Subpacket number as per RFC-4880 and later.
199 3: Flags in hex. Currently the only two bits assigned are 1, to
200 indicate that the subpacket came from the hashed part of the
201 signature, and 2, to indicate the subpacket was marked critical.
202 4: Length of the subpacket. Note that this is the length of the
203 subpacket, and not the length of field 5 below. Due to the need
204 for %-encoding, the length of field 5 may be up to 3x this value.
205 5: The subpacket data. Printable ASCII is shown as ASCII, but other
206 values are rendered as %XX where XX is the hex value for the byte.
209 Format of the "--status-fd" output
210 ==================================
211 Every line is prefixed with "[GNUPG:] ", followed by a keyword with
212 the type of the status line and a some arguments depending on the
213 type (maybe none); an application should always be prepared to see
214 more arguments in future versions.
218 May be issued right before a signature verification starts. This
219 is useful to define a context for parsing ERROR status
220 messages. No arguments are currently defined.
222 GOODSIG <long_keyid_or_fpr> <username>
223 The signature with the keyid is good. For each signature only
224 one of the three codes GOODSIG, BADSIG or ERRSIG will be
225 emitted and they may be used as a marker for a new signature.
226 The username is the primary one encoded in UTF-8 and %XX
227 escaped. The fingerprint may be used instead of the long keyid
228 if it is available. This is the case with CMS and might
229 eventually also be available for OpenPGP.
231 EXPSIG <long_keyid_or_fpr> <username>
232 The signature with the keyid is good, but the signature is
233 expired. The username is the primary one encoded in UTF-8 and
234 %XX escaped. The fingerprint may be used instead of the long
235 keyid if it is available. This is the case with CMS and might
236 eventually also be available for OpenPGP.
238 EXPKEYSIG <long_keyid_or_fpr> <username>
239 The signature with the keyid is good, but the signature was
240 made by an expired key. The username is the primary one
241 encoded in UTF-8 and %XX escaped. The fingerprint may be used
242 instead of the long keyid if it is available. This is the
243 case with CMS and might eventually also be available for
246 REVKEYSIG <long_keyid_or_fpr> <username>
247 The signature with the keyid is good, but the signature was
248 made by a revoked key. The username is the primary one encoded
249 in UTF-8 and %XX escaped. The fingerprint may be used instead
250 of the long keyid if it is available. This is the case with
251 CMS and might eventually also be available for OpenPGP.
253 BADSIG <long_keyid_or_fpr> <username>
254 The signature with the keyid has not been verified okay. The
255 username is the primary one encoded in UTF-8 and %XX
256 escaped. The fingerprint may be used instead of the long keyid
257 if it is available. This is the case with CMS and might
258 eventually also be available for OpenPGP.
260 ERRSIG <long_keyid_or_fpr> <pubkey_algo> <hash_algo> \
261 <sig_class> <timestamp> <rc>
262 It was not possible to check the signature. This may be
263 caused by a missing public key or an unsupported algorithm. A
264 RC of 4 indicates unknown algorithm, a 9 indicates a missing
265 public key. The other fields give more information about this
266 signature. sig_class is a 2 byte hex-value. The fingerprint
267 may be used instead of the long keyid if it is available.
268 This is the case with CMS and might eventually also be
269 available for OpenPGP.
271 Note, that TIMESTAMP may either be a number with seconds since
272 epoch or an ISO 8601 string which can be detected by the
273 presence of the letter 'T' inside.
275 VALIDSIG <fingerprint in hex> <sig_creation_date> <sig-timestamp>
276 <expire-timestamp> <sig-version> <reserved> <pubkey-algo>
277 <hash-algo> <sig-class> [ <primary-key-fpr> ]
279 The signature with the keyid is good. This is the same as
280 GOODSIG but has the fingerprint as the argument. Both status
281 lines are emitted for a good signature. All arguments here
282 are on one long line. sig-timestamp is the signature creation
283 time in seconds after the epoch. expire-timestamp is the
284 signature expiration time in seconds after the epoch (zero
285 means "does not expire"). sig-version, pubkey-algo, hash-algo,
286 and sig-class (a 2-byte hex value) are all straight from the
287 signature packet. PRIMARY-KEY-FPR is the fingerprint of the
288 primary key or identical to the first argument. This is
289 useful to get back to the primary key without running gpg
290 again for this purpose.
292 The primary-key-fpr parameter is used for OpenPGP and not
293 available for CMS signatures. The sig-version as well as the
294 sig class is not defined for CMS and currently set to 0 and 00.
296 Note, that *-TIMESTAMP may either be a number with seconds
297 since epoch or an ISO 8601 string which can be detected by the
298 presence of the letter 'T' inside.
300 SIG_ID <radix64_string> <sig_creation_date> <sig-timestamp>
301 This is emitted only for signatures of class 0 or 1 which
302 have been verified okay. The string is a signature id
303 and may be used in applications to detect replay attacks
304 of signed messages. Note that only DLP algorithms give
305 unique ids - others may yield duplicated ones when they
306 have been created in the same second.
308 Note, that SIG-TIMESTAMP may either be a number with seconds
309 since epoch or an ISO 8601 string which can be detected by the
310 presence of the letter 'T' inside.
312 ENC_TO <long_keyid> <keytype> <keylength>
313 The message is encrypted to this LONG_KEYID. KEYTYPE is the
314 numerical value of the public key algorithm or 0 if it is not
315 known, KEYLENGTH is the length of the key or 0 if it is not
316 known (which is currently always the case). Gpg prints this
317 line always; Gpgsm only if it knows the certificate.
320 No data has been found. Codes for what are:
322 2 - Expected a packet but did not found one.
323 3 - Invalid packet found, this may indicate a non OpenPGP
325 4 - signature expected but not found
326 You may see more than one of these status lines.
329 Unexpected data has been encountered
330 0 - not further specified 1
333 TRUST_UNDEFINED <error token>
334 TRUST_NEVER <error token>
335 TRUST_MARGINAL [0 [<validation_model>]]
336 TRUST_FULLY [0 [<validation_model>]]
337 TRUST_ULTIMATE [0 [<validation_model>]]
338 For good signatures one of these status lines are emitted to
339 indicate the validity of the key used to create the signature.
340 The error token values are currently only emitted by gpgsm.
341 VALIDATION_MODEL describes the algorithm used to check the
342 validity of the key. The defaults are the standard Web of
343 Trust model for gpg and the the standard X.509 model for
344 gpgsm. The defined values are
346 "pgp" for the standard PGP WoT.
347 "shell" for the standard X.509 model.
348 "chain" for the chain model.
350 Note that we use the term "TRUST_" in the status names for
351 historic reasons; we now speak of validity.
353 PKA_TRUST_GOOD <mailbox>
354 PKA_TRUST_BAD <mailbox>
355 Depending on the outcome of the PKA check one of the above
356 status codes is emitted in addition to a TRUST_* status.
357 Without PKA info available or
360 This is deprecated in favor of KEYEXPIRED.
362 KEYEXPIRED <expire-timestamp>
363 The key has expired. expire-timestamp is the expiration time
364 in seconds since Epoch. This status line is not very useful
365 because it will also be emitted for expired subkeys even if
366 this subkey is not used. To check whether a key used to sign
367 a message has expired, the EXPKEYSIG status line is to be
370 Note, that TIMESTAMP may either be a number with seconds since
371 epoch or an ISO 8601 string which can be detected by the
372 presence of the letter 'T' inside.
375 The used key has been revoked by its owner. No arguments yet.
378 The ASCII armor is corrupted. No arguments yet.
381 The IDEA algorithms has been used in the data. A
382 program might want to fallback to another program to handle
383 the data if GnuPG failed. This status message used to be emitted
384 also for RSA but this has been dropped after the RSA patent expired.
385 However we can't change the name of the message.
397 NEED_PASSPHRASE <long main keyid> <long keyid> <keytype> <keylength>
398 Issued whenever a passphrase is needed.
399 keytype is the numerical value of the public key algorithm
400 or 0 if this is not applicable, keylength is the length
401 of the key or 0 if it is not known (this is currently always the case).
403 NEED_PASSPHRASE_SYM <cipher_algo> <s2k_mode> <s2k_hash>
404 Issued whenever a passphrase for symmetric encryption is needed.
406 NEED_PASSPHRASE_PIN <card_type> <chvno> [<serialno>]
407 Issued whenever a PIN is requested to unlock a card.
410 No passphrase was supplied. An application which encounters this
411 message may want to stop parsing immediately because the next message
412 will probably be a BAD_PASSPHRASE. However, if the application
413 is a wrapper around the key edit menu functionality it might not
414 make sense to stop parsing but simply ignoring the following
417 BAD_PASSPHRASE <long keyid>
418 The supplied passphrase was wrong or not given. In the latter case
419 you may have seen a MISSING_PASSPHRASE.
422 The supplied passphrase was good and the secret key material
426 The symmetric decryption failed - one reason could be a wrong
427 passphrase for a symmetrical encrypted message.
430 The decryption process succeeded. This means, that either the
431 correct secret key has been used or the correct passphrase
432 for a conventional encrypted message was given. The program
433 itself may return an errorcode because it may not be possible to
434 verify a signature for some reasons.
436 NO_PUBKEY <long keyid>
437 NO_SECKEY <long keyid>
438 The key is not available
440 IMPORT_CHECK <long keyid> <fingerprint> <user ID>
441 This status is emitted in interactive mode right before
442 the "import.okay" prompt.
444 IMPORTED <long keyid> <username>
445 The keyid and name of the signature just imported
447 IMPORT_OK <reason> [<fingerprint>]
448 The key with the primary key's FINGERPRINT has been imported.
450 0 := Not actually changed
451 1 := Entirely new key.
455 16 := Contains private key.
456 The flags may be ORed.
458 IMPORT_PROBLEM <reason> [<fingerprint>]
459 Issued for each import failure. Reason codes are:
460 0 := "No specific reason given".
461 1 := "Invalid Certificate".
462 2 := "Issuer Certificate missing".
463 3 := "Certificate Chain too long".
464 4 := "Error storing certificate".
466 IMPORT_RES <count> <no_user_id> <imported> <imported_rsa> <unchanged>
467 <n_uids> <n_subk> <n_sigs> <n_revoc> <sec_read> <sec_imported> <sec_dups> <not_imported>
468 Final statistics on import process (this is one long line)
470 FILE_START <what> <filename>
471 Start processing a file <filename>. <what> indicates the performed
478 Marks the end of a file processing which has been started
483 Mark the start and end of the actual decryption process. These
484 are also emitted when in --list-only mode.
486 BEGIN_ENCRYPTION <mdc_method> <sym_algo>
488 Mark the start and end of the actual encryption process.
491 Mark the start of the actual signing process. This may be used
492 as an indication that all requested secret keys are ready for
495 DELETE_PROBLEM reason_code
496 Deleting a key failed. Reason codes are:
498 2 - Must delete secret key first
499 3 - Ambigious specification
501 PROGRESS what char cur total
502 Used by the primegen and Public key functions to indicate progress.
503 "char" is the character displayed with no --status-fd enabled, with
504 the linefeed replaced by an 'X'. "cur" is the current amount
505 done and "total" is amount to be done; a "total" of 0 indicates that
506 the total amount is not known. The condition
507 TOATL && CUR == TOTAL
508 may be used to detect the end of an operation.
509 Well known values for WHAT:
510 "pk_dsa" - DSA key generation
511 "pk_elg" - Elgamal key generation
512 "primegen" - Prime generation
513 "need_entropy" - Waiting for new entropy in the RNG
514 "file:XXX" - processing file XXX
515 (note that current gpg versions leave out the
517 "tick" - generic tick without any special meaning - useful
518 for letting clients know that the server is
520 "starting_agent" - A gpg-agent was started because it is not
522 "learncard" Send by the agent and gpgsm while learing
523 the data of a smartcard.
524 "card_busy" A smartcard is still working
526 SIG_CREATED <type> <pubkey algo> <hash algo> <class> <timestamp> <key fpr>
527 A signature has been created using these parameters.
531 (only the first character should be checked)
532 class: 2 hex digits with the signature class
534 Note, that TIMESTAMP may either be a number with seconds since
535 epoch or an ISO 8601 string which can be detected by the
536 presence of the letter 'T' inside.
538 KEY_CREATED <type> <fingerprint> [<handle>]
539 A key has been created
540 type: 'B' = primary and subkey
543 The fingerprint is one of the primary key for type B and P and
544 the one of the subkey for S. Handle is an arbitrary
545 non-whitespace string used to match key parameters from batch
548 KEY_NOT_CREATED [<handle>]
549 The key from batch run has not been created due to errors.
552 SESSION_KEY <algo>:<hexdigits>
553 The session key used to decrypt the message. This message will
554 only be emitted when the special option --show-session-key
555 is used. The format is suitable to be passed to the option
556 --override-session-key
559 NOTATION_DATA <string>
560 name and string are %XX escaped; the data may be split
561 among several NOTATION_DATA lines.
563 USERID_HINT <long main keyid> <string>
564 Give a hint about the user ID for a certain keyID.
567 string is %XX escaped
573 INV_RECP <reason> <requested_recipient>
574 INV_SGNR <reason> <requested_sender>
575 Issued for each unusable recipient/sender. The reasons codes
576 currently in use are:
577 0 := "No specific reason given".
579 2 := "Ambigious specification"
580 3 := "Wrong key usage"
585 8 := "Policy mismatch"
586 9 := "Not a secret key"
587 10 := "Key not trusted"
588 11 := "Missing certificate" (e.g. intermediate or root cert.)
590 Note that for historical reasons the INV_RECP status is also
591 used for gpgsm's SIGNER command where it relates to signer's
592 of course. Newer GnuPG versions are using INV_SGNR;
593 applications should ignore the INV_RECP during the sender's
594 command processing once they have seen an INV_SGNR. We use
595 different code so that we can distinguish them while doing an
601 Issued when no recipients/senders are usable.
603 ALREADY_SIGNED <long-keyid>
604 Warning: This is experimental and might be removed at any time.
607 The output was truncated to MAXNO items. This status code is issued
608 for certain external requests
610 ERROR <error location> <error code> [<more>]
612 This is a generic error status message, it might be followed
613 by error location specific data. <error code> and
614 <error_location> should not contain spaces. The error code is
615 a either a string commencing with a letter or such a string
616 prefixed with a numerical error code and an underscore; e.g.:
619 ATTRIBUTE <fpr> <octets> <type> <index> <count>
620 <timestamp> <expiredate> <flags>
621 This is one long line issued for each attribute subpacket when
622 an attribute packet is seen during key listing. <fpr> is the
623 fingerprint of the key. <octets> is the length of the
624 attribute subpacket. <type> is the attribute type
625 (1==image). <index>/<count> indicates that this is the Nth
626 indexed subpacket of count total subpackets in this attribute
627 packet. <timestamp> and <expiredate> are from the
628 self-signature on the attribute packet. If the attribute
629 packet does not have a valid self-signature, then the
630 timestamp is 0. <flags> are a bitwise OR of:
631 0x01 = this attribute packet is a primary uid
632 0x02 = this attribute packet is revoked
633 0x04 = this attribute packet is expired
635 CARDCTRL <what> [<serialno>]
636 This is used to control smartcard operations.
637 Defined values for WHAT are:
638 1 = Request insertion of a card. Serialnumber may be given
639 to request a specific card. Used by gpg 1.4 w/o scdaemon.
640 2 = Request removal of a card. Used by gpg 1.4 w/o scdaemon.
641 3 = Card with serialnumber detected
642 4 = No card available.
643 5 = No card reader available
644 6 = No card support available
646 PLAINTEXT <format> <timestamp> <filename>
647 This indicates the format of the plaintext that is about to be
648 written. The format is a 1 byte hex code that shows the
649 format of the plaintext: 62 ('b') is binary data, 74 ('t') is
650 text data with no character set specified, and 75 ('u') is
651 text data encoded in the UTF-8 character set. The timestamp
652 is in seconds since the epoch. If a filename is available it
653 gets printed as the third argument, percent-escaped as usual.
655 PLAINTEXT_LENGTH <length>
656 This indicates the length of the plaintext that is about to be
657 written. Note that if the plaintext packet has partial length
658 encoding it is not possible to know the length ahead of time.
659 In that case, this status tag does not appear.
661 SIG_SUBPACKET <type> <flags> <len> <data>
662 This indicates that a signature subpacket was seen. The
663 format is the same as the "spk" record above.
665 SC_OP_FAILURE [<code>]
666 An operation on a smartcard definitely failed. Currently
667 there is no indication of the actual error code, but
668 application should be prepared to later accept more arguments.
669 Defined values for CODE are:
670 0 - unspecified error (identically to a missing CODE)
675 A smart card operaion succeeded. This status is only printed
676 for certain operation and is mostly useful to check whether a
677 PIN change really worked.
679 BACKUP_KEY_CREATED fingerprint fname
680 A backup key named FNAME has been created for the key with
684 Format of the "--attribute-fd" output
685 =====================================
687 When --attribute-fd is set, during key listings (--list-keys,
688 --list-secret-keys) GnuPG dumps each attribute packet to the file
689 descriptor specified. --attribute-fd is intended for use with
690 --status-fd as part of the required information is carried on the
691 ATTRIBUTE status tag (see above).
693 The contents of the attribute data is specified by RFC 4880. For
694 convenience, here is the Photo ID format, as it is currently the only
697 Byte 0-1: The length of the image header. Due to a historical
698 accident (i.e. oops!) back in the NAI PGP days, this is
699 a little-endian number. Currently 16 (0x10 0x00).
701 Byte 2: The image header version. Currently 0x01.
703 Byte 3: Encoding format. 0x01 == JPEG.
705 Byte 4-15: Reserved, and currently unused.
707 All other data after this header is raw image (JPEG) data.
710 Format of the "--list-config" output
711 ====================================
713 --list-config outputs information about the GnuPG configuration for
714 the benefit of frontends or other programs that call GnuPG. There are
715 several list-config items, all colon delimited like the rest of the
716 --with-colons output. The first field is always "cfg" to indicate
717 configuration information. The second field is one of (with
720 version: the third field contains the version of GnuPG.
724 pubkey: the third field contains the public key algorithmdcaiphers
725 this version of GnuPG supports, separated by semicolons. The
726 algorithm numbers are as specified in RFC-4880.
728 cfg:pubkey:1;2;3;16;17
730 cipher: the third field contains the symmetric ciphers this version of
731 GnuPG supports, separated by semicolons. The cipher numbers
732 are as specified in RFC-4880.
734 cfg:cipher:2;3;4;7;8;9;10
736 digest: the third field contains the digest (hash) algorithms this
737 version of GnuPG supports, separated by semicolons. The
738 digest numbers are as specified in RFC-4880.
740 cfg:digest:1;2;3;8;9;10
742 compress: the third field contains the compression algorithms this
743 version of GnuPG supports, separated by semicolons. The
744 algorithm numbers are as specified in RFC-4880.
748 group: the third field contains the name of the group, and the fourth
749 field contains the values that the group expands to, separated
752 For example, a group of:
753 group mynames = paige 0x12345678 joe patti
756 cfg:group:mynames:patti;joe;0x12345678;paige
761 See the Libcrypt manual.
764 Unattended key generation
765 =========================
766 This feature allows unattended generation of keys controlled by a
767 parameter file. To use this feature, you use --gen-key together with
768 --batch and feed the parameters either from stdin or from a file given
771 The format of this file is as follows:
772 o Text only, line length is limited to about 1000 chars.
773 o You must use UTF-8 encoding to specify non-ascii characters.
774 o Empty lines are ignored.
775 o Leading and trailing spaces are ignored.
776 o A hash sign as the first non white space character indicates a comment line.
777 o Control statements are indicated by a leading percent sign, the
778 arguments are separated by white space from the keyword.
779 o Parameters are specified by a keyword, followed by a colon. Arguments
780 are separated by white space.
781 o The first parameter must be "Key-Type", control statements
782 may be placed anywhere.
783 o Key generation takes place when either the end of the parameter file
784 is reached, the next "Key-Type" parameter is encountered or at the
785 control statement "%commit"
786 o Control statements:
790 Suppress actual key generation (useful for syntax checking).
792 Perform the key generation. An implicit commit is done
793 at the next "Key-Type" parameter.
796 Do not write the key to the default or commandline given
797 keyring but to <filename>. This must be given before the first
798 commit to take place, duplicate specification of the same filename
799 is ignored, the last filename before a commit is used.
800 The filename is used until a new filename is used (at commit points)
801 and all keys are written to that file. If a new filename is given,
802 this file is created (and overwrites an existing one).
803 Both control statements must be given.
805 Enable a mode where the command "passphrase" is ignored and
806 instead the usual passphrase dialog is used. This does not
807 make sense for batch key generation; however the unattended
808 key generation feature is also used by GUIs and this feature
809 relinquishes the GUI from implementing its own passphrase
810 entry code. This is a global option.
812 Disable the ask-passphrase mode.
814 o The order of the parameters does not matter except for "Key-Type"
815 which must be the first parameter. The parameters are only for the
816 generated keyblock and parameters from previous key generations are not
817 used. Some syntactically checks may be performed.
818 The currently defined parameters are:
819 Key-Type: <algo-number>|<algo-string>
820 Starts a new parameter block by giving the type of the
821 primary key. The algorithm must be capable of signing.
822 This is a required parameter.
823 Key-Length: <length-in-bits>
824 Length of the key in bits. Default is 1024.
825 Key-Usage: <usage-list>
826 Space or comma delimited list of key usage, allowed values are
827 "encrypt", "sign", and "auth". This is used to generate the
828 key flags. Please make sure that the algorithm is capable of
829 this usage. Note that OpenPGP requires that all primary keys
830 are capable of certification, so no matter what usage is given
831 here, the "cert" flag will be on. If no Key-Usage is
832 specified, all the allowed usages for that particular
834 Subkey-Type: <algo-number>|<algo-string>
835 This generates a secondary key. Currently only one subkey
837 Subkey-Length: <length-in-bits>
838 Length of the subkey in bits. Default is 1024.
839 Subkey-Usage: <usage-list>
840 Similar to Key-Usage.
842 If you want to specify a passphrase for the secret key,
843 enter it here. Default is not to use any passphrase.
845 Name-Comment: <string>
847 The 3 parts of a key. Remember to use UTF-8 here.
848 If you don't give any of them, no user ID is created.
849 Expire-Date: <iso-date>|(<number>[d|w|m|y])
850 Set the expiration date for the key (and the subkey). It may
851 either be entered in ISO date format (2000-08-15) or as number
852 of days, weeks, month or years. The special notation
853 "seconds=N" is also allowed to directly give an Epoch
854 value. Without a letter days are assumed. Note that there is
855 no check done on the overflow of the type used by OpenPGP for
856 timestamps. Thus you better make sure that the given value
857 make sense. Although OpenPGP works with time intervals, GnuPG
858 uses an absolute value internally and thus the last year we
859 can represent is 2105.
860 Creation-Date: <iso-date>
861 Set the creation date of the key as stored in the key
862 information and which is also part of the fingerprint
863 calculation. Either a date like "1986-04-26" or a full
864 timestamp like "19860426T042640" may be used. The time is
865 considered to be UTC. If it is not given the current time
867 Preferences: <string>
868 Set the cipher, hash, and compression preference values for
869 this key. This expects the same type of string as "setpref"
871 Revoker: <algo>:<fpr> [sensitive]
872 Add a designated revoker to the generated key. Algo is the
873 public key algorithm of the designated revoker (i.e. RSA=1,
874 DSA=17, etc.) Fpr is the fingerprint of the designated
875 revoker. The optional "sensitive" flag marks the designated
876 revoker as sensitive information. Only v4 keys may be
879 This is an optional parameter only used with the status lines
880 KEY_CREATED and KEY_NOT_CREATED. STRING may be up to 100
881 characters and should not contain spaces. It is useful for
882 batch key generation to associate a key parameter block with a
885 This is an optional parameter that specifies the preferred
886 keyserver URL for the key.
891 %echo Generating a standard key
896 Name-Real: Joe Tester
897 Name-Comment: with stupid passphrase
898 Name-Email: joe@foo.bar
903 # Do a commit here, so that we can later print "done" :-)
907 $ gpg --batch --gen-key foo
909 $ gpg --no-default-keyring --secret-keyring ./foo.sec \
910 --keyring ./foo.pub --list-secret-keys
911 /home/wk/work/gnupg-stable/scratch/foo.sec
912 ------------------------------------------
913 sec 1024D/915A878D 2000-03-09 Joe Tester (with stupid passphrase) <joe@foo.bar>
914 ssb 1024g/8F70E2C0 2000-03-09
918 Layout of the TrustDB
919 =====================
920 The TrustDB is built from fixed length records, where the first byte
921 describes the record type. All numeric values are stored in network
922 byte order. The length of each record is 40 bytes. The first record of
923 the DB is always of type 1 and this is the only record of this type.
925 FIXME: The layout changed, document it here.
929 Unused record, can be reused for any purpose.
933 Version information for this TrustDB. This is always the first
934 record of the DB and the only one with type 1.
936 3 bytes 'gpg' magic value
937 1 byte Version of the TrustDB (2)
938 1 byte marginals needed
939 1 byte completes needed
940 1 byte max_cert_depth
941 The three items are used to check whether the cached
942 validity value from the dir record can be used.
943 1 u32 locked flags [not used]
944 1 u32 timestamp of trustdb creation
945 1 u32 timestamp of last modification which may affect the validity
946 of keys in the trustdb. This value is checked against the
947 validity timestamp in the dir records.
948 1 u32 timestamp of last validation [currently not used]
949 (Used to keep track of the time, when this TrustDB was checked
951 1 u32 record number of keyhashtable [currently not used]
952 1 u32 first free record
953 1 u32 record number of shadow directory hash table [currently not used]
954 It does not make sense to combine this table with the key table
955 because the keyid is not in every case a part of the fingerprint.
956 1 u32 record number of the trusthashtbale
959 Record type 2: (directory record)
961 Informations about a public key certificate.
962 These are static values which are never changed without user interaction.
966 1 u32 LID . (This is simply the record number of this record.)
967 1 u32 List of key-records (the first one is the primary key)
968 1 u32 List of uid-records
972 1 byte maximum validity of all the user ids
973 1 u32 time of last validity check.
974 1 u32 Must check when this time has been reached.
975 (0 = no check required)
978 Record type 3: (key record)
980 Informations about a primary public key.
981 (This is mainly used to lookup a trust record)
986 1 u32 next - next key record
989 1 byte pubkey algorithm
990 1 byte length of the fingerprint (in bytes)
991 20 bytes fingerprint of the public key
992 (This is the value we use to identify a key)
994 Record type 4: (uid record)
996 Informations about a userid
997 We do not store the userid but the hash value of the userid because that
1002 1 u32 LID points to the directory record.
1003 1 u32 next next userid
1004 1 u32 pointer to preference record
1005 1 u32 siglist list of valid signatures
1007 1 byte validity of the key calculated over this user id
1008 20 bytes ripemd160 hash of the username.
1011 Record type 5: (pref record)
1013 This record type is not anymore used.
1017 1 u32 LID; points to the directory record (and not to the uid record!).
1018 (or 0 for standard preference record)
1020 30 byte preference data
1022 Record type 6 (sigrec)
1024 Used to keep track of key signatures. Self-signatures are not
1025 stored. If a public key is not in the DB, the signature points to
1026 a shadow dir record, which in turn has a list of records which
1027 might be interested in this key (and the signature record here
1032 1 u32 LID points back to the dir record
1033 1 u32 next next sigrec of this uid or 0 to indicate the
1036 1 u32 Local_id of signatures dir or shadow dir record
1037 1 byte Flag: Bit 0 = checked: Bit 1 is valid (we have a real
1038 directory record for this)
1039 1 = valid is set (but may be revoked)
1043 Record type 8: (shadow directory record)
1045 This record is used to reserve a LID for a public key. We
1046 need this to create the sig records of other keys, even if we
1047 do not yet have the public key of the signature.
1048 This record (the record number to be more precise) will be reused
1049 as the dir record when we import the real public key.
1053 1 u32 LID (This is simply the record number of this record.)
1055 1 byte pubkey algorithm
1057 1 u32 hintlist A list of records which have references to
1058 this key. This is used for fast access to
1059 signature records which are not yet checked.
1060 Note, that this is only a hint and the actual records
1061 may not anymore hold signature records for that key
1062 but that the code cares about this.
1067 Record Type 10 (hash table)
1069 Due to the fact that we use fingerprints to lookup keys, we can
1070 implement quick access by some simple hash methods, and avoid
1071 the overhead of gdbm. A property of fingerprints is that they can be
1072 used directly as hash values. (They can be considered as strong
1074 What we use is a dynamic multilevel architecture, which combines
1075 hashtables, record lists, and linked lists.
1077 This record is a hashtable of 256 entries; a special property
1078 is that all these records are stored consecutively to make one
1079 big table. The hash value is simple the 1st, 2nd, ... byte of
1080 the fingerprint (depending on the indirection level).
1082 When used to hash shadow directory records, a different table is used
1083 and indexed by the keyid.
1087 n u32 recnum; n depends on the record length:
1088 n = (reclen-2)/4 which yields 9 for the current record length
1091 the total number of such record which makes up the table is:
1093 which is 29 for a record length of 40.
1095 To look up a key we use the first byte of the fingerprint to get
1096 the recnum from this hashtable and look up the addressed record:
1097 - If this record is another hashtable, we use 2nd byte
1098 to index this hash table and so on.
1099 - if this record is a hashlist, we walk all entries
1100 until we found one a matching one.
1101 - if this record is a key record, we compare the
1102 fingerprint and to decide whether it is the requested key;
1105 Record type 11 (hash list)
1107 see hash table for an explanation.
1108 This is also used for other purposes.
1112 1 u32 next next hash list record
1113 n times n = (reclen-5)/5
1116 For the current record length of 40, n is 7
1120 Record type 254 (free record)
1122 All these records form a linked list of unused records.
1129 GNU extensions to the S2K algorithm
1130 ===================================
1131 S2K mode 101 is used to identify these extensions.
1132 After the hash algorithm the 3 bytes "GNU" are used to make
1133 clear that these are extensions for GNU, the next bytes gives the
1134 GNU protection mode - 1000. Defined modes are:
1135 1001 - do not store the secret part at all
1136 1002 - a stub to access smartcards (not used in 1.2.x)
1142 * For packet version 3 we calculate the keyids this way:
1143 RSA := low 64 bits of n
1144 ELGAMAL := build a v3 pubkey packet (with CTB 0x99) and calculate
1145 a rmd160 hash value from it. This is used as the
1146 fingerprint and the low 64 bits are the keyid.
1148 * Revocation certificates consist only of the signature packet;
1149 "import" knows how to handle this. The rationale behind it is
1153 OIDs below the GnuPG arc:
1154 =========================
1156 1.3.6.1.4.1.11591.2 GnuPG
1157 1.3.6.1.4.1.11591.2.1 notation
1158 1.3.6.1.4.1.11591.2.1.1 pkaAddress
1159 1.3.6.1.4.1.11591.2.12242973 invalid encoded OID
1163 Keyserver Message Format
1164 =========================
1166 The keyserver may be contacted by a Unix Domain socket or via TCP.
1168 The format of a request is:
1172 "Content-length:" digits
1176 Where command-tag is
1184 The format of a response is:
1187 "GNUPG/1.0" status-code status-text
1188 "Content-length:" digits
1191 followed by <digits> bytes of data
1196 o 1xx: Informational - Request received, continuing process
1198 o 2xx: Success - The action was successfully received, understood,
1201 o 4xx: Client Error - The request contains bad syntax or cannot be
1204 o 5xx: Server Error - The server failed to fulfill an apparently
1209 Documentation on HKP (the http keyserver protocol):
1211 A minimalistic HTTP server on port 11371 recognizes a GET for /pks/lookup.
1212 The standard http URL encoded query parameters are this (always key=value):
1214 - op=index (like pgp -kv), op=vindex (like pgp -kvv) and op=get (like
1217 - search=<stringlist>. This is a list of words that must occur in the key.
1218 The words are delimited with space, points, @ and so on. The delimiters
1219 are not searched for and the order of the words doesn't matter (but see
1222 - exact=on. This switch tells the hkp server to only report exact matching
1223 keys back. In this case the order and the "delimiters" are important.
1225 - fingerprint=on. Also reports the fingerprints when used with 'index' or
1228 The keyserver also recognizes http-POSTs to /pks/add. Use this to upload
1232 A better way to do this would be a request like:
1234 /pks/lookup/<gnupg_formatierte_user_id>?op=<operation>
1236 This can be implemented using Hurd's translator mechanism.
1237 However, I think the whole key server stuff has to be re-thought;
1238 I have some ideas and probably create a white paper.