- java.lang.Object
-
- io.github.mmm.crypto.random.RandomCreatorImpl
-
- All Implemented Interfaces:
CryptoAlgorithm,RandomConstants,RandomCreator
public class RandomCreatorImpl extends Object implements RandomCreator
Implementation ofRandomCreator.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Field Summary
-
Fields inherited from interface io.github.mmm.crypto.random.RandomConstants
RANDOM_ALGORITHM_SHA1_PRNG
-
-
Constructor Summary
Constructors Constructor Description RandomCreatorImpl(SecureRandom secureRandom, int reseedCount)The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAlgorithm()byte[]nextRandom(int bytes)
-
-
-
Constructor Detail
-
RandomCreatorImpl
public RandomCreatorImpl(SecureRandom secureRandom, int reseedCount)
The constructor.- Parameters:
secureRandom- the underlyingSecureRandom.reseedCount- there-seed count.
-
-
Method Detail
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithmin interfaceCryptoAlgorithm- Returns:
- the name of the underlying algorithm (e.g. "RSA", "NONEwithECDSA", etc.).
- See Also:
Key.getAlgorithm(),Signature.getAlgorithm(),MessageDigest.getAlgorithm(),SecureRandom.getAlgorithm(),Cipher.getAlgorithm()
-
nextRandom
public byte[] nextRandom(int bytes)
- Specified by:
nextRandomin interfaceRandomCreator- Parameters:
bytes- the requested number of random bytes.- Returns:
- the
bytearray with the given number of random bytes. - See Also:
SecureRandom.nextBytes(byte[])
-
-