Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Latest commit

 

History

History
87 lines (76 loc) · 3.47 KB

secured-transport.md

File metadata and controls

87 lines (76 loc) · 3.47 KB

Overview

DtronixMessageQueue utilizes a custom transport protocol which utilizes several of the technologies used in the TLS protocol. A full blown TLS protocol is a little overkill since authentication and encryption type negotiation is not required. Forward-security is a corner stone of this transport protocol. To facilitate that functionality the Diffie–Hellman key exchange methods are used with ephemeral keys generated for each connection.

Once the key echance occurs, the chanels are encrypted with AES-256.

All transmissions are sent in blocks of 16 bytes. This aligns with the 16 byte blocks utilized by 128 bit AES encryption.

Protocol

Pre-Encryption Negotiation Setup

Client Direction Server Notes
CONNECT -> - Initial connection from server
EncryptChannel -> - Contains the first half of the D-H key exchange
- <- EncryptChannel Contains the second half of the D-H key exchange

Types of Headers

Name Frame bytes MqFrameType
(byte)
Body Length
(ushort?)
Payload
(byte[]?)
Description
Unset 1 0 - - Initial state for all headers.
BodyPayload 3 1 ushort [2 bytes] byte[] Contains a body.
Padding 1 2 - - Single byte header. Used to pad to reach 16 byte blocks.
ConnectionClose 2 3 - - Contains a byte stating the reason the seesion closed.
EncryptChannel 1 4 byte[140] - DH Key exchange process.

Header Type BodyPayload

0 1 2
01234567 01234567 01234567
1 (byte) [8]Body Length (uint16) [16]
Body Data (byte[]) [...]

Header Type Padding

0
01234567
2 (byte) [8]

Header Type ConnectionClose

0 1
01234567 01234567
3 (byte) [8]CloseReason(byte) [8]

Header Type EncryptChanel

0
01234567
4 (byte) [8]
DH public key (byte) [140]