Skip to content

Commit 9970530

Browse files
authored
Update PROTOCOL.md
1 parent 4b00256 commit 9970530

File tree

1 file changed

+72
-53
lines changed

1 file changed

+72
-53
lines changed

PROTOCOL.md

Lines changed: 72 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,149 @@
1-
COLDWIRE PROTOCOL
1+
# COLDWIRE PROTOCOL
22

33
Version: Draft 1.0 (Work in Progress)
4+
45
Author: ChadSec (Freedom Club)
56

6-
INTRODUCTION
7+
## 1. INTRODUCTION
8+
### 1.1. prologue
79

8-
ColdWire is a post-quantum secure communication protocol focused on:
10+
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
916

10-
Minimal metadata leakage
17+
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.
1119

12-
Server as a dumb relay (no trust in server)
20+
- **Worst case security**: Falls back to `ML-KEM-1024` (`Kyber1024`) security
1321

14-
Per-contact cryptographic verification
1522

16-
No persistent contact lists or user directories on the server
23+
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.
1724

18-
No concept of friend requests server-side
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).
1926

20-
Server only relays encrypted messages between clients, deleting data after delivery.
27+
### 1.2. Terminology & wording
2128

22-
CRYPTOGRAPHIC PRIMITIVES
29+
`Alice`: User initiating verification (User 1)
2330

24-
Authentication:
31+
`Bob`: Contact being verified (User 2)
2532

26-
Long-term Identity Key: ML-DSA-87 (Dilithium5) signature key pair
33+
`Client`: The Coldwire client software (context-dependent, could refer to user or app)
2734

28-
Per-contact Verification Keys: ML-DSA-87 key pair generated for each contact
35+
`User`: The human end-user (not the software)
36+
`SMP`: Socialist Millionaire Problem
2937

30-
Identity Verification: Socialist Millionaire Problem (SMP) variant
38+
## 2. CRYPTOGRAPHIC PRIMITIVES
3139

32-
Key Derivation & Proofs:
40+
### Authentication:
3341

34-
Hash: SHA3-512
42+
Long-term Identity Key: `ML-DSA-87` (`Dilithium5`) signature key pair
3543

36-
Password-based KDF: Argon2id
44+
Per-contact Verification Keys: ML-DSA-87 key pair generated for each contact
3745

38-
MAC: HMAC-SHA3-512
46+
Identity Verification: Socialist Millionaire Problem (SMP) variant
3947

40-
AUTHENTICATION FLOW
48+
### Key Derivation & Proofs:
4149

42-
Identity Key Generation
50+
Hash: `SHA3-512` (Note: we use `SHA3`, because `SHA3`'s Keccak sponge remains indifferentitable from a random oracle even under quantum attacks)
4351

44-
Client generates ML-DSA-87 key pair locally.
52+
MAC: `HMAC-SHA3-512`
4553

46-
Public key and user ID used for authentication; private key stored securely on disk.
54+
Password-based KDF: `Argon2id` with `Memory_cost` set to `256MB`, `iterations` set to 3 and `salt_length` set to `32`.
4755

48-
Registration / Login
4956

50-
Client sends POST /authentication/init with public key (and user_id if re-authenticating).
57+
## 3. AUTHENTICATION FLOW
5158

52-
Server responds with a base64-encoded random challenge.
59+
### Identity Key Generation
5360

54-
Client decodes challenge, signs it with Dilithium private key.
61+
`Client` generates a `ML-DSA-87` keypair locally (if he doesn't already have a keypair.)
5562

56-
Client sends signature to POST /authentication/verify.
63+
`Public key` and `user ID` used for authentication; private key stored securely on disk.
5764

58-
Server verifies signature:
65+
### Registration / Login
5966

60-
If valid & key exists: returns JSON Web Token (JWT) with existing user_id.
67+
Client sends
68+
```
69+
POST /authentication/init
70+
```
71+
with JSON payload that consists of public key (and user_id if re-authenticating).
6172

62-
If valid & key new: generates new 16-byte random numeric user_id, returns JWT.
73+
Server responds with a base64-encoded random challenge.
74+
75+
`Client` decodes challenge, signs it with his Dilithium private key.
6376

64-
Client must include JWT in Authorization header for all subsequent requests.
77+
`Client` sends signature to POST /authentication/verify.
6578

66-
TERMS
79+
Server verifies signature:
6780

68-
Alice: User initiating verification (User 1)
81+
**If valid & key exists**: returns JSON Web Token (JWT) with existing `user_id`.
6982

70-
Bob: Contact being verified (User 2)
83+
**If valid & key new**: generates new 16-byte random numeric `user_id`, and returns JWT.
7184

72-
Client: The Coldwire client software (context-dependent, could refer to user or app)
85+
`Client` must include JWT in Authorization header for all subsequent requests.
7386

74-
User: The human end-user (not the software)
7587

76-
CONTACT VERIFICATION (SMP VARIANT)
88+
## 4. SMP verification
7789

7890
ColdWire uses a human-language variant of Socialist Millionaire Problem (SMP) to verify per-contact keys.
7991
Server does not store any contact relationships; all verification state is local to the clients.
8092

81-
Assumptions:
93+
### 4.1. Assumptions:
8294

8395
Alice wants to add Bob as a contact and verify authenticity of Bob's per-contact key.
8496

85-
5.1 SMP INITIATION (Alice → Bob)
97+
### 4.2. SMP Initiation (Alice → Bob)
8698

8799
Alice generates per-contact ML-DSA-87 key pair (PK_A, SK_A). Stores SK_A locally.
88100

89101
Alice composes human-language question & normalized answer.
90102

91103
Alice sends:
92-
104+
```
93105
POST /smp/initiate
106+
```
107+
```json
94108
{
95109
"question" : "What cafe did we meet at last time?",
96-
"nonce" : base64(32 random bytes) # rA
97-
"public_key" : base64(PK_A)
98-
"recipient_id": Bob's user_id
110+
"nonce" : "32 random bytes that are base64 encoded", # rA
111+
"public_key" : "PK_A base64 encoded"
112+
"recipient_id": "Bob's user ID"
99113
}
114+
```
100115

101-
5.2 SMP STEP 2 (Bob Alice)
116+
### 4.3. SMP STEP 2 (Bob to Alice)
102117

103-
Bob generates per-contact ML-DSA-87 key pair (PK_B, SK_B).
118+
Bob generates per-contact `ML-DSA-8`7 key pair (`PK_B`, `SK_B`).
104119

105120
Bob reads question, inputs answer.
106121

107122
Computes shared secret:
108-
123+
```python
109124
fpA = sha3_512(PK_A)
110-
rA = Alice's nonce (decoded from base64)
125+
rA = b"Alice's nonce (decoded from base64)"
111126
rB = random_bytes(32)
112127
secret = normalize(answer)
113128
secret = argon2id(secret, sha3_512(rA + rB))
114129
message = rA + rB + fpA
115130
proof_1 = HMAC(secret, message, sha3_512)
131+
```
116132

117133
Bob sends:
118-
134+
```
119135
POST /smp/step_2
136+
```
137+
```json
120138
{
121-
"proof" : hex(proof_1),
122-
"nonce" : base64(rB),
123-
"public_key" : base64(PK_B),
124-
"recipient_id": Alice's user_id
139+
"proof" : "proof_1 hex encoded",
140+
"nonce" : "rB base64 encoded",
141+
"public_key" : "PK_B base64 encoded",
142+
"recipient_id": "Alice's 16 digits user_id"
125143
}
144+
```
126145

127-
5.3 SMP STEP 3 (Alice → Bob)
146+
### 4.4. SMP STEP 3 (Alice → Bob)
128147

129148
Alice computes expected proof_1 from Bob and verifies.
130149

0 commit comments

Comments
 (0)