|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.bouncycastle.crypto.engines.RijndaelEngine
public class RijndaelEngine
an implementation of Rijndael, based on the documentation and reference implementation by Paulo Barreto, Vincent Rijmen, for v2.0 August '99.
Note: this implementation is based on information prior to final NIST publication.
Field Summary | |
---|---|
private long |
A0
|
private long |
A1
|
private long |
A2
|
private long |
A3
|
private static byte[] |
aLogtable
|
private int |
BC
|
private long |
BC_MASK
|
private int |
blockBits
|
private boolean |
forEncryption
|
private static byte[] |
logtable
|
private static int |
MAXKC
|
private static int |
MAXROUNDS
|
private static int[] |
rcon
|
private int |
ROUNDS
|
private static byte[] |
S
|
(package private) static byte[][] |
shifts0
|
private byte[] |
shifts0SC
|
(package private) static byte[][] |
shifts1
|
private byte[] |
shifts1SC
|
private static byte[] |
Si
|
private long[][] |
workingKey
|
Constructor Summary | |
---|---|
RijndaelEngine()
default constructor - 128 bit block size. |
|
RijndaelEngine(int blockBits)
basic constructor - set the cipher up for a given blocksize |
Method Summary | |
---|---|
private long |
applyS(long r,
byte[] box)
|
private void |
decryptBlock(long[][] rk)
|
private void |
encryptBlock(long[][] rk)
|
private long[][] |
generateWorkingKey(byte[] key)
Calculate the necessary round keys The number of calculations depends on keyBits and blockBits |
java.lang.String |
getAlgorithmName()
Return the name of the algorithm the cipher implements. |
int |
getBlockSize()
Return the block size for this cipher (in bytes). |
void |
init(boolean forEncryption,
CipherParameters params)
initialise a Rijndael cipher. |
private void |
InvMixColumn()
Mix the bytes of every column in a linear way This is the opposite operation of Mixcolumn |
private void |
KeyAddition(long[] rk)
xor corresponding text input and round key input bytes |
private void |
MixColumn()
Mix the bytes of every column in a linear way |
private byte |
mul0x2(int b)
multiply two elements of GF(2^m) needed for MixColumn and InvMixColumn |
private byte |
mul0x3(int b)
|
private byte |
mul0x9(int b)
|
private byte |
mul0xb(int b)
|
private byte |
mul0xd(int b)
|
private byte |
mul0xe(int b)
|
private void |
packBlock(byte[] bytes,
int off)
|
int |
processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
Process one block of input from the array in and write it to the out array. |
void |
reset()
Reset the cipher. |
private long |
shift(long r,
int shift)
|
private void |
ShiftRow(byte[] shiftsSC)
Row 0 remains unchanged The other three rows are shifted a variable amount |
private void |
Substitution(byte[] box)
Replace every byte of the input by the byte at that place in the nonlinear S-box |
private void |
unpackBlock(byte[] bytes,
int off)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int MAXROUNDS
private static final int MAXKC
private static final byte[] logtable
private static final byte[] aLogtable
private static final byte[] S
private static final byte[] Si
private static final int[] rcon
static byte[][] shifts0
static byte[][] shifts1
private int BC
private long BC_MASK
private int ROUNDS
private int blockBits
private long[][] workingKey
private long A0
private long A1
private long A2
private long A3
private boolean forEncryption
private byte[] shifts0SC
private byte[] shifts1SC
Constructor Detail |
---|
public RijndaelEngine()
public RijndaelEngine(int blockBits)
blockBits
- the blocksize in bits, must be 128, 192, or 256.Method Detail |
---|
private byte mul0x2(int b)
private byte mul0x3(int b)
private byte mul0x9(int b)
private byte mul0xb(int b)
private byte mul0xd(int b)
private byte mul0xe(int b)
private void KeyAddition(long[] rk)
private long shift(long r, int shift)
private void ShiftRow(byte[] shiftsSC)
private long applyS(long r, byte[] box)
private void Substitution(byte[] box)
private void MixColumn()
private void InvMixColumn()
private long[][] generateWorkingKey(byte[] key)
public void init(boolean forEncryption, CipherParameters params)
init
in interface BlockCipher
forEncryption
- whether or not we are for encryption.params
- the parameters required to set up the cipher.
java.lang.IllegalArgumentException
- if the params argument is
inappropriate.public java.lang.String getAlgorithmName()
BlockCipher
getAlgorithmName
in interface BlockCipher
public int getBlockSize()
BlockCipher
getBlockSize
in interface BlockCipher
public int processBlock(byte[] in, int inOff, byte[] out, int outOff)
BlockCipher
processBlock
in interface BlockCipher
in
- the array containing the input data.inOff
- offset into the in array the data starts at.out
- the array the output data will be copied into.outOff
- the offset into the out array the output will start at.
public void reset()
BlockCipher
reset
in interface BlockCipher
private final void unpackBlock(byte[] bytes, int off)
private final void packBlock(byte[] bytes, int off)
private final void encryptBlock(long[][] rk)
private final void decryptBlock(long[][] rk)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |