public class VirgilKey extends Object
| Modifier and Type | Method and Description |
|---|---|
CreateCardRequest |
buildCardRequest(String identity,
String type)
Build Create Card Request
|
CreateCardRequest |
buildCardRequest(String identity,
String type,
Map<String,String> data)
Build Create Card Request
|
static VirgilKey |
create(String keyName)
Creates a VirgilKey with specified key name.
|
static VirgilKey |
create(String keyName,
KeyPair keyPair)
Creates a new VirgilKey with custom Public/Private key pair.
|
static VirgilKey |
create(String keyName,
KeyPair keyPair,
String password)
Creates a new VirgilKey with custom Public/Private key pair.
|
static VirgilKey |
create(String keyName,
String password)
Creates a VirgilKey with specified key name.
|
byte[] |
decrypt(byte[] cipherData)
Decrypts the specified cipherdata using VirgilKey.
|
byte[] |
decryptThenVerify(byte[] cipherData,
VirgilCard signer)
Decrypts and verifies the data.
|
void |
destroy()
Destroys the current VirgilKey.
|
byte[] |
export()
Exports the VirgilKey to default Virgil Security format.
|
byte[] |
export(String password)
Exports the VirgilKey to default Virgil Security format.
|
String |
getKeyName() |
KeyPair |
getKeyPair() |
static VirgilKey |
load(String keyName)
Loads the VirgilKey by specified key name.
|
static VirgilKey |
load(String keyName,
String password)
Loads the VirgilKey by specified key name.
|
void |
setKeyName(String keyName) |
void |
setKeyPair(KeyPair keyPair) |
byte[] |
sign(byte[] data)
Generates a digital signature for specified data using current
VirgilKey.
|
void |
signRequest(SignedRequest request,
String appId)
Signs the request as authority.
|
byte[] |
signThenEncrypt(byte[] data,
List<VirgilCard> recipients)
Encrypts and signs the data.
|
public static VirgilKey create(String keyName, KeyPair keyPair)
keyName - Name of the key.keyPair - The key pair.public static VirgilKey create(String keyName, KeyPair keyPair, String password)
keyName - Name of the key.keyPair - The key pair.password - The password.EmptyArgumentException - if key name is blank.NullArgumentException - if key pair is null.VirgilKeyIsAlreadyExistsException - if key with the same name already exists at storage.public static VirgilKey create(String keyName)
keyName - Name of the key.public static VirgilKey create(String keyName, String password)
keyName - Name of the key.password - The password.public static VirgilKey load(String keyName)
keyName - Name of the key.public static VirgilKey load(String keyName, String password)
keyName - Name of the key.password - The password.public byte[] export()
public byte[] export(String password)
password - The password.public byte[] sign(byte[] data)
data - The data for which the digital signature will be generated.NullArgumentException - if data is null.public byte[] decrypt(byte[] cipherData)
cipherData - The encrypted data.NullArgumentException - if cipherData is null.public byte[] signThenEncrypt(byte[] data,
List<VirgilCard> recipients)
data - The data to be encrypted.recipients - The list of VirgilCard recipients.NullArgumentException - if recipients list is null.public byte[] decryptThenVerify(byte[] cipherData,
VirgilCard signer)
cipherData - The data to be decrypted.signer - The signer's VirgilCard.public CreateCardRequest buildCardRequest(String identity, String type)
identity - The identity.type - The identity type.public CreateCardRequest buildCardRequest(String identity, String type, Map<String,String> data)
identity - The identity.type - The identity type.data - The metadata.public void signRequest(SignedRequest request, String appId)
request - The request to sign.appId - The application identifier.public void destroy()
public KeyPair getKeyPair()
public void setKeyPair(KeyPair keyPair)
keyPair - the keyPair to setpublic String getKeyName()
public void setKeyName(String keyName)
keyName - the keyName to setCopyright © 2016. All rights reserved.