My programming style is to ’null’ for default value, and h’’ for explicit empty byte array.
From: Carsten Bormann <[email protected]> Date: Tuesday, 14. July 2026 at 15:14 To: Sipos, Brian J. <[email protected]> Cc: [email protected] <[email protected]> Subject: [COSE] Re: [EXT] Re: RFC 9052 clarification on recipient ciphertext CAUTION! External Email. Do not click links or open attachments unless you recognize the sender and know the content is safe. On 2026-07-14, at 14:46, Sipos, Brian J. <[email protected]> wrote: > > The root of the problem is the question “is the decoder-processor supposed to > treat null value any differently? For those interested in the history, here is what Jim Schaad said in <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailarchive.ietf.org%2Farch%2Fmsg%2Fcose%2FvfJ6mfHXq7bu6fw_sLD7f6XSiks&data=05%7C02%7Clijun.liao%40nio.io%7Cb3dc29ed9ff5414b1c7f08dee1a9d8e4%7Cea1b2f97423f4ab3bf6d45a36c09ce34%7C1%7C0%7C639196316812510944%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=YcQHJOC3sO%2F14GFSJ9MBisT1Fu8JULByQBoAMtWMxrc%3D&reserved=0<http://mailarchive.ietf.org/arch/msg/cose/vfJ6mfHXq7bu6fw_sLD7f6XSiks>> about a similar case: >> "For body_protected and sign_protected, if the fields are not present in >> their >> corresponding maps, an bstr of length zero should be used." >> >> Should? The encoding of this is interop-critical. Also, why not use NULL for >> absent field here? > > This is a lower case should and does have the same 2119 language meaning (see > the text in 1.1 about natural language). However 'is' will work just as well. > > I could just as easily use NULL, but there is no size or conception > difference. The change from NULL to an empty bstr came about from the idea > at one point during using arrays that it might be easier to do the parsing if > the empty binary string was used instead. It might also make checking of > types easier. This change got copied down into the structure to be signed as > it made the code easier (just copy the item). As I said, I am not wedded to > either way. I don’t know how that discussion continued, but it shows that Jim viewed null and the empty byte string in that case as interchangeable and the choice to be subject to minutiae such as ease of parsing. Now in that case, a choice was apparently made: empty_or_serialized_map = bstr .cbor header_map / bstr .size 0 Maybe the discrepancy in the case here, ciphertext (text explicitly says “nil" [null] and examples show empty byte string) is an incompletely executed change, or maybe the examples are just showing an incorrect transfer of the …_protected decision to ciphertext. At this point, I’d like to hear from more implementers… Grüße, Carsten _______________________________________________ COSE mailing list -- [email protected] To unsubscribe send an email to [email protected] [Banner]<http://www.nio.io/> This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. You may NOT use, disclose, copy or disseminate this information. If you have received this email in error, please notify the sender and destroy all copies of the original message and all attachments. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
_______________________________________________ COSE mailing list -- [email protected] To unsubscribe send an email to [email protected]
