CoseStructures

The to-be-authenticated structures of COSE. OSCORE and EDHOC never send full COSE messages; they build these structures and feed them to the AEAD or signature algorithm.

Functions

Link copied to clipboard
fun encStructure(protected: ByteArray, externalAad: ByteArray, context: String = "Encrypt0"): ByteArray

Enc_structure = [ context, protected, external_aad ] (RFC 9052 §5.3), the AEAD associated data for COSE_Encrypt0. OSCORE (RFC 8613 §5.4) and EDHOC (RFC 9528 §5.3.2) use it with context "Encrypt0".

Link copied to clipboard
fun sigStructure(protected: ByteArray, externalAad: ByteArray, payload: ByteArray, context: String = "Signature1"): ByteArray

Sig_structure = [ context, body_protected, external_aad, payload ] (RFC 9052 §4.4) for COSE_Sign1, as EDHOC's signature methods use it (RFC 9528 §5.3.2).