Class RBGNonce
java.lang.Object
org.cryptacular.generator.sp80038d.RBGNonce
- All Implemented Interfaces:
Nonce
RBG-based nonce generation strategy that uses a RBG component to produce values for the invocation field as described
in NIST SP-800-38D, section 8.2.2.
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.
- Author:
- Middleware Services
-
Constructor Summary
ConstructorsConstructorDescriptionRBGNonce()
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.Creates a new instance using the given fixed field value. -
Method Summary
-
Constructor Details
-
RBGNonce
public 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
public RBGNonce(int randomLength) Creates a new instance that produces length bytes of random data; that is, the fixed field of the nonce is null.- Parameters:
randomLength
- Number of bytes in the random part of the nonce. MUST be at least 12.
-
RBGNonce
Creates a new instance using the given fixed field value.- Parameters:
fixed
- User-defined fixed field value.randomLength
- Number of bytes in the random part of the nonce. MUST be at least 12.
-
-
Method Details
-
generate
Description copied from interface:Nonce
Generates a nonce value.- Specified by:
generate
in interfaceNonce
- Returns:
- Nonce bytes.
- Throws:
LimitException
- When a limit imposed by the nonce generation strategy, if any, is exceeded.
-
getLength
public int getLength()
-