public final Object getObject (Key key) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, InvalidKeyException

Retrieves the original (encapsulated) object.

This method creates a cipher for the algorithm that had been used in the sealing operation. If the default provider package provides an implementation of that algorithm, an instance of Cipher containing that implementation is used. If the algorithm is not available in the default package, other packages are searched. The Cipher object is initialized for decryption, using the given key and the parameters (if any) that had been used in the sealing operation.

The encapsulated object is unsealed and de-serialized, before it is returned.

Parameters:
key    the key used to unseal the object.

Returns:  the original object.

Exceptions:
IOException    if an error occurs during de-serialiazation.
ClassNotFoundException    if an error occurs during de-serialiazation.
NoSuchAlgorithmException    if the algorithm to unseal the object is not available.
InvalidKeyException    if the given key cannot be used to unseal the object (e.g., it has the wrong algorithm).
NullPointerException    if key is null.