|
27 | 27 | Step 4 user receive this proof and try to compute an identical one |
28 | 28 | If we succeed, the verification process is complete and we mark contact's as verified |
29 | 29 | |
30 | | - This provides a mathematical guarantee of authenticity and integrity for our long-term public keys |
| 30 | + This provides a strong guarantee of authenticity and integrity for our long-term public keys |
31 | 31 | IF the answer has enough entropy to be uncrackable *just* for the duration of the process |
32 | 32 | |
33 | 33 | """ |
|
40 | 40 | from core.trad_crypto import derive_key_argon2id, sha3_512 |
41 | 41 | from base64 import b64encode, b64decode |
42 | 42 | from core.constants import ( |
43 | | - SMP_NONCE_LENGTH |
| 43 | + SMP_NONCE_LENGTH, |
| 44 | + SMP_ANSWER_OUTPUT_LEN |
44 | 45 | ) |
45 | 46 | import hashlib |
46 | 47 | import secrets |
@@ -91,7 +92,7 @@ def initiate_smp(user_data: dict, user_data_lock, contact_id: str, question: str |
91 | 92 | user_data["contacts"][contact_id]["lt_sign_key_smp"]["smp_step"] = 1 |
92 | 93 |
|
93 | 94 | user_data["contacts"][contact_id]["lt_sign_keys"]["our_keys"]["private_key"] = private_key |
94 | | - user_data["contacts"][contact_id]["lt_sign_keys"]["our_keys"]["public_key"] = public_key |
| 95 | + user_data["contacts"][contact_id]["lt_sign_keys"]["our_keys"]["public_key"] = public_key |
95 | 96 |
|
96 | 97 |
|
97 | 98 |
|
@@ -120,7 +121,7 @@ def smp_step_2_answer_provided(user_data, user_data_lock, contact_id, answer, ui |
120 | 121 |
|
121 | 122 | # Derieve a high-entropy secret key from the low-entropy answer |
122 | 123 | argon2id_salt = sha3_512(our_nonce + contact_nonce) |
123 | | - answer_secret, _ = derive_key_argon2id(answer.encode(), salt=argon2id_salt, output_length=64) |
| 124 | + answer_secret, _ = derive_key_argon2id(answer.encode(), salt=argon2id_salt, output_length=SMP_ANSWER_OUTPUT_LEN) |
124 | 125 |
|
125 | 126 | # Compute our proof |
126 | 127 | our_message = contact_nonce + our_nonce + contact_key_fingerprint |
@@ -191,7 +192,7 @@ def smp_step_3(user_data, user_data_lock, contact_id, message, ui_queue) -> None |
191 | 192 |
|
192 | 193 | # Derieve a high-entropy secret key from the low-entropy answer |
193 | 194 | argon2id_salt = sha3_512(contact_nonce + our_nonce) |
194 | | - answer_secret, _ = derive_key_argon2id(answer.encode(), salt=argon2id_salt, output_length=64) |
| 195 | + answer_secret, _ = derive_key_argon2id(answer.encode(), salt=argon2id_salt, output_length=SMP_ANSWER_OUTPUT_LEN) |
195 | 196 |
|
196 | 197 | # Compute the proof |
197 | 198 | our_message = our_nonce + contact_nonce + our_key_fingerprint |
|
0 commit comments