Closed GoogleCodeExporter closed 9 years ago
Does it work if you don't construct the seed yourself? BTW looks like you're
using custom code for bip39 but I think it shouldn't be necessary?
Original comment by mh.in.en...@gmail.com
on 30 Jul 2014 at 3:13
I'll find a similar test in bitcoinj and do a 'contrast and compare' to see
what the root cause is
Original comment by jimburto...@gmail.com
on 30 Jul 2014 at 3:20
I have simplified it to use just bitcoinj classes and have it down to:
public void testChangePasswordSimple() throws Exception {
String password1 = "";
String password2 = "1throckSplockChockAdock";
NetworkParameters networkParameters = NetworkParameters.fromID(NetworkParameters.ID_MAINNET);
long creationTimeSecs = MnemonicCode.BIP39_STANDARDISATION_TIME_SECS;
String seedStr = "letter advice cage absurd amount doctor acoustic avoid letter advice cage above";
// Parse as mnemonic code.
final List<String> split = ImmutableList.copyOf(Splitter.on(" ").omitEmptyStrings().split(seedStr));
// Test encrypt / decrypt with empty password (password1) - this works ok
DeterministicSeed seed1 = new DeterministicSeed(split, password1, creationTimeSecs);
Wallet wallet1 = Wallet.fromSeed(networkParameters, seed1);
// Encrypt wallet
wallet1.encrypt(password1);
// Decrypt the wallet
wallet1.decrypt(password1);
// Test encrypt / decrypt with non trivial password (password2) - this fails
DeterministicSeed seed2 = new DeterministicSeed(split, password2, creationTimeSecs);
Wallet wallet2 = Wallet.fromSeed(networkParameters, seed2);
// Encrypt wallet
wallet2.encrypt(password2);
// Decrypt the wallet
wallet2.decrypt(password2);
}
The wallet2.decrypt fails with the same stack trace, namely:
com.google.bitcoin.crypto.KeyCrypterException: Provided AES key is wrong
at com.google.bitcoin.wallet.DeterministicKeyChain.toDecrypted(DeterministicKeyChain.java:763)
at com.google.bitcoin.wallet.KeyChainGroup.decrypt(KeyChainGroup.java:577)
at com.google.bitcoin.core.Wallet.decrypt(Wallet.java:884)
at org.multibit.hd.core.services.WalletServiceTest.testChangePasswordSimple(WalletServiceTest.java:204)
On Wed, Jul 30, 2014, at 04:19 PM, Jim wrote:
Original comment by jimburto...@gmail.com
on 30 Jul 2014 at 3:40
I apologize for the lack of clarity. The BIP32 seed *passphrase* is a
different animal from the wallet *password*. For now, please pass an empty
passphrase to the DeterministicSeed constructor.
Original comment by c1.devra...@niftybox.net
on 30 Jul 2014 at 5:16
Yes - this was it.
Once I changed all my DeterministicSeed constructors to use a blank passphrase
the tests ran and it works in-real-life too.
Ready to close
Original comment by jimburto...@gmail.com
on 30 Jul 2014 at 6:47
Original comment by mh.in.en...@gmail.com
on 3 Aug 2014 at 7:08
Original issue reported on code.google.com by
jimburto...@gmail.com
on 30 Jul 2014 at 3:10