public class VirgilCipherBase extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
swigCMemOwn |
| Modifier | Constructor and Description |
|---|---|
|
VirgilCipherBase()
Create a new instance of
VirgilCipherBase |
protected |
VirgilCipherBase(long cPtr,
boolean cMemoryOwn) |
| Modifier and Type | Method and Description |
|---|---|
void |
addKeyRecipient(byte[] recipientId,
byte[] publicKey)
Add recipient defined with id and public key.
|
void |
addPasswordRecipient(byte[] pwd)
Add recipient defined with password.
|
void |
close() |
static byte[] |
computeShared(byte[] publicKey,
byte[] privateKey)
Compute shared secret key on a given keys.
|
static byte[] |
computeShared(byte[] publicKey,
byte[] privateKey,
byte[] privateKeyPassword)
Compute shared secret key on a given keys.
|
VirgilCustomParams |
customParams()
Provide access to the object that handles custom parameters.
|
static long |
defineContentInfoSize(byte[] data)
Read content info size as part of the data.
|
void |
delete() |
protected void |
finalize() |
byte[] |
getContentInfo()
Get Virgil Security Cryptogram, that contains public algorithm parameters
that was used for encryption.
|
protected static long |
getCPtr(VirgilCipherBase obj) |
boolean |
keyRecipientExists(byte[] recipientId)
Check whether recipient with given identifier exists.
|
boolean |
passwordRecipientExists(byte[] password)
Check whether recipient with given password exists.
|
void |
removeAllRecipients()
Remove all recipients.
|
void |
removeKeyRecipient(byte[] recipientId)
Remove recipient with given identifier.
|
void |
removePasswordRecipient(byte[] pwd)
Remove recipient with given password.
|
void |
setContentInfo(byte[] contentInfo)
Create content info object from ASN.1 structure.
|
protected VirgilCipherBase(long cPtr,
boolean cMemoryOwn)
public VirgilCipherBase()
VirgilCipherBaseprotected static long getCPtr(VirgilCipherBase obj)
public void delete()
public void close()
close in interface AutoCloseablepublic void addKeyRecipient(byte[] recipientId,
byte[] publicKey)
recipientId - Recipient's unique identifier, MUST not be empty.publicKey - Recipient's public key, MUST not be empty.public void removeKeyRecipient(byte[] recipientId)
Remove recipient with given identifier.
If recipient with given identifier is absent - do nothing.
recipientId - Recipient's unique identifier.public boolean keyRecipientExists(byte[] recipientId)
Check whether recipient with given identifier exists.
Search order:
recipientId - the recipient's unique identifier.true if recipient with given identifier exists,
false - otherwise.public void addPasswordRecipient(byte[] pwd)
Add recipient defined with password.
Use it for password based encryption.
pwd - Recipient's password, MUST not be empty.public void removePasswordRecipient(byte[] pwd)
Remove recipient with given password.
If recipient with given password is absent - do nothing.
pwd - Recipient's password.public boolean passwordRecipientExists(byte[] password)
Check whether recipient with given password exists.
Search order:
password - Recipient's unique identifier.true if recipient with given password exists,
false - otherwise.public void removeAllRecipients()
public byte[] getContentInfo()
Get Virgil Security Cryptogram, that contains public algorithm parameters that was used for encryption.
Call this method after encryption process.
public void setContentInfo(byte[] contentInfo)
Create content info object from ASN.1 structure.
Call this method before decryption process.
contentInfo - Virgil Security Cryptogram.public static long defineContentInfoSize(byte[] data)
data - the data.0 - otherwise.public VirgilCustomParams customParams()
Provide access to the object that handles custom parameters.
Use this method to add custom parameters to the content info object.
Use this method before encryption process.
public static byte[] computeShared(byte[] publicKey,
byte[] privateKey,
byte[] privateKeyPassword)
Compute shared secret key on a given keys.
Keys SHOULD be of the identical type, i.e. both of type Curve25519.
publicKey - the public key.privateKey - the private key.privateKeyPassword - the private key password.public static byte[] computeShared(byte[] publicKey,
byte[] privateKey)
Compute shared secret key on a given keys.
Keys SHOULD be of the identical type, i.e. both of type Curve25519.
publicKey - the public key.privateKey - the private key.Copyright © 2016. All rights reserved.