Owner: @Marcin Pawlowski
Reviewers: 🟢@Youngjoon Lee 🟢@Alexander Mozeika 🟢@Álvaro Castro-Castilla
This document defines an implementation-friendly specification of the Payload Formatting, which is introduced in the Formatting section.
The payload contains a header and a body. The header informs the protocol about the way the body must be handled. The body contains a raw message (data/proposal or cover message). The payload must be of a fixed length to prevent adversaries from distinguishing types of messages based on their length. Therefore, shorter messages must be padded with random data.
The Payload
is a structure that contains a header
and a body
.
class Payload:
header: Header,
body: bytes
The header
is a structure that contains a body_type
and a body_length
.
class Header:
body_type: byte,
body_length: uint16
We define the following values of the body_type
:
body_type=0x00
, informs that the body
contains a cover message.body_type=0x01
, informs that the body
contains a data message.Any other value of type means that the message was not decapsulated correctly and must be discarded.
We define the body_length
as uint16. Therefore, the theoretical limit of the length of the body
is 65535 bytes. The body_length
must be set to the length of the body of the payload message (body_length=len(raw_message)
).