ECKey implements Serializable { public ECKey() { this(secureRandom); } ECKey();  ECKey(Provider provider, SecureRandom secureRandom);  ECKey(SecureRandom secureRandom);  ECKey(Provider provider, @Nullable PrivateKey privKey, ECPoint pub);  ECKey(@Nullable BigInteger priv, ECPoint pub); static ECPoint compressPoint(ECPoint uncompressed); static ECPoint decompressPoint(ECPoint compressed); static ECKey fromPrivate(BigInteger privKey); static ECKey fromPrivate(byte[] privKeyBytes); static ECKey fromPrivateAndPrecalculatedPublic(BigInteger priv, ECPoint pub); static ECKey fromPrivateAndPrecalculatedPublic(byte[] priv, byte[] pub); static ECKey fromPublicOnly(ECPoint pub); static ECKey fromPublicOnly(byte[] pub); ECKey decompress(); ECKey compress(); boolean isPubKeyOnly(); boolean hasPrivKey(); static byte[] publicKeyFromPrivate(BigInteger privKey, boolean compressed); static byte[] computeAddress(byte[] pubBytes); static byte[] computeAddress(ECPoint pubPoint); byte[] getAddress(); static byte[] pubBytesWithoutFormat(ECPoint pubPoint); byte[] getNodeId(); static ECKey fromNodeId(byte[] nodeId); byte[] getPubKey(); ECPoint getPubKeyPoint(); BigInteger getPrivKey(); boolean isCompressed(); String toString(); String toStringWithPrivate(); ECDSASignature doSign(byte[] input); ECDSASignature sign(byte[] messageHash); static byte[] signatureToKeyBytes(byte[] messageHash, String signatureBase64); static byte[] signatureToKeyBytes(byte[] messageHash, ECDSASignature sig); static byte[] signatureToAddress(byte[] messageHash, String signatureBase64); static byte[] signatureToAddress(byte[] messageHash, ECDSASignature sig); static ECKey signatureToKey(byte[] messageHash, String signatureBase64); static ECKey signatureToKey(byte[] messageHash, ECDSASignature sig); BigInteger keyAgreement(ECPoint otherParty); byte[] decryptAES(byte[] cipher); static boolean verify(byte[] data, ECDSASignature signature, byte[] pub); static boolean verify(byte[] data, byte[] signature, byte[] pub); boolean verify(byte[] data, byte[] signature); boolean verify(byte[] sigHash, ECDSASignature signature); boolean isPubKeyCanonical(); static boolean isPubKeyCanonical(byte[] pubkey); @Nullable static byte[] recoverPubBytesFromSignature(int recId, ECDSASignature sig, byte[] messageHash); @Nullable static byte[] recoverAddressFromSignature(int recId, ECDSASignature sig, byte[] messageHash); @Nullable static ECKey recoverFromSignature(int recId, ECDSASignature sig, byte[] messageHash); @Nullable byte[] getPrivKeyBytes(); @Override boolean equals(Object o); @Override int hashCode(); static final ECDomainParameters CURVE; static final ECParameterSpec CURVE_SPEC; static final BigInteger HALF_CURVE_ORDER; static final ECKey DUMMY; }
@Test public void testECKey() { ECKey key = new ECKey(); assertTrue(key.isPubKeyCanonical()); assertNotNull(key.getPubKey()); assertNotNull(key.getPrivKeyBytes()); log.debug(Hex.toHexString(key.getPrivKeyBytes()) + " :Generated privkey"); log.debug(Hex.toHexString(key.getPubKey()) + " :Generated pubkey"); }