Skip to main content

derive_candidate_entry

Function derive_candidate_entry 

Source
pub fn derive_candidate_entry(transparent_statement: &[u8]) -> Result<Vec<u8>>
Expand description

Derives the candidate entry from a presented Transparent Statement.

The input MUST be a COSE_Sign1 with four array elements: protected-header byte string, unprotected-header map, attached-payload byte string, and signature byte string. The payload MUST be present as a byte string; a null payload indicating detached content is not permitted. The input may be an untagged COSE_Sign1 or a COSE_Sign1 wrapped in tag 18.

The output is the deterministically encoded CBOR array [P, {}, M, S] where P, M, and S are the original byte-string contents and the unprotected header is replaced by an empty CBOR map (0xa0).

§Errors

Returns Error::Cose if the input is not valid CBOR, is not a four-element COSE_Sign1 array (with or without tag 18), the unprotected header is not a map, contains a null or detached payload, or has trailing bytes after the CBOR object.

§Derivation rules

  • P, M, and S are preserved by content. Their internal bytes are not parsed or reserialized.
  • The outer array is definite-length with shortest definite-length byte-string encodings per RFC 8949 Section 4.2.1.
  • The unprotected header is replaced by an empty map. This means attaching, removing, or modifying receipts does not change the candidate entry.