Package org.bouncycastle.crypto.util
Class JournalingSecureRandom
- java.lang.Object
-
- java.util.Random
-
- java.security.SecureRandom
-
- org.bouncycastle.crypto.util.JournalingSecureRandom
-
- All Implemented Interfaces:
java.io.Serializable
public class JournalingSecureRandom extends java.security.SecureRandomA SecureRandom that maintains a journal of its output.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JournalingSecureRandom(byte[] transcript, java.security.SecureRandom random)Constructor with a prior transcript.JournalingSecureRandom(java.security.SecureRandom random)Base constructor - no prior transcript.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the internalsbyte[]getTranscript()Return the transcript so far,voidnextBytes(byte[] bytes)Fill bytes with random data, journaling the random data before returning.-
Methods inherited from class java.security.SecureRandom
generateSeed, getAlgorithm, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstanceStrong, getParameters, getProvider, getSeed, next, nextBytes, reseed, reseed, setSeed, setSeed, toString
-
-
-
-
Constructor Detail
-
JournalingSecureRandom
public JournalingSecureRandom(java.security.SecureRandom random)
Base constructor - no prior transcript.- Parameters:
random- source of randomness we will be journaling.
-
JournalingSecureRandom
public JournalingSecureRandom(byte[] transcript, java.security.SecureRandom random)Constructor with a prior transcript. Both the transcript used and any new randomness are journaled.- Parameters:
transcript- initial transcript of randomness.random- source of randomness we will be journaling when the transcript runs out.
-
-
Method Detail
-
nextBytes
public final void nextBytes(byte[] bytes)
Fill bytes with random data, journaling the random data before returning.- Overrides:
nextBytesin classjava.security.SecureRandom- Parameters:
bytes- a block of bytes to be filled with random data.
-
clear
public void clear()
Clear the internals
-
getTranscript
public byte[] getTranscript()
Return the transcript so far,- Returns:
- a copy of the randomness produced so far.
-
-