public class HASHDRBG extends java.security.SecureRandomSpi implements IHashDrbg, AlgorithmStatus
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_DIGEST_ALG |
static int |
DEFAULT_STRENGTH |
static int |
MAX_SEED_LENGTH |
static int |
MAX_STRENGTH |
static int |
MIN_SEED_LENGTH |
static int |
MIN_STRENGTH |
static int |
SHA1_MAX_STRENGTH |
static int |
SHA224_MAX_STRENGTH |
Constructor and Description |
---|
HASHDRBG()
Construct a hash-based deterministic random bit generator
with the appropriate algorithm for this amount of strength.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
generate(int requested_no_of_bytes,
boolean prediction_resistant_requested,
byte[] additionalInput)
From section 10.1.1.4 of NIST SP 800-90
|
int |
init(java.lang.String algorithm,
int bitStrengthRequested,
java.nio.ByteBuffer entropySource,
boolean predictionResistant)
Initialize with the name of a hash algorithm to use,
the randomness strength requested, and a source of entropy.
|
void |
instantiate(byte[] nonce,
byte[] personalization)
From NIST SP 800-90, Appendix F.1.1
|
boolean |
isFipsApproved()
Module identifies if the cryptographic operation (algorithm) is FIPS certified
|
void |
reseed(byte[] addlInput)
From NIST SP 800-90, Appendix F.1.2
|
void |
zeroize()
This function zeroizes the class so that nothing is in memory
|
public static final int MIN_STRENGTH
public static final int MAX_STRENGTH
public static final int SHA1_MAX_STRENGTH
public static final int SHA224_MAX_STRENGTH
public static final int MIN_SEED_LENGTH
public static final int MAX_SEED_LENGTH
public static final java.lang.String DEFAULT_DIGEST_ALG
public static final int DEFAULT_STRENGTH
public HASHDRBG()
security_Strength
- SP 800-57A for current values. The number passed in
at initialization time
will determine the length of entropy data needed.
At time of writing, NIST SP 800-57A included 80 bits, which NIST SP 800-90 omits.
The remaining supported strengths are:
- 112 bits
- SHA1
- SHA224
- SHA256
- SHA392
- SHA512
- 128 bits
- SHA1
- SHA224
- SHA256
- SHA392
- SHA512
- 192 bits
- SHA224
- SHA256
- SHA392
- SHA512
- 256 bits
- SHA256
- SHA392
- SHA512
public boolean isFipsApproved()
AlgorithmStatus
isFipsApproved
in interface AlgorithmStatus
AlgorithmStatus.isFipsApproved()
public int init(java.lang.String algorithm, int bitStrengthRequested, java.nio.ByteBuffer entropySource, boolean predictionResistant) throws java.lang.IllegalArgumentException
init
in interface IHashDrbg
algorithm
- bitStrengthRequested
- entropySource
- may be null, if will drive with SecureRandomSpipredictionResistant
- whether additional entropy will be supplied through
the entropySource before generate operationsjava.lang.IllegalArgumentException
3 of NIST SP800-57 Part1, for Hash function security strengths
public void instantiate(byte[] nonce, byte[] personalization)
instantiate
in interface IHashDrbg
nonce
- caller-supplied nonce (optional, may be NULL)personalization
- caller-supplied personalization data (optional, may be NULL)
From NIST SP 800-90, Section 10.1.1.2public byte[] generate(int requested_no_of_bytes, boolean prediction_resistant_requested, byte[] additionalInput)
public void reseed(byte[] addlInput)
public void zeroize()
© Portions Copyright 2003, 2012 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2012, Oracle and/or its affiliates. All rights reserved.