|
TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.schlichtherle.truezip.crypto.SICSeekableBlockCipher
public class SICSeekableBlockCipher
Implements Counter (CTR) mode (alias Segmented Integer Counter - SIC).
on top of a simple block cipher.
This code is based on bouncy castle's SICBlockCipher class,
but also allows random access to a block.
| Field Summary | |
|---|---|
private long |
blockCounter
|
private int |
blockSize
|
private BlockCipher |
cipher
|
private byte[] |
counterIn
|
private byte[] |
counterOut
|
private byte[] |
IV
|
| Constructor Summary | |
|---|---|
SICSeekableBlockCipher(BlockCipher cipher)
Basic constructor. |
|
| Method Summary | |
|---|---|
String |
getAlgorithmName()
|
long |
getBlockCounter()
Returns the index of the block, starting at 0, which will be processed next when BlockCipher.processBlock(byte[], int, byte[], int) is called. |
int |
getBlockSize()
|
BlockCipher |
getUnderlyingCipher()
Returns the underlying block cipher which we are decorating. |
void |
init(boolean forEncryption,
CipherParameters params)
|
int |
processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
|
void |
reset()
|
void |
setBlockCounter(long block)
Sets the counter so that the block with the given index, starting at 0, can be processed next. |
private void |
updateCounter()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final BlockCipher cipher
private final int blockSize
private final byte[] IV
private final byte[] counterIn
private long blockCounter
private final byte[] counterOut
| Constructor Detail |
|---|
public SICSeekableBlockCipher(BlockCipher cipher)
cipher - The block cipher to be used.| Method Detail |
|---|
public BlockCipher getUnderlyingCipher()
public void init(boolean forEncryption,
CipherParameters params)
throws IllegalArgumentException
init in interface BlockCipherIllegalArgumentExceptionpublic String getAlgorithmName()
getAlgorithmName in interface BlockCipherpublic int getBlockSize()
getBlockSize in interface BlockCipher
public int processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
throws DataLengthException,
IllegalStateException
processBlock in interface BlockCipherDataLengthException
IllegalStateExceptionprivate void updateCounter()
public void setBlockCounter(long block)
SeekableBlockCipher
setBlockCounter in interface SeekableBlockCipherblock - The index of the block, starting at 0, which will be
processed next when
BlockCipher.processBlock(byte[], int, byte[], int) is called.public long getBlockCounter()
SeekableBlockCipherBlockCipher.processBlock(byte[], int, byte[], int) is called.
getBlockCounter in interface SeekableBlockCipherpublic void reset()
reset in interface BlockCipher
|
TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||