public class CriticalObject
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
cipher
The cipher for encrypting the serialized object.
|
static java.security.SecureRandom |
random
The random number generator for generating a new key.
|
Constructor and Description |
---|
CriticalObject(java.lang.Object o)
Creates a new CriticalObject with a new random key.
|
CriticalObject(java.lang.Object o,
boolean destroyCriticalData)
Creates a new CriticalObject with a new random key.
|
CriticalObject(java.lang.Object o,
byte[] key)
Creates a new CriticalObject from a given key.
|
CriticalObject(java.lang.Object o,
byte[] key,
boolean destroyCriticalData)
Creates a new CriticalObject from a given key.
|
Modifier and Type | Method and Description |
---|---|
protected static java.lang.Object |
deserialize(byte[] object)
Deserializes a given object from a byte array.
|
static void |
destroy(boolean[] a) |
static void |
destroy(byte[] a) |
static void |
destroy(double[] a) |
static void |
destroy(java.util.Enumeration a) |
static void |
destroy(float[] a) |
static void |
destroy(java.util.Hashtable a) |
static void |
destroy(int[] a) |
static void |
destroy(long[] a) |
static void |
destroy(java.lang.Object a) |
static void |
destroy(java.lang.Object[] a) |
static void |
destroy(java.util.Vector a) |
java.lang.Object |
getObject()
Returns the proteced CriticalObject.
|
java.lang.Object |
getObject(byte[] key)
Returns the proteced CriticalObject encrypted with a given key.
|
protected static byte[] |
serialize(java.lang.Object obj)
Serializes a given object to a byte array.
|
public static final java.lang.String cipher
public static final java.security.SecureRandom random
public CriticalObject(java.lang.Object o) throws java.io.IOException
This method first serializes the object and then encrypts it. If the object has an accessable method "destroyCriticalData" this method is invoked after the encryption.
o
- the critical object to protectjava.io.IOException
- if an error during the serializiation occurspublic CriticalObject(java.lang.Object o, boolean destroyCriticalData) throws java.io.IOException
This method first serializes the object and then encrypts it. If the object has an accessable method "destroyCriticalData" this method is invoked after the encryption.
o
- the critical object to protectdestroyCriticalData
- true if the method destroyCriticalData shall be invokedjava.io.IOException
- if an error during the serializiation occurspublic CriticalObject(java.lang.Object o, byte[] key) throws java.io.IOException
This method first serializes the object and then encrypts it. If the object has an accessable method "destroyCriticalData" this method is invoked after the encryption.
o
- the critical object to protectkey
- the key for generating an iv and a secret keyjava.io.IOException
- if an error during the serializiation occurspublic CriticalObject(java.lang.Object o, byte[] key, boolean destroyCriticalData) throws java.io.IOException
This method first serializes the object and then encrypts it. If the object has an accessable method "destroyCriticalData" this method is invoked after the encryption.
o
- the critical object to protectkey
- the key for generating an iv and a secret keydestroyCriticalData
- true if the method destroyCriticalData shall be invokedjava.io.IOException
- if an error during the serializiation occurspublic java.lang.Object getObject(byte[] key) throws java.io.IOException
key
- the key used when generating the CriticalObjectjava.io.IOException
public java.lang.Object getObject() throws java.io.IOException
java.io.IOException
protected static java.lang.Object deserialize(byte[] object) throws java.io.IOException
object
- the object as a byte arrayjava.io.IOException
protected static byte[] serialize(java.lang.Object obj) throws java.io.IOException
obj
- the object to serializejava.io.IOException
public static void destroy(byte[] a)
public static void destroy(int[] a)
public static void destroy(long[] a)
public static void destroy(float[] a)
public static void destroy(double[] a)
public static void destroy(boolean[] a)
public static void destroy(java.lang.Object[] a)
public static void destroy(java.lang.Object a)
public static void destroy(java.util.Vector a)
public static void destroy(java.util.Hashtable a)
public static void destroy(java.util.Enumeration a)