public class KeyPair
extends java.lang.Object
Constructor and Description |
---|
KeyPair(EdDSAPublicKey publicKey)
Creates a new KeyPair without a private key.
|
KeyPair(EdDSAPublicKey publicKey,
EdDSAPrivateKey privateKey)
Creates a new KeyPair from the given public and private keys.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canSign()
Returns true if this Keypair is capable of signing
|
boolean |
equals(java.lang.Object object) |
static KeyPair |
fromAccountId(java.lang.String accountId)
Creates a new Stellar KeyPair from a strkey encoded Stellar account ID.
|
static KeyPair |
fromBip39Seed(byte[] bip39Seed,
int accountNumber)
Finds the KeyPair for the path m/44'/148'/accountNumber' using the method described in
SEP-0005.
|
static KeyPair |
fromPublicKey(byte[] publicKey)
Creates a new Stellar keypair from a 32 byte address.
|
static KeyPair |
fromSecretSeed(byte[] seed)
Creates a new Stellar keypair from a raw 32 byte secret seed.
|
static KeyPair |
fromSecretSeed(char[] seed)
Creates a new Stellar KeyPair from a strkey encoded Stellar secret seed.
|
static KeyPair |
fromSecretSeed(java.lang.String seed)
Insecure Creates a new Stellar KeyPair from a strkey encoded Stellar secret seed.
|
static KeyPair |
fromXdrPublicKey(org.stellar.sdk.xdr.PublicKey key) |
static KeyPair |
fromXdrSignerKey(org.stellar.sdk.xdr.SignerKey key) |
java.lang.String |
getAccountId()
Returns the human readable account ID encoded in strkey.
|
byte[] |
getPublicKey() |
char[] |
getSecretSeed()
Returns the human readable secret seed encoded in strkey.
|
org.stellar.sdk.xdr.SignatureHint |
getSignatureHint() |
org.stellar.sdk.xdr.PublicKey |
getXdrPublicKey() |
org.stellar.sdk.xdr.SignerKey |
getXdrSignerKey() |
int |
hashCode() |
static KeyPair |
random()
Generates a random Stellar keypair.
|
byte[] |
sign(byte[] data)
Sign the provided data with the keypair's private key.
|
org.stellar.sdk.xdr.DecoratedSignature |
signDecorated(byte[] data)
Sign the provided data with the keypair's private key and returns
DecoratedSignature . |
boolean |
verify(byte[] data,
byte[] signature)
Verify the provided data and signature match this keypair's public key.
|
public KeyPair(EdDSAPublicKey publicKey)
publicKey
- public KeyPair(EdDSAPublicKey publicKey, EdDSAPrivateKey privateKey)
publicKey
- privateKey
- public boolean canSign()
public static KeyPair fromSecretSeed(char[] seed)
seed
- Char array containing strkey encoded Stellar secret seed.KeyPair
public static KeyPair fromSecretSeed(java.lang.String seed)
seed
- The strkey encoded Stellar secret seed.KeyPair
public static KeyPair fromSecretSeed(byte[] seed)
seed
- The 32 byte secret seed.KeyPair
public static KeyPair fromAccountId(java.lang.String accountId)
accountId
- The strkey encoded Stellar account ID.KeyPair
public static KeyPair fromPublicKey(byte[] publicKey)
publicKey
- The 32 byte public key.KeyPair
public static KeyPair fromBip39Seed(byte[] bip39Seed, int accountNumber)
bip39Seed
- The output of BIP0039accountNumber
- The number of the accountpublic static KeyPair random()
public java.lang.String getAccountId()
public char[] getSecretSeed()
public byte[] getPublicKey()
public org.stellar.sdk.xdr.SignatureHint getSignatureHint()
public org.stellar.sdk.xdr.PublicKey getXdrPublicKey()
public org.stellar.sdk.xdr.SignerKey getXdrSignerKey()
public static KeyPair fromXdrPublicKey(org.stellar.sdk.xdr.PublicKey key)
public static KeyPair fromXdrSignerKey(org.stellar.sdk.xdr.SignerKey key)
public byte[] sign(byte[] data)
data
- The data to sign.public org.stellar.sdk.xdr.DecoratedSignature signDecorated(byte[] data)
DecoratedSignature
.data
- public boolean verify(byte[] data, byte[] signature)
data
- The data that was signed.signature
- The signature.java.lang.RuntimeException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object