Package org.drasyl.identity
Class IdentityPublicKey
- java.lang.Object
-
- java.net.SocketAddress
-
- org.drasyl.identity.DrasylAddress
-
- org.drasyl.identity.IdentityPublicKey
-
- All Implemented Interfaces:
Serializable
,Key
,PublicKey
public abstract class IdentityPublicKey extends DrasylAddress implements PublicKey
This class models an ed25519 public key that is used as node's unique overlay address.This is an immutable object.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static short
KEY_LENGTH_AS_BYTES
static short
KEY_LENGTH_AS_STRING
static IdentityPublicKey
ZERO_ID
-
Constructor Summary
Constructors Constructor Description IdentityPublicKey()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyAgreementPublicKey
getLongTimeKeyAgreementKey()
IdentityPublicKey
intern()
static IdentityPublicKey
of(byte[] bytes)
Converts a byte[] into aIdentityPublicKey
.static IdentityPublicKey
of(String bytes)
Converts aString
into aIdentityPublicKey
.static IdentityPublicKey
of(ImmutableByteArray bytes)
byte[]
toByteArray()
String
toString()
-
-
-
Field Detail
-
KEY_LENGTH_AS_BYTES
public static final short KEY_LENGTH_AS_BYTES
- See Also:
- Constant Field Values
-
KEY_LENGTH_AS_STRING
public static final short KEY_LENGTH_AS_STRING
- See Also:
- Constant Field Values
-
ZERO_ID
public static final IdentityPublicKey ZERO_ID
-
-
Method Detail
-
getLongTimeKeyAgreementKey
public KeyAgreementPublicKey getLongTimeKeyAgreementKey()
- Returns:
- this public key as key agreement key (curve25519)
-
intern
public IdentityPublicKey intern()
-
toByteArray
public byte[] toByteArray()
- Specified by:
toByteArray
in interfaceKey
- Specified by:
toByteArray
in classDrasylAddress
-
of
public static IdentityPublicKey of(ImmutableByteArray bytes)
- Throws:
NullPointerException
- ifbytes
isnull
IllegalArgumentException
- ifbytes
has wrong key size
-
of
public static IdentityPublicKey of(byte[] bytes)
Converts a byte[] into aIdentityPublicKey
.- Parameters:
bytes
- public key- Returns:
IdentityPublicKey
- Throws:
NullPointerException
- ifkey
isnull
-
of
public static IdentityPublicKey of(String bytes)
Converts aString
into aIdentityPublicKey
.- Parameters:
bytes
- keyAsHexString as String- Returns:
IdentityPublicKey
- Throws:
NullPointerException
- ifkeyAsHexString
isnull
IllegalArgumentException
- ifkeyAsHexString
does not conform to a valid keyAsHexString string
-
-