Final crypto changes for BTPv2. #111

Use BLAKE2s to generate tags.
KDF arguments for key rotation.
Frame IV format.
This commit is contained in:
akwizgran
2016-01-01 14:53:54 +00:00
parent 19bfe71f18
commit 6a4aea77fb
7 changed files with 103 additions and 70 deletions

View File

@@ -8,12 +8,12 @@ public interface TransportConstants {
/** The length of the pseudo-random tag in bytes. */
int TAG_LENGTH = 16;
/** The length of the stream header IV in bytes. */
int STREAM_HEADER_IV_LENGTH = 24;
/** The length of the message authentication code (MAC) in bytes. */
int MAC_LENGTH = 16;
/** The length of the stream header initialisation vector (IV) in bytes. */
int STREAM_HEADER_IV_LENGTH = 24;
/** The length of the stream header in bytes. */
int STREAM_HEADER_LENGTH = STREAM_HEADER_IV_LENGTH + SecretKey.LENGTH
+ MAC_LENGTH;
@@ -21,8 +21,11 @@ public interface TransportConstants {
/** The length of the frame initalisation vector (IV) in bytes. */
int FRAME_IV_LENGTH = 24;
/** The length of the frame header payload in bytes. */
int FRAME_HEADER_PAYLOAD_LENGTH = 4;
/** The length of the frame header in bytes. */
int FRAME_HEADER_LENGTH = 4 + MAC_LENGTH;
int FRAME_HEADER_LENGTH = FRAME_HEADER_PAYLOAD_LENGTH + MAC_LENGTH;
/** The maximum length of a frame in bytes, including the header and MAC. */
int MAX_FRAME_LENGTH = 1024;