tribble.crypto
Class AESCipher

java.lang.Object
  extended bytribble.crypto.AbstractCipher
      extended bytribble.crypto.SymmetricCipher
          extended bytribble.crypto.AESCipher

public final class AESCipher
extends SymmetricCipher

AES encryption standard algorithm (also known as Rijndael). Rijndael (pronounced rain'doll) is a symmetric cipher with a 128-bit block size and a variable key size (128-bit, 192-bit, and 256-bit).

Rijndael is the United States AES encryption standard algorithm, which supersedes the previous DES encryption standard.

Acknowledgements

Rijndael was designed by Vincent Rijmen (rijmen@esat.kuleuven.ac.be) and Joan Daemen (daemen.j@protonworld.com).

This implementation was derived from source originally written by Cryptix:

Rijndael.java 1.8 2000/10/02

Copyright ©1995-2000 The Cryptix Foundation Limited. All rights reserved.

Use, modification, copying and distribution of this software is subject the terms and conditions of the Cryptix General Licence. You should have received a copy of the Cryptix General Licence along with this library; if not, you can download a copy from <http://www.cryptix.org/>.

Since:
2005-05-07
Version:
$Revision: 1.2 $ $Date: 2005/07/24 17:27:09 $
Author:
Raif S. Naffah, Paulo S. L. M. Barreto (pbarreto@cryptix.org), Jeroen C. van Gelderen (gelderen@cryptix.org), David R. Tribble (david@tribble.com).

THIS CODE MAY BE SUBJECT TO U.S. EXPORT RESTRICTIONS, AND SHOULD NOT BE EXPORTED OUTSIDE THE BORDERS OF THE UNITED STATES OF AMERICA.


Field Summary
 
Fields inherited from class tribble.crypto.SymmetricCipher
m_blockLen
 
Fields inherited from class tribble.crypto.AbstractCipher
m_alg, m_decrypt, m_init, m_keyLen
 
Constructor Summary
AESCipher()
          Default constructor.
 
Method Summary
protected  void blockDecrypt(byte[] in, int inOff, byte[] out, int outOff)
          Decrypt a block of ciphertext.
protected  void blockEncrypt(byte[] in, int inOff, byte[] out, int outOff)
          Encrypt a block of plaintext.
protected  void clear()
          Reset this cipher, wiping all sensitive information.
 int[] getKeySizes()
          Retrieve the key sizes supported by this cipher.
protected  void initialize(byte[] key, boolean decrypt)
          Initialize this cipher.
static void main(java.lang.String[] args)
          Test driver.
 
Methods inherited from class tribble.crypto.SymmetricCipher
getBlockSize, test, test
 
Methods inherited from class tribble.crypto.AbstractCipher
finalize, getAlgorithm, getKeySize
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AESCipher

public AESCipher()
Default constructor.

Since:
1.1, 2005-07-05
Method Detail

main

public static final void main(java.lang.String[] args)
                       throws java.lang.Exception
Test driver.

Usage java tribble.crypto.AESCipher [args...]

Parameters:
args - Command line arguments.
Throws:
java.lang.Exception - Thrown if an error occurs in the encryption engine.
Since:
1.1, 2005-07-05

getKeySizes

public int[] getKeySizes()
Retrieve the key sizes supported by this cipher.

Overrides:
getKeySizes in class AbstractCipher
Returns:
An array of key sizes (in bytes) used by this cipher algorithm.
Since:
1.2, 2005-07-24
See Also:
AbstractCipher.getKeySize()

initialize

protected void initialize(byte[] key,
                          boolean decrypt)
                   throws java.security.InvalidKeyException
Initialize this cipher.

Specified by:
initialize in class AbstractCipher
Parameters:
key - The symmetric (secret) encryption key for this cipher.
decrypt - If true, this indicates that this cipher is to be initialized for decrypting, otherwise it is to be initialized for encrypting.
Throws:
java.security.InvalidKeyException
Since:
1.1, 2002-04-26
See Also:
clear()

clear

protected void clear()
Reset this cipher, wiping all sensitive information.

This method will be called after this cipher object is no longer needed. It should overwrite any sensitive data contained within this object (e.g., encryption key schedules). This cipher object can no longer be used after this method has been called.

Specified by:
clear in class AbstractCipher
Since:
1.1, 2005-07-05
See Also:
initialize()

blockEncrypt

protected void blockEncrypt(byte[] in,
                            int inOff,
                            byte[] out,
                            int outOff)
Encrypt a block of plaintext.

Specified by:
blockEncrypt in class SymmetricCipher
Parameters:
in - Array containing a single block of plaintext bytes to encrypt. The length of the block is exactly equal to the cipher block size.
inOff - Index of the first byte of the plaintext block within array in to encrypt.
out - Array that will be filled with the encrypted ciphertext block. The length of the block is exactly equal to the cipher block size.
outOff - Index of the first byte of array out to fill with the encrypted ciphertext block.
Since:
1.1, 2002-04-26
See Also:
blockDecrypt(byte[], int, byte[], int)

blockDecrypt

protected void blockDecrypt(byte[] in,
                            int inOff,
                            byte[] out,
                            int outOff)
Decrypt a block of ciphertext.

Specified by:
blockDecrypt in class SymmetricCipher
Parameters:
in - Array containing a single block of ciphertext bytes to decrypt. The length of the block is exactly equal to the cipher block size.
inOff - Index of the first byte of the ciphertext block within array in to decrypt.
out - Array that will be filled with the decrypted plaintext block. The length of the block is exactly equal to the cipher block size.
outOff - Index of the first byte of array out to fill with the decrypted plaintext block.
Since:
1.1, 2002-04-26
See Also:
blockEncrypt(byte[], int, byte[], int)