Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class javax.crypto.SealedObject

java.lang.Object
    |
    +----javax.crypto.SealedObject

public class SealedObject
extends java.lang.Object
implements java.io.Serializable
This class enables a programmer to create an object and protect its confidentiality with a cryptographic algorithm.

Given any Serializable object, one can create a SealedObject that encapsulates the original object, in serialized format (i.e., a "deep copy"), and seals (encrypts) its serialized contents, using a cryptographic algorithm such as DES, to protect its confidentiality. The encrypted content can later be decrypted (with the corresponding algorithm using the correct decryption key) and de-serialized, yielding the original object.

Note that the Cipher object must be fully initialized with the correct algorithm, key, padding scheme, etc., before being applied to a SealedObject.

See Also:
Cipher

Constructor Summary
 SealedObject(java.io.Serializable object, Cipher c)
Constructs a SealedObject from any Serializable object.
 

Method Summary
java.lang.Object  getObject(Cipher c)
Retrieves the original (encapsulated) object.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SealedObject

public SealedObject(java.io.Serializable object,
                    Cipher c) throws java.io.IOException, IllegalBlockSizeException
Constructs a SealedObject from any Serializable object.

The given object is sealed using the given Cipher, assuming that the Cipher is already properly initialized.

Parameters:
object - the object to be sealed.
c - the cipher used to seal the object.
Throws:
java.io.IOException - if an error occurs during serialization
IllegalBlockSizeException - if the given cipher is a block cipher, no padding has been requested, and the total input length is not a multiple of the cipher's block size
Method Detail

getObject

public final java.lang.Object getObject(Cipher c) throws java.io.IOException, java.lang.ClassNotFoundException, IllegalBlockSizeException, BadPaddingException
Retrieves the original (encapsulated) object.

The encapsulated object is unsealed (using the given Cipher, assuming that the Cipher is already properly initialized) and de-serialized, before it is returned.

Parameters:
c - the cipher used to unseal the object
Returns:
the original object.
Throws:
java.io.IOException - if an error occurs during de-serialiazation
java.lang.ClassNotFoundException - if an error occurs during de-serialiazation
IllegalBlockSizeException - if the given cipher is a block cipher, no padding has been requested, and the total input length is not a multiple of the cipher's block size
BadPaddingException - if the given cipher has been initialized for decryption, and padding has been specified, but the input data does not have proper expected padding bytes

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS