Package org.conscrypt
Class OpenSSLRandom
- java.lang.Object
-
- java.security.SecureRandomSpi
-
- org.conscrypt.OpenSSLRandom
-
- All Implemented Interfaces:
Serializable
public class OpenSSLRandom extends SecureRandomSpi implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OpenSSLRandom()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]engineGenerateSeed(int numBytes)Generates and returns the specified number of seed bytes, computed using the seed generation algorithm used by thisSecureRandomSpi.protected voidengineNextBytes(byte[] bytes)Generates and stores random bytes in the givenbyte[]for each array element.protected voidengineSetSeed(byte[] seed)Reseeds thisSecureRandomSpiinstance with the specifiedseed.static voidseedOpenSSLPRNGFromLinuxRNG()Obtains a seed from the Linux RNG and mixes it into the OpenSSL PRNG (default RAND engine).
-
-
-
Method Detail
-
engineSetSeed
protected void engineSetSeed(byte[] seed)
Description copied from class:SecureRandomSpiReseeds thisSecureRandomSpiinstance with the specifiedseed. The seed of thisSecureRandomSpiinstance is supplemented, not replaced.- Specified by:
engineSetSeedin classSecureRandomSpi- Parameters:
seed- the new seed.
-
engineNextBytes
protected void engineNextBytes(byte[] bytes)
Description copied from class:SecureRandomSpiGenerates and stores random bytes in the givenbyte[]for each array element.- Specified by:
engineNextBytesin classSecureRandomSpi- Parameters:
bytes- thebyte[]to be filled with random bytes.
-
engineGenerateSeed
protected byte[] engineGenerateSeed(int numBytes)
Description copied from class:SecureRandomSpiGenerates and returns the specified number of seed bytes, computed using the seed generation algorithm used by thisSecureRandomSpi.- Specified by:
engineGenerateSeedin classSecureRandomSpi- Parameters:
numBytes- the number of seed bytes.- Returns:
- the seed bytes
-
seedOpenSSLPRNGFromLinuxRNG
public static void seedOpenSSLPRNGFromLinuxRNG()
Obtains a seed from the Linux RNG and mixes it into the OpenSSL PRNG (default RAND engine).NOTE: This modifies the OpenSSL PRNG shared by all instances of OpenSSLRandom and other crypto primitives offered by or built on top of OpenSSL.
-
-