static List<DeterministicKeyChain> fromProtobuf(List<Protos.Key> keys, @Nullable KeyCrypter crypter, boolean useSegwit) throws UnreadableWalletException { return fromProtobuf(keys, crypter, new DefaultKeyChainFactory(), useSegwit); }
static List<DeterministicKeyChain> fromProtobuf(List<Protos.Key> keys, @Nullable KeyCrypter crypter) throws UnreadableWalletException { return fromProtobuf(keys, crypter, new DefaultKeyChainFactory()); }
static List<DeterministicKeyChain> fromProtobuf(List<Protos.Key> keys, @Nullable KeyCrypter crypter) throws UnreadableWalletException { return fromProtobuf(keys, crypter, new DefaultKeyChainFactory()); }
static List<DeterministicKeyChain> fromProtobuf(List<Protos.Key> keys, @Nullable KeyCrypter crypter) throws UnreadableWalletException { return fromProtobuf(keys, crypter, new DefaultKeyChainFactory()); }
public static KeyChainGroup fromProtobufEncrypted(NetworkParameters params, List<Protos.Key> keys, KeyCrypter crypter, KeyChainFactory factory) throws UnreadableWalletException { checkNotNull(crypter); BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufEncrypted(keys, crypter); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, crypter, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, crypter); }
public static KeyChainGroup fromProtobufEncrypted(NetworkParameters params, List<Protos.Key> keys, KeyCrypter crypter, KeyChainFactory factory) throws UnreadableWalletException { checkNotNull(crypter); BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufEncrypted(keys, crypter); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, crypter, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, crypter); }
public static KeyChainGroup fromProtobufEncrypted(NetworkParameters params, List<Protos.Key> keys, KeyCrypter crypter, KeyChainFactory factory, boolean useSegwit) throws UnreadableWalletException { checkNotNull(crypter); BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufEncrypted(keys, crypter, useSegwit); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, crypter, factory, useSegwit); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, crypter, useSegwit); }
public static KeyChainGroup fromProtobufEncrypted(NetworkParameters params, List<Protos.Key> keys, KeyCrypter crypter, KeyChainFactory factory) throws UnreadableWalletException { checkNotNull(crypter); BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufEncrypted(keys, crypter); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, crypter, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, crypter); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory, boolean useSegwit) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys, useSegwit); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory, useSegwit); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null, useSegwit); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null); }
public static KeyChainGroup fromProtobufUnencrypted(NetworkParameters params, List<Protos.Key> keys, KeyChainFactory factory) throws UnreadableWalletException { BasicKeyChain basicKeyChain = BasicKeyChain.fromProtobufUnencrypted(keys); List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(keys, null, factory); EnumMap<KeyChain.KeyPurpose, DeterministicKey> currentKeys = null; if (!chains.isEmpty()) currentKeys = createCurrentKeysMap(chains); extractFollowingKeychains(chains); return new KeyChainGroup(params, basicKeyChain, chains, currentKeys, null); }
doubled.addAll(serialized); doubled.addAll(serialized); final List<DeterministicKeyChain> chains = DeterministicKeyChain.fromProtobuf(doubled, encChain.getKeyCrypter()); assertEquals(2, chains.size()); encChain = chains.get(0);
chain = DeterministicKeyChain.fromProtobuf(keys, null).get(0); assertEquals(EXPECTED_SERIALIZATION, protoToString(chain.serializeToProtobuf())); assertEquals(key1, chain.findKeyFromPubHash(key1.getPubKeyHash()));
@Test public void serializeAccountOne() throws Exception { long secs = 1389353062L; DeterministicKeyChain chain1 = new AccountOneChain(ENTROPY, "", secs); ECKey key1 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); final Address address = Address.fromBase58(UnitTestParams.get(), "n2nHHRHs7TiZScTuVhZUkzZfTfVgGYwy6X"); assertEquals(address, key1.toAddress(UnitTestParams.get())); DeterministicKey watching = chain1.getWatchingKey(); List<Protos.Key> keys = chain1.serializeToProtobuf(); KeyChainFactory factory = new KeyChainFactory() { @Override public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried) { return new AccountOneChain(crypter, seed); } @Override public DeterministicKeyChain makeWatchingKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicKey accountKey, boolean isFollowingKey, boolean isMarried) { throw new UnsupportedOperationException(); } }; chain1 = DeterministicKeyChain.fromProtobuf(keys, null, factory).get(0); ECKey key2 = chain1.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); assertEquals("mnp2j9za5zMuz44vNxrJCXXhZsCdh89QXn", key2.toAddress(UnitTestParams.get()).toString()); assertEquals(key1, chain1.findKeyFromPubHash(address.getHash160())); assertEquals(key2, chain1.findKeyFromPubKey(key2.getPubKey())); key1.sign(Sha256Hash.ZERO_HASH); ECKey key3 = chain1.getKey(KeyChain.KeyPurpose.CHANGE); assertEquals("mpjRhk13rvV7vmnszcUQVYVQzy4HLTPTQU", key3.toAddress(UnitTestParams.get()).toString()); key3.sign(Sha256Hash.ZERO_HASH); assertEquals(watching, chain1.getWatchingKey()); }
chain = DeterministicKeyChain.fromProtobuf(serialization, null).get(0); final DeterministicKey rekey4 = chain.getKey(KeyChain.KeyPurpose.CHANGE); assertEquals(key4.getPubKeyPoint(), rekey4.getPubKeyPoint());