Class Secp256k1PublicKey

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canEqual​(java.lang.Object other)  
      boolean equals​(java.lang.Object o)  
      static byte[] getShortKey​(byte[] key)
      Gets a short key
      int hashCode()  
      void loadPublicKey​(byte[] publicKey)
      Loads a public key from a byte array
      void readPublicKey​(java.io.Reader reader)
      Reads the public key from a file
      java.lang.Boolean verify​(byte[] message, byte[] signature)
      Iterates possible signature combinations and possible recovery id's Casper does not use signature.v so we have to iterate v We don't know v so we have to iterate the possible recover id's Converts to short public key for comparison
      void writePublicKey​(java.io.Writer writer)
      Writes the public key to a file
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Secp256k1PublicKey

        public Secp256k1PublicKey​(byte[] bytes)
      • Secp256k1PublicKey

        public Secp256k1PublicKey()
    • Method Detail

      • loadPublicKey

        public void loadPublicKey​(byte[] publicKey)
                           throws java.io.IOException
        Description copied from class: AbstractPublicKey
        Loads a public key from a byte array
        Specified by:
        loadPublicKey in class AbstractPublicKey
        Parameters:
        publicKey - the public key bytes
        Throws:
        java.io.IOException
      • readPublicKey

        public void readPublicKey​(java.io.Reader reader)
                           throws java.io.IOException
        Description copied from class: AbstractPublicKey
        Reads the public key from a file
        Specified by:
        readPublicKey in class AbstractPublicKey
        Parameters:
        reader - the source filename
        Throws:
        java.io.IOException - thrown if an error occurs reading the file
      • writePublicKey

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

        public java.lang.Boolean verify​(byte[] message,
                                        byte[] signature)
        Iterates possible signature combinations and possible recovery id's Casper does not use signature.v so we have to iterate v We don't know v so we have to iterate the possible recover id's Converts to short public key for comparison
        Specified by:
        verify in class AbstractPublicKey
        Parameters:
        message - the signed message
        signature - the signature to check against
        Returns:
        true|false public key found
      • getShortKey

        public static byte[] getShortKey​(byte[] key)
        Gets a short key
        Parameters:
        key - the key as a byte array
        Returns:
        short key as byte array