Crates.io | morf |
lib.rs | morf |
version | 0.2.1 |
source | src |
created_at | 2024-01-14 12:03:33.985623 |
updated_at | 2024-08-08 11:54:52.868048 |
description | Simple authenticated encryption layer over RF |
homepage | |
repository | |
max_upload_size | |
id | 1099385 |
size | 30,103 |
MoRF is a mutually-authenticated, encrypted communication protocol over lossy packet links with small MTUs, e.g. LoRa. Inspired by Noise.
no_std
compatible, no dynamic memory allocationTo establish an encrypted session, a client initiates a handshake to a server to exchange keys. Both peers are required to have ahead-of-time knowledge of each other's public key.
initial_encryption_key
server_ephemeral_public_key_mac_key
Let $InitialKey = DeriveKey(X25519(CE_{sec}, SS_{pub}), InitialEncryptionKeyInfo)$.
Field | Length |
---|---|
$Const(3)$ | 1 |
$CE_{pub}$ | 32 |
$ChaCha20(InitialKey, Hash(CS_{pub}))$ | 16 |
Lookup client static public key $CS_{pub}$ from the provided hash.
Let $ServerSepkMacKey = DeriveKey(X25519(SS_{sec}, CE_{pub}), ServerEphemeralPublicKeyMacKeyInfo)$.
Let $ServerSessionKey = Concat(X25519(SE_{sec}, CS_{pub}), X25519(SE_{sec}, CE_{pub}))$.
Field | Length |
---|---|
$Const(1)$ | 1 |
$SE_{pub}$ | 32 |
$Mac(ServerSepkMacKey, SE_{pub})$ | 16 |
Let $ClientSepkMacKey = DeriveKey(X25519(CE_{sec}, SS_{pub}), ServerEphemeralPublicKeyMacKeyInfo)$.
Check that:
$Mac(ClientSepkMacKey, Packet2[1:33]) == Packet2[33:49]$
Let $ClientSessionKey = Concat(X25519(CS_{sec}, SE_{pub}), X25519(CE_{sec}, SE_{pub}))$.