Top Description Fields Constructors Methods
org.bouncycastle.crypto.prng.drbg

public Class HashSP800DRBG

extends Object
implements SP80090DRBG
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.prng.drbg.SP80090DRBG
Imports
java.util.Hashtable, org.bouncycastle.crypto.Digest, org.bouncycastle.crypto.prng.EntropySource, org.bouncycastle.util.Arrays, .Integers

A SP800-90A Hash DRBG.

Field Summary

Modifier and TypeField and Description
private byte[]
private Digest
private EntropySource
private long
private int
private int
private byte[]
private static final int
private static final byte[]
private static final long
private static final Hashtable<K, V>

Constructor Summary

AccessConstructor and Description
public
HashSP800DRBG(Digest
source digest to use for DRB stream.
digest
,
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
private void
addTo(byte[] longer, byte[] shorter)

private void
doHash(byte[] input, byte[] output)

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.prng.drbg.SP80090DRBG.generate.

Populate a passed in array with random data.

public int

Returns:

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

Implements org.bouncycastle.crypto.prng.drbg.SP80090DRBG.getBlockSize.

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

private byte[]
private byte[]
hash(byte[] input)

private byte[]
hashgen(byte[] input, int lengthInBits)

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

Implements org.bouncycastle.crypto.prng.drbg.SP80090DRBG.reseed.

Reseed the DRBG.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_Cback to summary
private byte[] _C
_digestback to summary
private Digest _digest
_entropySourceback to summary
private EntropySource _entropySource
_reseedCounterback to summary
private long _reseedCounter
_securityStrengthback to summary
private int _securityStrength
_seedLengthback to summary
private int _seedLength
_Vback to summary
private byte[] _V
MAX_BITS_REQUESTback to summary
private static final int MAX_BITS_REQUEST
ONEback to summary
private static final byte[] ONE
RESEED_MAXback to summary
private static final long RESEED_MAX
seedlensback to summary
private static final Hashtable<K, V> seedlens

Constructor Detail

HashSP800DRBGback to summary
public HashSP800DRBG(Digest digest, int securityStrength, EntropySource entropySource, byte[] personalizationString, byte[] nonce)

Construct a SP800-90A Hash DRBG.

Minimum entropy requirement is the security strength requested.

Parameters
digest:Digest

source digest to use for DRB stream.

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

addToback to summary
private void addTo(byte[] longer, byte[] shorter)
doHashback to summary
private void doHash(byte[] input, byte[] output)
generateback to summary
public int generate(byte[] output, byte[] additionalInput, boolean predictionResistant)

Implements org.bouncycastle.crypto.prng.drbg.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.prng.drbg.SP80090DRBG.getBlockSize.

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

Returns:int

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

getEntropyback to summary
private byte[] getEntropy()
hashback to summary
private byte[] hash(byte[] input)
hashgenback to summary
private byte[] hashgen(byte[] input, int lengthInBits)
reseedback to summary
public void reseed(byte[] additionalInput)

Implements org.bouncycastle.crypto.prng.drbg.SP80090DRBG.reseed.

Reseed the DRBG.

Parameters
additionalInput:byte[]

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