Class EncryptingSerializer
java.lang.Object
org.apache.commons.jcs3.utils.serialization.StandardSerializer
org.apache.commons.jcs3.utils.serialization.EncryptingSerializer
- All Implemented Interfaces:
- IElementSerializer
Performs serialization and de-serialization. It encrypts and decrypts the
 value.
- Since:
- 3.1
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructorEncryptingSerializer(IElementSerializer serializer) Wrapper constructor
- 
Method SummaryModifier and TypeMethodDescription<T> TdeSerialize(byte[] data, ClassLoader loader) Uses default de-serialization to turn a byte array into an object.<T> byte[]serialize(T obj) Serializes an object using default serialization.voidsetAesCipherTransformation(String transformation) Set the cipher transformation for encryption and decryption Default is AES/ECB/PKCS5PaddingvoidsetPreSharedKey(String psk) Set the pre-shared key for encryption and decryptionMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.jcs3.engine.behavior.IElementSerializerdeSerializeFrom, deSerializeFrom, deSerializeFrom, serializeTo, serializeTo, serializeTo
- 
Constructor Details- 
EncryptingSerializerpublic EncryptingSerializer()Default constructor
- 
EncryptingSerializerWrapper constructor- Parameters:
- serializer- the wrapped serializer
 
 
- 
- 
Method Details
- 
setAesCipherTransformationSet the cipher transformation for encryption and decryption Default is AES/ECB/PKCS5Padding- Parameters:
- transformation- the transformation
 
- 
serializeSerializes an object using default serialization. Encrypts the byte array.- Specified by:
- serializein interface- IElementSerializer
- Overrides:
- serializein class- StandardSerializer
- Type Parameters:
- T- the type of the object
- Parameters:
- obj- object
- Returns:
- byte[]
- Throws:
- IOException- on i/o problem
 
- 
deSerializepublic <T> T deSerialize(byte[] data, ClassLoader loader) throws IOException, ClassNotFoundException Uses default de-serialization to turn a byte array into an object. Decrypts the value first. All exceptions are converted into IOExceptions.- Specified by:
- deSerializein interface- IElementSerializer
- Overrides:
- deSerializein class- StandardSerializer
- Parameters:
- data- data bytes
- loader- class loader to use
- Returns:
- Object
- Throws:
- IOException- on i/o problem
- ClassNotFoundException- if class is not found during deserialization