Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Commit 6517a33

Browse files
authored
Update PROTOCOL.md
1 parent f3eadda commit 6517a33

File tree

1 file changed

+56
-30
lines changed

1 file changed

+56
-30
lines changed

PROTOCOL.md

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,67 @@ Author: ChadSec (Freedom Club)
88
### 1.1. Prologue
99

1010
Coldwire is a post-quantum secure communication protocol focused on:
11-
- Minimal metadata leakage
12-
- 0-trust in server (server is just a dumb relay)
13-
- Messages & Keys plausible deniblity
14-
- Post-quantum future proofing
15-
- Design minimalism
11+
- Minimal metadata
12+
- *0-trust* in server (server is just a dumb relay, and is always assumed malicious)
13+
- Messages & Keys plausible deniblity
14+
- Post-quantum future proofing (NIST Post-quantum algorithms with tier-5 security)
15+
- Design minimalism (few dependecies, simple UI)
16+
1617

1718
There are a **best** and **worst** case scenario for Coldwire's security:
18-
- **Best case security**: Provides unbreakable encryption, no matter how much compute power an adversary has, by utilizing One-time-Pads (OTP) encryption.
19+
- **Best case security**: Provides *unbreakable encryption*, no matter how much compute power an adversary has, by utilizing One-time-Pads (OTP) encryption.
1920

2021
- **Worst case security**: Falls back to `ML-KEM-1024` (`Kyber1024`) security
2122

23+
We depend on The Open-Quantum Safe Project for the implementation of the Post-Quantum (PQ) algorithms.
24+
25+
We have chosen Python for our first `client` implementation for rapid development, and memory-safety. Additionally, this saves us from distributing binaries, which is a great thing security wise.
26+
27+
What you see in the source code tree, is exactly what you get. No surpises.
28+
29+
Additionally, we do extra effort to prevent 0-day exploits (memory-safety issues) in the underlying LibOQS and Tkinter libraries, by always truncating buffers to safe lengths before passing on to the libraries, we reduce the risk of buffer-overflows.
2230

2331
There are no persistent contact lists or user directories on the server, no concept of friend requests server-side, no usernames, no avatars, no bio, IPs, no online status, no metadata.
2432

25-
Server only relays encrypted data between clients, deleting data after delivery. Data is only kept in an in-memory database (official implementation uses Redis).
33+
Server only relays encrypted data between clients, deleting data after delivery. Data is only kept in an in-memory database (official server implementation uses Redis).
2634

2735
### 1.2. Terminology & Wording
2836

29-
`Alice`: User initiating verification (User 1)
37+
`Alice`: Our user, or a hypothetical `User 1`
3038

31-
`Bob`: Contact being verified (User 2)
39+
`Bob`: Our Contact, or a hypothetical `User 2`
3240

3341
`Client`: The Coldwire client software (context-dependent, could refer to user or app)
3442

3543
`User`: The human end-user (not the software)
44+
3645
`SMP`: Socialist Millionaire Problem
3746

38-
All requests payloads and responses are sent & received in `JSON` format, unless expliclity stated otherwise.
47+
`Dilithium`, `Dilithium5`: Interchangeably refers to `ML-DSA-87`
48+
49+
`Kyber`, `Kyber1024`: Interchangeably refers to `ML-KEM-1024`
50+
51+
`per-contact keys`: Refers to a keypair whose public key is **only sent once** to a contact in the `SMP` phase.
52+
53+
*All* requests payloads and responses are sent & received in `JSON` format, unless expliclity stated otherwise.
3954

4055
## 2. Cryptographic Primitives
4156

4257
### 2.1. Authentication:
4358

4459
Long-term Identity Key: `ML-DSA-87` (`Dilithium5`) signature key pair
4560

46-
Per-contact Verification Keys: ML-DSA-87 key pair generated for each contact
61+
Per-contact Verification Keys: `ML-DSA-87` key pair generated for each contact
4762

48-
Identity Verification: Socialist Millionaire Problem (SMP) variant
63+
Identity Verification: Custom `Socialist Millionaire Problem` (`SMP`) human-language variant.
4964

5065
### 2.2. Key Derivation & Proofs:
5166

5267
Hash: `SHA3-512` (Note: we use `SHA3`, because `SHA3`'s Keccak sponge remains indifferentitable from a random oracle even under quantum attacks)
5368

5469
MAC: `HMAC-SHA3-512`
5570

56-
Password-based KDF: `Argon2id` with `Memory_cost` set to `256MB`, `iterations` set to 3 and `salt_length` set to `32`.
71+
Password-based KDF: `Argon2id` with `Memory_cost` set to `256MB`, `iterations` set to `3` and `salt_length` set to `32`.
5772

5873

5974
## 3. Authentication Flow
@@ -70,31 +85,32 @@ Client sends
7085
```
7186
POST /authentication/init
7287
```
73-
with payload that consists of public key (and user_id if re-authenticating).
88+
with payload that consists of `user`'s base64-encoded public key (and `user_id` if re-authenticating).
7489

7590
Server responds with a base64-encoded random challenge.
7691

77-
`Client` decodes challenge, signs it with his Dilithium private key.
92+
`Client` decodes challenge, signs it with his `Dilithium` private key.
7893

7994
`Client` sends signature to ```POST /authentication/verify```.
8095

81-
Server verifies signature:
96+
Server *verifies* signature:
8297

8398
**If valid & key exists**: returns JSON Web Token (JWT) with existing `user_id`.
8499

85100
**If valid & key new**: generates new 16-byte random numeric `user_id`, and returns JWT.
86101

87-
`Client` must include JWT in Authorization header for all subsequent requests.
102+
`Client` must include `JWT` token in Authorization header for all subsequent requests.
88103

89104

90105
## 4. SMP verification
91106

92-
ColdWire uses a human-language variant of Socialist Millionaire Problem (SMP) to verify per-contact keys.
107+
ColdWire uses a human-language variant of *Socialist Millionaire Problem* (`SMP`) to verify per-contact keys.
93108
Server does not store any contact relationships; all verification state is local to the clients.
94109

110+
95111
### 4.1. Assumptions:
96112

97-
Alice wants to add Bob as a contact and verify authenticity of Bob's per-contact key.
113+
`Alice` wants to add `Bob` as a contact and verify authenticity of `Bob`'s per-contact key.
98114

99115
### 4.2. SMP Initiation (Alice → Bob)
100116

@@ -141,7 +157,7 @@ POST /smp/step_2
141157
"proof" : "proof_1 hex encoded",
142158
"nonce" : "rB base64 encoded",
143159
"public_key" : "PK_B base64 encoded",
144-
"recipient_id": "Alice's 16 digits user_id"
160+
"recipient_id": "Alice's 16 digits user ID"
145161
}
146162
```
147163

@@ -161,28 +177,38 @@ POST /smp/step_3
161177
```
162178
```json
163179
{
164-
"proof" : hex(proof_2),
165-
"recipient_id": Bob's user_id
180+
"proof" : "proof_2 hex encoded",
181+
"recipient_id": "Bob's 16 digits user ID"
166182
}
167183
```
168184

169185
### 4.5 SMP Completion (Bob verifies Alice)
170186

171-
Bob computes expected proof_2 and verifies.
187+
`Bob` computes expected `proof_2` and verifies.
188+
189+
**If valid**: mutual key verification established.
190+
191+
*Both* clients mark each others per-contact keys as verified locally.
192+
Now those keys serve as "root of trust" for Perfect Forward Secrecy (PFS) ephemeral keys exchanges.
193+
194+
### 4.6. SMP Security notes
172195

173-
If valid: mutual key verification established.
196+
Per-contact keypairs ensure compartmentalization of trust, we don't re-use our main authentication key for optimal cryptographic hygiene.
174197

175-
Both clients mark contact as verified locally.
198+
Verification security depends on entropy of the answer, `SMP` verification must occur within a relatively short timeframe to avoid brute-force feasibility.
176199

177-
### SMP Security notes
200+
`SMP` answer entropy doesn't have to be astronomically large, it just has to have enough entropy to be uncrackable for the duration of the `SMP` verification process.
178201

179-
Per-contact keypairs ensure compartmentalization of trust.
202+
Server remains unaware of trust relationships. Server is not aware of verification success. Verification is end-to-end.
180203

181-
Verification security depends on entropy of shared answer.
204+
The reason we use `per-contact keys` instead of our main identity keys is for **plausible deniability**, because `per-contact keys` are only exchanged *briefly*.
182205

183-
SMP interaction must occur within short timeframe to avoid brute-force feasibility.
206+
Neither `Alice` nor `Bob` can prove each other's ownership defintively.
184207

185-
Server remains unaware of trust relationships; verification is end-to-end.
208+
This **plausible deniability** only occurs if the server wasn't always malicious. (I.e. the server did not log `Alice` nor `Bob` requests containing their public_key).
186209

210+
This **plausible deniability** only occurs if the server was compromised *After* SMP verification is complete.
187211

188212

213+
## WORK-IN-PROGRESS
214+
We are working on writing more protocol sections

0 commit comments

Comments
 (0)