gurnec / btcrecover

An open source Bitcoin wallet password and seed recovery tool designed for the case where you already know most of your password/seed, but need assistance in trying different possible combinations.
GNU General Public License v2.0
1.27k stars 677 forks source link

Error Decrypting Blockchain wallet.aes.json #118

Open lincolnquick opened 6 years ago

lincolnquick commented 6 years ago

Error thrown:

C:\python27\python extract-blockchain-main-data.py wallet.aes.json Traceback (most recent call last): File "extract-blockchain-main-data.py", line 83, in raise ValueError("Encrypted Blockchain data length not divisible by encryption blocksize (16)") ValueError: Encrypted Blockchain data length not divisible by encryption blocksize (16)

lincolnquick commented 6 years ago

I opened my wallet.aes.json file and it appears to have 964 characters (964/16 = 60.25). I'm not sure why it isn't divisible by 16...should I just append 0s to the end?

gurnec commented 6 years ago

It's a good indication that your wallet file is somehow corrupted. If you have your wallet ID, you can try to download another copy by running the download-blockchain-wallet.py script (in the same directory as the extract scripts). If you still get the same error, then the copy saved by Blockchain.info may also be corrupted.

There's no way to know in what manner it's corrupted. Since btcrecover only needs a small portion of the wallet file to run (and that portion isn't at the end), you can modify the extract script to ignore the error and give you a data-extract string anyways. If the data it needs isn't corrupted, then everything's fine, but if not (and there's no way to know), attempts to find the password will always fail....

To modify the script, I'd start by download Notepad++. You can't use plain Windows Notepad. You can use plain Windows WordPad, but if you do, you must turn off "Word wrap" in the View ribbon.

Open extract-blockchain-main-data.py in your editor, and near the bottom of the file remove these two lines:

if len(data) % 16 != 0:
    raise ValueError("Encrypted Blockchain data length not divisible by encryption blocksize (16)")

Save the file and run it again, and it should give you the extract string.