|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.bitcoin.core.ECKey
public class ECKey
Represents an elliptic curve keypair that we own and can use for signing transactions. Currently, Bouncy Castle is used. In future this may become an interface with multiple implementations using different crypto libraries. The class also provides a static method that can verify a signature with just the public key.
Constructor Summary | |
---|---|
ECKey()
Generates an entirely new keypair. |
|
ECKey(BigInteger privKey)
Creates an ECKey given only the private key. |
Method Summary | |
---|---|
static ECKey |
fromASN1(byte[] asn1privkey)
Construct an ECKey from an ASN.1 encoded private key. |
byte[] |
getPubKey()
Gets the raw public key value. |
byte[] |
getPubKeyHash()
Gets the hash160 form of the public key (as seen in addresses). |
byte[] |
sign(byte[] input)
Calcuates an ECDSA signature in DER format for the given input hash. |
Address |
toAddress(NetworkParameters params)
Returns the address that corresponds to the public part of this ECKey. |
byte[] |
toASN1()
Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the BitCoin reference implementation in its wallet storage format. |
String |
toString()
|
boolean |
verify(byte[] data,
byte[] signature)
Verifies the given ASN.1 encoded ECDSA signature against a hash using the public key. |
static boolean |
verify(byte[] data,
byte[] signature,
byte[] pub)
Verifies the given ASN.1 encoded ECDSA signature against a hash using the public key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ECKey()
public ECKey(BigInteger privKey)
Method Detail |
---|
public static ECKey fromASN1(byte[] asn1privkey)
public byte[] toASN1()
public byte[] getPubKeyHash()
public byte[] getPubKey()
public String toString()
toString
in class Object
public Address toAddress(NetworkParameters params)
public byte[] sign(byte[] input)
public static boolean verify(byte[] data, byte[] signature, byte[] pub)
data
- Hash of the data to verify.signature
- ASN.1 encoded signature.pub
- The public key bytes to use.public boolean verify(byte[] data, byte[] signature)
data
- Hash of the data to verify.signature
- ASN.1 encoded signature.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |