|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.crypto.util.JournaledAlgorithm
JournaledAlgorithm keeps state of the JournalingSecureRandom and the AlgorithmIdentifier necessary to fully resume an encryption session. This class can be used to retrieve a session even if a process is completely stopped. 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
Constructor Summary | |
JournaledAlgorithm(AlgorithmIdentifier aid,
JournalingSecureRandom journaling)
|
|
JournaledAlgorithm(byte[] encoding)
Construct from a previous encoding, using CryptoServicesRegistrar.getSecureRandom() as the backup source of entropy. |
|
JournaledAlgorithm(byte[] encoding,
java.security.SecureRandom random)
Construct from a previous encoding, using the passed in random as a source for when the existing entropy runs out. |
Method Summary | |
AlgorithmIdentifier |
getAlgorithmIdentifier()
|
byte[] |
getEncoded()
Return a byte array representing the implementing object. |
JournalingSecureRandom |
getJournalingSecureRandom()
|
static JournaledAlgorithm |
getState(java.io.File tempfile,
java.security.SecureRandom random)
Reconstructs JournaledAlgorithm session from file containing it's raw encoding. |
static JournaledAlgorithm |
getState(java.io.InputStream stateIn,
java.security.SecureRandom random)
|
void |
storeState(java.io.File tempfile)
Store state of JournalingSecureRandom and AlgorithmIdentifier in temporary file |
void |
storeState(java.io.OutputStream out)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JournaledAlgorithm(AlgorithmIdentifier aid, JournalingSecureRandom journaling)
public JournaledAlgorithm(byte[] encoding)
encoding
- raw encoding of a previous JournaledAlgorithm.public JournaledAlgorithm(byte[] encoding, java.security.SecureRandom random)
encoding
- raw encoding of a previous JournaledAlgorithm.random
- back up source of entropy.Method Detail |
public JournalingSecureRandom getJournalingSecureRandom()
public AlgorithmIdentifier getAlgorithmIdentifier()
public void storeState(java.io.File tempfile) throws java.io.IOException
tempfile
- java.io.IOException
- public void storeState(java.io.OutputStream out) throws java.io.IOException
public static JournaledAlgorithm getState(java.io.InputStream stateIn, java.security.SecureRandom random) throws java.io.IOException, java.lang.ClassNotFoundException
public static JournaledAlgorithm getState(java.io.File tempfile, java.security.SecureRandom random) throws java.io.IOException, java.lang.ClassNotFoundException
tempfile
- temporary file containing serialized statejava.io.IOException
- java.lang.ClassNotFoundException
- public byte[] getEncoded() throws java.io.IOException
Encodable
getEncoded
in interface Encodable
org.bouncycastle.util.Encodable
java.io.IOException
- if an issue arises generation the encoding.
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |