org.bouncycastle.crypto.modes
Class KXTSBlockCipher
java.lang.Object
|
+--org.bouncycastle.crypto.BufferedBlockCipher
|
+--org.bouncycastle.crypto.DefaultBufferedBlockCipher
|
+--org.bouncycastle.crypto.modes.KXTSBlockCipher
- public class KXTSBlockCipher
- extends DefaultBufferedBlockCipher
Implementation of DSTU7624 XTS mode
Method Summary |
int |
doFinal(byte[] output,
int outOff)
Process the last block in the buffer. |
int |
getOutputSize(int length)
return the size of the output buffer required for an update plus a
doFinal with an input of 'length' bytes. |
protected static long |
getReductionPolynomial(int blockSize)
|
int |
getUpdateOutputSize(int len)
return the size of the output buffer required for an update
an input of len bytes. |
void |
init(boolean forEncryption,
CipherParameters parameters)
initialise the cipher. |
int |
processByte(byte in,
byte[] out,
int outOff)
process a single byte, producing an output block if necessary. |
int |
processBytes(byte[] input,
int inOff,
int len,
byte[] output,
int outOff)
process an array of bytes, producing output if necessary. |
void |
reset()
Reset the buffer and cipher. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
KXTSBlockCipher
public KXTSBlockCipher(BlockCipher cipher)
getReductionPolynomial
protected static long getReductionPolynomial(int blockSize)
getOutputSize
public int getOutputSize(int length)
- Description copied from class:
DefaultBufferedBlockCipher
- return the size of the output buffer required for an update plus a
doFinal with an input of 'length' bytes.
- Overrides:
getOutputSize
in class DefaultBufferedBlockCipher
- Following copied from class:
org.bouncycastle.crypto.DefaultBufferedBlockCipher
- Parameters:
length
- the length of the input.- Returns:
- the space required to accommodate a call to update and doFinal
with 'length' bytes of input.
getUpdateOutputSize
public int getUpdateOutputSize(int len)
- Description copied from class:
DefaultBufferedBlockCipher
- return the size of the output buffer required for an update
an input of len bytes.
- Overrides:
getUpdateOutputSize
in class DefaultBufferedBlockCipher
- Following copied from class:
org.bouncycastle.crypto.DefaultBufferedBlockCipher
- Parameters:
len
- the length of the input.- Returns:
- the space required to accommodate a call to update
with len bytes of input.
init
public void init(boolean forEncryption,
CipherParameters parameters)
- Description copied from class:
DefaultBufferedBlockCipher
- initialise the cipher.
- Overrides:
init
in class DefaultBufferedBlockCipher
- Following copied from class:
org.bouncycastle.crypto.DefaultBufferedBlockCipher
- Parameters:
forEncryption
- if true the cipher is initialised for
encryption, if false for decryption.params
- the key and other data required by the cipher.- Throws:
java.lang.IllegalArgumentException
- if the params argument is
inappropriate.
processByte
public int processByte(byte in,
byte[] out,
int outOff)
- Description copied from class:
DefaultBufferedBlockCipher
- process a single byte, producing an output block if necessary.
- Overrides:
processByte
in class DefaultBufferedBlockCipher
- Following copied from class:
org.bouncycastle.crypto.DefaultBufferedBlockCipher
- Parameters:
in
- the input byte.out
- the space for any output that might be produced.outOff
- the offset from which the output will be copied.- Returns:
- the number of output bytes copied to out.
- Throws:
DataLengthException
- if there isn't enough space in out.java.lang.IllegalStateException
- if the cipher isn't initialised.
processBytes
public int processBytes(byte[] input,
int inOff,
int len,
byte[] output,
int outOff)
- Description copied from class:
DefaultBufferedBlockCipher
- process an array of bytes, producing output if necessary.
- Overrides:
processBytes
in class DefaultBufferedBlockCipher
- Following copied from class:
org.bouncycastle.crypto.DefaultBufferedBlockCipher
- Parameters:
in
- the input byte array.inOff
- the offset at which the input data starts.len
- the number of bytes to be copied out of the input array.out
- the space for any output that might be produced.outOff
- the offset from which the output will be copied.- Returns:
- the number of output bytes copied to out.
- Throws:
DataLengthException
- if there isn't enough space in out.java.lang.IllegalStateException
- if the cipher isn't initialised.
doFinal
public int doFinal(byte[] output,
int outOff)
- Description copied from class:
DefaultBufferedBlockCipher
- Process the last block in the buffer.
- Overrides:
doFinal
in class DefaultBufferedBlockCipher
- Following copied from class:
org.bouncycastle.crypto.DefaultBufferedBlockCipher
- Parameters:
out
- the array the block currently being held is copied into.outOff
- the offset at which the copying starts.- Returns:
- the number of output bytes copied to out.
- Throws:
DataLengthException
- if there is insufficient space in out for
the output, or the input is not block size aligned and should be.java.lang.IllegalStateException
- if the underlying cipher is not
initialised.InvalidCipherTextException
- if padding is expected and not found.DataLengthException
- if the input is not block size
aligned.
reset
public void reset()
- Description copied from class:
DefaultBufferedBlockCipher
- Reset the buffer and cipher. After resetting the object is in the same
state as it was after the last init (if there was one).
- Overrides:
reset
in class DefaultBufferedBlockCipher