Name

SealedObject

Synopsis

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.

javax.crypto.SealedObject

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, ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.