Team LiB
Previous Section Next Section

SealedObjectjavax.crypto

Java 1.4serializable

This class is a wrapper around a serializable object. It serializes the object and encrypts the resulting data stream, thereby protecting the confidentiality of the object. Create a SealedObject by specifying the object to be sealed and a Cipher object to perform the encryption. Retrieve the sealed object by calling getObject( ) and specifying the Cipher or java.security.Key to use for decryption. The SealedObject keeps track of the encryption algorithm and parameters so that a Key object alone can decrypt the object.

Figure 17-9. javax.crypto.SealedObject


public class SealedObject implements Serializable {
// Public Constructors
     public SealedObject(Serializable object, Cipher c) 
        throws java.io.IOException, IllegalBlockSizeException;  
// Protected Constructors
     protected SealedObject(SealedObject so);  
// Public Instance Methods
     public final String getAlgorithm( );  
     public final Object getObject(java.security.Key key)
        throws java.io.IOException, ClassNotFoundException, 
        java.security.NoSuchAlgorithmException, java.security.InvalidKeyException;  
     public final Object getObject(Cipher c) 
        throws java.io.IOException, ClassNotFoundException, 
        IllegalBlockSizeException, BadPaddingException;  
     public final Object getObject(java.security.Key key, String provider) 
        throws java.io.IOException, ClassNotFoundException, 
        java.security.NoSuchAlgorithmException, 
        java.security.NoSuchProviderException, 
        java.security.InvalidKeyException;  
// Protected Instance Fields
     protected byte[ ] encodedParams;  
}

    Team LiB
    Previous Section Next Section