org.mmbase.util.transformers
Class EncryptionTransformerFactory

java.lang.Object
  extended by org.mmbase.util.transformers.EncryptionTransformerFactory
All Implemented Interfaces:
ParameterizedTransformerFactory<CharTransformer>

public class EncryptionTransformerFactory
extends Object
implements ParameterizedTransformerFactory<CharTransformer>

This transformerfactory can encrypt and decrypt strings. The algorithm which is used for encryption/decryption is parameterized, and defaults to AES. Since these encryption algorithms return raw bytes, an encoding must be supplied which is used to convert bytes to characters: either hexadecimal encoding or base64.

Author:
Sander de Boer

Nested Class Summary
(package private)  class EncryptionTransformerFactory.Decryption
           
(package private)  class EncryptionTransformerFactory.Encryption
           
 
Field Summary
protected static Parameter[] PARAMS
           
 
Constructor Summary
EncryptionTransformerFactory()
           
 
Method Summary
 Parameters createParameters()
          Create empty Parameters object for use with ParameterizedTransformerFactory.createTransformer(Parameters).
 CharTransformer createTransformer(Parameters parameters)
          Return a parameterized transformer, based on the given parameters.
static byte[] decode(String input, String format)
          Decode a given string to an array of bytes, using a given format.
static String encode(byte[] input, String format)
          Encode a given array of bytes to a string, using the given format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMS

protected static final Parameter[] PARAMS
Constructor Detail

EncryptionTransformerFactory

public EncryptionTransformerFactory()
Method Detail

encode

public static String encode(byte[] input,
                            String format)
Encode a given array of bytes to a string, using the given format. This can be 'hex' or 'base64'.


decode

public static byte[] decode(String input,
                            String format)
                     throws IllegalArgumentException
Decode a given string to an array of bytes, using a given format. This can throw an 'IllegalArgumentException' when the given input string isn't correct according to the format.

Throws:
IllegalArgumentException

createParameters

public Parameters createParameters()
Description copied from interface: ParameterizedTransformerFactory
Create empty Parameters object for use with ParameterizedTransformerFactory.createTransformer(Parameters).

Specified by:
createParameters in interface ParameterizedTransformerFactory<CharTransformer>

createTransformer

public CharTransformer createTransformer(Parameters parameters)
Return a parameterized transformer, based on the given parameters. These can be the following:

Specified by:
createTransformer in interface ParameterizedTransformerFactory<CharTransformer>


MMBase 2.0-SNAPSHOT - null