ERXCrypto Class Reference

Collaboration diagram for ERXCrypto:

Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static byte[] base64Decode (String s) throws IOException
static String base64Encode (byte[] byteArray)
static String base64EncryptedString (String clearText, Key secretKey)
static String base64EncryptedString (String clearText)
static String base64HashedString (String v)
static byte[] base64urlDecode (String s) throws IOException
static String base64urlEncode (byte[] byteArray)
static String blowfishDecode (String encryptedText)
static String blowfishEncode (String clearText)
static String bytesToString (byte[] bytes)
static ERXCrypterInterface crypterForAlgorithm (String algorithm)
static NSMutableDictionary
< String, String
decodedFormValuesDictionary (NSDictionary< String, NSArray< String >> dict)
static String decryptedBase64String (String encryptedText, Key secretKey)
static String decryptedBase64String (String encryptedText)
static ERXCrypterInterface defaultCrypter ()
static void main (String[] args)
static void setCrypterForAlgorithm (ERXCrypterInterface crypter, String algorithm)
static void setSecretKeyPath (String secretKeyPath)
static void setSecretKeyPathFramework (String secretKeyPathFramework)
static String shaEncode (String text)

Static Public Attributes

static final String AES = "AES"
static final String BLOWFISH = "Blowfish"
static final String DES = "DES"
static final Logger log = Logger.getLogger(ERXCrypto.class)

Static Private Member Functions

static synchronized
NSMutableDictionary< String,
ERXCrypterInterface
crypters ()

Static Private Attributes

static NSMutableDictionary
< String, ERXCrypterInterface
_crypters


Member Function Documentation

static byte [] base64Decode ( String  s  )  throws IOException [static]

Base64 decodes the passed in String

static String base64Encode ( byte[]  byteArray  )  [static]

Base64 encodes the passed in byte[]

static String base64EncryptedString ( String  clearText,
Key  secretKey 
) [static]

static String base64EncryptedString ( String  clearText  )  [static]

static String base64HashedString ( String  v  )  [static]

Uses the SHA hash algorithm found in the Sun JCE to hash the passed in String. This String is then base64 encoded and returned.

static byte [] base64urlDecode ( String  s  )  throws IOException [static]

Base64url decodes the passed in String

static String base64urlEncode ( byte[]  byteArray  )  [static]

Base64url encodes the passed in byte[]

static String blowfishDecode ( String  encryptedText  )  [static]

static String blowfishEncode ( String  clearText  )  [static]

static String bytesToString ( byte[]  bytes  )  [static]

static ERXCrypterInterface crypterForAlgorithm ( String  algorithm  )  [static]

Returns the crypter for the given algorithm. By default, DES and Blowfish are available ("DES", "Blowfish", etc).

Parameters:
algorithm the algorithm to lookup
Returns:
the corresponding crypter
Exceptions:
IllegalArgumentException if there is no crypter for the given algorithm

static synchronized NSMutableDictionary<String, ERXCrypterInterface> crypters (  )  [static, private]

static NSMutableDictionary<String, String> decodedFormValuesDictionary ( NSDictionary< String, NSArray< String >>  dict  )  [static]

Decodes all of the values from a given dictionary using the default crypter.

Parameters:
dict dictionary of key value pairs where the values are encoded strings
Returns:
a dictionary of decoded key-value pairs

static String decryptedBase64String ( String  encryptedText,
Key  secretKey 
) [static]

static String decryptedBase64String ( String  encryptedText  )  [static]

static ERXCrypterInterface defaultCrypter (  )  [static]

Returns the default crypter. By default this is Blowfish, but you can override the choice by setting er.extensions.ERXCrypto.default.

Returns:
the default crypter

static void main ( String[]  args  )  [static]

Run this with ERXMainRunner passing in the plaintext you want to encrypt using the default crypter. This is useful if you are using encrypted properties and you need a quick way to know what to set the property value to.

Parameters:
args the plaintext to encrypt

static void setCrypterForAlgorithm ( ERXCrypterInterface  crypter,
String  algorithm 
) [static]

Sets the crypter for the given algorithm.

Parameters:
crypter the crypter to use
algorithm the algorithm name

static void setSecretKeyPath ( String  secretKeyPath  )  [static]

static void setSecretKeyPathFramework ( String  secretKeyPathFramework  )  [static]

static String shaEncode ( String  text  )  [static]

Sha encodes a given string. The resulting string is safe to use in urls and cookies. From the digest of the string it is nearly impossible to determine what the original string was. Running the same string through the Sha digest multiple times will always produce the same hash.

Parameters:
text to be put through the sha digest
Returns:
hashed form of the given string


Member Data Documentation

final String AES = "AES" [static]

The constant for the AES encryption algorithm.

final String BLOWFISH = "Blowfish" [static]

The constant for the Blowfish encryption algorithm.

final String DES = "DES" [static]

The constant for the DES encryption algorithm.

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

logging support


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