asgaard.utils.cryptography
Class IDEA

java.lang.Object
  |
  +--asgaard.utils.cryptography.Cryptography
        |
        +--asgaard.utils.cryptography.IDEA

public class IDEA
extends Cryptography

IDEA.java - A java implementation of the IDEA block cipher. IDEA (International Data Encryption Algorithm) developed by Xuejia Lai and James L. Massey of ETH Zurich.

NOTE: The IDEA(tm) block cipher is covered by patents held by ETH and Ascom-Tech AG, Swiss patent number PCT/CH91/00117, European patent number EP 0 482 154 B1, U.S. patent number US005214703. IDEA(tm) is a trademark of Ascom-Tech AG. There is no license fee required for noncommercial use. Commercial users may obtain licensing details from Dieter Profos, Ascom Tech AG, Solothurn Lab, Postfach 151, 4502 Solothurn, Switzerland, Tel +41 65 242885, Fax +41 65 235761.

IDEA uses a lot of operations on unsigned 16 bit integers. Since Java has no unsigned integers these will be stored and manipulated as 32 bit integers.

Copyright © 1997 David Purdue.

See Also:
Cryptography

Constructor Summary
IDEA()
          Constructor - set up IDEA object with default key (all zeros).
 
Method Summary
 byte[] decrypt(byte[] ciphertext)
          Performs a IDEA decryption.
 byte[] decryptFinish()
          Tidies up a IDEA decryption.
 byte[] encrypt(byte[] plaintext)
          Performs a IDEA encryption.
 byte[] encryptFinish()
          Tidies up a IDEA encryption.
 byte[] getKey()
          Retrieves the IDEA user key from an object.
 void setKey(byte[] key)
          Stores the encryption key in the IDEA object.
 
Methods inherited from class asgaard.utils.cryptography.Cryptography
getCrypto
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDEA

public IDEA()
Constructor - set up IDEA object with default key (all zeros).
Method Detail

encrypt

public byte[] encrypt(byte[] plaintext)
               throws java.lang.NoSuchMethodException
Performs a IDEA encryption.
Parameters:
plaintext - The plain text to encrypt as an array of bytes.
Returns:
An array of bytes with the cipher text.
Throws:
java.lang.NoSuchMethodException - Thrown by superclass.
Overrides:
encrypt in class Cryptography
See Also:
Cryptography.encrypt(byte[])

encryptFinish

public byte[] encryptFinish()
                     throws java.lang.NoSuchMethodException
Tidies up a IDEA encryption.
Returns:
An array of bytes with the cipher text.
Throws:
java.lang.NoSuchMethodException - Thrown by superclass.
Overrides:
encryptFinish in class Cryptography
See Also:
Cryptography.encryptFinish()

decrypt

public byte[] decrypt(byte[] ciphertext)
               throws java.lang.NoSuchMethodException
Performs a IDEA decryption.
Parameters:
ciphertext - The cipher text to decrypt, an array of bytes.
Returns:
An array of bytes with the plain text.
Throws:
java.lang.NoSuchMethodException - Thrown by superclass.
Overrides:
decrypt in class Cryptography
See Also:
Cryptography.decrypt(byte[])

decryptFinish

public byte[] decryptFinish()
                     throws java.lang.NoSuchMethodException
Tidies up a IDEA decryption.
Returns:
An array of bytes with the plain text.
Throws:
java.lang.NoSuchMethodException - Thrown by superclass.
Overrides:
decryptFinish in class Cryptography
See Also:
Cryptography.decryptFinish()

setKey

public void setKey(byte[] key)
            throws java.lang.NoSuchMethodException
Stores the encryption key in the IDEA object. IDEA keys are 16 bytes long - if fewer bytes are given, pad with zeros, if too many then discard excess.
Parameters:
key - an array of bytes containing the key.
Throws:
java.lang.NoSuchMethodException - Thrown by superclass.
Overrides:
setKey in class Cryptography
See Also:
Cryptography.setKey(byte[])

getKey

public byte[] getKey()
              throws java.lang.NoSuchMethodException
Retrieves the IDEA user key from an object.
Returns:
An array of bytes with the user key.
Throws:
java.lang.NoSuchMethodException - Thrown by superclass.
Overrides:
getKey in class Cryptography
See Also:
Cryptography.getKey()