|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.common.util.crypto.cipher.BasicCryptor
public class BasicCryptor
Implementation of Cryptor
interface that can perform both
encryption and decryption. Instances of this class can be cast to any
of the following interfaces: Cryptor
, Encryptor
,
or Decryptor
.
Public methods in this class throw only CryptoException
s.
Encryptor
,
Decryptor
Field Summary | |
---|---|
protected java.lang.String |
cipherAlgorithm
|
protected java.security.Key |
decryptKey
The key to be used for decryption. |
protected javax.crypto.Cipher |
encryptCipher
The Cipher to use for encryption. |
Constructor Summary | |
---|---|
BasicCryptor(java.security.Key encryptKey,
java.security.Key decryptKey,
java.lang.String algorithm)
|
Method Summary | |
---|---|
byte[] |
decrypt(byte[] ciphertext)
Decrypt the ciphertext to yield the original cleartext. |
java.lang.String |
decrypt(java.lang.String ciphertext)
Decrypt the ciphertext to yield the original cleartext. |
byte[] |
encrypt(byte[] cleartext)
Encrypt the cleartext in byte array format. |
java.lang.String |
encrypt(java.lang.String cleartext)
Encrypt the cleartext |
protected void |
initDecryptCipher()
Initialize the ciphers used for encryption and decryption. |
protected void |
initEncryptCipher()
Initialize the cipher used for encryption. |
java.io.Serializable |
sealObject(java.io.Serializable object)
|
static java.lang.String |
stripEncryptionPrefix(java.lang.String ciphertext)
|
java.io.Serializable |
unsealObject(java.io.Serializable object)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.security.Key decryptKey
protected javax.crypto.Cipher encryptCipher
Cipher
to use for encryption.
protected java.lang.String cipherAlgorithm
Constructor Detail |
---|
public BasicCryptor(java.security.Key encryptKey, java.security.Key decryptKey, java.lang.String algorithm) throws CryptoException
CryptoException
Method Detail |
---|
public byte[] decrypt(byte[] ciphertext) throws CryptoException
decrypt
in interface Decryptor
ciphertext
- The text to be encrypted, in byte formThe
- decrypted cleartext, in byte form
CryptoException
public java.lang.String decrypt(java.lang.String ciphertext) throws CryptoException
Decryptor
decrypt
in interface Decryptor
ciphertext
- The text to be encrypted
CryptoException
public static java.lang.String stripEncryptionPrefix(java.lang.String ciphertext)
protected void initDecryptCipher() throws CryptoException
CryptoException
public java.io.Serializable unsealObject(java.io.Serializable object) throws CryptoException
unsealObject
in interface Decryptor
CryptoException
public byte[] encrypt(byte[] cleartext) throws CryptoException
encrypt
in interface Encryptor
cleartext
- The text to be encrypted, in byte formThe
- encrypted ciphertext, in byte form
CryptoException
public java.lang.String encrypt(java.lang.String cleartext) throws CryptoException
Encryptor
encrypt
in interface Encryptor
cleartext
- The text to be encrypted
CryptoException
protected void initEncryptCipher() throws CryptoException
CryptoException
public java.io.Serializable sealObject(java.io.Serializable object) throws CryptoException
sealObject
in interface Encryptor
CryptoException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |