Crates.io | ecdh-omr |
lib.rs | ecdh-omr |
version | 0.1.1 |
source | src |
created_at | 2024-05-02 20:57:43.781952 |
updated_at | 2024-05-02 21:03:03.512386 |
description | ECDH based Oblivious Message Retrieval |
homepage | |
repository | https://codeberg.org/reach/reach/src/branch/main/common/ecdh-omr |
max_upload_size | |
id | 1228163 |
size | 70,857 |
ECDH-OMR aims to solve the following problem:
ECDH-OMR solves this by using the commutative property of Diffie-Hellman key exchanges to implement a form of public key [blinding], allowing third parties to send messages to a recipient this third party cannot identify at rest or when relaying it. It is a form of Private Information Retrieval.
This library implements this scheme with x25519-dalek and (generically) with RustCrypto's elliptic-curves, as well as their AEADs (again, generically).
Warning This work has not yet been independently audited
While the scheme at it's core received preliminary reviews with positive results, more rigorous proofs should be published before considering its use. The implementation is a first stab at what a reasonable generic API for this could look like and has not received any reviews so far.
For experimental use and research only.
Although its use is not widespread, ECDH supports shared secrets among multiple parties. Effectively, the whole reason why this scheme works is because these two statements are equivalent:
This allows a server (or another third party) to encrypt information for a recipient the real public key they don't know of, and a recipient to decrypt information without having identified them to the server (or another third party).
For the purposes of the breakdown below, Alice sends an unencrypted message to Bob. How Alice would encrypt a message to Bob would have to be handled by a different layer of a protocol using this scheme.
Message = AEAD Dec ( ECDH ( BobSK, BlindedBlindingFactorBK ), Nonce, MessageCiphertext )
For an annotated version of this that also includes "decoys" or, please see examples/decoyed.rs
which also shows the use of decoy hints.
use ecdh_omr::*;
use x25519_dalek::*;
use rand_core::OsRng;
type Hint = ecdh_omr::Hint<X25519, ocb3::Ocb3<aes::Aes128>, 32>;
fn main() {
// Bob
let bob_secret = StaticSecret::random_from_rng(&mut OsRng);
let bob_public = PublicKey::from(&bob_secret); // -> Alice
// Alice
let bob_blinded_by_alice = bob_public.blind(&mut OsRng); // -> Server
let alice_message = [42u8; 32]; // -> Server
// Server
let hint = Hint::new(&bob_blinded_by_alice, &alice_message, &mut OsRng).unwrap(); // -> Bob
// Bob
let bob_recovered_message = bob_secret.try_to_take_the(&hint).unwrap(); // ✅
assert_eq!(alice_message, bob_recovered_message);
}
… Yes. That is necessary. That will exist. Soon. Promise ✨
Fundamentally, because it is a polling based scheme, rather than Fuzzy Message Detection for example where the server does matching work, its scale is limited by bandwidth and compute.
CSIDH/CTIDH technically supports this scheme, but aren't researched well enough researched to be viable at this point. Due to the scale limitations of ECDH-OMR though, it may be conceivable that CTIDH-OMR or ECDH-CTIDH-OMR could be usable in certain circumstances.
ML-KEM is not commutative, so this would require a way for a third party to change the ciphertext without changing the secret embedded within. We're not aware of whether this is possible or not.
ECDH based Oblivious Message Retrieval was developed by @eaon as part of Reach, an end-to-end encrypted communication platform designed for collaborative groups who wish to let anonymous individuals contact them with information and/or requests. Reach and the research that led to this crate has been self-funded so far, please get in touch if you would like to change that 😉
The author also contributed the scheme to SecureDrop's E2EE protocol research.
The author would like to thank Davide @TheZero for his early contribution to the aforementioned research, whereby an unusual use of multi-party Diffie-Hellman key exchanges were used to ephemerally "prove" secret key possession in a challenge/response protocol.
The author would also like to express their gratitude to Jacob Young for highlighting how the challenge/response protocol would allow servers to quickly correlate messages and infer identity properties of recipients, leading the author to take up this problem once again. And then also for taking even more time at [Recurse Center] to review the ECDH based Oblivious Message Retrieval scheme implemented in this crate. 🐙