Class Secp256k1PrivateKey

    • Constructor Detail

      • Secp256k1PrivateKey

        public Secp256k1PrivateKey​(byte[] privateKey)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • Secp256k1PrivateKey

        public Secp256k1PrivateKey()
    • Method Detail

      • loadPrivateKey

        public void loadPrivateKey​(byte[] privateKey)
                            throws java.io.IOException
        Description copied from class: AbstractPrivateKey
        Loads a private key from a byte array
        Specified by:
        loadPrivateKey in class AbstractPrivateKey
        Parameters:
        privateKey - the private key bytes
        Throws:
        java.io.IOException
      • readPrivateKey

        public void readPrivateKey​(java.io.Reader reader)
                            throws java.io.IOException
        Description copied from class: AbstractPrivateKey
        Reads the private key from a stream
        Specified by:
        readPrivateKey in class AbstractPrivateKey
        Parameters:
        reader - the source of the private key
        Throws:
        java.io.IOException - thrown if an error occurs reading the file
      • writePrivateKey

        public void writePrivateKey​(java.io.Writer writer)
                             throws java.io.IOException
        Description copied from class: AbstractPrivateKey
        Writes the private key to a file
        Specified by:
        writePrivateKey in class AbstractPrivateKey
        Parameters:
        writer - the target writer
        Throws:
        java.io.IOException - thrown if an error occurs writing the file
      • sign

        public byte[] sign​(byte[] message)
        When encoded in DER, this becomes the following sequence of bytes:

        0x30 b1 0x02 b2 (vr) 0x02 b3 (vs)

        where:

        b1 is a single byte value, equal to the length, in bytes, of the remaining list of bytes (from the first 0x02 to the end of the encoding); b2 is a single byte value, equal to the length, in bytes, of (vr); b3 is a single byte value, equal to the length, in bytes, of (vs); (vr) is the signed big-endian encoding of the value "r

        ", of minimal length; (vs) is the signed big-endian encoding of the value "s ", of minimal length.

        Specified by:
        sign in class AbstractPrivateKey
        Parameters:
        message - message to sign
        Returns:
        signed message
      • getKeyPair

        public org.web3j.crypto.ECKeyPair getKeyPair()
      • setKeyPair

        public void setKeyPair​(org.web3j.crypto.ECKeyPair keyPair)