Skip to main content

encode_secured_submessage_multi

Function encode_secured_submessage_multi 

Source
pub fn encode_secured_submessage_multi(
    plugin: &dyn CryptographicPlugin,
    local: CryptoHandle,
    receivers: &[(CryptoHandle, u32)],
    plaintext: &[u8],
) -> Result<Vec<u8>, SecurityRtpsError>
Expand description

Encodes a plain submessage blob as a secured sequence WITH receiver-specific MACs in the SEC_POSTFIX (spec §7.3.6.3).

The crypto plugin produces a common ciphertext plus a list of (key_id, mac) entries, one per reader.

§Wire layout SEC_POSTFIX (body)

  u32  count
  [ u32 key_id ; u8 mac[16] ] * count     // 20 bytes per entry

§Errors

  • Crypto passed through from the plugin.
  • Truncated if the MAC list > MAX_RECEIVER_MACS or the ciphertext > u32::MAX / SEC_POSTFIX body > u16::MAX.