public class AESPacketCipher
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BLOCK_SIZE |
Constructor and Description |
---|
AESPacketCipher() |
Modifier and Type | Method and Description |
---|---|
static void |
checkKeyLength(int keyLen)
Check the key len and fail if not valid.
|
static byte[] |
createS(boolean forEncryption) |
static int[][] |
generateWorkingKey(boolean forEncryption,
byte[] key)
Calculate the necessary round keys
The number of calculations depends on key size and block size
AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits
This code is written assuming those are the only possible values
|
static void |
processBlock(boolean forEncryption,
int[][] schedule,
byte[] s,
byte[] in,
int inOff,
byte[] out,
int outOff)
Does not allocate, does not do any bounds verification
Intended to be used within larger implementation that asserts limits.
|
public static final int BLOCK_SIZE
public static byte[] createS(boolean forEncryption)
public static int[][] generateWorkingKey(boolean forEncryption, byte[] key)
public static void processBlock(boolean forEncryption, int[][] schedule, byte[] s, byte[] in, int inOff, byte[] out, int outOff)
forEncryption
- directionschedule
- the key schedules
- in
- inOff
- out
- outOff
- public static void checkKeyLength(int keyLen) throws PacketCipherException
keyLen
- The key lenPacketCipherException