Class Keys


  • public class Keys
    extends java.lang.Object
    Crypto key utilities.
    • Method Detail

      • createEcKeyPair

        public static ECKeyPair createEcKeyPair()
                                         throws java.security.InvalidAlgorithmParameterException,
                                                java.security.NoSuchAlgorithmException,
                                                java.security.NoSuchProviderException
        Throws:
        java.security.InvalidAlgorithmParameterException
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
      • createEcKeyPair

        public static ECKeyPair createEcKeyPair​(java.security.SecureRandom random)
                                         throws java.security.InvalidAlgorithmParameterException,
                                                java.security.NoSuchAlgorithmException,
                                                java.security.NoSuchProviderException
        Throws:
        java.security.InvalidAlgorithmParameterException
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
      • getAddress

        public static java.lang.String getAddress​(ECKeyPair ecKeyPair)
      • getAddress

        public static java.lang.String getAddress​(java.math.BigInteger publicKey)
      • getAddress

        public static java.lang.String getAddress​(java.lang.String publicKey)
      • getAddress

        public static byte[] getAddress​(byte[] publicKey)
      • toChecksumAddress

        public static java.lang.String toChecksumAddress​(java.lang.String address)
        Checksum address encoding as per EIP-55.
        Parameters:
        address - a valid hex encoded address
        Returns:
        hex encoded checksum address
      • serialize

        public static byte[] serialize​(ECKeyPair ecKeyPair)
      • deserialize

        public static ECKeyPair deserialize​(byte[] input)