public class BasicCryptor extends Object implements Cryptor
Public methods in this class throw only CryptoExceptions.
| Modifier and Type | Field and Description |
|---|---|
protected String |
cipherAlgorithm |
protected Key |
decryptKey
The key to be used for decryption.
|
static String |
ENCRYPT_PREFIX |
protected Cipher |
encryptCipher
The
Cipher to use for encryption. |
static String |
OLD_ENCRYPT_PREFIX |
| Constructor and Description |
|---|
BasicCryptor(Key encryptKey,
Key decryptKey,
String algorithm,
IvParameterSpec iv) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] ciphertext)
Decrypt the ciphertext to yield the original cleartext.
|
byte[] |
encrypt(byte[] cleartext)
Encrypt the cleartext in byte array format.
|
byte[] |
encrypt(byte[] buffer,
int offset,
int length) |
protected void |
initDecryptCipher()
Initialize the ciphers used for encryption and decryption.
|
protected void |
initEncryptCipher()
Initialize the cipher used for encryption.
|
Object |
sealObject(Object object) |
void |
setClassLoader(ClassLoader classLoader) |
void |
setUseSealedObject(boolean useSealedObject) |
Object |
unsealObject(Object object) |
protected Key decryptKey
protected Cipher encryptCipher
Cipher to use for encryption.protected String cipherAlgorithm
public static final String OLD_ENCRYPT_PREFIX
public static final String ENCRYPT_PREFIX
public BasicCryptor(Key encryptKey, Key decryptKey, String algorithm, IvParameterSpec iv) throws CryptoException
CryptoExceptionpublic void setUseSealedObject(boolean useSealedObject)
public void setClassLoader(ClassLoader classLoader)
public byte[] decrypt(byte[] ciphertext)
throws CryptoException
decrypt in interface Cryptorciphertext - The text to be encrypted, in byte formCryptoExceptionprotected void initDecryptCipher()
throws CryptoException
CryptoExceptionpublic Object unsealObject(Object object) throws CryptoException
unsealObject in interface CryptorCryptoExceptionpublic byte[] encrypt(byte[] cleartext)
throws CryptoException
encrypt in interface Cryptorcleartext - The text to be encrypted, in byte formCryptoExceptionpublic byte[] encrypt(byte[] buffer,
int offset,
int length)
throws CryptoException
CryptoExceptionprotected void initEncryptCipher()
throws CryptoException
CryptoExceptionpublic Object sealObject(Object object) throws CryptoException
sealObject in interface CryptorCryptoExceptionCopyright © 2020. All rights reserved.