org.jboss.remoting.marshal.encryption
Class EncryptingUnMarshaller

java.lang.Object
  extended by org.jboss.remoting.marshal.serializable.SerializableUnMarshaller
      extended by org.jboss.remoting.marshal.encryption.EncryptingUnMarshaller
All Implemented Interfaces:
java.io.Serializable, PreferredStreamUnMarshaller, SerialUnMarshaller, UnMarshaller, VersionedUnMarshaller

public class EncryptingUnMarshaller
extends SerializableUnMarshaller

EncryptingMarshaller and EncryptingUnMarshaller are a general purpose encrypting marshaller / decompressing unmarshaller pair based on Java's crypto stream facilities.

EncryptingUnMarshaller is subclassed from SerializableUnMarshaller, and by default it uses super.read() to deserialize an object, once the object has been decrypted. Optionally, it can wrap any other unmarshaller and use that instead of SerializableUnMarshaller to unmarshall an encrypted input stream. For example,

new EncryptingUnMarshaller(new HTTPUnMarshaller())
will create an umarshaller that uses an HTTPUnMarshaller to restore an unencrypted input stream.

Version:
$Revision: 2385 $
Author:
Anil.Saldhana@jboss.org
See Also:
Serialized Form

Field Summary
static java.lang.String DATATYPE
           
 
Fields inherited from class org.jboss.remoting.marshal.serializable.SerializableUnMarshaller
customClassLoader, serializationType
 
Constructor Summary
EncryptingUnMarshaller()
          Create a new EncryptingUnMarshaller.
EncryptingUnMarshaller(UnMarshaller unMarshaller)
          Create a new EncryptingUnMarshaller.
 
Method Summary
 UnMarshaller cloneUnMarshaller()
          Returns a new EncryptingUnMarshaller
 java.lang.Object read(java.io.InputStream inputStream, java.util.Map metadata, int version)
          Restores a encrypted, marshalled form of an object to its original state.
 void setCipherAlgorithm(java.lang.String algo)
          Set the Cipher Algorithm to use
 
Methods inherited from class org.jboss.remoting.marshal.serializable.SerializableUnMarshaller
getMarshallingStream, getMarshallingStream, getSerializationType, read, setClassLoader, setSerializationType
 
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

EncryptingUnMarshaller

public EncryptingUnMarshaller()
Create a new EncryptingUnMarshaller.


EncryptingUnMarshaller

public EncryptingUnMarshaller(UnMarshaller unMarshaller)
Create a new EncryptingUnMarshaller.

Parameters:
unMarshaller - unmarshaller to be used to restore unencrypted byte stream to original object
Method Detail

setCipherAlgorithm

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

Parameters:
algo -
See Also:
EncryptionManager.DEFAULT_CIPHER_ALGORITHM

read

public java.lang.Object read(java.io.InputStream inputStream,
                             java.util.Map metadata,
                             int version)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Restores a encrypted, marshalled form of an object to its original state.

Specified by:
read in interface VersionedUnMarshaller
Overrides:
read in class SerializableUnMarshaller
Parameters:
inputStream - InputStream from which marshalled form is to be retrieved
metadata - can be any transport specific metadata (such as headers from http transport). This can be null, depending on if transport supports metadata.
version - wire format version
Returns:
restored object
Throws:
java.io.IOException - if there is a problem reading from inputStream
java.lang.ClassNotFoundException - if there is a problem finding a class needed for unmarshalling

cloneUnMarshaller

public UnMarshaller cloneUnMarshaller()
                               throws java.lang.CloneNotSupportedException
Returns a new EncryptingUnMarshaller

Specified by:
cloneUnMarshaller in interface UnMarshaller
Overrides:
cloneUnMarshaller in class SerializableUnMarshaller
Returns:
a new EncryptingUnMarshaller
Throws:
java.lang.CloneNotSupportedException - In practice no exceptions are thrown.


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