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

public Class CamelliaLightEngine

extends Object
implements BlockCipher
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.BlockCipher
Imports
org.bouncycastle.crypto.BlockCipher, .CipherParameters, .CryptoServicesRegistrar, .DataLengthException, .OutputLengthException, org.bouncycastle.crypto.constraints.DefaultServiceProperties, org.bouncycastle.crypto.params.KeyParameter

Camellia - based on RFC 3713, smaller implementation, about half the size of CamelliaEngine.

Field Summary

Modifier and TypeField and Description
private int
private static final int
private boolean
private boolean
private int[]
private int[]
private static final int
private static final byte[]
private static final int[]
private int[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private int
private int
bytes2int(byte[] src, int offset)

private void
camelliaF2(int[] s, int[] skey, int keyoff)

private void
camelliaFLs(int[] s, int[] fkey, int keyoff)

private static void
decroldq(int rot, int[] ki, int ioff, int[] ko, int ooff)

private static void
decroldqo32(int rot, int[] ki, int ioff, int[] ko, int ooff)

public String
getAlgorithmName()

Implements org.bouncycastle.crypto.BlockCipher.getAlgorithmName.

Return the name of the algorithm the cipher implements.

public int
getBlockSize()

Implements org.bouncycastle.crypto.BlockCipher.getBlockSize.

Return the block size for this cipher (in bytes).

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

Implements org.bouncycastle.crypto.BlockCipher.init.

Initialise the cipher.

private void
int2bytes(int word, byte[] dst, int offset)

private static int
leftRotate(int x, int s)

private byte
lRot8(byte v, int rot)

public int
processBlock(byte[]
the array containing the input data.
in
,
int
offset into the in array the data starts at.
inOff
,
byte[]
the array the output data will be copied into.
out
,
int
the offset into the out array the output will start at.
outOff
)

Implements org.bouncycastle.crypto.BlockCipher.processBlock.

Process one block of input from the array in and write it to the out array.

private int
processBlock128(byte[] in, int inOff, byte[] out, int outOff)

private int
processBlock192or256(byte[] in, int inOff, byte[] out, int outOff)

public void
reset()

Implements org.bouncycastle.crypto.BlockCipher.reset.

Reset the cipher.

private static int
rightRotate(int x, int s)

private static void
roldq(int rot, int[] ki, int ioff, int[] ko, int ooff)

private static void
roldqo32(int rot, int[] ki, int ioff, int[] ko, int ooff)

private int
sbox2(int x)

private int
sbox3(int x)

private int
sbox4(int x)

private void
setKey(boolean forEncryption, byte[] key)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_keySizeback to summary
private int _keySize
BLOCK_SIZEback to summary
private static final int BLOCK_SIZE
forEncryptionback to summary
private boolean forEncryption
initializedback to summary
private boolean initialized
keback to summary
private int[] ke
kwback to summary
private int[] kw
MASK8back to summary
private static final int MASK8
SBOX1back to summary
private static final byte[] SBOX1
SIGMAback to summary
private static final int[] SIGMA
subkeyback to summary
private int[] subkey

Constructor Detail

CamelliaLightEngineback to summary
public CamelliaLightEngine()

Method Detail

bitsOfSecurityback to summary
private int bitsOfSecurity()
bytes2intback to summary
private int bytes2int(byte[] src, int offset)
camelliaF2back to summary
private void camelliaF2(int[] s, int[] skey, int keyoff)
camelliaFLsback to summary
private void camelliaFLs(int[] s, int[] fkey, int keyoff)
decroldqback to summary
private static void decroldq(int rot, int[] ki, int ioff, int[] ko, int ooff)
decroldqo32back to summary
private static void decroldqo32(int rot, int[] ki, int ioff, int[] ko, int ooff)
getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.BlockCipher.getAlgorithmName.

Doc from org.bouncycastle.crypto.BlockCipher.getAlgorithmName.

Return the name of the algorithm the cipher implements.

Returns:String

the name of the algorithm the cipher implements.

getBlockSizeback to summary
public int getBlockSize()

Implements org.bouncycastle.crypto.BlockCipher.getBlockSize.

Doc from org.bouncycastle.crypto.BlockCipher.getBlockSize.

Return the block size for this cipher (in bytes).

Returns:int

the block size for this cipher in bytes.

initback to summary
public void init(boolean forEncryption, CipherParameters params)

Implements org.bouncycastle.crypto.BlockCipher.init.

Doc from org.bouncycastle.crypto.BlockCipher.init.

Initialise the cipher.

Parameters
forEncryption:boolean

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

params:CipherParameters

the key and other data required by the cipher.

int2bytesback to summary
private void int2bytes(int word, byte[] dst, int offset)
leftRotateback to summary
private static int leftRotate(int x, int s)
lRot8back to summary
private byte lRot8(byte v, int rot)
processBlockback to summary
public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws IllegalStateException

Implements org.bouncycastle.crypto.BlockCipher.processBlock.

Doc from org.bouncycastle.crypto.BlockCipher.processBlock.

Process one block of input from the array in and write it to the out array.

Parameters
in:byte[]

the array containing the input data.

inOff:int

offset into the in array the data starts at.

out:byte[]

the array the output data will be copied into.

outOff:int

the offset into the out array the output will start at.

Returns:int

the number of bytes processed and produced.

Exceptions
IllegalStateException:
if the cipher isn't initialised.
processBlock128back to summary
private int processBlock128(byte[] in, int inOff, byte[] out, int outOff)
processBlock192or256back to summary
private int processBlock192or256(byte[] in, int inOff, byte[] out, int outOff)
resetback to summary
public void reset()

Implements org.bouncycastle.crypto.BlockCipher.reset.

Doc from org.bouncycastle.crypto.BlockCipher.reset.

Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).

rightRotateback to summary
private static int rightRotate(int x, int s)
roldqback to summary
private static void roldq(int rot, int[] ki, int ioff, int[] ko, int ooff)
roldqo32back to summary
private static void roldqo32(int rot, int[] ki, int ioff, int[] ko, int ooff)
sbox2back to summary
private int sbox2(int x)
sbox3back to summary
private int sbox3(int x)
sbox4back to summary
private int sbox4(int x)
setKeyback to summary
private void setKey(boolean forEncryption, byte[] key)