mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Implement stream header for BTPv2. #111
This commit is contained in:
@@ -1,25 +1,35 @@
|
||||
package org.briarproject.api.transport;
|
||||
|
||||
|
||||
import org.briarproject.api.crypto.SecretKey;
|
||||
|
||||
public interface TransportConstants {
|
||||
|
||||
/** The length of the pseudo-random tag in bytes. */
|
||||
int TAG_LENGTH = 16;
|
||||
|
||||
/** The maximum length of a frame in bytes, including the header and MAC. */
|
||||
int MAX_FRAME_LENGTH = 1024;
|
||||
/** The length of the stream header IV in bytes. */
|
||||
int STREAM_HEADER_IV_LENGTH = 12;
|
||||
|
||||
/** The length of the message authentication code (MAC) in bytes. */
|
||||
int MAC_LENGTH = 16;
|
||||
|
||||
/** The length of the stream header in bytes. */
|
||||
int STREAM_HEADER_LENGTH = STREAM_HEADER_IV_LENGTH + SecretKey.LENGTH
|
||||
+ MAC_LENGTH;
|
||||
|
||||
/** The length of the frame initalisation vector (IV) in bytes. */
|
||||
int FRAME_IV_LENGTH = 12;
|
||||
|
||||
/** The length of the frame header in bytes. */
|
||||
int HEADER_LENGTH = 4 + MAC_LENGTH;
|
||||
int FRAME_HEADER_LENGTH = 4 + MAC_LENGTH;
|
||||
|
||||
/** The maximum length of a frame in bytes, including the header and MAC. */
|
||||
int MAX_FRAME_LENGTH = 1024;
|
||||
|
||||
/** The maximum total length of the frame payload and padding in bytes. */
|
||||
int MAX_PAYLOAD_LENGTH = MAX_FRAME_LENGTH - HEADER_LENGTH - MAC_LENGTH;
|
||||
|
||||
/** The length of the initalisation vector (IV) in bytes. */
|
||||
int IV_LENGTH = 12;
|
||||
int MAX_PAYLOAD_LENGTH = MAX_FRAME_LENGTH - FRAME_HEADER_LENGTH
|
||||
- MAC_LENGTH;
|
||||
|
||||
/**
|
||||
* The minimum stream length in bytes that all transport plugins must
|
||||
|
||||
Reference in New Issue
Block a user