public class VirgilTinyCipher extends Object implements AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
static class |
VirgilTinyCipher.PackageSize |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
swigCMemOwn |
| Modifier | Constructor and Description |
|---|---|
|
VirgilTinyCipher()
Create a new instance of
VirgilTinyCipher |
|
VirgilTinyCipher(long packageSize)
Create a new instance of
VirgilTinyCipher |
protected |
VirgilTinyCipher(long cPtr,
boolean cMemoryOwn) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPackage(byte[] pkg)
Add package.
|
void |
close() |
byte[] |
decrypt(byte[] recipientPrivateKey)
Decrypt accumulated packages.
|
byte[] |
decrypt(byte[] recipientPrivateKey,
byte[] recipientPrivateKeyPassword)
Decrypt accumulated packages.
|
void |
delete() |
void |
encrypt(byte[] data,
byte[] recipientPublicKey)
Encrypt data with given public key.
|
void |
encryptAndSign(byte[] data,
byte[] recipientPublicKey,
byte[] senderPrivateKey)
Encrypt data with given public key and sign package.
|
void |
encryptAndSign(byte[] data,
byte[] recipientPublicKey,
byte[] senderPrivateKey,
byte[] senderPrivateKeyPassword)
Encrypt data with given public key and sign package.
|
protected void |
finalize() |
protected static long |
getCPtr(VirgilTinyCipher obj) |
byte[] |
getPackage(long index)
Return specific package.
|
long |
getPackageCount()
Return total package count.
|
boolean |
isPackagesAccumulated()
Define whether all packages was accumulated or not.
|
void |
reset()
Prepare cipher for the next encryption.
|
byte[] |
verifyAndDecrypt(byte[] senderPublicKey,
byte[] recipientPrivateKey)
Verify accumulated packages and then decrypt it.
|
byte[] |
verifyAndDecrypt(byte[] senderPublicKey,
byte[] recipientPrivateKey,
byte[] recipientPrivateKeyPassword)
Verify accumulated packages and then decrypt it.
|
protected VirgilTinyCipher(long cPtr,
boolean cMemoryOwn)
public VirgilTinyCipher(long packageSize)
VirgilTinyCipherpackageSize - maximum number of bytes in one package.public VirgilTinyCipher()
VirgilTinyCipherprotected static long getCPtr(VirgilTinyCipher obj)
public void delete()
public void close()
close in interface AutoCloseablepublic void reset()
Prepare cipher for the next encryption.
SHOULD be used before the next encryption.
public void encrypt(byte[] data,
byte[] recipientPublicKey)
data - data to be encrypted.recipientPublicKey - recipient public key.public void encryptAndSign(byte[] data,
byte[] recipientPublicKey,
byte[] senderPrivateKey,
byte[] senderPrivateKeyPassword)
data - the data to be encrypted.recipientPublicKey - the recipient public key.senderPrivateKey - the sender private key protected with password.senderPrivateKeyPassword - the sender private key password.public void encryptAndSign(byte[] data,
byte[] recipientPublicKey,
byte[] senderPrivateKey)
data - the data to be encrypted.recipientPublicKey - the recipient public key.senderPrivateKey - the sender private key.public long getPackageCount()
Return total package count.
Package count is known when encryption process is completed.
public byte[] getPackage(long index)
Return specific package.
Return package with specific index.
Packages are available when encryption process is completed.
index - package index.public void addPackage(byte[] pkg)
Add package.
Accumulate packages before decryption.
pkg - the package to be accumulatedpublic boolean isPackagesAccumulated()
true if all packages was successfully accumulated,
false otherwise.public byte[] decrypt(byte[] recipientPrivateKey,
byte[] recipientPrivateKeyPassword)
recipientPrivateKey - recipient private key.recipientPrivateKeyPassword - recipient private key password.public byte[] decrypt(byte[] recipientPrivateKey)
recipientPrivateKey - recipient private key.public byte[] verifyAndDecrypt(byte[] senderPublicKey,
byte[] recipientPrivateKey,
byte[] recipientPrivateKeyPassword)
senderPublicKey - sender public key.recipientPrivateKey - recipient private key.recipientPrivateKeyPassword - recipient private key password.public byte[] verifyAndDecrypt(byte[] senderPublicKey,
byte[] recipientPrivateKey)
senderPublicKey - sender public key.recipientPrivateKey - recipient private key.Copyright © 2016. All rights reserved.