NONCE | Secret Box | Tag |
---|---|---|
* | * | * |
Type | Timestamp | Packet ID | Payload Length | Payload | Padding |
---|---|---|---|---|---|
1 byte | 4 bytes int32 | 8 byte int64 | 2 bytes int16 | * | * |
Secret box is encrypted using CHACHA20-POLY1305
- Client Hello
- Server Hello
- Data
- ACK
- SACK
Handshake is encrypted using 256 bit pre-shared key:
HMAC_SHA256(PSK, TOTP_HEX(PSK))
Client generate a RSA key pair. and put the public key in secret box.
Server generate a random key for data transfer , encrypt it with public key , and send it to client.
User custom data
3: Normal Data
4: Data must reply ACK
5-10: Reversed
Confirm packet is received
If server received out-of-order packet , request missing packet immediately.