/** * Returns the root key that the {@link DeterministicHierarchy} was created with. */ public DeterministicKey getRootKey() { return get(rootPath, false, false); } }
/** * Returns the root key that the {@link DeterministicHierarchy} was created with. */ public DeterministicKey getRootKey() { return get(rootPath, false, false); } }
/** * Returns the root key that the {@link DeterministicHierarchy} was created with. */ public DeterministicKey getRootKey() { return get(rootPath, false, false); } }
/** * Returns the root key that the {@link DeterministicHierarchy} was created with. */ public DeterministicKey getRootKey() { return get(rootPath, false, false); } }
/** Returns the deterministic key for the given absolute path in the hierarchy, optionally creating it */ public DeterministicKey getKeyByPath(List<ChildNumber> path, boolean create) { return hierarchy.get(path, false, create); }
/** Returns the deterministic key for the given absolute path in the hierarchy, optionally creating it */ public DeterministicKey getKeyByPath(List<ChildNumber> path, boolean create) { return hierarchy.get(path, false, create); }
/** * Extends the tree by calculating the requested child for the given path. For example, to get the key at position * 1/2/3 you would pass 1/2 as the parent path and 3 as the child number. * * @param parentPath the path to the parent * @param relative whether the path is relative to the root path * @param createParent whether the parent corresponding to path should be created (with any necessary ancestors) if it doesn't exist already * @return the requested key. * @throws IllegalArgumentException if the parent doesn't exist and createParent is false. */ public DeterministicKey deriveChild(List<ChildNumber> parentPath, boolean relative, boolean createParent, ChildNumber createChildNumber) { return deriveChild(get(parentPath, relative, createParent), createChildNumber); }
private void initializeHierarchyUnencrypted(DeterministicKey baseKey) { rootKey = baseKey; addToBasicChain(rootKey); hierarchy = new DeterministicHierarchy(rootKey); externalKey = hierarchy.get(EXTERNAL_PATH, true, true); internalKey = hierarchy.get(INTERNAL_PATH, true, true); addToBasicChain(externalKey); addToBasicChain(internalKey); }
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, SimpleHDKeyChain chain, DeterministicKey parent, ImmutableList<ChildNumber> path) { DeterministicKey key = chain.hierarchy.get(path, true, false); key = key.encrypt(checkNotNull(simpleKeyChain.getKeyCrypter(), "Chain has null KeyCrypter"), aesKey, parent); hierarchy.putKey(key); simpleKeyChain.importKey(key); return key; }
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, DeterministicKeyChain chain, DeterministicKey parent, ImmutableList<ChildNumber> path) { DeterministicKey key = chain.hierarchy.get(path, false, false); key = key.encrypt(checkNotNull(basicKeyChain.getKeyCrypter()), aesKey, parent); hierarchy.putKey(key); basicKeyChain.importKey(key); return key; }
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, DeterministicKeyChain chain, DeterministicKey parent, ImmutableList<ChildNumber> path) { DeterministicKey key = chain.hierarchy.get(path, false, false); key = key.encrypt(checkNotNull(basicKeyChain.getKeyCrypter()), aesKey, parent); hierarchy.putKey(key); basicKeyChain.importKey(key); return key; }
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, DeterministicKeyChain chain, DeterministicKey parent, ImmutableList<ChildNumber> path) { DeterministicKey key = chain.hierarchy.get(path, false, false); key = key.encrypt(checkNotNull(basicKeyChain.getKeyCrypter()), aesKey, parent); hierarchy.putKey(key); basicKeyChain.importKey(key); return key; }
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, DeterministicKeyChain chain, DeterministicKey parent, ImmutableList<ChildNumber> path) { DeterministicKey key = chain.hierarchy.get(path, false, false); key = key.encrypt(checkNotNull(basicKeyChain.getKeyCrypter()), aesKey, parent); hierarchy.putKey(key); basicKeyChain.importKey(key); return key; }
private DeterministicKey encryptNonLeaf(KeyParameter aesKey, SimpleHDKeyChain chain, DeterministicKey parent, ImmutableList<ChildNumber> path) { DeterministicKey key = chain.hierarchy.get(path, true, false); key = key.encrypt(checkNotNull(simpleKeyChain.getKeyCrypter(), "Chain has null KeyCrypter"), aesKey, parent); hierarchy.putKey(key); simpleKeyChain.importKey(key); return key; }
@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); }
@Test public void serializeUnencryptedChildRoot() throws UnreadableWalletException { DeterministicHierarchy hierarchy = new DeterministicHierarchy(masterKey); DeterministicKey rootKey = hierarchy.get(BitcoinTest.get().getBip44Path(0), false, true); SimpleHDKeyChain newChain = new SimpleHDKeyChain(rootKey); serializeUnencrypted(newChain, DETERMINISTIC_WALLET_SERIALIZATION_TXT_CHILD_ROOT_KEY); }
@Test public void encryptionChildRoot() throws UnreadableWalletException { DeterministicHierarchy hierarchy = new DeterministicHierarchy(masterKey); DeterministicKey rootKey = hierarchy.get(BitcoinTest.get().getBip44Path(0), false, true); SimpleHDKeyChain newChain = new SimpleHDKeyChain(rootKey); encryption(newChain); }
@Test public void encryptionChildRoot() throws UnreadableWalletException { DeterministicHierarchy hierarchy = new DeterministicHierarchy(masterKey); DeterministicKey rootKey = hierarchy.get(BitcoinTest.get().getBip44Path(0), false, true); SimpleHDKeyChain newChain = new SimpleHDKeyChain(rootKey); encryption(newChain); }
@Test public void serializeUnencryptedChildRoot() throws UnreadableWalletException { DeterministicHierarchy hierarchy = new DeterministicHierarchy(masterKey); DeterministicKey rootKey = hierarchy.get(BitcoinTest.get().getBip44Path(0), false, true); SimpleHDKeyChain newChain = new SimpleHDKeyChain(rootKey); serializeUnencrypted(newChain, DETERMINISTIC_WALLET_SERIALIZATION_TXT_CHILD_ROOT_KEY); }
@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); }