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
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final shortstatic final shortstatic final IdentityPublicKey -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBytes()inthashCode()intern()static IdentityPublicKeyof(byte[] bytes) Converts a byte[] into aIdentityPublicKey.static IdentityPublicKeyConverts aStringinto aIdentityPublicKey.static IdentityPublicKeyof(ImmutableByteArray bytes) static IdentityPublicKeyofDirect(byte[] bytes) Converts a byte[] into aIdentityPublicKey.byte[]toString()voidwriteTo(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:
toByteArrayin interfaceKey- Specified by:
toByteArrayin classDrasylAddress
-
toString
-
hashCode
public int hashCode() -
equals
-
writeTo
public void writeTo(io.netty.buffer.ByteBuf out) Description copied from class:DrasylAddressWrites this public key to the bufferout.- Specified by:
writeToin 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- ifkeyisnullIllegalArgumentException- ifbyteshas wrong key size
-
of
Converts a byte[] into aIdentityPublicKey.- Parameters:
bytes- public key- Returns:
IdentityPublicKey- Throws:
NullPointerException- ifkeyisnullIllegalArgumentException- ifbyteshas wrong key size
-
of
- Throws:
NullPointerException- ifbytesisnullIllegalArgumentException- ifbyteshas wrong key size
-
of
Converts aStringinto aIdentityPublicKey.- Parameters:
bytes- keyAsHexString as String- Returns:
IdentityPublicKey- Throws:
NullPointerException- ifkeyAsHexStringisnullIllegalArgumentException- ifkeyAsHexStringdoes not conform to a valid keyAsHexString string
-