Package org.drasyl.identity
Class CompressedPrivateKey
- java.lang.Object
-
- org.drasyl.identity.CompressedPrivateKey
-
-
Field Summary
Fields Modifier and Type Field Description protected String
compressedKey
protected K
key
-
Constructor Summary
Constructors Constructor Description CompressedPrivateKey(String compressedKey)
Creates a new compressed private key from the given string.CompressedPrivateKey(PrivateKey key)
Creates a new compressed private key from the given private key.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getCompressedKey()
int
hashCode()
static CompressedPrivateKey
of(String compressedKey)
Converts aString
into aCompressedPrivateKey
.static CompressedPrivateKey
of(PrivateKey key)
Converts aPrivateKey
into aCompressedPrivateKey
.String
toString()
PrivateKey
toUncompressedKey()
Returns thePrivateKey
object of this compressed private key.
-
-
-
Field Detail
-
compressedKey
protected final String compressedKey
-
key
protected K key
-
-
Constructor Detail
-
CompressedPrivateKey
public CompressedPrivateKey(String compressedKey) throws CryptoException
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
public CompressedPrivateKey(PrivateKey key) throws CryptoException
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 Detail
-
toUncompressedKey
public PrivateKey toUncompressedKey() throws CryptoException
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
public static CompressedPrivateKey of(String compressedKey) throws CryptoException
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
public static CompressedPrivateKey of(PrivateKey key) throws CryptoException
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
public String getCompressedKey()
-
-