Package org.drasyl.identity
Class CompressedPublicKey
java.lang.Object
org.drasyl.identity.CompressedPublicKey
- All Implemented Interfaces:
Address
This interface models a compressed key that can be converted into a string and vice versa.
This is an immutable object.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCompressedPublicKey(String compressedKey) Creates a new compressed public key from the given string.Creates a new compressed public key from the given public key. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static CompressedPublicKeyConverts aStringinto aCompressedPublicKey.static CompressedPublicKeyConverts aPublicKeyinto aCompressedPublicKey.toString()Returns thePublicKeyobject of this compressed public key.
-
Field Details
-
compressedKey
-
key
-
-
Constructor Details
-
CompressedPublicKey
Creates a new compressed public key from the given string.- Parameters:
compressedKey- compressed public key- Throws:
IllegalArgumentException- if string parameter does not conform to a valid hexadecimal stringCryptoException- if the string parameter does not conform to a valid key
-
CompressedPublicKey
Creates a new compressed public key from the given public key.- Parameters:
key- compressed public key- Throws:
IllegalArgumentException- if parameter does not conform to a valid hexadecimal stringCryptoException- if the parameter does not conform to a valid key
-
-
Method Details
-
toUncompressedKey
Returns thePublicKeyobject of this compressed public key.- Throws:
IllegalArgumentException- if string parameter does not conform to a valid hexadecimal stringCryptoException- if the string parameter does not conform to a valid key
-
of
Converts aStringinto aCompressedPublicKey.- Parameters:
compressedKey- compressed key as String- Returns:
CompressedPublicKey- Throws:
CryptoException- if string parameter does not conform to a valid keyIllegalArgumentException- if string parameter does not conform to a valid hexadecimal string
-
of
Converts aPublicKeyinto aCompressedPublicKey.- Parameters:
key- public key- Returns:
CompressedPublicKey- Throws:
CryptoException- if string parameter does not conform to a valid keyIllegalArgumentException- if string parameter does not conform to a valid hexadecimal string
-
getCompressedKey
-
hashCode
public int hashCode() -
equals
-
toString
-