Re: What ASN.1 got right

Nico Williams <> Tue, 02 March 2021 05:48 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 8745B3A1F06 for <>; Mon, 1 Mar 2021 21:48:10 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.119
X-Spam-Status: No, score=-2.119 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (1024-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id rNcNu7VpB00v for <>; Mon, 1 Mar 2021 21:48:09 -0800 (PST)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 24A113A26A9 for <>; Mon, 1 Mar 2021 21:48:04 -0800 (PST)
X-Sender-Id: dreamhost|x-authsender|
Received: from (localhost []) by (Postfix) with ESMTP id 46442402A16; Tue, 2 Mar 2021 05:48:03 +0000 (UTC)
Received: from (100-96-18-39.trex.outbound.svc.cluster.local []) (Authenticated sender: dreamhost) by (Postfix) with ESMTPA id BB9524029CD; Tue, 2 Mar 2021 05:48:02 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by (trex/6.0.2); Tue, 02 Mar 2021 05:48:03 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|
X-MailChannels-Auth-Id: dreamhost
X-Obese-Illustrious: 3c5e535c01bd34ab_1614664083008_2416593921
X-MC-Loop-Signature: 1614664083007:219560086
X-MC-Ingress-Time: 1614664083007
Received: from (localhost []) by (Postfix) with ESMTP id 7DFAD8727D; Mon, 1 Mar 2021 21:48:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed;; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to;; bh=hZoaQz8FL8iAPb v3adE2/W+sY2w=; b=NJUH84s80ehaM8E4DX8iBRgFrtt7zEVJbi1P/DU+v7S7xp ADQ86X+a+y7ajPUpt1/o+6IGHdWjlCoHN6wWV+Vyr6r6FZfyXH8KlfHfGw+x4Qum YLYMlp1Mv/fONGo//x844/SB8Figlh/VpxKvefcZqEaAL0exe+IcmcgX6IP5s=
Received: from localhost (unknown []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: by (Postfix) with ESMTPSA id 2A9867EF9C; Mon, 1 Mar 2021 21:48:00 -0800 (PST)
Date: Mon, 1 Mar 2021 23:47:58 -0600
X-DH-BACKEND: pdx1-sub0-mail-a86
From: Nico Williams <>
To: Phillip Hallam-Baker <>
Cc: IETF Discussion Mailing List <>
Subject: Re: What ASN.1 got right
Message-ID: <20210302054757.GP30153@localhost>
References: <20210302010731.GL30153@localhost> <>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <>
User-Agent: Mutt/1.9.4 (2018-02-28)
Archived-At: <>
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: IETF-Discussion <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Tue, 02 Mar 2021 05:48:11 -0000

On Tue, Mar 02, 2021 at 12:14:24AM -0500, Phillip Hallam-Baker wrote:
>                       [...]. I want 'x is an integer' and the only time I
> want to have more information is if x won't fit into 64 bits. Similarly, I

Yes, I agree with this.  Use [u]i[8|16|32|64] to indicate the expected
range of integers that aren't arbitrarily large, and make the name of
the large integer type denote as much so that it's not used accidentally
instead of machine word sized integer types.

If an integer really is expected to do something like express named
versions, then sure, name the valid values.

> don't want the schema to say '2 to 6 objects of type foo', the minimum
> number of entries in a list is always either 0 or 1 and the maximum is
> always 1 or infinity. Nothing else is needed at the schema layer. If you
> have detailed data constraints you can always apply them later.


This is true for database schemas too.  Cardinality is always one of
zero-or-one, zero-one-or-many, one, or one-or-many.  Simpler that way.

ASN.1 is _too_ expressive in this regard, I agree, though one does not
have to use its full range of expressivity.