/** * Returns the key chain found in the given list of keys. */ public static NxtFamilyKey fromProtobuf(List<Protos.Key> keys, @Nullable KeyCrypter crypter) throws UnreadableWalletException { if (keys.size() != 2) { throw new UnreadableWalletException("Expected 2 keys, NXT secret and Curve25519 " + "pub/priv pair, instead got: " + keys.size()); } Protos.Key entropyProto = keys.get(0); DeterministicKey entropyKey = KeyUtils.getDeterministicKey(entropyProto, null, crypter); Protos.Key publicKeyProto = keys.get(1); if (publicKeyProto.getType() != Protos.Key.Type.ORIGINAL) { throw new UnreadableWalletException("Unexpected type for NXT public key: " + publicKeyProto.getType()); } byte[] publicKeyBytes = publicKeyProto.getPublicKey().toByteArray(); return new NxtFamilyKey(entropyKey, publicKeyBytes); }
LazyECPoint pubkey = new LazyECPoint(ECKey.CURVE.getCurve(), key.getPublicKey().toByteArray());
public Builder mergeFrom(com.openwallet.core.protos.Protos.Key other) { if (other == com.openwallet.core.protos.Protos.Key.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasSecretBytes()) { setSecretBytes(other.getSecretBytes()); } if (other.hasEncryptedData()) { mergeEncryptedData(other.getEncryptedData()); } if (other.hasPublicKey()) { setPublicKey(other.getPublicKey()); } if (other.hasLabel()) { bitField0_ |= 0x00000010; label_ = other.label_; onChanged(); } if (other.hasDeterministicKey()) { mergeDeterministicKey(other.getDeterministicKey()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * <code>optional bytes public_key = 4;</code> * * <pre> * The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to * do lots of slow EC math on startup. For DETERMINISTIC_MNEMONIC entries this is missing. * </pre> */ public Builder clearPublicKey() { bitField0_ = (bitField0_ & ~0x00000008); publicKey_ = getDefaultInstance().getPublicKey(); onChanged(); return this; }