aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-03-30 07:07:02 +0000
committerWerner Koch <[email protected]>2017-03-30 07:07:02 +0000
commita8895c99a7d0750132477d80cd66caaf3a709113 (patch)
treee36d1f640132ecc4723fe204de452ea95eaf7074 /doc
parentgpg: Extend free_packet to handle a packet parser context. (diff)
downloadgnupg-a8895c99a7d0750132477d80cd66caaf3a709113.tar.gz
gnupg-a8895c99a7d0750132477d80cd66caaf3a709113.zip
gpg: Revamp reading and writing of ring trust packets.
* g10/parse-packet.c (parse_trust): Rename to ... (parse_ring_trust): this. Change args and implement new ring trust packet format. (parse): Add special ring trust packet handling. * g10/packet.h (PKT_user_id): New fields KEYUPDATE, UPDATEURL, and KEYSRC. (PKT_public_key): Ditto. (RING_TRUST_SIG, RING_TRUST_KEY, RING_TRUST_UID): New consts. (PKT_ring_trust): New. (struct packet_struct): Remove member RING_TRUST. (strcu parse_packet_ctx_s): Add field SKIP_META. (init_parse_packet): Init SKIPT_META. * g10/free-packet.c (release_public_key_parts): Free UDPATEURL. (free_user_id): Ditto. * g10/mainproc.c (list_node): Remove printing of non-documented "rtv" lines. * g10/build-packet.c (build_packet_and_meta): New. (do_ring_trust): New. * g10/export.c (write_keyblock_to_output): Use build_packet_and_meta in backup mode. (do_export_one_keyblock): Ditto. * g10/import.c (read_block): Add arg WITH_META. Skip ring trust packets if that ism not set. (import): Call read_block WITH_META in restore mode. * g10/keydb.h (KEYSRC_UNKNOWN, KEYSRC_FILE, KEYSRC_KS, KEYSRC_PREF_KS) (KEYSRC_WKD, KEYSRC_WKD_SD, KEYSRC_DANE): New constants. They are not yet used, though. * g10/keydb.c (parse_keyblock_image): Allow ring trust packets. (build_keyblock_image): Ditto. Use build_packet_and_meta. * g10/keyring.c (keyring_get_keyblock): Remove specila treatment of ring trust packets. (write_keyblock): Use build_packet_and_meta. Remove special treatment of ring trust packets and initialization of the signature caches. -- This patch introduced the framework to store meta data for keys and user ids in the keyrings/keyboxes. Ring trust packets are implementation defined and have always been used in gpg to cache the signature verification status. Ring trust packets are only exported with the export option "backup" and only imported with the import option "restore". The new code uses a cleaner way to handle the ring trust packets: When the parser reads a ring trust packet and the previously read packet matches the type of that ring trust packet, the information is stored in that previously read packet (signature, user id, or primary key) and the next packet is read immediately. Thus only the parser sees the ring trust packets. Ring trust packets are written by using the new function build_packet_and_meta instead of build_packet. That function writes a ring trust packet when the needed information is available. As a side-effect of this patch the signature status cache works again and "gpg --check-sigs" is thus much faster. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'doc')
-rw-r--r--doc/DETAILS37
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/DETAILS b/doc/DETAILS
index 83d9fea75..1624315ff 100644
--- a/doc/DETAILS
+++ b/doc/DETAILS
@@ -1311,6 +1311,43 @@ CREATE TABLE signatures (
S2K Specifier with an offset of 1000.
+* Format of the OpenPGP TRUST packet
+
+ According to RFC4880 (5.10), the trust packet (aka ring trust) is
+ only used within keyrings and contains data that records the user's
+ specifications of which key holds trusted introducers. The RFC also
+ states that the format of this packet is implementation defined and
+ SHOULD NOT be emitted to output streams or should be ignored on
+ import. GnuPG uses this packet in several additional ways:
+
+ - 1 octet :: Trust-Value (only used by Subtype SIG)
+ - 1 octet :: Signature-Cache (only used by Subtype SIG; value must
+ be less than 128)
+ - 3 octets :: Fixed value: "gpg"
+ - 1 octet :: Subtype
+ - 0 :: Signature cache (SIG)
+ - 1 :: Key source on the primary key (KEY)
+ - 2 :: Key source on a user id (UID)
+ - 1 octet :: Key Source; i.e. the origin of the key:
+ - 0 :: Unknown source.
+ - 1 :: Direct import from a file.
+ - 2 :: Public keyserver.
+ - 3 :: Preferred keysrver.
+ - 4 :: Web Key Directory.
+ - 5 :: Web Key Directory via sub-domain.
+ - 6 :: OpenPGP DANE.
+ - 4 octets :: Time of last update. This is a a four-octet scalar
+ with the seconds since Epoch.
+ - 1 octet :: Scalar with the length of the following field.
+ - N octets :: String with the URL of the source. This may be a
+ zero-length string.
+
+ If the packets contains only two octets a Subtype of 0 is assumed;
+ this is the only format recognized by GnuPG versions < 2.1.18.
+ Trust-Value and Signature-Cache must be zero for all subtypes other
+ than SIG.
+
+
* Keyserver helper message format
*This information is obsolete*