Class JournalingSecureRandom

  • All Implemented Interfaces:
    java.io.Serializable

    public class JournalingSecureRandom
    extends java.security.SecureRandom
    A 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
      void clear()
      Clear the internals
      byte[] getTranscript()
      Return the transcript so far,
      void nextBytes​(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
      • Methods inherited from class java.util.Random

        doubles, doubles, doubles, doubles, ints, ints, ints, ints, longs, longs, longs, longs, nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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:
        nextBytes in class java.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.