SealedObject (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[Serializable](../../java/io/Serializable.html "interface in java.io")


public class SealedObject extends Object implements 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 AES, 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.

The original object that was sealed can be recovered in two different ways:

Since:

1.4

See Also:

Cipher, Serialized Form

Fields

Modifier and Type Field Description
protected byte[] encodedParams The cryptographic parameters used by the sealing Cipher, encoded in the default format.

Constructors

Modifier Constructor Description
SealedObject​(Serializable object,Cipher c) Constructs a SealedObject from any Serializable object.
protected SealedObject​(SealedObject so) Constructs a SealedObject object from the passed-in SealedObject.
Modifier and Type Method Description
String getAlgorithm() Returns the algorithm that was used to seal this object.
Object getObject​(Key key) Retrieves the original (encapsulated) object.
Object getObject​(Key key,String provider) Retrieves the original (encapsulated) object.
Object getObject​(Cipher c) Retrieves the original (encapsulated) object.

Methods declared in class java.lang.Object

[clone](../../java/lang/Object.html#clone%28%29), [equals](../../java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../java/lang/Object.html#finalize%28%29), [getClass](../../java/lang/Object.html#getClass%28%29), [hashCode](../../java/lang/Object.html#hashCode%28%29), [notify](../../java/lang/Object.html#notify%28%29), [notifyAll](../../java/lang/Object.html#notifyAll%28%29), [toString](../../java/lang/Object.html#toString%28%29), [wait](../../java/lang/Object.html#wait%28%29), [wait](../../java/lang/Object.html#wait%28long%29), [wait](../../java/lang/Object.html#wait%28long,int%29)