Function hpke::ComputeNonce
source · [−]Expand description
Compute Nonce
The sequence number provides nonce uniqueness: The nonce used for
each encryption or decryption operation is the result of XORing
base_nonce
with the current sequence number, encoded as a big-endian
integer of the same length as base_nonce
. Implementations MAY use a
sequence number that is shorter than the nonce length (padding on the left
with zero), but MUST raise an error if the sequence number overflows.
def Context<ROLE>.ComputeNonce(seq):
seq_bytes = I2OSP(seq, Nn)
return xor(self.base_nonce, seq_bytes)