Package org.drasyl.identity
Class CompressedPrivateKey
java.lang.Object
org.drasyl.identity.CompressedPrivateKey
- 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
ConstructorsConstructorDescriptionCompressedPrivateKey(String compressedKey) Creates a new compressed private key from the given string.Creates a new compressed private key from the given private key. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static CompressedPrivateKeyConverts aStringinto aCompressedPrivateKey.static CompressedPrivateKeyof(PrivateKey key) Converts aPrivateKeyinto aCompressedPrivateKey.toString()Returns thePrivateKeyobject of this compressed private key.
-
Field Details
-
compressedKey
-
key
-
-
Constructor Details
-
CompressedPrivateKey
Creates a new compressed private key from the given string.- Parameters:
compressedKey- compressed private 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
-
CompressedPrivateKey
Creates a new compressed private key from the given private key.- Parameters:
key- compressed private 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 thePrivateKeyobject of this compressed private 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 aCompressedPrivateKey.- 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 aPrivateKeyinto aCompressedPrivateKey.- Parameters:
key- private 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
-