|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectAES
public class AES
Java AES implementation which takes a 128-, 192- or 256-bit key and encrypts or decrypts the given text.
| Field Summary | |
|---|---|
protected int |
current
The index of the current state in this AES cipher. |
protected static int[] |
invSBox
The inverse S-Box substitution table. |
protected int[] |
key
The cipher key. |
protected static int |
Nb
The number of 32-bit words comprising the plaintext and columns comprising the state matrix of an AES cipher. |
protected int |
Nk
The number of 32-bit words comprising the cipher key in this AES cipher. |
protected int |
Nr
The number of rounds in this AES cipher. |
protected static int[] |
rCon
Rcon |
protected int[][][] |
s
The state matrices in this AES cipher. |
protected static int[] |
sBox
The S-Box substitution table. |
protected int[] |
w
The key schedule in this AES cipher. |
| Constructor Summary | |
|---|---|
protected |
AES()
Protected constructor. |
|
AES(byte[] input)
Constructs an AES cipher using a specific key. |
| Method Summary | |
|---|---|
protected int[][] |
addRoundKey(int[][] s,
int round)
Adds the key schedule for a round to a state matrix. |
protected int[][] |
cipher(int[][] in,
int[][] out)
Encrypts the cipher text. |
byte[] |
decrypt(byte[] y)
Decrypts a 128-bit (16-byte) ciphertext block using this AES cipher |
byte[] |
encrypt(byte[] x)
Encrypts a 128-bit (16-byte) plaintext block using this AES cipher |
protected int[][] |
invCipher(int[][] in,
int[][] out)
Decrypts the cipher text. |
protected int[][] |
invMixColumns(int[][] s)
Unmixes each column of a state matrix. |
protected int[][] |
invShiftRows(int[][] s)
Applies an inverse cyclic shift to the last 3 rows of a state matrix. |
protected int[][] |
invSubBytes(int[][] s)
Applies inverse S-Box substitution to each byte of a state matrix. |
protected static int |
invSubWord(int w)
Applies inverse S-box substitution to each byte of a 4-byte word. |
protected int[] |
keyExpand()
|
static void |
main(java.lang.String[] argv)
Test Driver. |
protected int[][] |
mixColumns(int[][] s)
Mixes each column of a state matrix. |
protected static int |
mult(int a,
int b)
Multiplies two polynomials a(x), b(x) in GF(2^8) modulo the irreducible polynomial m(x) = x^8+x^4+x^3+x+1. |
protected static int |
rotWord(int w)
Applies a cyclic permutation to a 4-byte word. |
protected int[][] |
shiftRows(int[][] s)
Applies a cyclic shift to the last 3 rows of a state matrix. |
protected int[][] |
subBytes(int[][] s)
Applies S-Box substitution to each byte of a state matrix. |
protected static int |
subWord(int w)
Applies S-box substitution to each byte of a 4-byte word. |
protected static int |
xtime(int b)
Multiplies x times a polynomial b(x) in GF(2^8) modulo the irreducible polynomial m(x) = x^8+x^4+x^3+x+1. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int current
protected static final int[] invSBox
protected static final int[] rCon
protected static int Nb
protected int Nk
protected int Nr
protected int[][][] s
protected static final int[] sBox
protected int[] w
protected int[] key
| Constructor Detail |
|---|
public AES(byte[] input)
input - A 128-, 192- or 256-bit (i.e. 16-, 24- or 32-byte) secret key.
java.lang.IllegalArgumentException - if unknown key size is passed.protected AES()
| Method Detail |
|---|
protected int[][] addRoundKey(int[][] s,
int round)
s - A state matrix having Nb columns and 4 rows.round - A round of the key schedule w to be added.
protected int[][] cipher(int[][] in,
int[][] out)
in - array of text to encryptout - array to store the encrypted text
protected int[][] invCipher(int[][] in,
int[][] out)
in - array of encrypted text to decryptout - array to store the decrypted text
public byte[] decrypt(byte[] y)
AbstractAES
decrypt in interface AbstractAESy - The 128-bit (16-byte) ciphertext block to be decrypted.
public byte[] encrypt(byte[] x)
AbstractAES
encrypt in interface AbstractAESx - The 128-bit (16-byte) plaintext block to be encrypted.
protected int[][] invMixColumns(int[][] s)
s - A state matrix having Nb columns and 4 rows.
protected int[][] invShiftRows(int[][] s)
s - A state matrix having Nb columns and 4 rows.
protected int[][] invSubBytes(int[][] s)
s - A state matrix having Nb columns and 4 rows.
protected static int invSubWord(int w)
w - A 4-byte word.
protected int[] keyExpand()
protected int[][] mixColumns(int[][] s)
s - A state matrix having Nb columns and 4 rows.
protected static int mult(int a,
int b)
a - A polynomial a(x) = a7x^7+a6x^6+a5x^5+a4x^4+a3x^3+a2x^2+a1x+a0 in
GF(2^8).b - A polynomial b(x) = b7x^7+b6x^6+b5x^5+b4x^4+b3x^3+b2x^2+b1x+b0 in
GF(2^8).
protected static int rotWord(int w)
w - A 4-byte word.
protected int[][] shiftRows(int[][] s)
s - A state matrix having Nb columns and 4 rows.
protected int[][] subBytes(int[][] s)
s - A state matrix having Nb columns and 4 rows.
protected static int subWord(int w)
w - A 4-byte word.
protected static int xtime(int b)
b - A polynomial b(x) = b7x^7+b6x^6+b5x^5+b4x^4+b3x^3+b2x^2+b1x+b0 in
GF(2^8).
public static void main(java.lang.String[] argv)
throws java.io.IOException
argv -
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||