Note
This should be used with a shutdown hook to save the state of the journaling and the algorithm identifier even in the case of a forced shutdown.
The raw encoding is in ASN.1 format.
Details: Use serialization of critical parameters of the the JournalingSecureRandom and AlgorithmIdentifier. Because these two classes are not serializable, create interior class to serialize only the critical parameters in the form of byte[] arrays
| Modifier and Type | Field and Description |
|---|---|
| private transient AlgorithmIdentifier | |
| private transient JournalingSecureRandom |
| Access | Constructor and Description |
|---|---|
| public | |
| public | JournaledAlgorithm(byte[]
raw encoding of a previous JournaledAlgorithm. encoding)Construct from a previous encoding, using CryptoServicesRegistrar.getSecureRandom() as the backup source of entropy. |
| public | JournaledAlgorithm(byte[]
raw encoding of a previous JournaledAlgorithm. encoding, SecureRandom back up source of entropy. random)Construct from a previous encoding, using the passed in random as a source for when the existing entropy runs out. |
| Modifier and Type | Method and Description |
|---|---|
| public AlgorithmIdentifier | |
| public byte[] | getEncoded()
Implements org. |
| public JournalingSecureRandom | |
| public static JournaledAlgorithm | |
| public static JournaledAlgorithm | getState(File
temporary file containing serialized state tempfile, SecureRandom random)Reconstructs JournaledAlgorithm session from file containing it's raw encoding. |
| private void | |
| private void | |
| public void | storeState(File tempfile)
Store state of JournalingSecureRandom and AlgorithmIdentifier in temporary file |
| public void | |
| private void |
| algID | back to summary |
|---|---|
| private transient AlgorithmIdentifier algID | |
| journaling | back to summary |
|---|---|
| private transient JournalingSecureRandom journaling | |
| JournaledAlgorithm | back to summary |
|---|---|
| public JournaledAlgorithm(AlgorithmIdentifier aid, JournalingSecureRandom journaling) | |
| JournaledAlgorithm | back to summary |
|---|---|
| public JournaledAlgorithm(byte[] encoding) Construct from a previous encoding, using CryptoServicesRegistrar.getSecureRandom() as the backup source of entropy.
| |
| JournaledAlgorithm | back to summary |
|---|---|
| public JournaledAlgorithm(byte[] encoding, SecureRandom random) Construct from a previous encoding, using the passed in random as a source for when the existing entropy runs out.
| |
| getAlgorithmIdentifier | back to summary |
|---|---|
| public AlgorithmIdentifier getAlgorithmIdentifier() | |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() throws IOException Implements org. Doc from org. Return a byte array representing the implementing object.
| |
| getJournalingSecureRandom | back to summary |
|---|---|
| public JournalingSecureRandom getJournalingSecureRandom() | |
| getState | back to summary |
|---|---|
| public static JournaledAlgorithm getState(InputStream stateIn, SecureRandom random) throws IOException, ClassNotFoundException | |
| getState | back to summary |
|---|---|
| public static JournaledAlgorithm getState(File tempfile, SecureRandom random) throws IOException, ClassNotFoundException Reconstructs JournaledAlgorithm session from file containing it's raw encoding.
| |
| initFromEncoding | back to summary |
|---|---|
| private void initFromEncoding(byte[] encoding, SecureRandom random) | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException | |
| storeState | back to summary |
|---|---|
| public void storeState(File tempfile) throws IOException Store state of JournalingSecureRandom and AlgorithmIdentifier in temporary file | |
| storeState | back to summary |
|---|---|
| public void storeState(OutputStream out) throws IOException | |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream out) throws IOException | |