Package org.nervos.ckb.crypto.secp256k1
Class Sign
java.lang.Object
org.nervos.ckb.crypto.secp256k1.Sign
public class Sign
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSign.SignatureData -
Field Summary
Fields Modifier and Type Field Description static intSIGN_LENGTH -
Constructor Summary
Constructors Constructor Description Sign() -
Method Summary
Modifier and Type Method Description static java.math.BigIntegersignedMessageToKey(byte[] message, Sign.SignatureData signatureData)Given an arbitrary piece of text and an message signature encoded in bytes, returns the public key that was used to sign it.static Sign.SignatureDatasignMessage(byte[] message, ECKeyPair keyPair)static Sign.SignatureDatasignMessage(byte[] message, ECKeyPair keyPair, boolean isHash)
-
Field Details
-
SIGN_LENGTH
public static final int SIGN_LENGTH- See Also:
- Constant Field Values
-
-
Constructor Details
-
Sign
public Sign()
-
-
Method Details
-
signMessage
-
signMessage
-
signedMessageToKey
public static java.math.BigInteger signedMessageToKey(byte[] message, Sign.SignatureData signatureData) throws java.security.SignatureExceptionGiven an arbitrary piece of text and an message signature encoded in bytes, returns the public key that was used to sign it. This can then be compared to the expected public key to determine if the signature was correct.- Parameters:
message- RLP encoded message.signatureData- The message signature components- Returns:
- the public key used to sign the message
- Throws:
java.security.SignatureException- If the public key could not be recovered or if there was a signature formatTx error.
-