Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: pennyflipper101 on October 31, 2023, 06:43:38 AM



Title: How to decrypt encrypted private key with password from corrupted wallet
Post by: pennyflipper101 on October 31, 2023, 06:43:38 AM
I have a 94 digit encrypted mkey that I obtained from my corrupted wallet.dat file I also have the password the salt and iterations. Using the password I知 unable to send bitcoins but I was wondering if I was able to decrypt the encrypted mkey using my password, salt and iterations in order to decrypt my private key and have it in wallet import format


Title: Re: How to decrypt encrypted private key with password from corrupted wallet
Post by: achow101 on October 31, 2023, 06:43:23 PM
mkey is not a private key. It is the encryption key that was used to encrypt all of the actual private keys in the wallet. This encryption key is itself encrypted with your password. Decrypting it won't get you anything useful unless you have the rest of the wallet.dat file and all of its ckey records.


Title: Re: How to decrypt encrypted private key with password from corrupted wallet
Post by: pennyflipper101 on November 01, 2023, 01:42:41 AM
mkey is not a private key. It is the encryption key that was used to encrypt all of the actual private keys in the wallet. This encryption key is itself encrypted with your password. Decrypting it won't get you anything useful unless you have the rest of the wallet.dat file and all of its ckey records.
oh ok well I have a py wallet file with a bunch of keys, how would I find the one I need to decrypt with the mkey as well as the salt the iterations and my password.


Title: Re: How to decrypt encrypted private key with password from corrupted wallet
Post by: achow101 on November 01, 2023, 02:27:04 AM
oh ok well I have a py wallet file with a bunch of keys, how would I find the one I need to decrypt with the mkey as well as the salt the iterations and my password.
All of them. All of the keys in the wallet should be encrypted with the same mkey.

Note that a wallet contains multiple keys, not just one key. You need to decrypt them all in order to spend all of your funds as each key corresponds to a different address in the wallet.


Title: Re: How to decrypt encrypted private key with password from corrupted wallet
Post by: pennyflipper101 on November 01, 2023, 02:43:43 AM
How would I go about to decrypt the keys I知 familiar with python but I知 just making sure I get all the things together I might need to decrypt.


Title: Re: How to decrypt encrypted private key with password from corrupted wallet
Post by: BitMaxz on November 01, 2023, 12:11:09 PM
How would I go about to decrypt the keys I知 familiar with python but I知 just making sure I get all the things together I might need to decrypt.
Do you still have the wallet.dat file?
If you know the password why not try to salvage the wallet.dat file?

If Salvage does not work you can try Pywallet check the guide below

- https://bitcointalk.org/index.php?topic=38004.0
- https://www.devtome.com/doku.php?id=pywallet


Title: Re: How to decrypt encrypted private key with password from corrupted wallet
Post by: pennyflipper101 on November 01, 2023, 02:18:45 PM
I used pywallet are the keys labeled sec the private keys that I would use to import the bitcoin to a new wallet


Title: Re: How to decrypt encrypted private key with password from corrupted wallet
Post by: whanau on November 02, 2023, 01:38:34 AM
How would I go about to decrypt the keys I知 familiar with python but I知 just making sure I get all the things together I might need to decrypt.

There are various programs available that will provide all the information from the wallet. What you want is an output something like this:

mkey was found @   45016 : 0xafd8
mkey offset - 72   44944 : 0xaf90

Encrypted mkey: 7784b2306edd18536689f31e0e08f49d02fac009c7298c142c27aaf52a10b984bb578f124cb1ed0 854fe460f16aa9cf4

IV: 02fac009c7298c142c27aaf52a10b984

CT: bb578f124cb1ed0854fe460f16aa9cf4

salt: 1dabf1816b34e175

nDerivations: 62719

encrypted ckey: e8a4f5010e1ccee267592ec9d488db13ea19985ea5e9bffa5262fd0d39fae0c637c338d4df92a57 76709d489c8f03f34
public key    : 02ecfa1b5b5d513c136cd5926308ed949debdcb5e1007f66dc53eef2f1c24775cf
public address: 14Xe8m1NwHnpcpdqDZV8psTnKQg2NH2Xgr

encrypted ckey: c6663ccd1d880386f5bfc4e5049dab541c844ec5a12fcf90d34238636e2af97d9aca5dcb6eaa226 e80483b8adc1e8368
public key    : 02ec04626fb4c25314c7b82a7b0fa4ef2867ed3b57bc2558c4bba251485a1d2517
public address: 1Jxtg991gSidyd1UMMBM9oE5nR7vCEqCeG

and lots more...

Given the age of the wallet, you need to check all the uncompressed public addresses to see which one holds the funds. Once you know that, IF you have the password, you decrypt the Mkey and use the result to decrypt the associated ckey which is the 'spend' key
Good luck