Internet-Draft | OpenPGP Literal Data Metadata Integrity | January 2024 |
Gallagher | Expires 5 July 2024 | [Page] |
This document specifies a method for ensuring the integrity of file metadata when signed using OpenPGP.¶
This note is to be removed before publishing as an RFC.¶
The latest revision of this draft can be found at https://andrewgdotcom.gitlab.io/draft-gallagher-openpgp-literal-metadata. Status information for this document may be found at https://datatracker.ietf.org/doc/draft-gallagher-openpgp-literal-metadata/.¶
Discussion of this document takes place on the OpenPGP Working Group mailing list (mailto:openpgp@ietf.org), which is archived at https://mailarchive.ietf.org/arch/browse/openpgp/. Subscribe at https://www.ietf.org/mailman/listinfo/openpgp/.¶
Source for this draft and an issue tracker can be found at https://gitlab.com/andrewgdotcom/draft-gallagher-openpgp-literal-metadata.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 5 July 2024.¶
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
Due to a design oversight in an early version of PGP, the literal data metadata (file type, file name, and file timestamp) were not covered by any integrity-protection mechanisms. That omission has persisted through subsequent OpenPGP specifications, up to and including [RFC4880]. This document introduces the missing integrity check by adopting and extending the "Literal Data Meta Hash" subpacket from [LIBREPGP], section 5.2.3.33.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
This subpacket MAY be used to protect the metadata of a Literal Data Packet. It is only useful when located in the hashed-subpackets area of a v4 (or later) signature over a Literal Data Packet, and so it SHOULD NOT appear elsewhere. The packet SHOULD be marked as critical.¶
The metadata is always of the same form as it appears in the Literal Data Packet (type 11, [RFC4880] section 5.9), i.e.:¶
A one-octet field that describes how the data is formatted.¶
File name as a string (one-octet length, followed by a file name).¶
A four-octet number that indicates a date associated with the literal data.¶
The first octet of the subpacket contents indicates the encoding of the subpacket. A value of 0 indicates Hashed encoding, and a value of 1 indicates Verbatim encoding. The remaining octets of the subpacket are encoding-dependent.¶
The remainder of the packet contains a 32 octet fixed-length hash value. The hash is computed over the metadata as specified above, using SHA-256 [FIPS180]. When an implementation is validating a signature containing a Literal Data Meta (Hashed) subpacket in its hashed-subpackets area, it MUST re-create the hash from the metadata section of the Literal Data packet that is signed over. If the calculated hash value does not match the one in the subpacket, the signature MUST be deemed as invalid.¶
The remainder of the packet contains a verbatim copy of the metadata as specified above. When an implementation has successfully validated a signature containing a Literal Data Meta (Verbatim) subpacket in its hashed-subpackets area, the metadata section of the Literal Data Packet that is signed over MUST be replaced with the copy from the Literal Data Meta subpacket.¶
A signature containing a Literal Data Meta (Verbatim) subpacket can be round-tripped via detached-signature format without loss of integrity. A signature containing a Literal Data Meta (Hashed) subpacket does not have this property, because the metadata cannot be regenerated from the hash and is therefore lost on conversion to a detached signature.¶
It is therefore RECOMMENDED that implementations generate Literal Data Hash subpackets using the Verbatim encoding.¶
This document requests that the following entry be added to the OpenPGP Signature Subpacket registry:¶
Type | Name | Specification |
---|---|---|
40 | Literal Data Meta | This document |
The author would like to thank Werner Koch for his earlier work on the Literal Data Meta Hash subpacket.¶