SSJ  3.3.1
Stochastic Simulation in Java
Static Public Member Functions | Static Package Functions | Static Package Attributes | List of all members
Rijndael_Algorithm Class Reference

Rijndael –pronounced Reindaal– is a variable block-size (128-, 192- and 256-bit), variable key-size (128-, 192- and 256-bit) symmetric cipher. More...

Collaboration diagram for Rijndael_Algorithm:
[legend]

Static Public Member Functions

static Object makeKey (byte[] k) throws InvalidKeyException
 Convenience method to expand a user-supplied key material into a session key, assuming Rijndael's default block size (128-bit). More...
 
static byte [] blockEncrypt (byte[] in, int inOffset, Object sessionKey)
 Convenience method to encrypt exactly one block of plaintext, assuming Rijndael's default block size (128-bit). More...
 
static byte [] blockDecrypt (byte[] in, int inOffset, Object sessionKey)
 Convenience method to decrypt exactly one block of plaintext, assuming Rijndael's default block size (128-bit). More...
 
static boolean self_test ()
 A basic symmetric encryption/decryption test. More...
 
static int blockSize ()
 
static synchronized Object makeKey (byte[] k, int blockSize) throws InvalidKeyException
 Expand a user-supplied key material into a session key. More...
 
static byte [] blockEncrypt (byte[] in, int inOffset, Object sessionKey, int blockSize)
 Encrypt exactly one block of plaintext. More...
 
static byte [] blockDecrypt (byte[] in, int inOffset, Object sessionKey, int blockSize)
 Decrypt exactly one block of ciphertext. More...
 
static int getRounds (int keySize, int blockSize)
 Return The number of rounds for a given Rijndael's key and block sizes. More...
 
static void main (String[] args)
 

Static Package Functions

static void debug (String s)
 
static void trace (boolean in, String s)
 
static void trace (String s)
 
 [static initializer]
 
static final int mul (int a, int b)
 
static final int mul4 (int a, byte[] b)
 

Static Package Attributes

static final String NAME = "Rijndael_Algorithm"
 
static final boolean IN = true
 
static final boolean OUT = false
 
static final boolean DEBUG = Rijndael_Properties.GLOBAL_DEBUG
 
static final int debuglevel = DEBUG ? Rijndael_Properties.getLevel(NAME) : 0
 
static final PrintWriter err = DEBUG ? Rijndael_Properties.getOutput() : null
 
static final boolean TRACE = Rijndael_Properties.isTraceable(NAME)
 
static final int BLOCK_SIZE = 16
 
static final int [] alog = new int[256]
 
static final int [] log = new int[256]
 
static final byte [] S = new byte[256]
 
static final byte [] Si = new byte[256]
 
static final int [] T1 = new int[256]
 
static final int [] T2 = new int[256]
 
static final int [] T3 = new int[256]
 
static final int [] T4 = new int[256]
 
static final int [] T5 = new int[256]
 
static final int [] T6 = new int[256]
 
static final int [] T7 = new int[256]
 
static final int [] T8 = new int[256]
 
static final int [] U1 = new int[256]
 
static final int [] U2 = new int[256]
 
static final int [] U3 = new int[256]
 
static final int [] U4 = new int[256]
 
static final byte [] rcon = new byte[30]
 
static final int [][][] shifts
 

Detailed Description

Rijndael –pronounced Reindaal– is a variable block-size (128-, 192- and 256-bit), variable key-size (128-, 192- and 256-bit) symmetric cipher.

Rijndael was written by Vincent Rijmen and Joan Daemen.

Portions of this code are Copyright © 1997, 1998 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

Revision

Author
Raif S. Naffah
Paulo S. L. M. Barreto

Member Function Documentation

◆ blockDecrypt() [1/2]

static byte [] blockDecrypt ( byte []  in,
int  inOffset,
Object  sessionKey 
)
static

Convenience method to decrypt exactly one block of plaintext, assuming Rijndael's default block size (128-bit).

Parameters
inThe ciphertext.
inOffsetIndex of in from which to start considering data.
sessionKeyThe session key to use for decryption.
Returns
The plaintext generated from a ciphertext using the session key.

◆ blockDecrypt() [2/2]

static byte [] blockDecrypt ( byte []  in,
int  inOffset,
Object  sessionKey,
int  blockSize 
)
static

Decrypt exactly one block of ciphertext.

Parameters
inThe ciphertext.
inOffsetIndex of in from which to start considering data.
sessionKeyThe session key to use for decryption.
blockSizeThe block size in bytes of this Rijndael.
Returns
The plaintext generated from a ciphertext using the session key.

◆ blockEncrypt() [1/2]

static byte [] blockEncrypt ( byte []  in,
int  inOffset,
Object  sessionKey 
)
static

Convenience method to encrypt exactly one block of plaintext, assuming Rijndael's default block size (128-bit).

Parameters
inThe plaintext.
inOffsetIndex of in from which to start considering data.
sessionKeyThe session key to use for encryption.
Returns
The ciphertext generated from a plaintext using the session key.

◆ blockEncrypt() [2/2]

static byte [] blockEncrypt ( byte []  in,
int  inOffset,
Object  sessionKey,
int  blockSize 
)
static

Encrypt exactly one block of plaintext.

Parameters
inThe plaintext.
inOffsetIndex of in from which to start considering data.
sessionKeyThe session key to use for encryption.
blockSizeThe block size in bytes of this Rijndael.
Returns
The ciphertext generated from a plaintext using the session key.

◆ blockSize()

static int blockSize ( )
static
Returns
The default length in bytes of the Algorithm input block.

◆ getRounds()

static int getRounds ( int  keySize,
int  blockSize 
)
static

Return The number of rounds for a given Rijndael's key and block sizes.

Parameters
keySizeThe size of the user key material in bytes.
blockSizeThe desired block size in bytes.
Returns
The number of rounds for a given Rijndael's key and block sizes.

◆ makeKey() [1/2]

static Object makeKey ( byte []  k) throws InvalidKeyException
static

Convenience method to expand a user-supplied key material into a session key, assuming Rijndael's default block size (128-bit).

Parameters
keyThe 128/192/256-bit user-key to use.
Exceptions
InvalidKeyExceptionIf the key is invalid.

◆ makeKey() [2/2]

static synchronized Object makeKey ( byte []  k,
int  blockSize 
) throws InvalidKeyException
static

Expand a user-supplied key material into a session key.

Parameters
keyThe 128/192/256-bit user-key to use.
blockSizeThe block size in bytes of this Rijndael.
Exceptions
InvalidKeyExceptionIf the key is invalid.

◆ self_test()

static boolean self_test ( )
static

A basic symmetric encryption/decryption test.

Member Data Documentation

◆ shifts

final int [][][] shifts
staticpackage
Initial value:
= new int[][][] {
{ {0, 0}, {1, 3}, {2, 2}, {3, 1} },
{ {0, 0}, {1, 5}, {2, 4}, {3, 3} },
{ {0, 0}, {1, 7}, {3, 5}, {4, 4} }
}

The documentation for this class was generated from the following file: