/** * Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom} * object and of the requested size in bits. The derived seed is further protected with a user selected passphrase * (see BIP 39). */ public DeterministicKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs, boolean useSegwit) { this(new DeterministicSeed(random, bits, passphrase, seedCreationTimeSecs), useSegwit); }
/** * Creates a deterministic key chain starting from the given entropy. All keys yielded by this chain will be the same * if the starting seed is the same. You should provide the creation time in seconds since the UNIX epoch for the * seed: this lets us know from what part of the chain we can expect to see derived keys appear. */ public DeterministicKeyChain(byte[] entropy, String passphrase, long seedCreationTimeSecs) { this(new DeterministicSeed(entropy, passphrase, seedCreationTimeSecs)); }
/** * Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom} * object and of the requested size in bits. The derived seed is further protected with a user selected passphrase * (see BIP 39). */ public DeterministicKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs) { this(new DeterministicSeed(random, bits, passphrase, seedCreationTimeSecs)); }
/** * Creates a deterministic key chain starting from the given entropy. All keys yielded by this chain will be the same * if the starting seed is the same. You should provide the creation time in seconds since the UNIX epoch for the * seed: this lets us know from what part of the chain we can expect to see derived keys appear. */ public DeterministicKeyChain(byte[] entropy, String passphrase, long seedCreationTimeSecs) { this(new DeterministicSeed(entropy, passphrase, seedCreationTimeSecs)); }
/** * Creates a deterministic key chain starting from the given entropy. All keys yielded by this chain will be the same * if the starting seed is the same. You should provide the creation time in seconds since the UNIX epoch for the * seed: this lets us know from what part of the chain we can expect to see derived keys appear. */ public DeterministicKeyChain(byte[] entropy, String passphrase, long seedCreationTimeSecs, boolean useSegwit) { this(new DeterministicSeed(entropy, passphrase, seedCreationTimeSecs), useSegwit); }
/** * Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom} * object and of the requested size in bits. The derived seed is further protected with a user selected passphrase * (see BIP 39). */ public DeterministicKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs) { this(new DeterministicSeed(random, bits, passphrase, seedCreationTimeSecs)); }
/** * Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom} * object and of the requested size in bits. The derived seed is further protected with a user selected passphrase * (see BIP 39). */ public DeterministicKeyChain(SecureRandom random, int bits, String passphrase, long seedCreationTimeSecs) { this(new DeterministicSeed(random, bits, passphrase, seedCreationTimeSecs)); }
public Wallet(List<String> mnemonic, @Nullable String password) throws MnemonicException { MnemonicCode.INSTANCE.check(mnemonic); password = password == null ? "" : password; seed = new DeterministicSeed(mnemonic, null, password, 0); masterKey = HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes()); accountsByType = new LinkedHashMap<CoinType, ArrayList<WalletAccount>>(); accounts = new LinkedHashMap<String, WalletAccount>(); }
public DeterministicSeed encrypt(KeyCrypter keyCrypter, KeyParameter aesKey) { checkState(encryptedMnemonicCode == null, "Trying to encrypt seed twice"); checkState(mnemonicCode != null, "Mnemonic missing so cannot encrypt"); EncryptedData encryptedMnemonic = keyCrypter.encrypt(getMnemonicAsBytes(), aesKey); EncryptedData encryptedSeed = keyCrypter.encrypt(seed, aesKey); return new DeterministicSeed(encryptedMnemonic, encryptedSeed, creationTimeSeconds); }
public DeterministicSeed encrypt(KeyCrypter keyCrypter, KeyParameter aesKey) { checkState(encryptedMnemonicCode == null, "Trying to encrypt seed twice"); checkState(mnemonicCode != null, "Mnemonic missing so cannot encrypt"); EncryptedData encryptedMnemonic = keyCrypter.encrypt(getMnemonicAsBytes(), aesKey); EncryptedData encryptedSeed = keyCrypter.encrypt(seed, aesKey); return new DeterministicSeed(encryptedMnemonic, encryptedSeed, creationTimeSeconds); }
public DeterministicSeed encrypt(KeyCrypter keyCrypter, KeyParameter aesKey) { checkState(encryptedMnemonicCode == null, "Trying to encrypt seed twice"); checkState(mnemonicCode != null, "Mnemonic missing so cannot encrypt"); EncryptedData encryptedMnemonic = keyCrypter.encrypt(getMnemonicAsBytes(), aesKey); EncryptedData encryptedSeed = keyCrypter.encrypt(seed, aesKey); return new DeterministicSeed(encryptedMnemonic, encryptedSeed, creationTimeSeconds); }
public DeterministicSeed encrypt(KeyCrypter keyCrypter, KeyParameter aesKey) { checkState(encryptedMnemonicCode == null, "Trying to encrypt seed twice"); checkState(mnemonicCode != null, "Mnemonic missing so cannot encrypt"); EncryptedData encryptedMnemonic = keyCrypter.encrypt(getMnemonicAsBytes(), aesKey); EncryptedData encryptedSeed = keyCrypter.encrypt(seed, aesKey); return new DeterministicSeed(encryptedMnemonic, encryptedSeed, creationTimeSeconds); }
public DeterministicSeed decrypt(KeyCrypter crypter, String passphrase, KeyParameter aesKey) { checkState(isEncrypted()); checkNotNull(encryptedMnemonicCode); List<String> mnemonic = decodeMnemonicCode(crypter.decrypt(encryptedMnemonicCode, aesKey)); byte[] seed = encryptedSeed == null ? null : crypter.decrypt(encryptedSeed, aesKey); return new DeterministicSeed(mnemonic, seed, passphrase, creationTimeSeconds); }
public DeterministicSeed decrypt(KeyCrypter crypter, String passphrase, KeyParameter aesKey) { checkState(isEncrypted()); checkNotNull(encryptedMnemonicCode); List<String> mnemonic = decodeMnemonicCode(crypter.decrypt(encryptedMnemonicCode, aesKey)); byte[] seed = encryptedSeed == null ? null : crypter.decrypt(encryptedSeed, aesKey); return new DeterministicSeed(mnemonic, seed, passphrase, creationTimeSeconds); }
public DeterministicSeed decrypt(KeyCrypter crypter, String passphrase, KeyParameter aesKey) { checkState(isEncrypted()); checkNotNull(encryptedMnemonicCode); List<String> mnemonic = decodeMnemonicCode(crypter.decrypt(encryptedMnemonicCode, aesKey)); byte[] seed = encryptedSeed == null ? null : crypter.decrypt(encryptedSeed, aesKey); return new DeterministicSeed(mnemonic, seed, passphrase, creationTimeSeconds); }
private MarriedKeyChain createMarriedKeyChain() { byte[] entropy = Sha256Hash.hash("don't use a seed like this in real life".getBytes()); DeterministicSeed seed = new DeterministicSeed(entropy, "", MnemonicCode.BIP39_STANDARDISATION_TIME_SECS); MarriedKeyChain chain = MarriedKeyChain.builder() .seed(seed) .followingKeys(watchingAccountKey) .threshold(2).build(); return chain; }
@Before public void setup() { BriefLogFormatter.init(); DeterministicSeed seed = new DeterministicSeed(ENTROPY, "", 0); masterKey = HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes()); DeterministicHierarchy hierarchy = new DeterministicHierarchy(masterKey); DeterministicKey rootKey = hierarchy.get(ImmutableList.of(ChildNumber.ZERO_HARDENED), false, true); chain = new SimpleHDKeyChain(rootKey); chain.setLookaheadSize(10); }
@Before public void setup() { BriefLogFormatter.init(); DeterministicSeed seed = new DeterministicSeed(ENTROPY, "", 0); masterKey = HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes()); DeterministicHierarchy hierarchy = new DeterministicHierarchy(masterKey); DeterministicKey rootKey = hierarchy.get(ImmutableList.of(ChildNumber.ZERO_HARDENED), false, true); chain = new SimpleHDKeyChain(rootKey); chain.setLookaheadSize(10); }
@Before public void setup() throws MnemonicException, UnreadableWalletException { DeterministicSeed seed = new DeterministicSeed(recoveryPhrase, null, "", 0); DeterministicKey masterKey = HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes()); hierarchy = new DeterministicHierarchy(masterKey); wallet = new Wallet(recoveryPhrase); nxtAccount = (NxtFamilyWallet)wallet.createAccount(NXT, null); otherAccount = new NxtFamilyWallet(hierarchy.get(NXT.getBip44Path(1), false, true), NXT); }
@Before public void setup() throws MnemonicException, UnreadableWalletException { DeterministicSeed seed = new DeterministicSeed(recoveryPhrase, null, "", 0); DeterministicKey masterKey = HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes()); hierarchy = new DeterministicHierarchy(masterKey); wallet = new Wallet(recoveryPhrase); nxtAccount = (NxtFamilyWallet)wallet.createAccount(NXT, null); otherAccount = new NxtFamilyWallet(hierarchy.get(NXT.getBip44Path(1), false, true), NXT); }