Class BigIntegerCounterNonce
java.lang.Object
org.cryptacular.generator.sp80038a.BigIntegerCounterNonce
- All Implemented Interfaces:
Nonce
Uses a
BigInteger
to back a counter in order to produce nonces of arbitrary length.
A common use case for this component is creation of IVs for ciphers with 16-byte block size, e.g. AES.
Instances of this class are thread safe.
- Author:
- Middleware Services
-
Constructor Summary
ConstructorsConstructorDescriptionBigIntegerCounterNonce
(BigInteger counter, int length) Creates a new instance with given parameters. -
Method Summary
-
Constructor Details
-
BigIntegerCounterNonce
Creates a new instance with given parameters.- Parameters:
counter
- Initial counter value.length
- Maximum length of generated counter values in bytes.
-
-
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()
-