public class KeyPair
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static KeyPair |
fromPrivate(PrivateKey privateKey)
Creates a key pair around a private key using the default engine.
|
static KeyPair |
fromPrivate(PrivateKey privateKey,
CryptoEngine engine)
Creates a key pair around a private key.
|
PrivateKey |
getPrivateKey()
Gets the private key.
|
PublicKey |
getPublicKey()
Gets the public key.
|
boolean |
hasPrivateKey()
Determines if the current key pair has a private key.
|
static KeyPair |
onlyPublic(PublicKey publicKey)
Creates a pair that only holds a public key using the default engine.
|
static KeyPair |
onlyPublic(PublicKey publicKey,
CryptoEngine engine)
Creates a pair that only holds a public key.
|
static KeyPair |
random()
Creates a random key pair using the default engine.
|
static KeyPair |
random(CryptoEngine engine)
Creates a random key pair using the provided engine.
|
public static KeyPair random()
KeyPair
with both public and private keys.public static KeyPair random(CryptoEngine engine)
engine
- the engine.KeyPair
with both public and private keys.public static KeyPair fromPrivate(PrivateKey privateKey, CryptoEngine engine)
privateKey
- The private key.engine
- the engine.KeyPair
with both public and private keys.public static KeyPair onlyPublic(PublicKey publicKey)
publicKey
- The public key.KeyPair
with just the public key.public static KeyPair onlyPublic(PublicKey publicKey, CryptoEngine engine)
publicKey
- The public key.engine
- the engine.KeyPair
with just the public key.public static KeyPair fromPrivate(PrivateKey privateKey)
privateKey
- The private key.KeyPair
with both public and private keys.public PrivateKey getPrivateKey()
IllegalStateException
if the private key hasn't been
set.public PublicKey getPublicKey()
public boolean hasPrivateKey()