On 2025-10-07, at 15:34, Thomas Fossati <[email protected]> wrote:
> 
> However, to be clear: what happens when COSE_X509 is used in a
> protected header (e.g., x5chain, x5bag, x5chain-sender)?  Should it
> obey §9 of RFC 9052, or can it be indefinite-length?

9.  CBOR Encoding Restrictions

   *  The restriction applies to the encoding of the Sig_structure, the
      Enc_structure, and the MAC_structure.

Any Sig_structure, Enc_structure, of MAC_Structure built out of the COSE data 
items containing that protected header needs to be built using common 
deterministic encoding (of which only a small part actually is used in these 
very simple data structures).
Nothing on the wire is influenced by the common deterministic encoding 
constraint.

Note that the common deterministic encoding constraint do not reach into the 
“empty_or_serialized_map” elements.  These byte strings are created in the 
over-the-wire structure as a byte string and then used verbatim in the 
Sig/Enc/MAC_structure computations.

E.g., in 4.4 of RFC 9052 [1]:

   How to compute a signature:

   1.  Create a Sig_structure and populate it with the appropriate
       fields.

(Note that the field computation does *not* mention Section 9.
body_protected/sign_protected simply are copies of the empty_or_serialized map 
that was sent for the protected header in the body/signer structure — this has 
therefore been sent as a byte string for direct use.)

   2.  Create the value ToBeSigned by encoding the Sig_structure to a
       byte string, using the encoding described in Section 9.

(This is the place, analogously for Enc_structure and MAC_structure, where 
Section 9 is applied.)

Grüße, Carsten

[1]: https://www.rfc-editor.org/rfc/rfc9052#section-4.4-5


_______________________________________________
COSE mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to