java.lang.Object | |
↳ | javax.crypto.SealedObject |
A SealedObject
is a wrapper around a serializable
object
instance and encrypts it using a cryptographic cipher.
Since a SealedObject
instance is serializable it can
either be stored or transmitted over an insecure channel.
The wrapped object can later be decrypted (unsealed) using the corresponding key and then be deserialized to retrieve the original object. The sealed object itself keeps track of the cipher and corresponding parameters.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
encodedParams | The cipher's AlgorithmParameters in encoded format. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
SealedObject instance wrapping the specified object
and sealing it using the specified cipher. |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
SealedObject instance by copying the data from
the specified object. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the algorithm this object was sealed with.
| |||||||||||
Returns the wrapped object, decrypting it using the specified key.
| |||||||||||
Returns the wrapped object, decrypting it using the specified key.
| |||||||||||
Returns the wrapped object, decrypting it using the specified
cipher.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The cipher's AlgorithmParameters
in encoded format.
Equivalent to cipher.getParameters().getEncoded()
,
or null if the cipher did not use any parameters.
Creates a new SealedObject
instance wrapping the specified object
and sealing it using the specified cipher.
The cipher must be fully initialized.
object | the object to seal, can be null . |
---|---|
c | the cipher to encrypt the object. |
IOException | if the serialization fails. |
---|---|
IllegalBlockSizeException | if the specified cipher is a block cipher and the length of the serialized data is not a multiple of the ciphers block size. |
NullPointerException | if the cipher is null .
|
Creates a new SealedObject
instance by copying the data from
the specified object.
so | the object to copy. |
---|
Returns the algorithm this object was sealed with.
Returns the wrapped object, decrypting it using the specified key.
key | the key to decrypt the data with. |
---|
IOException | if deserialization fails. |
---|---|
ClassNotFoundException | if deserialization fails. |
NoSuchAlgorithmException | if the algorithm to decrypt the data is not available. |
InvalidKeyException | if the specified key cannot be used to decrypt the data. |
Returns the wrapped object, decrypting it using the specified key. The specified provider is used to retrieve the cipher algorithm.
key | the key to decrypt the data. |
---|---|
provider | the name of the provider that provides the cipher algorithm. |
IOException | if deserialization fails. |
---|---|
ClassNotFoundException | if deserialization fails. |
NoSuchAlgorithmException | if the algorithm used to decrypt the data is not available. |
NoSuchProviderException | if the specified provider is not available. |
InvalidKeyException | if the specified key cannot be used to decrypt the data. |
Returns the wrapped object, decrypting it using the specified cipher.
c | the cipher to decrypt the data. |
---|
IOException | if deserialization fails. |
---|---|
ClassNotFoundException | if deserialization fails. |
IllegalBlockSizeException | if the specified cipher is a block cipher and the length of the serialized data is not a multiple of the ciphers block size. |
BadPaddingException | if the padding of the data does not match the padding scheme. |