We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bdbac79 commit 59665ccCopy full SHA for 59665cc
coti/crypto_utils.py
@@ -206,6 +206,15 @@ def decrypt_rsa(private_key_bytes, ciphertext):
206
)
207
return plaintext
208
209
+#This function recovers a user's key by decrypting two encrypted key shares with the given private key,
210
+#and then XORing the two key shares together.
211
+def recover_user_key(private_key_bytes, encrypted_key_share0, encrypted_key_share1):
212
+ key_share0 = decrypt_rsa(private_key_bytes, encrypted_key_share0)
213
+ key_share1 = decrypt_rsa(private_key_bytes, encrypted_key_share1)
214
+
215
+ # XOR both key shares to get the user key
216
+ return bytes([a ^ b for a, b in zip(key_share0, key_share1)])
217
218
219
# Function to compute Keccak-256 hash
220
def keccak256(data):
0 commit comments