Package org.xrpl.xrpl4j.crypto.core.keys
Class PrivateKey
java.lang.Object
org.xrpl.xrpl4j.crypto.core.keys.PrivateKey
- All Implemented Interfaces:
Destroyable
A typed instance of an XRPL private-key.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final UnsignedByte
Keys generated from the secp256k1 curve have 33 bytes in XRP Ledger. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
destroy()
boolean
int
hashCode()
final boolean
static PrivateKey
of
(UnsignedByteArray value) Instantiates a new instance of a private key using the supplied bytes.sha256()
A SHA-256 hash of the private key material contained in this object.toString()
value()
Accessor for the key value, in binary (Note: will be 33 bytes).final VersionType
The type of this key (eitherVersionType.ED25519
orVersionType.SECP256K1
).
-
Field Details
-
PREFIX
Keys generated from the secp256k1 curve have 33 bytes in XRP Ledger. However, keys derived from the ed25519 curve have only 32 bytes, and so get prefixed with this HEX value so that all keys in the ledger are 33 bytes.
-
-
Method Details
-
of
Instantiates a new instance of a private key using the supplied bytes. Note that in order to derive a private key, considering using instances of eitherWalletFactory
orKeyPairService
.- Parameters:
value
- AnUnsignedByteArray
containing this key's binary value.- Returns:
- A
PrivateKey
.
-
value
Accessor for the key value, in binary (Note: will be 33 bytes).- Returns:
- An instance of
UnsignedByteArray
.
-
versionType
The type of this key (eitherVersionType.ED25519
orVersionType.SECP256K1
).- Returns:
- A
VersionType
.
-
destroy
public final void destroy()- Specified by:
destroy
in interfaceDestroyable
-
isDestroyed
public final boolean isDestroyed()- Specified by:
isDestroyed
in interfaceDestroyable
-
equals
-
hashCode
public int hashCode() -
sha256
A SHA-256 hash of the private key material contained in this object.- Returns:
- A hex-encoded
String
representing the hash of this private key.
-
toString
-