public class JournaledAlgorithm extends java.lang.Object implements Encodable, java.io.Serializable
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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) |
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.public JournalingSecureRandom getJournalingSecureRandom()
public AlgorithmIdentifier getAlgorithmIdentifier()
public void storeState(java.io.File tempfile)
throws java.io.IOException
tempfile - java.io.IOExceptionpublic void storeState(java.io.OutputStream out)
throws java.io.IOException
java.io.IOExceptionpublic static JournaledAlgorithm getState(java.io.InputStream stateIn, java.security.SecureRandom random) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic 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.IOExceptionjava.lang.ClassNotFoundExceptionpublic byte[] getEncoded()
throws java.io.IOException
EncodablegetEncoded in interface Encodablejava.io.IOException - if an issue arises generation the encoding.