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 TypeMethodDescriptionboolean
int
hashCode()
static CompressedPrivateKey
Converts aString
into aCompressedPrivateKey
.static CompressedPrivateKey
of
(PrivateKey key) Converts aPrivateKey
into aCompressedPrivateKey
.toString()
Returns thePrivateKey
object 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 thePrivateKey
object 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 aString
into 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 aPrivateKey
into 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
-