Top Description Fields Constructors Methods
org.bouncycastle.crypto.modes

public Class KXTSBlockCipher

extends DefaultBufferedBlockCipher
Class Inheritance
Imports
org.bouncycastle.crypto.BlockCipher, .CipherParameters, .DataLengthException, .DefaultBufferedBlockCipher, .OutputLengthException, org.bouncycastle.crypto.params.ParametersWithIV, org.bouncycastle.util.Pack

Implementation of DSTU7624 XTS mode

Field Summary

Modifier and TypeField and Description
private final int
private int
private static final long
private static final long
private static final long
private final long
private final long[]
private final long[]
Inherited from org.bouncycastle.crypto.DefaultBufferedBlockCipher:
bufbufOffcipherforEncryptionmbCipherpartialBlockOkaypgpCFB

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
doFinal(byte[]
the array the block currently being held is copied into.
output
,
int
the offset at which the copying starts.
outOff
)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.doFinal.

Process the last block in the buffer.
public int
getOutputSize(int
the length of the input.
length
)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.getOutputSize.

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)

public int
getUpdateOutputSize(int
the length of the input.
len
)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.getUpdateOutputSize.

return the size of the output buffer required for an update an input of len bytes.
private static void
GF_double(long redPoly, long[] z)

public void
init(boolean
if true the cipher is initialised for encryption, if false for decryption.
forEncryption
,
CipherParameters
the key and other data required by the cipher.
parameters
)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.init.

initialise the cipher.
private void
processBlocks(byte[] input, int inOff, byte[] output, int outOff)

public int
processByte(byte
the input byte.
in
,
byte[]
the space for any output that might be produced.
out
,
int
the offset from which the output will be copied.
outOff
)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.processByte.

process a single byte, producing an output block if necessary.
public int
processBytes(byte[]
the input byte array.
input
,
int
the offset at which the input data starts.
inOff
,
int
the number of bytes to be copied out of the input array.
len
,
byte[]
the space for any output that might be produced.
output
,
int
the offset from which the output will be copied.
outOff
)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.processBytes.

process an array of bytes, producing output if necessary.
public void
reset()

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.reset.

Reset the buffer and cipher.
Inherited from org.bouncycastle.crypto.DefaultBufferedBlockCipher:
getBlockSizegetUnderlyingCipher

Field Detail

blockSizeback to summary
private final int blockSize
counterback to summary
private int counter
RED_POLY_128back to summary
private static final long RED_POLY_128
RED_POLY_256back to summary
private static final long RED_POLY_256
RED_POLY_512back to summary
private static final long RED_POLY_512
reductionPolynomialback to summary
private final long reductionPolynomial
tw_currentback to summary
private final long[] tw_current
tw_initback to summary
private final long[] tw_init

Constructor Detail

KXTSBlockCipherback to summary
public KXTSBlockCipher(BlockCipher cipher)

Method Detail

doFinalback to summary
public int doFinal(byte[] output, int outOff)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.doFinal.

Doc from org.bouncycastle.crypto.DefaultBufferedBlockCipher.doFinal.

Process the last block in the buffer.

Parameters
output:byte[]

the array the block currently being held is copied into.

outOff:int

the offset at which the copying starts.

Returns:int

the number of output bytes copied to out.

getOutputSizeback to summary
public int getOutputSize(int length)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.getOutputSize.

Doc from org.bouncycastle.crypto.DefaultBufferedBlockCipher.getOutputSize.

return the size of the output buffer required for an update plus a doFinal with an input of 'length' bytes.

Parameters
length:int

the length of the input.

Returns:int

the space required to accommodate a call to update and doFinal with 'length' bytes of input.

getReductionPolynomialback to summary
protected static long getReductionPolynomial(int blockSize)
getUpdateOutputSizeback to summary
public int getUpdateOutputSize(int len)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.getUpdateOutputSize.

Doc from org.bouncycastle.crypto.DefaultBufferedBlockCipher.getUpdateOutputSize.

return the size of the output buffer required for an update an input of len bytes.

Parameters
len:int

the length of the input.

Returns:int

the space required to accommodate a call to update with len bytes of input.

GF_doubleback to summary
private static void GF_double(long redPoly, long[] z)
initback to summary
public void init(boolean forEncryption, CipherParameters parameters)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.init.

Doc from org.bouncycastle.crypto.DefaultBufferedBlockCipher.init.

initialise the cipher.

Parameters
forEncryption:boolean

if true the cipher is initialised for encryption, if false for decryption.

parameters:CipherParameters

the key and other data required by the cipher.

processBlocksback to summary
private void processBlocks(byte[] input, int inOff, byte[] output, int outOff)
processByteback to summary
public int processByte(byte in, byte[] out, int outOff)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.processByte.

Doc from org.bouncycastle.crypto.DefaultBufferedBlockCipher.processByte.

process a single byte, producing an output block if necessary.

Parameters
in:byte

the input byte.

out:byte[]

the space for any output that might be produced.

outOff:int

the offset from which the output will be copied.

Returns:int

the number of output bytes copied to out.

processBytesback to summary
public int processBytes(byte[] input, int inOff, int len, byte[] output, int outOff)

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.processBytes.

Doc from org.bouncycastle.crypto.DefaultBufferedBlockCipher.processBytes.

process an array of bytes, producing output if necessary.

Parameters
input:byte[]

the input byte array.

inOff:int

the offset at which the input data starts.

len:int

the number of bytes to be copied out of the input array.

output:byte[]

the space for any output that might be produced.

outOff:int

the offset from which the output will be copied.

Returns:int

the number of output bytes copied to out.

resetback to summary
public void reset()

Overrides org.bouncycastle.crypto.DefaultBufferedBlockCipher.reset.

Doc from org.bouncycastle.crypto.DefaultBufferedBlockCipher.reset.

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).