Skip to main content

build_hybrid_external_aad

Function build_hybrid_external_aad 

Source
pub fn build_hybrid_external_aad(base_aad: &[u8]) -> Vec<u8> ⓘ
Expand description

Extend a base external_aad with the HYBRID_COMPOSITE_ALG_ID binding.

Produces the deterministic CBOR encoding of the 2-element array [base_aad : bstr, HYBRID_COMPOSITE_ALG_ID : bstr]. Wrapping the (already CBOR) base AAD as a byte string inside a fresh 2-bstr array is unambiguous: the Classical AAD is the bare base bytes (a CBOR [int,int] array, major type 4), whereas the Hybrid AAD is a CBOR [bstr,bstr] array (also major type 4 but with bstr elements), so the two TBS inputs can never collide.

Used ONLY in Hybrid mode; Classical mode signs/verifies against the bare base_aad so classical-only behaviour is byte-for-byte unchanged.