forked from hclivess/Bismuth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecovery.py
26 lines (17 loc) · 809 Bytes
/
recovery.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from Crypto.PublicKey import RSA
import hashlib
key = RSA.importKey(open('privkey.der'.encode("utf-8")).read())
public_key = key.publickey()
private_key_readable = key.exportKey().decode("utf-8")
public_key_readable = key.publickey().exportKey().decode("utf-8")
address = hashlib.sha224(public_key_readable.encode("utf-8")).hexdigest() # hashed public key
recovery_file_priv = "privkey_recovered.der"
recovery_priv = open(recovery_file_priv, 'w')
recovery_priv.write(str(private_key_readable))
recovery_priv.close()
print ("Private key recovered to: {}".format(recovery_file_priv))
recovery_file_pub = "pubkey_recovered.der"
recovery_pub = open(recovery_file_pub, 'w')
recovery_pub.write(str(public_key_readable))
recovery_pub.close()
print ("Public key recovered to: {}".format(recovery_file_pub))