Title: encrypt/decrypt wallet Post by: jonas.schnelli on October 08, 2013, 02:59:20 PM Hi
I'd like to understand the bitcoinj wallet encryption. When i have a enrcypted wallet (enc with Wallet.encrypt()), when is the time to decyrpt/reencrypt the wallet? Do i have to wallet.decrypt before sending/signing the coins? Do i have to re-encrypt the wallet after decrypt/sign? I did not play around with is yet (theory questions). Thanks -- </jonas> Title: Re: encrypt/decrypt wallet Post by: Mike Hearn on October 08, 2013, 04:49:02 PM We need a documentation article on this feature.
You encrypt a wallet once. At that point, when creating spends, you can set SendRequest.aesKey and it will be used to decrypt keys as it signs. Deriving an AES key from a users password is meant to be slow/intensive. So, the wallet takes the key directly and not the password (in case you wish to use it multiple times, cache it for a while, etc). You can get the KeyParameter (which holds the key object) by using wallet.getKeyCrypter().derivePassword("password"). |