Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: khangmartin on September 23, 2019, 07:41:28 PM



Title: AES-256-CBC and Private Key
Post by: khangmartin on September 23, 2019, 07:41:28 PM
I am at the final stage. I am now working on checking the encryption for the private keys inside the wallet.

      Why does the calculation not work for decrypting private key?


I have the correct private key which was derived from Bitcoin string within Bitcoin2john.py script for wallet.dat.
I have double sha 256 public key for the above address.
I have gotten the unencrypted master key data from the following function in crypter.cpp:

bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext)

        std::string MasterKey (vMasterKey.begin(), vMasterKey.end());

The error I am getting is as follows: Given final block not properly padded. Such issues can arise if a bad key is used during decryption. Any help on this will be greatly appreciated with a small tip of thanks to your address.


Title: Re: AES-256-CBC and Private Key
Post by: achow101 on September 24, 2019, 03:28:22 AM
What software are you using to decrypt the key?