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
This class models an ed25519 public key that is used as node's unique overlay address.
This is an immutable object.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
static final short
static final short
static final IdentityPublicKey
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getBytes()
int
hashCode()
intern()
static IdentityPublicKey
of
(byte[] bytes) Converts a byte[] into aIdentityPublicKey
.static IdentityPublicKey
Converts aString
into aIdentityPublicKey
.static IdentityPublicKey
of
(ImmutableByteArray bytes) static IdentityPublicKey
ofDirect
(byte[] bytes) Converts a byte[] into aIdentityPublicKey
.byte[]
toString()
void
writeTo
(io.netty.buffer.ByteBuf out) Writes this public key to the bufferout
.
-
Field Details
-
INTERNING_PUB_KEYS
public static final boolean INTERNING_PUB_KEYS -
KEY_LENGTH_AS_BYTES
public static final short KEY_LENGTH_AS_BYTES- See Also:
-
KEY_LENGTH_AS_STRING
public static final short KEY_LENGTH_AS_STRING- See Also:
-
ZERO_ID
-
-
Method Details
-
getLongTimeKeyAgreementKey
- Returns:
- this public key as key agreement key (curve25519)
-
intern
-
getBytes
-
toByteArray
public byte[] toByteArray()- Specified by:
toByteArray
in interfaceKey
- Specified by:
toByteArray
in classDrasylAddress
-
toString
-
hashCode
public int hashCode() -
equals
-
writeTo
public void writeTo(io.netty.buffer.ByteBuf out) Description copied from class:DrasylAddress
Writes this public key to the bufferout
.- Specified by:
writeTo
in classDrasylAddress
- Parameters:
out
- writes this public key to the given buffer
-
ofDirect
Converts a byte[] into aIdentityPublicKey
.- Parameters:
bytes
- public key- Returns:
IdentityPublicKey
- Throws:
NullPointerException
- ifkey
isnull
IllegalArgumentException
- ifbytes
has wrong key size
-
of
Converts a byte[] into aIdentityPublicKey
.- Parameters:
bytes
- public key- Returns:
IdentityPublicKey
- Throws:
NullPointerException
- ifkey
isnull
IllegalArgumentException
- ifbytes
has wrong key size
-
of
- Throws:
NullPointerException
- ifbytes
isnull
IllegalArgumentException
- ifbytes
has wrong key size
-
of
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
-