public class RBGNonce extends java.lang.Object implements Nonce
NOTE: users of this class are responsible for counting number of invocations and enforcing the constraints described in section 8.3; namely the following:
The total number of invocations of the authenticated encryption function shall not exceed 232, including all IV lengths and all instances of the authenticated encryption function with the given key.
Instances of this class are thread safe.
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
fixed
Fixed field value.
|
private int |
randomLength
Number of bytes of random data in invocation field.
|
private org.bouncycastle.crypto.prng.drbg.SP80090DRBG |
rbg
Random bit generator.
|
| Constructor and Description |
|---|
RBGNonce()
Creates a new instance that produces 12-bytes (96-bits) of random data; that is, the fixed field of the nonce is
null.
|
RBGNonce(int randomLength)
Creates a new instance that produces length bytes of random data; that is, the fixed field of the nonce is null.
|
RBGNonce(java.lang.String fixed,
int randomLength)
Creates a new instance using the given fixed field value.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
generate()
Generates a nonce value.
|
int |
getLength() |
private static org.bouncycastle.crypto.prng.drbg.SP80090DRBG |
newRBG(int length,
byte[] domain)
Creates a new DRBG instance.
|
private final byte[] fixed
private final int randomLength
private final org.bouncycastle.crypto.prng.drbg.SP80090DRBG rbg
public RBGNonce()
public RBGNonce(int randomLength)
randomLength - Number of bytes in the random part of the nonce. MUST be at least 12.public RBGNonce(java.lang.String fixed,
int randomLength)
fixed - User-defined fixed field value.randomLength - Number of bytes in the random part of the nonce. MUST be at least 12.public byte[] generate()
throws LimitException
Noncegenerate in interface NonceLimitException - When a limit imposed by the nonce generation strategy, if any, is exceeded.public int getLength()
private static org.bouncycastle.crypto.prng.drbg.SP80090DRBG newRBG(int length,
byte[] domain)
length - Length in bits of values produced by DRBG.domain - Domain qualifier.