[COSE] Re: C509 Native signature calculation

Brian Sipos <brian.sipos+ietf@gmail.com> Thu, 16 July 2026 01:31 UTC

Return-Path: <brian.sipos@gmail.com>
X-Original-To: cose@mail2.ietf.org
Delivered-To: cose@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1]) by mail2.ietf.org (Postfix) with ESMTP id B96881178EA9D for <cose@mail2.ietf.org>; Wed, 15 Jul 2026 18:31:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ietf.org; s=ietf1; t=1784165477; bh=wMTAB6GvDYePuMGI6jkrivqb0866rBED/5oJz08ugj0=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=YFz1yet9pP9F9FpvTM9zAv/OtUr7CLzYwZEzGaOhVZ/kJ46m8BL2K9kkHJwCPKo+r klK7NsKYkVIx/EWW3yyowM2ldqwp4cq+qi+jLapWRn4f63ZZPDhcV+peSt3GHwbUwr +29A/BU/HnAuCWpv+yTiloMMORGYkuafO8527l9E=
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: mail2.ietf.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail2.ietf.org ([166.84.6.31]) by localhost (mail2.ietf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id USS7JDCUFF-9 for <cose@mail2.ietf.org>; Wed, 15 Jul 2026 18:31:17 -0700 (PDT)
Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail2.ietf.org (Postfix) with ESMTPS id 427231178EA96 for <cose@ietf.org>; Wed, 15 Jul 2026 18:31:17 -0700 (PDT)
Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-472326ca506so4913788f8f.2 for <cose@ietf.org>; Wed, 15 Jul 2026 18:31:17 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1784165470; cv=none; d=google.com; s=arc-20260327; b=CfMdmHxPAR/mq9ryU6Hmv6vHVNuFc0gMolAw2QX2FHJRiqgJEhsWQTw6czIf3JCMWF 2/ZUoi+ulLYUJgA9nvGOOp9Yb7hazbcYuqZD7ks0t0zZ44f1cxZYDgVVyQ/TxkXbKNHQ jI6D8AzKJyQKvKSkB3eqLJgBLx3nm3WhAvkUnd0CTqS2iJfQRpTsyoNOdRwCi/ZInN5i zyh+rS1wT1U7du7+qSoluMj7M5G7md0mNoNv4v7HRiDd8ZiRMbxjC0RrTK/lDS+PEzci rjpPpJe282ii0OaHVf+iVmhoS+hIwM8sIjDPe3NQ/g2sKbq/drEbv2X8OCJ+7UeE7T2t GAYA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=wMTAB6GvDYePuMGI6jkrivqb0866rBED/5oJz08ugj0=; fh=6VPMFHQlacinljH6S+7kprcCTPojkYZxUd7end4Z8Ww=; b=WHJkE34FRkhCgQjT1oVtpWGxhuYeBMuYKwT5GoEHt7oi92J0KvdyM4PUyER7nURTJi uUu71TXK17MiG2g4jvYDmSLXWm5cgDwshb4GtPDXTPShjDspxGZFEpKT8hDdtN9fVcfC +S54y7ji2JfgX4inzv9rCrlbfYwhlf7CD1CKm8g2VmOJyd8S6a4Cd0csMoPIv40nNaAw uPkslqwN6YHD9bSdnUg6AoruFOGfpmQGUfgabwiH5E1jefPck2kY7zdhNqcdRA2nafMD MQmWyUSjDGUBcJdRcYA/aNSXB8TpREMVgYqi7UhSSpixxYjOX8j7ajUfDcTw0aSMAATG G5Ew==; darn=ietf.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784165470; x=1784770270; darn=ietf.org; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wMTAB6GvDYePuMGI6jkrivqb0866rBED/5oJz08ugj0=; b=EoEgUWl9ST7nmufDtI/Cqml01+lzhIcZAZPOEI5mjcG2WK39oe0tuG0ptNARZ462QD Ie456+xx5pFbXtGkVwal3ewoce9anSkrGy/02dp8MOw+7qrdwFrHoubBAaKMOGDHYE5I cUY+p7791FL7lxn6q8yx0+d/4QSD3BalGw7RVfFpwfHlRnbqO0Rcyfdxz63A6CCKEEWf jWwlhNr3KyiW7hGexfj5wMP8wFWz23jsEu0G46tA7g5T3lCbbkjABhhk5/bHeX/K/+rj FtTg/ALYTPDDFdIHnMo9INFSPjsJRSRoojyHtk3CE1VykKr7Q5gqhegpBVbgJmxVh55Y ve9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784165470; x=1784770270; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=wMTAB6GvDYePuMGI6jkrivqb0866rBED/5oJz08ugj0=; b=YACi8VD04fOem+6TPexRY2YechpXWtwPIoxx9H4bR3/cGUmoFn+ccJ+eqzSSj2/uYY KB38dO6JE4aMJU1IA8h5vBRol6791OTXDtfceU+ap0p2oael7ZpYl4FSGCzw8KRSRHOU y6aJKbhIq6W0uletr9ETZQ5Q3pahaT5Q+ylwkSg3kJDDX+KnUUgDLaOvZ7kPA0Gpzif2 s0+r2T4dTCPCGGbXdk4tcuLwarRCXwnrYq7QvRgzeTudeIx+d6ffsmyiyS4ohmEDub4P 7UlErxuP7Fb0VNhJB3guc6gm6vXIsdftx3m+l2PERNz5Ap/BOs/vEJZ9OLDSNWuR7W9s j/9w==
X-Gm-Message-State: AOJu0YyB2ZW5mgZ4+VZQ5+PXRo0veZo4Z8FcNig8k4O8uWB39+buPCF3 Tj8+6pJlLkIxokzRzba37YJq8wvsVU+GjSZ3C/9O+I0ro6OzjvyzKNskROgX1n/MjGzGyV3kzUw sBzyqJfbawe/hpTjz34+93DE9TzZPXhF2+DcH
X-Gm-Gg: AfdE7cn3kV5NR+aMev8CHxxplLIDGwcMmAU4bqw6if+hmMamut4NwRkg5KkX/WL5DfY FrLqrGrSAFCTaXh/GZAVDepsah0slULXohW3g3nI8F0cd+GTIz+FxKfVxxdWQYhhy5U2ew5NvnI SGMbUbtO3dV2qD46lyWdBR3eZYJB2kMFczkHqNepm+RylzYlc8zKKXwmh4cV0xXZm5jXA3nxxnl EehX5HwGJGclBR1g3ATTtdu6Ef1K2mwHDslro5d4YGfo+M9cFswH1SCx9oiKw==
X-Received: by 2002:a05:6000:1786:b0:474:3b3b:5e5f with SMTP id ffacd0b85a97d-47f46340659mr13798773f8f.16.1784165470041; Wed, 15 Jul 2026 18:31:10 -0700 (PDT)
MIME-Version: 1.0
References: <DEAE8CA2-8CF4-42A3-B370-9FE7EBB972AA@island-resort.com>
In-Reply-To: <DEAE8CA2-8CF4-42A3-B370-9FE7EBB972AA@island-resort.com>
From: Brian Sipos <brian.sipos+ietf@gmail.com>
Date: Wed, 15 Jul 2026 21:30:58 -0400
X-Gm-Features: AUfX_mwZfn_-PnuPghdSWjZH9dwbhLSmyJf9tQYxcKVf1JmUAscjnhCDMGb9KMo
Message-ID: <CAM1+-ggry2KE8gcNVi-9onjiswtjfjif19OKAzD1+9WV+R3Q-A@mail.gmail.com>
To: Laurence Lundblade <lgl@island-resort.com>
Content-Type: multipart/alternative; boundary="0000000000000ffa550656b065eb"
Message-ID-Hash: XE7K7S6QXKC23XOFEPJE5CZOQ7QP6GTE
X-Message-ID-Hash: XE7K7S6QXKC23XOFEPJE5CZOQ7QP6GTE
X-MailFrom: brian.sipos@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cose.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: cose <cose@ietf.org>
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [COSE] Re: C509 Native signature calculation
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/V9fHKTeGPfqpFWSAFMJ1V7dJmEk>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Owner: <mailto:cose-owner@ietf.org>
List-Post: <mailto:cose@ietf.org>
List-Subscribe: <mailto:cose-join@ietf.org>
List-Unsubscribe: <mailto:cose-leave@ietf.org>

Laurence,
One other interesting example of needing "part of a CBOR sequence" for
hashing is in the EDHOC protocol when using (the transport-specific
equivalent of) the media type "application/cid-edhoc+cbor-seq" as opposed
to the basic "application/edhoc+cbor-seq". The difference is that the
content is "... an EDHOC message prepended by a connection identifier ..."
which is just CBOR sequence concatenation CID + edhoc_msg. For the decoder
though, the CID is _not_ part of the message and needs to be excluded from
the transcript hash of the message!

So this is another case of non-trivial (maybe "special") access to the
encoded CBOR data of part of a larger structure. Similarly to BPv7 CRC
evaluation, the EDHOC message hash could be taken from a re-encoding of
just the message (without CID prefix) or through extra information about in
which part of the encoded data the message resides.

To your original question here: I did some naive experimentation of C509
creation and validation with Python cbor2 library and cryptography library
(and it all worked).

Brian S.

On Wed, Jul 15, 2026 at 4:05 PM Laurence Lundblade <lgl@island-resort.com>
wrote:

> We’re having a discussion on signing/hashing in the CBOR WG. See [Hashing
> non-wrapped CBOR]. COSE byte-string wraps hashed/signed data. Bundle and
> C509 don't.
>
> I believe hashing non-wrapped CBOR affects which CBOR libraries you can
> use. Or stated differently, it puts a new requirement on CBOR libraries. My
> personal view has been that byte string wrapping is the proper practice as
> described in [Appendix G] because simple CBOR libraries don’t provide
> access to the undecoded CBOR of sub-parts, but maybe that turns out not to
> be the case.
>
> Can you comment on implementations that have been done of C509 native
> signatures and which CBOR libraries they used?
>
> LL
>
>
> [Appendix G]:
> https://www.ietf.org/archive/id/draft-ietf-cbor-serialization-07.html#name-cbor-byte-string-wrapping
> [Hashing non-wrapped CBOR]:
> https://mailarchive.ietf.org/arch/msg/cbor/BZ6GiQ2B69K4Nv0jmuDGBvFhlEw/
>
>
>
>
> _______________________________________________
> COSE mailing list -- cose@ietf.org
> To unsubscribe send an email to cose-leave@ietf.org
>