Class CTRSP800DRBG
- java.lang.Object
-
- org.bouncycastle.crypto.prng.drbg.CTRSP800DRBG
-
- All Implemented Interfaces:
SP80090DRBG
public class CTRSP800DRBG extends java.lang.Object implements SP80090DRBG
A SP800-90A CTR DRBG.
-
-
Constructor Summary
Constructors Constructor Description CTRSP800DRBG(BlockCipher engine, int keySizeInBits, int securityStrength, EntropySource entropySource, byte[] personalizationString, byte[] nonce)Construct a SP800-90A CTR DRBG.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgenerate(byte[] output, byte[] additionalInput, boolean predictionResistant)Populate a passed in array with random data.intgetBlockSize()Return the block size (in bits) of the DRBG.voidreseed(byte[] additionalInput)Reseed the DRBG.
-
-
-
Constructor Detail
-
CTRSP800DRBG
public CTRSP800DRBG(BlockCipher engine, int keySizeInBits, int securityStrength, EntropySource entropySource, byte[] personalizationString, byte[] nonce)
Construct a SP800-90A CTR DRBG.Minimum entropy requirement is the security strength requested.
- Parameters:
engine- underlying block cipher to use to support DRBGkeySizeInBits- size of the key to use with the block cipher.securityStrength- security strength required (in bits)entropySource- source of entropy to use for seeding/reseeding.personalizationString- personalization string to distinguish this DRBG (may be null).nonce- nonce to further distinguish this DRBG (may be null).
-
-
Method Detail
-
getBlockSize
public int getBlockSize()
Return the block size (in bits) of the DRBG.- Specified by:
getBlockSizein interfaceSP80090DRBG- Returns:
- the number of bits produced on each internal round of the DRBG.
-
generate
public int generate(byte[] output, byte[] additionalInput, boolean predictionResistant)Populate a passed in array with random data.- Specified by:
generatein interfaceSP80090DRBG- Parameters:
output- output array for generated bits.additionalInput- additional input to be added to the DRBG in this step.predictionResistant- true if a reseed should be forced, false otherwise.- Returns:
- number of bits generated, -1 if a reseed required.
-
reseed
public void reseed(byte[] additionalInput)
Reseed the DRBG.- Specified by:
reseedin interfaceSP80090DRBG- Parameters:
additionalInput- additional input to be added to the DRBG in this step.
-
-