public class CTRBlockCipher
extends java.lang.Object
Constructor and Description |
---|
CTRBlockCipher(BlockCipher c)
Basic constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getBlockSize() |
BlockCipher |
getUnderlyingCipher()
return the underlying block cipher that we are wrapping.
|
void |
init(byte[] iv) |
void |
init(byte[] iv,
int offset,
int length)
Initialize the cipher with an IV.
|
byte |
processByte(byte in) |
void |
processBytes(byte[] input,
int offsetIn,
int length,
byte[] output,
int offsetOut)
Encrypt some data.
|
public CTRBlockCipher(BlockCipher c)
c
- the block cipher to be used.public BlockCipher getUnderlyingCipher()
public void init(byte[] iv, int offset, int length) throws java.lang.IllegalArgumentException
iv
- The initialization vector. This is the initial value of
the plaintext counter. The plaintext is XORed with a sequence of
bytes consisting of the encryption of successive values of the counter.java.lang.IllegalArgumentException
- If the IV length is wrong.public void init(byte[] iv) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public int getBlockSize()
public byte processByte(byte in)
public void processBytes(byte[] input, int offsetIn, int length, byte[] output, int offsetOut)
input
- The input data array.offsetIn
- The offset within the input data array to the first byte.length
- The number of bytes to encrypt.output
- The output data array.offsetOut
- The offset within the output data array to the first byte.