Received: from fum.andrewg.com (fum.andrewg.com [IPv6:2a01:4f9:c011:23ad::1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange x25519 server-signature ECDSA (prime256v1) server-digest
 SHA256)
	(No client certificate requested)
	by mx.ietf.org (Postfix) with ESMTPS id 9DB8946
	for <openpgp@ietf.org>; Mon, 26 Oct 2026 12:36:25 +0000 (UTC)
Authentication-Results: mx.ietf.org;
	dkim=pass header.d=andrewg.com header.s=andrewg-com header.b=NE48ZCLa;
	spf=pass (mx.ietf.org: domain of andrewg@andrewg.com designates
 2a01:4f9:c011:23ad::1 as permitted sender) smtp.mailfrom=andrewg@andrewg.com;
	dmarc=pass (policy=quarantine) header.from=andrewg.com
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=andrewg.com;
	s=andrewg-com; t=1793018178;
	bh=Ivo1/noTQHYHJgqn+F75E+/7zG6n0Q6LweFTMZeErsE=;
	h=From:Subject:Date:References:Cc:In-Reply-To:To:From;
	b=NE48ZCLa9v+lCmN7d0Mvj9UqFV5316zPMnroUb+dFIjyzWFxuI3AChhmJVXE1z8C4
	 PmoJHg4pNcFH5feXIkxU2aDa5n7OD9/6e0n2G1lizUUeYIbrfSRchKFLFOdhDIA4Ty
	 Z7G3dMXOUBqlOgHGNEDGDzdzlf0jV4yL9wtHpktREsc8nmQ5echKd7zy1KiSaLgXtY
	 4FQP3BVX1mktwLEcfsKUiOSvDnZUer/G85opTmlEST+TdjMC5lGwuL3ug3BG9RPV+K
	 d9ML8flknqeTVVMjCEMt+7d+dNXKaBO2nC+j50bcJXS+3mFiT5WloId0MH6I5Rvp7j
	 zqayIlISpKobw==
Received: from smtpclient.apple (unknown [109.255.218.45])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest
 SHA256)
	(No client certificate requested)
	by fum.andrewg.com (Postfix) with ESMTPSA id 29B145E1C9;
	Mon, 26 Oct 2026 12:36:18 +0000 (UTC)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
From: Andrew Gallagher <andrewg@andrewg.com>
Mime-Version: 1.0 (1.0)
Date: Mon, 26 Oct 2026 12:36:06 +0000
Message-Id: <86B3DB48-79F3-43E7-8696-53DCBC519E56@andrewg.com>
References: 
 <SY9P300MB881477C78D3D07FE72D736AC75EE612@SY9P300MB881477.AUSP300.PROD.OUTLOOK.COM>
In-Reply-To: 
 <SY9P300MB881477C78D3D07FE72D736AC75EE612@SY9P300MB881477.AUSP300.PROD.OUTLOOK.COM>
To: Peter Gutmann <pgut001@cs.auckland.ac.nz>
X-Mailer: iPhone Mail (23H30)
X-Spamd-Bar: -----------------------
Message-ID-Hash: 4AJ6ETE6YWDR6LYJAJZPLKDUP2B56QZB
X-Message-ID-Hash: 4AJ6ETE6YWDR6LYJAJZPLKDUP2B56QZB
X-MailFrom: andrewg@andrewg.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop;
 banned-address; header-match-openpgp.ietf.org-0; emergency;
 member-moderation; nonmember-moderation; administrivia; implicit-dest;
 max-recipients; max-size; news-moderation; no-subject; digests;
 suspicious-header
CC: openpgp@ietf.org
X-Mailman-Version: 3.3.10
Precedence: list
Subject: [openpgp] Re: OpenPGP grammar concerns (fwd: [Peter Gutmann] Re:
 [oss-security] Retrospective by 'gpg.fail' authors)
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
Archived-At: 
 <https://mailarchive.ietf.org/arch/msg/openpgp/SvMnKki8_SwhulE9Og9mtMtKkX4>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Owner: <mailto:openpgp-owner@ietf.org>
List-Post: <mailto:openpgp@ietf.org>
List-Subscribe: <mailto:openpgp-join@ietf.org>
List-Unsubscribe: <mailto:openpgp-leave@ietf.org>

On 26 Oct 2026, at 01:52, Peter Gutmann <pgut001@cs.auckland.ac.nz> wrote:
>=20
> =EF=BB=BFAndrew Gallagher <andrewg@andrewg.com> writes:
>=20
>> That's exactly what PGP does, there's no second encapsulation on this lev=
el.
>> The literal data packet is inside the decrypted cleartext.
>=20
> No, it's not what PGP does.  With CMS the packaging is:
>=20
>  Sign( data )
>=20
> With PGP it's:
>=20
>  Sign( Literal( data ) )

This is quite far removed from how the packets appear on the wire though, an=
d if we=E2=80=99re viewing it on a higher level of API abstraction it=E2=80=99=
s just as valid to view it as (say) =E2=80=9CSignLiteral( data )=E2=80=9D an=
d abstract away the fact that there is a literal packet in there.

> with a completely unnecessary double-encapsulation of the data.  All you n=
eed
> to do is change the Sign() to include a length and you can do away with th=
e
> unnecessary double-encapsulation.

I=E2=80=99m struggling to see what the practical difference would be. There=E2=
=80=99s still a leading length parameter, followed by a data stream. That=E2=
=80=99s equivalent to an encapsulation format, just with the length prefixes=
 moved around a little.

To take a counterfactual, the data stream could have been a length-prefixed f=
ield inside the OPS packet rather than a length-prefixed packet. But then yo=
u would have a length encoding of the OPS packet that included the length of=
 the data stream, which would add one more nested length encoding rather tha=
n remove one.

A slightly better (but equivalent) design would be an OPS packet that contai=
ned the signed data but didn=E2=80=99t have an explicit length for it, letti=
ng it extend to the end of the OPS packet itself. But in this scenario you w=
ould also need to know where the signed data started, particularly in the mu=
lti-signature case, so you would still need some way of determining the leng=
th of the metadata part of the OPS packet - and the easiest way to do this i=
s a length parameter. So we still have the same number of length parameters a=
s the spec, just in different places and covering different things.

You could conceivably reduce the number of length parameters by relying on t=
he OPS packet having a known internal structure and omitting its packet fram=
ing. But this sacrifices forward compatibility - you can=E2=80=99t then do n=
ice things like signing over the same data with both a v4 and v6 key if lega=
cy code doesn=E2=80=99t know the structure (and therefore the length) of a v=
6 OPS packet.

So yes, some of the length prefixes in PGP may seem redundant if you assume t=
here is no need for forward compatibility. But the vast majority of length p=
refixes in PGP are there because we cannot assume that objects have fixed si=
zes, and parsers need to be able to gracefully ignore stuff from the future.=


> CMS supports streaming data, and has (via ASN.1 BER) since before PGP exis=
ted.

I stand corrected. My knowledge of BER is limited.

A=
