Top Description Fields Constructors Methods
org.bouncycastle.crypto.fips

pack-priv Class HMacSP800DRBG

extends Object
implements SP80090DRBG
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.fips.SP80090DRBG, org.bouncycastle.crypto.fips.DRBG
Imports
java.util.HashMap, .Map, org.bouncycastle.crypto.EntropySource, org.bouncycastle.crypto.internal.Mac, org.bouncycastle.crypto.internal.params.KeyParameterImpl, org.bouncycastle.util.Arrays, org.bouncycastle.util.encoders.Hex

A SP800-90A HMAC DRBG.

Field Summary

Modifier and TypeField and Description
private EntropySource
private Mac
private byte[]
private long
private int
private byte[]
private static final Map<String, byte[][]>
private static final int
private static final long
private static final Map<String, byte[][]>
private static final Map<String, byte[][]>

Constructor Summary

AccessConstructor and Description
public
HMacSP800DRBG(Mac
Hash MAC to base the DRBG on.
hMac
,
int
security strength required (in bits)
securityStrength
,
EntropySource
source of entropy to use for seeding/reseeding.
entropySource
,
byte[]
personalization string to distinguish this DRBG (may be null).
personalizationString
,
byte[]
nonce to further distinguish this DRBG (may be null).
nonce
)

Construct a SP800-90A Hash DRBG.

Method Summary

Modifier and TypeMethod and Description
public VariantInternalKatTest
createReseedSelfTest(FipsAlgorithm
the FipsAlgorithm type
algorithm
)

Implements org.bouncycastle.crypto.fips.DRBG.createReseedSelfTest.

Return a KAT for the DRBG - used prior to reseed.
public VariantInternalKatTest
createSelfTest(FipsAlgorithm algorithm)

Implements org.bouncycastle.crypto.fips.SP80090DRBG.createSelfTest.

Perform a instantiate/generate/reseed test.
protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
public int

Returns:

number of bits generated, -1 if a reseed required.
generate
(byte[]
output array for generated bits.
output
,
byte[]
additional input to be added to the DRBG in this step.
additionalInput
,
boolean
true if a reseed should be forced, false otherwise.
predictionResistant
)

Implements org.bouncycastle.crypto.fips.SP80090DRBG.generate.

Populate a passed in array with random data.
public int

Returns:

the number of bits produced on each round of the DRBG.
getBlockSize
()

Implements org.bouncycastle.crypto.fips.SP80090DRBG.getBlockSize.

Return the block size (in bits) of the DRBG.
private byte[]
public int

Returns:

the security strength (in bits) of the DRBG.
getSecurityStrength
()

Implements org.bouncycastle.crypto.fips.DRBG.getSecurityStrength.

Return the security strength of the DRBG.
private void
hmac_DRBG_Update(byte[] seedMaterial)

private void
hmac_DRBG_Update_Func(byte[] seedMaterial, byte vValue)

private void
init(Mac hMac, int securityStrength, EntropySource entropySource, byte[] personalizationString, byte[] nonce)

public void
reseed(byte[]
additional input to be added to the DRBG in this step.
additionalInput
)

Implements org.bouncycastle.crypto.fips.SP80090DRBG.reseed.

Reseed the DRBG.
private void
reseedFromSeedMaterial(byte[] seedMaterial)

Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_entropySourceback to summary
private EntropySource _entropySource
_hMacback to summary
private Mac _hMac
_Kback to summary
private byte[] _K
_reseedCounterback to summary
private long _reseedCounter
_securityStrengthback to summary
private int _securityStrength
_Vback to summary
private byte[] _V
katsback to summary
private static final Map<String, byte[][]> kats
MAX_BITS_REQUESTback to summary
private static final int MAX_BITS_REQUEST
RESEED_MAXback to summary
private static final long RESEED_MAX
reseedKatsback to summary
private static final Map<String, byte[][]> reseedKats
reseedValuesback to summary
private static final Map<String, byte[][]> reseedValues

Constructor Detail

HMacSP800DRBGback to summary
public HMacSP800DRBG(Mac hMac, int securityStrength, EntropySource entropySource, byte[] personalizationString, byte[] nonce)

Construct a SP800-90A Hash DRBG.

Minimum entropy requirement is the security strength requested.

Parameters
hMac:Mac

Hash MAC to base the DRBG on.

securityStrength:int

security strength required (in bits)

entropySource:EntropySource

source of entropy to use for seeding/reseeding.

personalizationString:byte[]

personalization string to distinguish this DRBG (may be null).

nonce:byte[]

nonce to further distinguish this DRBG (may be null).

Method Detail

createReseedSelfTestback to summary
public VariantInternalKatTest createReseedSelfTest(FipsAlgorithm algorithm)

Implements org.bouncycastle.crypto.fips.DRBG.createReseedSelfTest.

Doc from org.bouncycastle.crypto.fips.DRBG.createReseedSelfTest.

Return a KAT for the DRBG - used prior to reseed.

Parameters
algorithm:FipsAlgorithm

the FipsAlgorithm type

Returns:VariantInternalKatTest

a self test

createSelfTestback to summary
public VariantInternalKatTest createSelfTest(FipsAlgorithm algorithm)

Implements org.bouncycastle.crypto.fips.SP80090DRBG.createSelfTest.

Doc from org.bouncycastle.crypto.fips.SP80090DRBG.createSelfTest.

Perform a instantiate/generate/reseed test.

Returns:VariantInternalKatTest

Doc from org.bouncycastle.crypto.fips.DRBG.createSelfTest.

a self test

finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Annotations
@Override
Exceptions
Throwable:
the Exception raised by this method
generateback to summary
public int generate(byte[] output, byte[] additionalInput, boolean predictionResistant)

Implements org.bouncycastle.crypto.fips.SP80090DRBG.generate.

Populate a passed in array with random data.

Parameters
output:byte[]

output array for generated bits.

additionalInput:byte[]

additional input to be added to the DRBG in this step.

predictionResistant:boolean

true if a reseed should be forced, false otherwise.

Returns:int

number of bits generated, -1 if a reseed required.

getBlockSizeback to summary
public int getBlockSize()

Implements org.bouncycastle.crypto.fips.SP80090DRBG.getBlockSize.

Return the block size (in bits) of the DRBG.

Returns:int

the number of bits produced on each round of the DRBG.

getEntropyback to summary
private byte[] getEntropy()
getSecurityStrengthback to summary
public int getSecurityStrength()

Implements org.bouncycastle.crypto.fips.DRBG.getSecurityStrength.

Return the security strength of the DRBG.

Returns:int

the security strength (in bits) of the DRBG.

hmac_DRBG_Updateback to summary
private void hmac_DRBG_Update(byte[] seedMaterial)
hmac_DRBG_Update_Funcback to summary
private void hmac_DRBG_Update_Func(byte[] seedMaterial, byte vValue)
initback to summary
private void init(Mac hMac, int securityStrength, EntropySource entropySource, byte[] personalizationString, byte[] nonce)
reseedback to summary
public void reseed(byte[] additionalInput)

Implements org.bouncycastle.crypto.fips.SP80090DRBG.reseed.

Reseed the DRBG.

Parameters
additionalInput:byte[]

additional input to be added to the DRBG in this step.

reseedFromSeedMaterialback to summary
private void reseedFromSeedMaterial(byte[] seedMaterial)