[dtn] Re: Private use/unassigned URI schemes?

"Sipos, Brian J." <Brian.Sipos@jhuapl.edu> Fri, 18 October 2024 16:48 UTC

Return-Path: <Brian.Sipos@jhuapl.edu>
X-Original-To: dtn@ietfa.amsl.com
Delivered-To: dtn@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id F0485C1E0D85; Fri, 18 Oct 2024 09:48:42 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.105
X-Spam-Level:
X-Spam-Status: No, score=-2.105 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=jhuapl.edu
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cCqt90L1-RFD; Fri, 18 Oct 2024 09:48:38 -0700 (PDT)
Received: from aplegw02.jhuapl.edu (aplegw02.jhuapl.edu [128.244.251.169]) by ietfa.amsl.com (Postfix) with ESMTP id 7F312C1D52F5; Fri, 18 Oct 2024 09:48:38 -0700 (PDT)
Received: from pps.filterd (aplegw02.jhuapl.edu [127.0.0.1]) by aplegw02.jhuapl.edu (8.18.1.2/8.18.1.2) with ESMTP id 49IGbUMQ016764; Fri, 18 Oct 2024 12:48:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jhuapl.edu; h=cc : content-type : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=JHUAPLDec2018; bh=GDY2Twc/ZDe9g7l8bUeee/OWLJ88FLIth8WAbs6Q0F8=; b=mpub9j88OlaHCNNlKsG8nhpTLt+k4hIH3FF2hcAwVwL9Rvjmnsb5s4lLV4P3NlTATYAN Af5AM4hlNrUiruJ196gy6QMsKBRplGryUuUYR1//Nov/gU7k0fMWPBLgyifZRscH+85U AilD7qdgWcxb48JGR3bC+Vw790xD0JSfgU6U3cyMR6PzJvhrksnq0BNMzSbw/ZFifwrK JkevC/F7DCJJlAXDnEGPwPJElW7/w5LfTZkGB3PcO0zRus/sHSRGcj01+ZfUOJ/rxVaV g6B1sAv0uuz532doaBMa7EjNTwtpjEcn4XG7WpZ43pRY55gdtWDJQSL2XwUsKe7H3nEP cw==
Received: from aplex25.dom1.jhuapl.edu (aplex25.dom1.jhuapl.edu [10.114.162.10]) by aplegw02.jhuapl.edu (PPS) with ESMTPS id 427nb0f0yg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Oct 2024 12:48:37 -0400
Received: from APLEX21.dom1.jhuapl.edu (10.114.162.6) by APLEX25.dom1.jhuapl.edu (10.114.162.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 18 Oct 2024 12:48:36 -0400
Received: from APLEX21.dom1.jhuapl.edu ([fe80::20d7:9545:f01e:9b2]) by APLEX21.dom1.jhuapl.edu ([fe80::20d7:9545:f01e:9b2%5]) with mapi id 15.02.1544.011; Fri, 18 Oct 2024 12:48:36 -0400
From: "Sipos, Brian J." <Brian.Sipos@jhuapl.edu>
To: Rick Taylor <rick@tropicalstormsoftware.com>, "dtn@ietf.org" <dtn@ietf.org>
Thread-Topic: Private use/unassigned URI schemes?
Thread-Index: AQHbGprlEju/mWyiYkKhTizHbrsk2bJ/8YcwgAAIXNCAAAcaEIABgoIwgAAEOmCACe2UIIAAwR4wgABM1pCAADACYIAADHRA
Date: Fri, 18 Oct 2024 16:48:36 +0000
Message-ID: <a7d7faef9d544e34aaef2e6146aa7369@jhuapl.edu>
References: <MN0PR01MB76824D0A8F35D230073605F0AA7F2@MN0PR01MB7682.prod.exchangelabs.com> <049145456b764007b3b1297e538f2be4@jhuapl.edu> <38A5475DE83986499AEACD2CFAFC3F9802ADDD4A66@tss-server1.home.tropicalstormsoftware.com> <38A5475DE83986499AEACD2CFAFC3F9802ADDD4A81@tss-server1.home.tropicalstormsoftware.com> <4d02d86b6f60409d924f2eb97e30712a@jhuapl.edu> <38A5475DE83986499AEACD2CFAFC3F9802ADDD5EF1@tss-server1.home.tropicalstormsoftware.com> <dcb75db7d0a94c9d8a70e3b7c1d2a761@jhuapl.edu> <38A5475DE83986499AEACD2CFAFC3F9802ADDD9998@tss-server1.home.tropicalstormsoftware.com> <95abd72d281747bc8b71a3ae3af1b8a6@jhuapl.edu> <38A5475DE83986499AEACD2CFAFC3F9802ADDD9B1D@tss-server1.home.tropicalstormsoftware.com>
In-Reply-To: <38A5475DE83986499AEACD2CFAFC3F9802ADDD9B1D@tss-server1.home.tropicalstormsoftware.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
x-originating-ip: [10.114.162.19]
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="SHA1"; boundary="----=_NextPart_000_0140_01DB215C.0BB48790"
MIME-Version: 1.0
X-CrossPremisesHeadersFilteredBySendConnector: APLEX25.dom1.jhuapl.edu
X-OrganizationHeadersPreserved: APLEX25.dom1.jhuapl.edu
X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-18_12,2024-10-17_01,2024-09-30_01
Message-ID-Hash: HW5YNP3KEAAKXXKCDC7QKGSMDDMNVLLE
X-Message-ID-Hash: HW5YNP3KEAAKXXKCDC7QKGSMDDMNVLLE
X-MailFrom: Brian.Sipos@jhuapl.edu
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-dtn.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "cbor@ietf.org" <cbor@ietf.org>
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [dtn] Re: Private use/unassigned URI schemes?
List-Id: "Delay Tolerant Networking (DTN) discussion list at the IETF." <dtn.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/dtn/mmfQGd8K2W2PaH02RJDPIMMl52g>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dtn>
List-Help: <mailto:dtn-request@ietf.org?subject=help>
List-Owner: <mailto:dtn-owner@ietf.org>
List-Post: <mailto:dtn@ietf.org>
List-Subscribe: <mailto:dtn-join@ietf.org>
List-Unsubscribe: <mailto:dtn-leave@ietf.org>

Rick,

Yes, there is no obvious right answer and internal to a processor there can
be a parameter to handle either case "decode an EID from a sequence" or
"decode an EID from an array container". For a streaming CBOR decoder, the
second option is just the procedure: decode the item header, validate that
it is a 2-item array, and then decode from the interior sequence.

 

For a batch CBOR decoder, I suspect that the API for decoding a sequence (if
present) is actually just to put it in the API version of an array container
(as hinted at in Section 4.2 of RFC 8742
<https://www.rfc-editor.org/rfc/rfc8742.html#section-4.2>  and Section 3.8.4
of RFC 8610 <https://datatracker.ietf.org/doc/html/rfc8610#section-3.8.4> )
or have the caller wrap the bytes in an array framing (if decoder does not
handle sequences). As an example, the python library `cbor2` has no native
notion of sequence handling, it's left to the calling application to figure
out but because it can operate on file-like inputs the file stream itself
can manage sequence iteration at no extra expense.

 

To me it feels like an implementation is free to do things in as much of an
optimized (or not) way as they choose and neither option really restricts or
enhances efficiency of processing. Falling back to "all else being equal"
saving the extra byte tips the scale toward the `.cborseq` embedding of EID.

 

Throwing this back on the CBOR WG side, any opinions or experience in this
kind of thing elsewhere? The presence of both `.cbor` and `.cborseq` CDDL
operators implies that they are each just as expected and reasonable to use.

 

Brian S.

 

From: Rick Taylor <rick@tropicalstormsoftware.com> 
Sent: Friday, October 18, 2024 11:47 AM
To: Sipos, Brian J. <Brian.Sipos@jhuapl.edu>; dtn@ietf.org
Cc: cbor@ietf.org
Subject: [EXT] RE: Private use/unassigned URI schemes?

 


APL external email warning: Verify sender rick@tropicalstormsoftware.com
<mailto:rick@tropicalstormsoftware.com>  before clicking links or
attachments

 

Brian,

 

Yeah.  I can see the logic, and I'm not sure where I stand.   Having posted
my reply I looked at RFC9172, where of course the CBOR structure form,
rather than CBOR array form, is used for the ABS, so there is precedent for
both styles.

 

Sure, the sequence saves a byte, but does it add the possibility of
confusion: "EIDs are always encoded as a CBOR array as defined in RFC9171,
except when they're not" kind of thing?  I wonder whether consistency might
trump the cost of an octet?

 

Rick

 

From: Sipos, Brian J. [mailto:Brian.Sipos@jhuapl.edu] 
Sent: 18 October 2024 15:02
To: Rick Taylor; dtn@ietf.org <mailto:dtn@ietf.org> 
Cc: cbor@ietf.org <mailto:cbor@ietf.org> 
Subject: RE: Private use/unassigned URI schemes?

 

Rick,

Because of the IMO quite well-designed nature of CBOR (and CDDL) there are
several highly efficient possibilities. The main thing is to separate
concerns of "carry or transport an EID (or EID Pattern)" from "decode and
interpret an EID (or EID Pattern)". Within a BPv7 primary block, there is
little value in separating these because it (by definition) is a BP-aware
processor and interpreting the EIDs is necessary (leaving aside the
unknown/private scheme ID issue).

 

But when embedding EIDs in these other not-really-BP-aware protocols or
transports there is a huge burden to force the processing (or at least
handling) of the EID contents. Even in ongoing work to separate a
BPA-independent BPSec library this issue comes up that the ASB contains a
plain EID as its Security Source field [5] but the EID-parsing logic is part
of the BPA (outside a BPSec library) so introduces an interesting coupling
between the two. For something completely BP-unaware like a C509 library it
becomes a huge hurdle if an EID cannot be handled as opaque data.

 

The good thing is that the answers to your questions are pretty simple.

For the first question about burden on decoders, if it is EID-aware
(otherwise why would it be decoding an EID) then it "knows" that an EID by
definition contains exactly two CBOR items and how to interpret them. But
even BP-unaware tools like the CBOR Playground can properly handle the
embedded-CBOR-sequence [6] to get back the original form. Even CBOR
sequences are self-delimited within the bounds of a fixed-length byte
string.

 

For the question about EID-identifying tag, in these cases that I am talking
about there are already extrinsic "type-value" style of identifiers of how
the value should be interpreted. So a tag wouldn't add any additional
information for these uses. There might be some general purpose value, but
not here. These uses all involve situations where the only thing which can
be there is an encoded EID.

 

For the question about preserving or eliding the array container, this gets
more subjective. Both of the following forms carry the same information but
like you said if the array is carried inside the bstr it adds an additional
byte to the encoding (but since the size of the array is fixed there is no
additional information conveyed).

 

   emb-eid1 = bstr .cborseq eid-structure
   emb-eid2 = bstr .cbor eid-structure

 

While this choice is a little arbitrary, this is the crux of my original
question to try to settle on "what seems like the best approach" to avoid
multiple uses of EID-in-bytestring following different conventions. All else
being equal my preference is toward the embedded sequence so that there is
no additional encoded size since the uses of binary-encoded-EID are all
cases where size is at a premium anyway (the C509 use case is not to add
capability but to reduce encoded size and processing needs).

 

As a secondary thought, relating to EID Patterns there will be a similar
need. But the current binary encoding doesn't have a single overall form
like the `eid-structure` and that might need to be corrected along with an
appendix explaining how to embed an EID Pattern within a CBOR byte string.

 

[5] https://www.rfc-editor.org/rfc/rfc9172.html#section-3.6-3.7

[6] https://cbor.me/?bytes=4A02831A000EE868186401
<https://cbor.me/?bytes=4A02831A000EE868186401&embcbor=1> &embcbor=1

 

From: Rick Taylor <rick@tropicalstormsoftware.com
<mailto:rick@tropicalstormsoftware.com> > 
Sent: Friday, October 18, 2024 4:28 AM
To: Sipos, Brian J. <Brian.Sipos@jhuapl.edu <mailto:Brian.Sipos@jhuapl.edu>
>; dtn@ietf.org <mailto:dtn@ietf.org> 
Cc: cbor@ietf.org <mailto:cbor@ietf.org> 
Subject: [EXT] RE: Private use/unassigned URI schemes?

 


APL external email warning: Verify sender rick@tropicalstormsoftware.com
<mailto:rick@tropicalstormsoftware.com>  before clicking links or
attachments

 

Hi Brian,

 

I can understand the advantage of being able to encapsulate any EID as a
CBOR byte string, but I'm unfamiliar with the "CBOR structure" concept.  If
we were to lose the outermost array as you suggest, does this place work on
parsers/processors to 'know' that the structure is expected to have 2
elements?  I feel like we are trading self-description for a byte.

 

However, if a CBOR structure with an out-of-band schema is a well-used
thing, then it's definitely a valid approach.  Also, would a "this is an
EID" tag help, or are we just adding bytes again?

 

I'm not 100% sure of the pros and cons of keeping the CBOR representation of
an EID as an array (definitely a CBOR any), as compared to encapsulating it
in "Some bytes" - I suppose it depends a lot on where it's to be used, and
I'm unfamiliar with the use-cases .  Quickly reading [2], given a Name isn't
defined as a 'CBOR any', then the encapsulation in a bstr seems the sensible
option, but do we really care about saving the 1 byte required by the
outermost array?

 

Just my rambling thoughts.

 

Rick

 

 

From: Sipos, Brian J. [ <mailto:Brian.Sipos@jhuapl.edu>
mailto:Brian.Sipos@jhuapl.edu] 
Sent: 18 October 2024 03:00
To: Rick Taylor;  <mailto:dtn@ietf.org> dtn@ietf.org
Cc:  <mailto:cbor@ietf.org> cbor@ietf.org
Subject: RE: Private use/unassigned URI schemes?

 

Related to EID encoding/handling/decoding: for new applications of EIDs,
outside of existing BPv7 structure, can we find some consensus about a
better way to embed and handle them that eases the burden on the enveloping
context?

 

For example, there is a draft CBOR encoding of X.509 certificates [2] that
could compress the bundleEID Other Name form and some of the new BPv7
application standard drafts involve embedding either EIDs or the proposed
EID Patterns. In other internet applications, one of the benefits to
handling URIs is the ability to treat one as opaque text if all you need to
do is transport/embed it and not actually inspect or dereference it.

 

With CBOR encoding, the use of embedding-in-byte-string [3] provides what I
think is a really great opportunity to have the advantages of being able to
treat specific items as opaque data but still be able to use COTS libraries
to efficiently encode and decode the embedded forms [4]. To be clear, I'm
not proposing altering existing used of EIDs just possible benefits to new
applications that need to embed encoded EIDs.

 

>From Appendix B of RFC 9171 [1] the CDDL for the EID is:

   eid = $eid .within eid-structure

   eid-structure = [

     uri-code: uint,

     SSP: any

   ]

 

Using the EID structure embedded as a CBOR sequence would give the form:

   emb-eid = bstr .cborseq ($eid .within eid-structure)

   eid-structure = [

     uri-code: uint,

     SSP: any

   ]

 

The benefit of this technique is that for small sizes (under 24 bytes
encoded) the total size between the two options doesn't differ. This means
that all valid IPN-scheme EIDs will have no penalty (!) because they encode
to a sequence no longer than 1+1+5+5+9=21 bytes.

 

A specific example of the two forms are the following CBOR EDN and encoded
form for "ipn:977000.100.1".

 

Plain EID:      [2,[977000,100,1]]   <=> 8202831A000EE868186401

Embedded form: <<2,[977000,100,1]>>  <=> 4A02831A000EE868186401

 

Notice that the only difference in encoded form is the leading container
(length-2 array vs. bstr), so converting between the two is also trivial.

 

I'm copying this possible method/example to the CBOR WG mailing list to
solicit advice from CBOR and CDDL experts and ask whether this kind of
bstr-embedding has been widely used elsewhere, and if there are any specific
caveats or gotchas to its use.

 

Thanks for all feedback,

Brian S.

 

[1] https://www.rfc-editor.org/rfc/rfc9171.html#appendix-B

[2] https://datatracker.ietf.org/doc/draft-ietf-cose-cbor-encoded-cert/

[3] https://datatracker.ietf.org/doc/html/rfc8610#appendix-G.3

[4]
https://github.com/laurencelundblade/QCBOR/blob/master/inc/qcbor/qcbor_spiff
y_decode.h#L1975 and
https://github.com/laurencelundblade/QCBOR/blob/master/inc/qcbor/qcbor_encod
e.h#L1851