Edge Protocol

A custom cryptographic protocol designed for secure, stateless key derivation, tamper-resistant identifiers, and efficient verification in crypto-systems.

At a glance
Start date2024-03-09
Language(s)Rust
GitHub Repo(s)
Edge Protocol

Purpose

Edge Protocol provides a secure foundation for crypto-systems without requiring persistent private-key storage. It enables:

Design Goals

Cryptographic Primitives

The Edge Protocol is implemented using Rust generics, allowing developers to supply any compatible algorithms from the RustCrypto ecosystem. This includes:

This design ensures that the protocol is not tied to a specific curve, hash function, or RNG. Implementers can choose primitives that match their performance, security, or compliance requirements while preserving the protocol's structure and guarantees.

Another note: because this library was created with prerelease versions of RustCrypto crates, you may have to use specific prerelease versions of RustCrypto crates.

ECDH

Used for key agreement for encrypting and decrypting requests and responses.

ECDSA

Used for signing and verifying requests and responses.

HKDF

Used to derive private keys and symmetric keys from:

MAC (HMAC or CMAC)

Used to validate IDs, detect tampering, and authenticate requests.

ID Structure

Each ID consists of:

This structure provides:

Key Derivation

Private keys are derived using HKDF:

let salt = csprng.generate_epoch_salt(epoch, purpose);
let mut key = [0u8; 48];
private_key = hkdf.extract(&mut key, &[salt, curve, key_id, associated_data]);

This allows:

Implementation Note:

In the current version, the CSPRNG generates rotating salts that are fed into HKDF as part of the info parameter. A future revision will instead generate rotating HKDF and MAC keys directly and maintain them in a small LRU cache for improved clarity and security.

Associative IDs

IDs can be linked by including one ID within another's MAC input or HKDF info parameter. This enables:

Even if two IDs share identical prefixes and MACs, their derived private keys will differ when associated data is incorporated into the derivation.

Expiring IDs

Expiration timestamps are embedded using:

This enables compact, self‑contained expiration semantics without server‑side state. The exact right‑shift amount, timestamp bit‑width, and epoch/version bit allocation are configurable through the VersionConfig (this will later be named the EpochConfig or RotationConfig). These parameters allow IDs to be made extremely compact, but misconfiguration can lead to premature timestamp rollover or insufficient representable lifetime. Careful selection of these values is required to ensure long‑term system usability.

Data Encryption

Symmetric keys are derived using HKDF with the data's ID, index key, or path as input. Nonces are prefixed to the ciphertext, and pseudorandom nonces are preferred for simplicity and safety.

Limitations and Future Work

Shorter MACs reduce ID size but increase collision and forgery probability.

Version 1 uses epoch-specific salts in the HKDF info parameter. While the salts remain private and are generated by a secure CSPRNG, this design introduces a low-risk vulnerability due to the intended use of the info field. A future revision will replace salts with rotating HKDF and MAC keys generated by the CSPRNG.

The next version of the Edge Protocol will be implemented once the RustCrypto crates reach their next stable minor release, replacing the current prerelease-based implementation.