atg.projects.store.crypto
Class DESEncryptor

java.lang.Object
  extended by atg.projects.store.crypto.AbstractEncryptor
      extended by atg.projects.store.crypto.DESEncryptor
All Implemented Interfaces:
Encryptor, java.io.Serializable

public class DESEncryptor
extends AbstractEncryptor

A simple class for performing encryption/decryption operations using the javax.crypto package.

See Also:
Serialized Form

Field Summary
protected static java.lang.String ALGORITHM
          Crypto algorithm name.
static java.lang.String CLASS_VERSION
          Class version string
protected static java.lang.String KEY
          24 byte key string.
 
Constructor Summary
DESEncryptor()
          Default constructor.
 
Method Summary
protected  byte[] decodeToByteArray(java.lang.String pValue)
          Decode to byte array.
protected  void doAcceptDecryptKey(byte[] pValue)
          This is two way encryption, so encrypt/decrypt keys are the same.
protected  void doAcceptEncryptKey(byte[] pValue)
          This is two way encryption, so encrypt/decrypt keys are the same.
protected  byte[] doDecrypt(byte[] pValue)
          Performs decription of array of bytes.
protected  byte[] doEncrypt(byte[] pValue)
          Performs encryption of array of bytes.
protected  void doInit()
          Initialize DESEncrytor.
protected  java.lang.String encodeToString(byte[] pValue)
          Once encrypted, string data may no longer be a string because the encrypted data is binary and may contain null characters, thus it may need to be encoded using a encoder such as Base64, UUEncode (ASCII only) or UCEncode(ASCII independent).
 
Methods inherited from class atg.projects.store.crypto.AbstractEncryptor
acceptDecryptKey, acceptEncryptKey, decrypt, decrypt, encrypt, encrypt, init, postDecrypt, postDecrypt, postEncrypt, postEncrypt, preDecrypt, preDecrypt, preEncrypt, preEncrypt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


ALGORITHM

protected static final java.lang.String ALGORITHM
Crypto algorithm name.

See Also:
Constant Field Values

KEY

protected static final java.lang.String KEY
24 byte key string.

See Also:
Constant Field Values
Constructor Detail

DESEncryptor

public DESEncryptor()
Default constructor.

Method Detail

doAcceptEncryptKey

protected final void doAcceptEncryptKey(byte[] pValue)
                                 throws EncryptorException
This is two way encryption, so encrypt/decrypt keys are the same.

Specified by:
doAcceptEncryptKey in class AbstractEncryptor
Parameters:
pValue - - key
Throws:
EncryptorException - if encryption error occurs

doAcceptDecryptKey

protected final void doAcceptDecryptKey(byte[] pValue)
                                 throws EncryptorException
This is two way encryption, so encrypt/decrypt keys are the same.

Specified by:
doAcceptDecryptKey in class AbstractEncryptor
Parameters:
pValue - - key
Throws:
EncryptorException - if encryption error occurs

doInit

protected final void doInit()
                     throws EncryptorException
Initialize DESEncrytor.

Specified by:
doInit in class AbstractEncryptor
Throws:
EncryptorException - This exception indicates that a severe error occured while performing a cryptograpy operation.

doEncrypt

protected final byte[] doEncrypt(byte[] pValue)
                          throws EncryptorException
Performs encryption of array of bytes.

Specified by:
doEncrypt in class AbstractEncryptor
Parameters:
pValue - array of bytes to encrypt
Returns:
encrypted array of bytes
Throws:
EncryptorException - This exception indicates that a severe error occured while performing a cryptograpy operation.

doDecrypt

protected final byte[] doDecrypt(byte[] pValue)
                          throws EncryptorException
Performs decription of array of bytes.

Specified by:
doDecrypt in class AbstractEncryptor
Parameters:
pValue - decrypt array of bytes
Returns:
decrypted array of bytes
Throws:
EncryptorException - This exception indicates that a severe error occured while performing a cryptograpy operation.

encodeToString

protected java.lang.String encodeToString(byte[] pValue)
                                   throws EncryptorException
Once encrypted, string data may no longer be a string because the encrypted data is binary and may contain null characters, thus it may need to be encoded using a encoder such as Base64, UUEncode (ASCII only) or UCEncode(ASCII independent).

Overrides:
encodeToString in class AbstractEncryptor
Parameters:
pValue - Value to encode
Returns:
Encoded data
Throws:
EncryptorException - This exception indicates that an error occured while performing a cryptograpy operation.

decodeToByteArray

protected byte[] decodeToByteArray(java.lang.String pValue)
                            throws EncryptorException
Decode to byte array.

Overrides:
decodeToByteArray in class AbstractEncryptor
Parameters:
pValue - - value to decode
Returns:
byte array
Throws:
EncryptorException - if encryption error occurs