|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.digitalsanctuary.atg.crypto.AbstractEncryptor
Field Summary | |
static java.lang.String |
CHAR_SET
This defines the character set which is used explicitly during byte[]<-->String conversions. |
Constructor Summary | |
AbstractEncryptor(byte[] pKey)
This constructor takes in a cipher key in the form of a byte array. |
|
AbstractEncryptor(java.lang.String pKey)
This constructor takes in a cipher key in the form of a String. |
Method Summary | |
java.lang.String |
computeMAC(java.lang.String pClearText)
This method computes the MAC message signature for the clear text. |
protected byte[] |
decrypt(byte[] pBytesToDecrypt)
This method takes in a byte array and decrypts it using the AES algorithm and the key used to setup this class. |
java.lang.String |
decrypt(java.lang.String pStringToDecrypt)
This method wraps the byte array based encrypt and allows you to pass in a String, which it decodes to a byte array. |
protected byte[] |
encrypt(byte[] pBytesToEncrypt)
This method takes in a byte array and encrypts it using the AES algorithm and the key used to setup this class. |
java.lang.String |
encrypt(java.lang.String pStringToEncrypt)
This method wraps the byte array based encrypt and allows you to pass in a String, which it decodes to a byte array. |
protected abstract java.lang.String |
getAlgorithmName()
The Algorithm name for the Encryptor. |
void |
setKey(byte[] pKey)
This method takes in a cipher key byte array, sets it into this class's member variable KeyBytes, and then calls initialize() to initialize the encryption and decryption Cipher instances with this new key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CHAR_SET
Constructor Detail |
public AbstractEncryptor(byte[] pKey) throws EncryptorException
pKey
- byte array of the cipher key. 32 bytes/256 bits recommended.
EncryptorException
- if the key cannot be used to setup the encryption and decryption Cipher instances.public AbstractEncryptor(java.lang.String pKey) throws EncryptorException
pKey
- String of the cipher key. 32 characters/256 bits recommended.
EncryptorException
- if the key cannot be used to setup the encryption and decryption Cipher instances.Method Detail |
public java.lang.String computeMAC(java.lang.String pClearText) throws EncryptorException
pClearText
- the plain text you wish to compute the MAC for. This must match the plain text you encrypt.
EncryptorException
- if the key is invalid, if the algorithm is improperly defined, or if the encoding fails.public final java.lang.String decrypt(java.lang.String pStringToDecrypt) throws EncryptorException
pStringToDecrypt
- The String you wish to decrypt with this Encryptor
EncryptorException
- if the String to decrypt could not be decoded using Base64.public final java.lang.String encrypt(java.lang.String pStringToEncrypt) throws EncryptorException
pStringToEncrypt
- The String you wish to encrypt with this AESEncryptor
EncryptorException
- if the encrypted bytes could not be encoded using Base64.public final void setKey(byte[] pKey) throws EncryptorException
pKey
- byte array of the cipher key. 32 bytes/256 bits recommended.
EncryptorException
- if initialization fails, typically due to a bad key.protected final byte[] decrypt(byte[] pBytesToDecrypt) throws EncryptorException
pBytesToDecrypt
- the byte array to be decrypted using AES and the key in mKeyBytes
EncryptorException
- if decryption fails.protected final byte[] encrypt(byte[] pBytesToEncrypt) throws EncryptorException
pBytesToEncrypt
- the byte array to be encrypted using AES and the key in mKeyBytes
EncryptorException
- if encryption fails.protected abstract java.lang.String getAlgorithmName()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |