h09219 s 00039/00088/00093 d D 1.4 97/12/09 15:24:52 luehe 5 4 c rm ,* e s 00000/00019/00181 d D 1.3 97/10/22 15:25:08 luehe 4 3 c removed examples e s 00003/00003/00197 d D 1.2 97/10/18 13:59:54 luehe 3 1 c removed examples e s 00000/00000/00000 d R 1.2 97/10/09 09:58:17 Codemgr 2 1 c SunPro Code Manager data about conflicts, renames, etc... c Name history : 1 0 security/JCE1.2/earlyaccess/javax.crypto.SealedObject.html e s 00200/00000/00000 d D 1.1 97/10/09 09:58:16 luehe 1 0 c date and time created 97/10/09 09:58:16 by luehe e u U f e 0 t T I 1
D 3 E 3 I 3 D 5 E 5 I 5 E 5 E 3D 3 All Packages Class Hierarchy This Package Previous Next IndexE 3 I 3 D 5 All Packages Class Hierarchy This Package Previous Next Index E 5 I 5 All Packages Class Hierarchy This Package Previous Next Index E 5 E 3
java.lang.Object | +----javax.crypto.SealedObject
Given any Serializable object, one can create a SealedObject D 5 that embeds in its content the original object, in serialized format (i.e., a "deep copy"). Then, a cryptographic algorithm, such as DES, can be applied to the content to protect its confidentiality. The encrypted content can later be decrypted with the corresponding algorithm using the correct decryption key.
After decryption, the original content can be obtained in object form through deserialization. The content, while encrypted, is not available to anyone who does not possess the correct decryption key, assuming that the cryptosystem is secure. E 5 I 5 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 DES, 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. E 5 D 4
A typical usage is illustrated with the following code segment.
(generate a key and initialize cipher) KeyGenerator keyGen = KeyGenerator.getInstance("DES"); SecretKey desKey = keyGen.generateKey(); Cipher cipher = Cipher.getInstance("DES"); cipher.init(Cipher.ENCRYPT_MODE, desKey); ... (create SealedObject and encrypt) SealedObject so = new SealedObject("we are here"); so.seal(cipher); ... (decrypt and retrieve the original object) cipher.init(Cipher.DECRYPT_MODE, desKey); so.unseal(cipher); try { String s = (String) so.getContent(); } catch (java.lang.ClassNotFoundException e) {};E 4
Note that the Cipher object must be fully initialized with the correct algorithm, key, padding scheme, etc., before being applied to a SealedObject.
D 5 public SealedObject(Serializable object) throws IOException E 5 I 5 public SealedObject(Serializable object, Cipher c) throws IOException, IllegalBlockSizeException E 5
The given object is sealed using the given Cipher, assuming that the Cipher is already properly initialized. E 5
D 5 public final void resetContent(Serializable object) throws IOException E 5 I 5 public final Object getObject(Cipher c) throws IOException, ClassNotFoundException, IllegalBlockSizeException, BadPaddingException E 5
The encapsulated object is unsealed (using the given Cipher, assuming that the Cipher is already properly initialized) and de-serialized, before it is returned. E 5
public final Object getContent() throws IOException, ClassNotFoundException
public final void seal(Cipher c) throws IllegalBlockSizeException
public final void unseal(Cipher c) throws IllegalBlockSizeException, BadPaddingException
D 3 All Packages Class Hierarchy This Package Previous Next IndexE 3 I 3 D 5 All Packages Class Hierarchy This Package Previous Next Index E 5 I 5 All Packages Class Hierarchy This Package Previous Next Index E 5 E 3 E 1