public class Key
extends java.lang.Object
This class helps developers to migrate from one format to another (hex, byte array, big integer)
Constructor and Description |
---|
Key(java.math.BigInteger value,
int expectedSize)
Creates a new key from an big integer with leading zeros if necessary.
|
Key(byte[] bytes,
int expectedSize)
Creates a new public key.
|
Key(java.lang.String hex,
int expectedSize)
Creates a new key from an hex completing with leading zeros if necessary.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.nio.ByteBuffer |
getByteBuffer()
Gets raw public key value.
|
byte[] |
getBytes()
Creates the a key value.
|
java.math.BigInteger |
getRaw()
Gets the raw key value as BigInteger.
|
int |
getSize()
Returns the size of the key
|
int |
hashCode() |
java.lang.String |
toHex() |
java.lang.String |
toString() |
public Key(byte[] bytes, int expectedSize)
bytes
- The raw key value.expectedSize
- the expected byte array size.public Key(java.math.BigInteger value, int expectedSize)
value
- The numeric key value.expectedSize
- the expected byte array size.public Key(java.lang.String hex, int expectedSize)
hex
- The hey key value.expectedSize
- the expected byte array size.public int getSize()
public byte[] getBytes()
public java.nio.ByteBuffer getByteBuffer()
public java.math.BigInteger getRaw()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toHex()
public java.lang.String toString()
toString
in class java.lang.Object