ERXAbstractBlowfishCrypter Class Reference

Inherits er::extensions::crypting::ERXCrypterInterface.

Inherited by ERXBlowfishCrypter, and ERXKeyStoreBlowfishCrypter.

Collaboration diagram for ERXAbstractBlowfishCrypter:

Collaboration graph
[legend]

List of all members.

Public Member Functions

int blockSize ()
String decrypt (String cryptedText)
String encrypt (String clearText)
 ERXAbstractBlowfishCrypter ()
void setBlockSize (int blockSize)

Static Public Attributes

static final Logger log = Logger.getLogger(ERXCrypto.class)

Protected Member Functions

Cipher createBlowfishCipher (int mode)
Cipher decryptCipher ()
Cipher encryptCipher ()
abstract Key secretBlowfishKey () throws Exception

Private Attributes

int _blockSize
Cipher _decryptCipher
Cipher _encryptCipher


Detailed Description

ERXAbstractBlowfishCrypter is a blowfish implementation of the crypter interface that allows subclasses to override the source of the blowfish key. The blowfish cipher is a two-way cipher meaning the original string that was encrypted can be retrieved. The way that this version of the blowfish cipher is encrypted it is safe to use as a form value.

Author:
mschrag

Constructor & Destructor Documentation


Member Function Documentation

int blockSize (  ) 

Returns the block size for this cipher.

Returns:
the block size for this cipher

Cipher createBlowfishCipher ( int  mode  )  [protected]

Creates a blowfish cipher for a given mode. The two possible modes for a blowfish cipher are: ENCRYPT and DECRYPT.

Parameters:
mode of the cipher (encrypting or decrypting)
Returns:
a blowfish cipher initialized with the given mode and with the secretKey from the above method.

String decrypt ( String  cryptedText  ) 

Decodes a blowfish encoded string. Note that the originally encoded string should have been encoded with the same secret key as is used for the decoding cipher or else you are going to get garbage. To encode a string have a look at blowfishEncode.

Parameters:
cryptedText blowfish encoded string to be decoded
Returns:
decode clear text string

Implements ERXCrypterInterface.

Cipher decryptCipher (  )  [protected]

Method used to return the shared instance of the blowfish decryption cipher.

Returns:
blowfish decryption cipher

String encrypt ( String  clearText  ) 

Blowfish encodes a given string using the secret key specified in the System property: ERBlowfishCipherKey. The blowfish cipher is a two way cipher meaning that given the secret key you can de-cipher what the original string is. For one-way encryption look at methods dealing with the Sha alogrithm. To decode a blowfish encoded string use the method: blowfishDecode. The resultant string from encoding a string is safe for use in urls and cookies.

Parameters:
clearText string to be encrypted
Returns:
encrypted string

Implements ERXCrypterInterface.

Cipher encryptCipher (  )  [protected]

Method used to return the shared instance of the blowfish encryption cipher.

Returns:
blowfish encryption cipher

abstract Key secretBlowfishKey (  )  throws Exception [protected, pure virtual]

Returns the secret key to use for this cipher.

Returns:
a secret key for the blowfish cipher

Implemented in ERXBlowfishCrypter, and ERXKeyStoreBlowfishCrypter.

void setBlockSize ( int  blockSize  ) 

Sets the block size to use for this cipher.

Parameters:
blockSize the block size to use for this cipher


Member Data Documentation

int _blockSize [private]

Block size of blowfish encrypted strings

Cipher _decryptCipher [private]

Used to cache the blowfish decryption cipher

Cipher _encryptCipher [private]

Used to cache the blowfish encryption cipher

final Logger log = Logger.getLogger(ERXCrypto.class) [static]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:07 2012 for Project Wonder by  doxygen 1.5.8