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 class  Sign.SignatureData  
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int SIGN_LENGTH  
  • Constructor Summary

    Constructors 
    Constructor Description
    Sign()  
  • Method Summary

    Modifier and Type Method Description
    static java.math.BigInteger signedMessageToKey​(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.SignatureData signMessage​(byte[] message, ECKeyPair keyPair)  
    static Sign.SignatureData signMessage​(byte[] message, ECKeyPair keyPair, boolean isHash)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Sign

      public Sign()
  • Method Details

    • signMessage

      public static Sign.SignatureData signMessage​(byte[] message, ECKeyPair keyPair)
    • signMessage

      public static Sign.SignatureData signMessage​(byte[] message, ECKeyPair keyPair, boolean isHash)
    • signedMessageToKey

      public static java.math.BigInteger signedMessageToKey​(byte[] message, Sign.SignatureData signatureData) throws java.security.SignatureException
      Given 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.