public class BigIntegerCounterNonce extends Object implements Nonce
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.
Constructor and Description |
---|
BigIntegerCounterNonce(BigInteger counter,
int length)
Creates a new instance with given parameters.
|
public BigIntegerCounterNonce(BigInteger counter, int length)
counter
- Initial counter value.length
- Maximum length of generated counter values in bytes.public byte[] generate() throws LimitException
Nonce
generate
in interface Nonce
LimitException
- When a limit imposed by the nonce generation strategy, if any, is exceeded.Copyright © 2003-2024 Virginia Tech. All Rights Reserved.