Package com.norswap.nanoeth.signature
Class Signature
java.lang.Object
com.norswap.nanoeth.signature.Signature
public final class Signature extends Object
An ECDSA signature using the SECP-256k1 curve.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
int
hashCode()
ECPoint
recoverPublicKey(byte[] message)
Recover the public key from the signature of the hash of the given message, as specified in SEC1 §4.1.6.ECPoint
recoverPublicKeyWithoutHashing(byte[] message)
Recover the public key from the signature of the given message, as specified in SEC1 §4.1.6.String
toString()
boolean
verify(byte[] message)
Returns true only if this is a valid signature for Keccak hash of the given message.boolean
verify(ECPoint publicKey, byte[] message)
Returns true only if this is a valid signature for Keccak hash of the given message.boolean
verifyWithoutHashing(ECPoint publicKey, byte[] message)
Returns true only if this is a valid signature for the given message.
-
Field Details
-
yParity
public final byte yParityThe y Parity that specifies which key generated this signature (as there are two possible keys). This is also sometimes called "recovery ID" as it allows recovering the public key from the signature. See the signature package README for more information.Will be 1 if y is odd, 0 if even.
-
r
-
s
-
-
Constructor Details
-
Signature
Creates a new signature with the givenyParity
,r
ands
values.s
must be in its canonical form (seeSignatureUtils.canonicalizeS(Natural)
).- Throws:
IllegalSignature
-
-
Method Details
-
verify
public boolean verify(byte[] message)Returns true only if this is a valid signature for Keccak hash of the given message.The public key is automatically recovered from the signature and the message.
-
verify
Returns true only if this is a valid signature for Keccak hash of the given message. -
verifyWithoutHashing
Returns true only if this is a valid signature for the given message.In Ethereum, the message will always be a hash.
-
recoverPublicKey
Recover the public key from the signature of the hash of the given message, as specified in SEC1 §4.1.6. -
recoverPublicKeyWithoutHashing
Recover the public key from the signature of the given message, as specified in SEC1 §4.1.6.In Ethereum, the
message
will always be a hash. -
equals
-
hashCode
public int hashCode() -
toString
-