Re: [Ace] DTLS profile - Open points

Marco Tiloca <marco.tiloca@ri.se> Sat, 22 May 2021 10:05 UTC

Return-Path: <marco.tiloca@ri.se>
X-Original-To: ace@ietfa.amsl.com
Delivered-To: ace@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B153C3A1EC3 for <ace@ietfa.amsl.com>; Sat, 22 May 2021 03:05:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.1
X-Spam-Level:
X-Spam-Status: No, score=-2.1 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, MSGID_FROM_MTA_HEADER=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=ri.se
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 FmQlpO47ctkp for <ace@ietfa.amsl.com>; Sat, 22 May 2021 03:05:53 -0700 (PDT)
Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70040.outbound.protection.outlook.com [40.107.7.40]) (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 07A183A1EC0 for <ace@ietf.org>; Sat, 22 May 2021 03:05:52 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I+VAWtf0pmiqm0Fr7QGWs4SddqlfkpbpcrIrYyDmAdE0ME0YHNvAkhBc7zsj5U5aL1U83o4z8EoU7y2MSEw2nVbabEqSalhgQtgBWDHQ5kRYC3w2TtUp2QWWMV3CNUzDf9B2zN3PZOzz+1XeQKScZPr+4SU6LjjrzZJaqkPzfLvy0SoeQbWG+yZbJ5a+50fz0YIrcNZsIYhEpqYvZSXFiC5GRN6FjiXrwRSrOeRwG6pT5GkPl5RFiQjIGn6fl7SVTbfjl1hhQfm1YR2KqNGErq024Q9LW526yVbiHoRxHmZAyH/QabFBwvuaLPuikbDOlxpwrxl4VJbHvqtWfF29OA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O/EXVSN81Xxq/+uCNewStQmB1iH7E1A25wYqRok4UsM=; b=YY52rEoFZsQDLcrnWBm8yEqRtCwih1GALRT2Y5WoG9ISAI2nw+de1LdToRZynR6oLR5tJqs/vgmbi6CQRV5XZCAJEJA4sHElcZcg/YgQXGniLHf8vB/x7/w7keUsuifMuPZ7tp80P6guKZMD2DUtUE6htr+OniLlzK3veHAK4Li1PKWTMFZe/fwVfqgXADtHSgSEV7SItRD/nu5/2+SdyEfSVMJryVfajxgd+9NiJpjRsIr3Qq1D/rummbh8c11zzF5yy9HfTNaP+9z3++GHnhrrKmIMKtDi9wnyORGxtWJ97rlGQFLaEaRLKj7kloZp3ghi4caOTeo4SgM630SzIw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ri.se; dmarc=pass action=none header.from=ri.se; dkim=pass header.d=ri.se; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ri.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O/EXVSN81Xxq/+uCNewStQmB1iH7E1A25wYqRok4UsM=; b=F3TnFlLJRYe/+un1iaqQUli/qK7pWJ498yEBncAhyhVf7GkyftnFtQHaoTd1DkHPrf3VGdDk6KEvbWMD4pzDTbMMY8S0KEaIqa6LMAt5OmeHMaqYZ0hx6weziUiCMs8Edfc6FrLBuFRqDKwUIm0XL3BPQehWt0Vdk2sn6nEMDTI=
Authentication-Results: ietf.org; dkim=none (message not signed) header.d=none;ietf.org; dmarc=none action=none header.from=ri.se;
Received: from DB8P189MB1032.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:16e::14) by DB6P189MB0406.EURP189.PROD.OUTLOOK.COM (2603:10a6:6:3b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Sat, 22 May 2021 10:05:48 +0000
Received: from DB8P189MB1032.EURP189.PROD.OUTLOOK.COM ([fe80::1913:bcf7:e20a:a4e6]) by DB8P189MB1032.EURP189.PROD.OUTLOOK.COM ([fe80::1913:bcf7:e20a:a4e6%7]) with mapi id 15.20.4150.027; Sat, 22 May 2021 10:05:48 +0000
To: Olaf Bergmann <bergmann@tzi.org>, =?UTF-8?Q?G=c3=b6ran_Selander?= <goran.selander@ericsson.com>
Cc: Carsten Bormann <cabo@tzi.org>, Stefanie Gerdes <gerdes@tzi.de>, Ludwig Seitz <ludwig.seitz@combitech.com>, Daniel Migault <daniel.migault@ericsson.com>, Loganaden Velvindron <loganaden@gmail.com>, ace@ietf.org
References: <78BB5F64-D76D-4BCD-8048-FDB47248680B@ericsson.com> <87cztknt20.fsf@wangari> <87wnrsmdd2.fsf@wangari>
From: Marco Tiloca <marco.tiloca@ri.se>
Message-ID: <346d0a43-7202-5e15-c2cb-60c165e62dce@ri.se>
Date: Sat, 22 May 2021 12:05:45 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1
In-Reply-To: <87wnrsmdd2.fsf@wangari>
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="50AOqE2UMgqbEP0E1jUCHIqRFAM3OmmTa"
X-Originating-IP: [185.76.9.102]
X-ClientProxiedBy: HE1PR0401CA0074.eurprd04.prod.outlook.com (2603:10a6:3:19::42) To DB8P189MB1032.EURP189.PROD.OUTLOOK.COM (2603:10a6:10:16e::14)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
Received: from [10.8.3.8] (185.76.9.102) by HE1PR0401CA0074.eurprd04.prod.outlook.com (2603:10a6:3:19::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Sat, 22 May 2021 10:05:47 +0000
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: c67d265a-75c7-477b-7b90-08d91d092bf8
X-MS-TrafficTypeDiagnostic: DB6P189MB0406:
X-LD-Processed: 5a9809cf-0bcb-413a-838a-09ecc40cc9e8,ExtAddr
X-Microsoft-Antispam-PRVS: <DB6P189MB0406A31EB25A222DA060FED699289@DB6P189MB0406.EURP189.PROD.OUTLOOK.COM>
X-MS-Oob-TLC-OOBClassifiers: OLM:10000;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: 3GhmefCX/yKsK+KCCsRYOS0xqK24ou+tt6+rCYxPN9OvqPwvSzNbegfMeH4oeN9iAKF+2MBuQ4nNq0sdDuEl+MDDAJuNEL/PKiN1m+eSETKfWRlN0hauhr7OkuR+YDdPW7cF/L6Gw7bJuj3cQOQjPYrXr9cp9YBfEtgVgAnNSD+INe6KDgN90uetYFXydJiVmFe15UC5T8UKZsNqxA02jyGYqWyEjQMbIjQ9nmUjZ73vRz5+CM+ypYLlN9+yuTXo+zXqN0Xqo4W3monyLTSp2rctmqiL0eaD7szvZEoc/uNeyxjzXwElKR2MiSdS/6bpp+FsvzhsxmsRZro8Uu9+oHLyCT3Vuf2dDteOlEheIVGOx4jPEZgrUaczLa94parPm1s+a4DtisOhetE8wmbVHZjW5ZJenfHn7D02h6p5kKBIucco4Wf/AbI4CD6veOuNjl76BufpjpdH2lM0bPEYWvTjXgVpJCmS+PLaJXt1y2FDuxy1uuPlmN1vlWTJ4LBUZDqwG2N1fchKhPfznypeJDVNqUdaeLK9NhBUy69bZ4q0/C0MEnEabmjQzr9mjckZVnhmixgYK2+6liGe6guN0emZm0MhRdAWMp4A5kFYPq7bM4wJWeBkyAeqhWhgvOrjecyFGXCQQdPqBkFh61c+xs4XbVDmpS0xb8j/hf678K2WMt06aJms4OnZ6NDy1ROGIlKr+Uf79TeygngOiI1th0TPZVASA+OiSRnGp/JzNoJvb9KPAt3l7Xac2odbNRQF/PkyUmvo6rDaHA+BGaaSqMgTXcFA3rtLEobaZcknEbq1//mEpdEhZKsszotGE00K
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8P189MB1032.EURP189.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(136003)(39840400004)(396003)(346002)(376002)(366004)(956004)(235185007)(66946007)(36756003)(86362001)(5660300002)(16526019)(21480400003)(186003)(54906003)(66556008)(66476007)(44832011)(38100700002)(2906002)(110136005)(6486002)(33964004)(966005)(31696002)(31686004)(478600001)(53546011)(66574015)(83380400001)(2616005)(316002)(16576012)(26005)(8936002)(4326008)(8676002)(43740500002)(45980500001); DIR:OUT; SFP:1101;
X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?UXhiYy91OHZOOGJMbVk2RTl0Vnlodk1aYmlsaWZMZWFKeXllWjE5bUVUWEVP?= =?utf-8?B?cnJHS0V0OUVscUhuNjFEOW9GU29zb2pjNTVoS1YyZS9qT0RPQUwrMC91SlNr?= =?utf-8?B?QjBHLzhhVkI1UWoxeFZBQ1FXTHkwYjZnRlVhQUtxSlZyNEJjSGlUSVdtOEhF?= =?utf-8?B?OGorQythZmlhUE9kTWprZk8vWXdKVzBWYzErRHVyKzNSQUJKa3htUWhaV2h1?= =?utf-8?B?MWtCQllVbURjWU5ualVjNGtIREk5eTR3S1BzYU1GNW01ZmxEWG1rVVlEWXZk?= =?utf-8?B?ZVJlck9XNGpqSkRaa1p2TEMreVFJbm41M3pPSGMyWVhvTjNlNTdTL3RZWS90?= =?utf-8?B?SmxPd0M1RktEbmJXREdiMXdiYit3WmhQWjFCTHU4a0N0cHQxU2NLbEpxamt0?= =?utf-8?B?MGt5NDlydlNaY2UvOS96VEwwZ2ZYd2lrZk04UlNrYmdiM1NmMFdHS24wQkpC?= =?utf-8?B?YlYxeTNad01Tc1NkMWRuK0JCSVFzZXNnaktvbjUvNDVCS1dFUUNrMlBZOGtJ?= =?utf-8?B?R2w4M1lxcFl0SitwWmlyWFFkQVFuWXFWbkdVRE5KL2dYcHFHTjdOZ2NtWktW?= =?utf-8?B?aXl2R3I4SkpKNGVNRERrOTNVK0dSaTg5U1hDcDU1L2pyUy9BSHhjRE5QUWt6?= =?utf-8?B?ck90d2pHUEc5cmFRcFZUenNKVUlHTCtGSnI2MVBqQ3J0M0prMXZ0eUFkT0li?= =?utf-8?B?ZWxQYWZpaFhQRXBCZWdNRTRXWmFTNXI3a2J2ckZyM1lYM0MxMGpPK29qM210?= =?utf-8?B?L2ozWGhkZGtNazJmdGg2OWFLVVBwSUduQkpLRUlOZ3Yyd2RuVjhraHNmY3lq?= =?utf-8?B?eENZODhPb3N0a0pEMEp4aXdkdm5YTUZzZ2IwOHpEWlQxV1UxUlVtMWVCVFJv?= =?utf-8?B?Q2xZeXZKMTNscU9UbkZNL2FacHQwWE1EZ2xpbjJ4Rk4zZVpQKzlIMzhiOWds?= =?utf-8?B?eDB4TTRLeWxKZ2ROZS8rRnVEbmRzZVBZVFhEQTBKMEphTUhsM1NicnBMcmZk?= =?utf-8?B?UEQrRi9IOGE1cjAxdk9aVFpzY2xZYndsZTFhV01RcG1jdnNyamk3YlFQQXdM?= =?utf-8?B?SVBEd0pubnA3WU54OFJvL1FhTjVjTDV5YTg2ZjdBNU9PNHVFUlM1TnpFZ2Ny?= =?utf-8?B?eWsrbkE3cnY2QzNBcEVyeFBid3ZYRmRqR0VMbFJsTmo1M0NWVU5WWGI0RElt?= =?utf-8?B?cXRwcFpxMU9JcjRMRk5LQlBLbE1NRFIyUW43cG1NYktLbkVvbC9OZmNydmRK?= =?utf-8?B?b3haWkNYbyt6QklZUndEMWt5S0tRb1FFYWZUci9RRVdDK09rM1ZDOWV6elJi?= =?utf-8?B?dDZNQjFZOEFXVVFzTFhkd2E0dmdrQTVhS1dCT3h5M29QbVBMbE5RaWNReEM2?= =?utf-8?B?NUFyVitKR2k1ejJBTGdEYnkreG11UjNJU3N3bzBPcjFheDdqS3dmQ085VEZx?= =?utf-8?B?UUR2S2NteWM2SXRsOVRmbUY0YWZlR0pMaDVuSkhYR05VNDQwN3VHaXNVa21Y?= =?utf-8?B?WGxnM3VYcXBwZnpFenhDVjZDdE4vSExVR3Vxb1RwU2tnR1F5TitVN2RFUVE5?= =?utf-8?B?K3hKV0J2YkVTVnVnRlRyVHVmdGhGazdWeHI3YzdpbmJHRVdMek9sWjZmais5?= =?utf-8?B?R2lCVUR3NkRRSUJibWJDYzlHUXo1ZkdiRXc5eEpKeUNoSHZHM3hYOTdncDI0?= =?utf-8?B?ZWxGQllObUh3Vk5vZFdERi9ZVGp6UGthOEZVVjJCQXpQdWRuMFYyVlZsUUtq?= =?utf-8?Q?OWjGiv5+OBnXz5xubKRsQM8O8lVzhWnWMwIFhLU?=
X-MS-Exchange-Transport-Forked: True
X-OriginatorOrg: ri.se
X-MS-Exchange-CrossTenant-Network-Message-Id: c67d265a-75c7-477b-7b90-08d91d092bf8
X-MS-Exchange-CrossTenant-AuthSource: DB8P189MB1032.EURP189.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2021 10:05:48.3762 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 5a9809cf-0bcb-413a-838a-09ecc40cc9e8
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 589GLPnmLN8wEirvFIScW8Xctp9S6MEBpAmGXP21+id7Z/8X+qaFEW22x5Qk/AJq2yu8NiaueuzUWFvIU7zd6w==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6P189MB0406
Archived-At: <https://mailarchive.ietf.org/arch/msg/ace/OIKRykrtT-2FPOxi88eVswGZ5RY>
Subject: Re: [Ace] DTLS profile - Open points
X-BeenThere: ace@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Authentication and Authorization for Constrained Environments \(ace\)" <ace.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ace>, <mailto:ace-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ace/>
List-Post: <mailto:ace@ietf.org>
List-Help: <mailto:ace-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ace>, <mailto:ace-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 22 May 2021 10:05:59 -0000

Hi Olaf,

Thanks for the feeback and additional input; it looks clearer and better 
now.

Please, see inline.

Best,
/Marco

On 2021-05-21 15:21, Olaf Bergmann wrote:
> Hi Göran, Marco,
>
> (Adding the COSE mailing list for potential comments.)
>
> please see inline for my thoughts on this.
>
> On 2021-05-21, Göran Selander <goran.selander@ericsson.com> wrote:
>
>> Hello co-authors,
>>
>> (cc: Marco and ACE co-chairs)
>>
>> Returning to the subject in our recent mail thread I asked Marco to
>> summarize what he thinks remain to be addressed, see below. I think
>> these are valid points that each merit at least a note in the
>> specification. Do you agree?
>>
>> Should we ask Marco to repeat this on the ACE mailing list or is it
>> enough that we resolve them for the next version of the draft?
>>
>> Thanks
>> Göran
>>
>>
>> On 2021-05-20, 17:48, "Marco Tiloca" <marco.tiloca@ri.se> wrote:
>>
>>      Please find below a summary of the four open points.
>>
>>      All of them refer to Section 3.3.2 "DTLS Channel Setup Between Client
>>      and Resource Server", and specifically to the paragraph before
>> and the
>>      paragraph after Figure 9.
>>
>>      The original mail thread has subject "Conversion of access token to
>>      psk_identity".
>>
>>      Best,
>>      /Marco
>>
>>
>>      a) Clarify that the elements of the structure in Figure 9 of Section
>>      3.3.2 have to follow that exact order. This ensures that the
>> result and
>>      its following encoding are deterministic. This can't be taken for
>>      granted from a CBOR implementation building a CBOR map.
> I do not see why we would need to mandate this order. Although this
> could help with optimized parsers, it violates Postel's theorem and
> therefore should be avoided IMO.
>
> (That we indeed might have to say in the document is whether duplicate
> keys are allowed. As we are just using data represenations from other
> sources such as COSE and the CBOR-OAuth mappings, I would expect these
> specs to define the restrictions on the deterministic CBOR; I did not
> check that, though.)

==>MT
I initially interpreted that, by using the elements retrieved from the 
received Token, the RS had to rebuild and store exactly the same 
serialization that the client will have later built and sent on the wire 
as "psk_identity".

That would have required C and RS to agree on a canonical format of the 
CBOR map in Figure 9, to be sure that the "psk_identity" in 
ClientKeyExchange can match with the same "psk_identity" that the RS 
rebuilt and stored after receiving the Token.

Now my RS is storing as local lookup-label only the "kid" (rather than 
the whole "psk_identity" to expect on the wire). If the RS does so and 
actually relies on the "kid" only as a local lookup-label, I agree it's 
not necessary to have a fixed order of "kty" and "kid" into "COSE_Key".

When working on this, I managed to make also the following protected 
resource access work, so addressing also the last point (d), at least in 
Californium --- more on that below.
<==

>
>>      b) In Section 3.3.2, refer to RFC 7925 not only for the case where
>>      psk_identity is the token (see the paragraph following Figure 9), but
>>      also for the case when psk_identity is the structure in Figure 9
>> of the
>>      DTLS profile (see the paragraph before Figure 9).
> No, the uploading case is different because the client itself constructs
> the cnf structure shown in Figure 9.

==>MT
Ok, meaning it's not "opaque data" like in the case where "psk_identity" 
is the Token. Thanks.
<==

>
>>      c) In Section 3.3.2, the text before Figure 9 says: "This
>> structure then
>>      is included as the only element in the "cnf" structure that is
>> used as
>>      value for "psk_identity" as shown in Figure 9."
>>
>>          I think it should be clarified what "is used" actually
>> means. This
>>      can be either:
> Commit be8ac2c now clarifies that the serialized CBOR structure is put
> into the psk_identity (option i).

==>MT
I thought the CBOR serialization should refer to the most outer 
structure as the one used as value of "psk_identity", i.e. the map 
including the "cnf" element, also called "cnf structure".

Then, still following the same functional approach of option (i), I 
think the text should actually say:

OLD:
The CBOR serialization of this structure then is included ...

NEW:
This structure then is included as the only element in the `cnf` 
structure, whose CBOR serialization is used as value for `psk_identity` 
as shown in ...


Correct? To be even more clear, it would help to include after Figure 9 
also the actual serialization used in "psk_identity" for that, which 
should be:

0xA1 08 A1 01 A2 01 04 02 48 3D027833FC6267CE

<==

>
>>          i) using the binary serialization of the structure "as is"
>> with no
>>      re-coding, just like for the case when psk_identity is the token (see
>>      the paragraph after Figure 9); or
>>
>>          ii) saying that the specific way of "using" it for
>> psk_identity is
>>      up to the C and RS to pre-agree somehow, while still giving a
>>      recommendation like the one above; or
>>
>>          iii) see next item (d), trying to address implementations without
>>      "full support" for binary psk_identity.
>>
>>      d) Regarding psk_identity, RFC 7925 has the intent to *not require* a
>>      UTF-8 character string, which remains in general possible to use as
>>      valid opaque byte string. The ultimate goal is to tell to TLS
>>      implementations "don't try to parse" that string, since it may not be
>>      UTF-8 compliant.
> Yes.
>
>>      So, character strings are not *required* but they may
>>      still *be used*.
> I am not sure what this sentence means. Is this about sequences of
> multibyte characters such as UCS-2?

==>MT
It's just a rephrased summary of the text before that :-)

See "RFC 7925 has the intent to *not require* a UTF-8 character string, 
which remains in general possible to use as valid opaque byte string."
<==

>
>>      If so, they just have to be treated as opaque bytes
>>      anyway by DTLS.
>>
>>          As in point (c) above, the profile currently says that: if
>>      psk_identity is the token, its binary serialization is used; if
>>      psk_identity is not the token, the "cnf" structure of Figure 9 "is
>>      used", without further details.
>>
>>          It seems that implementations (e.g., Californium) don't fully
>>      support non-UTF-8 psk_identity values all the way up to an application
>>      needing to retrieve it, like in the case of an ACE RS.
>>
>>          In Californium, DTLS itself works with a non UTF-8 psk_identity
>>      (through a discouraged workaround), but the server eventually stores
>>      that identity to be accessible for the application as a UTF-8 character
>>      string anyway, thus making the original binary identity not available to
>>      the application. This results, in this case, in failed access to
>>      resources. A detailed explanation of this issue in Californium is in the
>>      mail I sent on 2021-05-07, at 12:55 CEST.
>>
>>          An admittedly arguable change in the profile to address both points
>>      (c) and (d) can be:
>>
>>             - When the token is used as psk_identity, then psk_identity is
>>      the base64 serialization of the token, which results in a UTF-8
>>      compliant string.
>>
>>             - When the "cnf" structure is used as psk_identity, then
>>      psk_identity is the base64 serialization of the binary encoding of the
>>      "cnf" structure, which results in a UTF-8 compliant string.
>>
>>             - The above can be the recommended option, unless otherwise
>>      pre-agreed by the Client and Resource Server.
> There has been a longer discussion about this (including my note that
> you could use UTF-8 for serialization to possibly save some bytes
> compared to the more expensive base64.)
>
> However: The major question is if we take this as an opportunity to fix
> the non-compliant Cf rather than specifying an IoT-protocol that wastes
> bytes on the wire although there is a clear recommendation in RFC 7925
> that psk_identity is not be parsed as UTF-8?

==>MT
I think I've solved this, although it was not straightforward.

Now my RS locally forces a convenient DTLS peer identity in its DTLS key 
store, rather than using the "psk_identity" verbatim from the wire 
(which would be easier and more convenient, but it breaks things later 
on as we discussed).

Californium actually provides a method for this manual identity 
"normalization" [1], as available to use in a DTLS Key Store --- in this 
case, basically in the middle of the handshake.

That locally overridden identity is what would be made available to the 
application to retrieve, from messages protected with the DTLS session 
in question. In particular, that identity can locally be set to be a 
character string (e.g., by base64 re-encoding), that the DTLS layer 
would thus make available to the application as usual, for matching with 
the peer identity paired with the stored Token, and ultimately making 
access control checks work as expected.

So, it would still be better that the peer identity was possible for the 
application to retrieve also when a non-character-string, but it seems 
anyway possible in Californium to be compliant with the spec through 
this additional manual normalization.

Thanks,
/Marco


[1] 
https://github.com/eclipse/californium/blob/df967c316fd6a4809f2f23ec10102e8d6a1bf73a/scandium-core/src/main/java/org/eclipse/californium/scandium/dtls/PskPublicInformation.java#L122
<==

>
> Grüße
> Olaf

-- 
Marco Tiloca
Ph.D., Senior Researcher

Division: Digital System
Department: Computer Science
Unit: Cybersecurity

RISE Research Institutes of Sweden
https://www.ri.se

Phone: +46 (0)70 60 46 501
Isafjordsgatan 22 / Kistagången 16
SE-164 40 Kista (Sweden)