|
1 | | -COLDWIRE PROTOCOL |
| 1 | +# COLDWIRE PROTOCOL |
2 | 2 |
|
3 | 3 | Version: Draft 1.0 (Work in Progress) |
| 4 | + |
4 | 5 | Author: ChadSec (Freedom Club) |
5 | 6 |
|
6 | | -INTRODUCTION |
| 7 | +## 1. INTRODUCTION |
| 8 | +### 1.1. prologue |
7 | 9 |
|
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 |
9 | 16 |
|
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. |
11 | 19 |
|
12 | | -Server as a dumb relay (no trust in server) |
| 20 | +- **Worst case security**: Falls back to `ML-KEM-1024` (`Kyber1024`) security |
13 | 21 |
|
14 | | -Per-contact cryptographic verification |
15 | 22 |
|
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. |
17 | 24 |
|
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). |
19 | 26 |
|
20 | | -Server only relays encrypted messages between clients, deleting data after delivery. |
| 27 | +### 1.2. Terminology & wording |
21 | 28 |
|
22 | | -CRYPTOGRAPHIC PRIMITIVES |
| 29 | +`Alice`: User initiating verification (User 1) |
23 | 30 |
|
24 | | -Authentication: |
| 31 | +`Bob`: Contact being verified (User 2) |
25 | 32 |
|
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) |
27 | 34 |
|
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 |
29 | 37 |
|
30 | | -Identity Verification: Socialist Millionaire Problem (SMP) variant |
| 38 | +## 2. CRYPTOGRAPHIC PRIMITIVES |
31 | 39 |
|
32 | | -Key Derivation & Proofs: |
| 40 | +### Authentication: |
33 | 41 |
|
34 | | -Hash: SHA3-512 |
| 42 | +Long-term Identity Key: `ML-DSA-87` (`Dilithium5`) signature key pair |
35 | 43 |
|
36 | | -Password-based KDF: Argon2id |
| 44 | +Per-contact Verification Keys: ML-DSA-87 key pair generated for each contact |
37 | 45 |
|
38 | | -MAC: HMAC-SHA3-512 |
| 46 | +Identity Verification: Socialist Millionaire Problem (SMP) variant |
39 | 47 |
|
40 | | -AUTHENTICATION FLOW |
| 48 | +### Key Derivation & Proofs: |
41 | 49 |
|
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) |
43 | 51 |
|
44 | | -Client generates ML-DSA-87 key pair locally. |
| 52 | +MAC: `HMAC-SHA3-512` |
45 | 53 |
|
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`. |
47 | 55 |
|
48 | | -Registration / Login |
49 | 56 |
|
50 | | -Client sends POST /authentication/init with public key (and user_id if re-authenticating). |
| 57 | +## 3. AUTHENTICATION FLOW |
51 | 58 |
|
52 | | -Server responds with a base64-encoded random challenge. |
| 59 | +### Identity Key Generation |
53 | 60 |
|
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.) |
55 | 62 |
|
56 | | -Client sends signature to POST /authentication/verify. |
| 63 | +`Public key` and `user ID` used for authentication; private key stored securely on disk. |
57 | 64 |
|
58 | | -Server verifies signature: |
| 65 | +### Registration / Login |
59 | 66 |
|
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). |
61 | 72 |
|
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. |
63 | 76 |
|
64 | | -Client must include JWT in Authorization header for all subsequent requests. |
| 77 | +`Client` sends signature to POST /authentication/verify. |
65 | 78 |
|
66 | | -TERMS |
| 79 | +Server verifies signature: |
67 | 80 |
|
68 | | -Alice: User initiating verification (User 1) |
| 81 | +**If valid & key exists**: returns JSON Web Token (JWT) with existing `user_id`. |
69 | 82 |
|
70 | | -Bob: Contact being verified (User 2) |
| 83 | +**If valid & key new**: generates new 16-byte random numeric `user_id`, and returns JWT. |
71 | 84 |
|
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. |
73 | 86 |
|
74 | | -User: The human end-user (not the software) |
75 | 87 |
|
76 | | -CONTACT VERIFICATION (SMP VARIANT) |
| 88 | +## 4. SMP verification |
77 | 89 |
|
78 | 90 | ColdWire uses a human-language variant of Socialist Millionaire Problem (SMP) to verify per-contact keys. |
79 | 91 | Server does not store any contact relationships; all verification state is local to the clients. |
80 | 92 |
|
81 | | -Assumptions: |
| 93 | +### 4.1. Assumptions: |
82 | 94 |
|
83 | 95 | Alice wants to add Bob as a contact and verify authenticity of Bob's per-contact key. |
84 | 96 |
|
85 | | -5.1 SMP INITIATION (Alice → Bob) |
| 97 | +### 4.2. SMP Initiation (Alice → Bob) |
86 | 98 |
|
87 | 99 | Alice generates per-contact ML-DSA-87 key pair (PK_A, SK_A). Stores SK_A locally. |
88 | 100 |
|
89 | 101 | Alice composes human-language question & normalized answer. |
90 | 102 |
|
91 | 103 | Alice sends: |
92 | | - |
| 104 | +``` |
93 | 105 | POST /smp/initiate |
| 106 | +``` |
| 107 | +```json |
94 | 108 | { |
95 | 109 | "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" |
99 | 113 | } |
| 114 | +``` |
100 | 115 |
|
101 | | -5.2 SMP STEP 2 (Bob → Alice) |
| 116 | +### 4.3. SMP STEP 2 (Bob to Alice) |
102 | 117 |
|
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`). |
104 | 119 |
|
105 | 120 | Bob reads question, inputs answer. |
106 | 121 |
|
107 | 122 | Computes shared secret: |
108 | | - |
| 123 | +```python |
109 | 124 | fpA = sha3_512(PK_A) |
110 | | -rA = Alice's nonce (decoded from base64) |
| 125 | +rA = b"Alice's nonce (decoded from base64)" |
111 | 126 | rB = random_bytes(32) |
112 | 127 | secret = normalize(answer) |
113 | 128 | secret = argon2id(secret, sha3_512(rA + rB)) |
114 | 129 | message = rA + rB + fpA |
115 | 130 | proof_1 = HMAC(secret, message, sha3_512) |
| 131 | +``` |
116 | 132 |
|
117 | 133 | Bob sends: |
118 | | - |
| 134 | +``` |
119 | 135 | POST /smp/step_2 |
| 136 | +``` |
| 137 | +```json |
120 | 138 | { |
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" |
125 | 143 | } |
| 144 | +``` |
126 | 145 |
|
127 | | -5.3 SMP STEP 3 (Alice → Bob) |
| 146 | +### 4.4. SMP STEP 3 (Alice → Bob) |
128 | 147 |
|
129 | 148 | Alice computes expected proof_1 from Bob and verifies. |
130 | 149 |
|
|
0 commit comments