mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Variable-length frames (untested).
This commit is contained in:
@@ -13,10 +13,10 @@ public interface AuthenticatedCipher {
|
||||
throws GeneralSecurityException;
|
||||
|
||||
/** Encrypts or decrypts data in a single-part operation. */
|
||||
int doFinal(byte[] input, int inputOff, int len, byte[] output,
|
||||
int process(byte[] input, int inputOff, int len, byte[] output,
|
||||
int outputOff) throws GeneralSecurityException;
|
||||
|
||||
/** Returns the length of the message authenticated code (MAC) in bytes. */
|
||||
/** Returns the length of the message authentication code (MAC) in bytes. */
|
||||
int getMacLength();
|
||||
|
||||
/** Returns the block size of the cipher in bytes. */
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.IOException;
|
||||
public interface StreamEncrypter {
|
||||
|
||||
/** Encrypts the given frame and writes it to the stream. */
|
||||
void writeFrame(byte[] payload, int payloadLength, boolean finalFrame)
|
||||
throws IOException;
|
||||
void writeFrame(byte[] payload, int payloadLength, int paddingLength,
|
||||
boolean finalFrame) throws IOException;
|
||||
|
||||
/** Flushes the stream. */
|
||||
void flush() throws IOException;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.api.transport;
|
||||
|
||||
|
||||
public interface TransportConstants {
|
||||
|
||||
/** The length of the pseudo-random tag in bytes. */
|
||||
@@ -8,18 +9,18 @@ public interface TransportConstants {
|
||||
/** The maximum length of a frame in bytes, including the header and MAC. */
|
||||
int MAX_FRAME_LENGTH = 1024;
|
||||
|
||||
/** The length of the initalisation vector (IV) in bytes. */
|
||||
int IV_LENGTH = 12;
|
||||
|
||||
/** The length of the additional authenticated data (AAD) in bytes. */
|
||||
int AAD_LENGTH = 6;
|
||||
|
||||
/** The length of the frame header in bytes. */
|
||||
int HEADER_LENGTH = 2;
|
||||
|
||||
/** The length of the message authentication code (MAC) in bytes. */
|
||||
int MAC_LENGTH = 16;
|
||||
|
||||
/** The length of the frame header in bytes. */
|
||||
int HEADER_LENGTH = 4 + MAC_LENGTH;
|
||||
|
||||
/** 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;
|
||||
|
||||
/**
|
||||
* The minimum stream length in bytes that all transport plugins must
|
||||
* support. Streams may be shorter than this length, but all transport
|
||||
|
||||
Reference in New Issue
Block a user