/* package */ void decrypt(KeyParameter aesKey) { checkNotNull(aesKey, "Attemting to decrypt with a null KeyParameter"); lock.lock(); try { checkState(isEncrypted(), "Wallet is already decrypted"); if (seed != null) { checkState(seed.isEncrypted(), "Seed is already decrypted"); List<String> mnemonic = null; try { mnemonic = decodeMnemonicCode(getKeyCrypter().decrypt(seed.getEncryptedData(), aesKey)); } catch (UnreadableWalletException e) { throw new RuntimeException(e); } seed = new DeterministicSeed(new byte[16], mnemonic, 0); } masterKey = masterKey.decrypt(getKeyCrypter(), aesKey); for (WalletAccount account : accounts.values()) { if (account.isEncryptable()) { account.decrypt(aesKey); } } } finally { lock.unlock(); } }