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 TypeMethodDescriptionboolean
int
hashCode()
static CompressedPublicKey
Converts aString
into aCompressedPublicKey
.static CompressedPublicKey
Converts aPublicKey
into aCompressedPublicKey
.toString()
Returns thePublicKey
object 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 thePublicKey
object 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 aString
into 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 aPublicKey
into 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
-