Re: [saag] ASN.1 vs. DER Encoding

Peter Gutmann <pgut001@cs.auckland.ac.nz> Wed, 27 March 2019 09:45 UTC

Return-Path: <pgut001@cs.auckland.ac.nz>
X-Original-To: saag@ietfa.amsl.com
Delivered-To: saag@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 06F921202A7 for <saag@ietfa.amsl.com>; Wed, 27 Mar 2019 02:45:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.199
X-Spam-Level:
X-Spam-Status: No, score=-4.199 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=auckland.ac.nz
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eeOFnk5b94Gy for <saag@ietfa.amsl.com>; Wed, 27 Mar 2019 02:45:22 -0700 (PDT)
Received: from mx4-int.auckland.ac.nz (mx4-int.auckland.ac.nz [130.216.125.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 630181202A0 for <saag@ietf.org>; Wed, 27 Mar 2019 02:45:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=auckland.ac.nz; i=@auckland.ac.nz; q=dns/txt; s=mail; t=1553679921; x=1585215921; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=i6DXfpK1HOY7tFqyx1tHMQh/wq/ZYgG0ZEXOE123yEQ=; b=RldUSIGJqFyO2pwGRWICN9pnI7g+VC6woTUxeghpHv+HniMPF4bidPgK 5Vz1KlEwecmmuC3zzWQvzQAmF94bO5UtzukHhfrO+x87xYXGDoRIOxa9a qX/0x5N/OMEzZuTCSGd2BoIgb2DkYUDjfWG68ljoatd9Yw6avBiRIgVQ1 aWL/Ewvnk0/bffKmAyPRZOKJSWwZNAdFJjZnYr1ORD/zS0+1PlYn8FnNP eFPdHbcmgfZCTWA7FFTsAbd/Kxu2jFjrUYrGXMOCArhxE+zxcjMyou43/ WZ8X3HhpyTdyFzRrSqKpNIRpoA65M5rAcalGpXtmamez9cn93p5vPlRyX Q==;
X-IronPort-AV: E=Sophos;i="5.60,276,1549882800"; d="scan'208";a="53346680"
X-Ironport-HAT: MAIL-SERVERS - $RELAYED
X-Ironport-Source: 10.6.2.2 - Outgoing - Outgoing
Received: from exchangemx.uoa.auckland.ac.nz (HELO uxcn13-ogg-a.UoA.auckland.ac.nz) ([10.6.2.2]) by mx4-int.auckland.ac.nz with ESMTP/TLS/AES256-SHA; 27 Mar 2019 22:45:17 +1300
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz (10.6.2.5) by uxcn13-ogg-a.UoA.auckland.ac.nz (10.6.2.2) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 02:45:17 -0700
Received: from uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) by uxcn13-ogg-d.UoA.auckland.ac.nz ([10.6.2.5]) with mapi id 15.00.1395.000; Wed, 27 Mar 2019 22:45:17 +1300
From: Peter Gutmann <pgut001@cs.auckland.ac.nz>
To: Nico Williams <nico@cryptonector.com>, "Dr. Pala" <madwolf@openca.org>
CC: "saag@ietf.org" <saag@ietf.org>
Thread-Topic: [saag] ASN.1 vs. DER Encoding
Thread-Index: AQHU4/B7Wn4JSCcuPE2ed5Fjno127KYdRg2AgABTYgCAAaGbjg==
Date: Wed, 27 Mar 2019 09:45:16 +0000
Message-ID: <1553679912618.8510@cs.auckland.ac.nz>
References: <20190326164951.GX4211@localhost>, <20190326214816.GB4211@localhost>
In-Reply-To: <20190326214816.GB4211@localhost>
Accept-Language: en-NZ, en-GB, en-US
Content-Language: en-NZ
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [130.216.158.4]
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/saag/8r01x7MxQPPQ9DvUuFl-jcfuCJM>
Subject: Re: [saag] ASN.1 vs. DER Encoding
X-BeenThere: saag@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Security Area Advisory Group <saag.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/saag>, <mailto:saag-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/saag/>
List-Post: <mailto:saag@ietf.org>
List-Help: <mailto:saag-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/saag>, <mailto:saag-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Mar 2019 09:45:25 -0000

Nico Williams <nico@cryptonector.com> writes:

I realise this is the standard ASN.1-vs-everything-else debate that comes up
every year or so, without wanting to dig up the standard responses from every
previous time it's occurred I'll try and make just one comment:

>Now to back up that assertion:
>
>1) TLV encodings are bloated by nature due to being highly redundant.
>
>2) That redundancy is a source of errors when manually coding a codec.

It's actually the opposite, with a proper TLV encoding you can create a
simple, universal recursive-descent parser that will take any arbitrary
encoded blob and report "valid" or "not valid".  It's with the non-redundant,
or at least non-self-describing, encodings where you need to hand-roll a
parser each time any field anywhere is updated, and which can't be statically
checked like ASN.1 (meaning BER/DER) can.

>Thus there is almost zero benefit to self-describing encodings.

... apart from the fact that they can be statically analysed to check whether
they're well-formed or not, unlike the encodings in PGP, TLS, IPsec, SSH, ...

Peter.