org.jboss.remoting.marshal.encryption
Class EncryptingMarshaller

java.lang.Object
  extended by org.jboss.remoting.marshal.serializable.SerializableMarshaller
      extended by org.jboss.remoting.marshal.encryption.EncryptingMarshaller
All Implemented Interfaces:
java.io.Serializable, Marshaller, PreferredStreamMarshaller, SerialMarshaller, VersionedMarshaller

public class EncryptingMarshaller
extends SerializableMarshaller

EncryptingMarshaller and EncryptingMarshaller are a general purpose encryption based marshaller / decompressing unmarshaller pair based on Java's Cipher facilities.

EncryptingMarshaller is subclassed from SerializableMarshaller, and by default it uses super.write() to marshall an object, which is then encrypted. Optionally, it can wrap any other marshaller and use that instead of SerializableMarshaller to marshall an object before it is encrypted. For example,

new EncryptingMarshaller(new HTTPMarshaller())

will create a marshaller that encrypts the output of an HTTPMarshaller.

Author:
Anil Saldhana
See Also:
Serialized Form

Field Summary
static java.lang.String DATATYPE
           
 
Constructor Summary
EncryptingMarshaller()
          Create a new EncryptingMarshaller.
EncryptingMarshaller(Marshaller marshaller)
          Create a new EncryptingMarshaller.
EncryptingMarshaller(java.lang.String algo, java.security.Key key)
          Create a new EncryptingMarshaller.
 
Method Summary
 Marshaller cloneMarshaller()
          Returns a EncryptingMarshaller.
 void setCipherAlgorithm(java.lang.String algo)
          Set the Cipher Algorithm to use
 void write(java.lang.Object dataObject, java.io.OutputStream output, int version)
          Writes encrypted, marshalled form of dataObject to output.
 
Methods inherited from class org.jboss.remoting.marshal.serializable.SerializableMarshaller
getMarshallingStream, getMarshallingStream, getSerializationType, setSerializationType, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATATYPE

public static final java.lang.String DATATYPE
See Also:
Constant Field Values
Constructor Detail

EncryptingMarshaller

public EncryptingMarshaller()
Create a new EncryptingMarshaller.


EncryptingMarshaller

public EncryptingMarshaller(java.lang.String algo,
                            java.security.Key key)
Create a new EncryptingMarshaller.

Parameters:
algo - Cipher Algorithm
key - Key
See Also:
setCipherAlgorithm(String)

EncryptingMarshaller

public EncryptingMarshaller(Marshaller marshaller)
Create a new EncryptingMarshaller.

Parameters:
marshaller - A Marshaller which is used to turn objects into byte streams.
Method Detail

setCipherAlgorithm

public void setCipherAlgorithm(java.lang.String algo)
Set the Cipher Algorithm to use

Parameters:
algo -
See Also:
EncryptionManager.DEFAULT_CIPHER_ALGORITHM

write

public void write(java.lang.Object dataObject,
                  java.io.OutputStream output,
                  int version)
           throws java.io.IOException
Writes encrypted, marshalled form of dataObject to output.

Specified by:
write in interface VersionedMarshaller
Overrides:
write in class SerializableMarshaller
Parameters:
dataObject - arbitrary object to be marshalled
output - OutputStream to which output is to be marshalled
version - wire format version
Throws:
java.io.IOException

cloneMarshaller

public Marshaller cloneMarshaller()
                           throws java.lang.CloneNotSupportedException
Returns a EncryptingMarshaller.

Specified by:
cloneMarshaller in interface Marshaller
Overrides:
cloneMarshaller in class SerializableMarshaller
Returns:
a EncryptingMarshaller.
Throws:
java.lang.CloneNotSupportedException - In practice no exceptions are thrown


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.