cryptix
Class IDEA

java.lang.Object
  |
  +--cryptix.BlockCipher
        |
        +--cryptix.IDEA

public final class IDEA
extends BlockCipher

IDEA is a block cipher with a key length of 16 bytes and a block length of 8 bytes. It is highly popular, being the original cipher in PGP, and has received a lot of cryptanalytic attention.

References

IDEA was written by Dr. X. Lai and Prof. J. Massey. See the IDEA page for more details. The algorithm is subject to patent claims by Ascom Systec Ltd (applied for May 1991) and is licensable.

Copyright © 1995, 1996, 1997 Systemics Ltd on behalf of the Cryptix Development Team. All rights reserved.


Field Summary
static int BLOCK_LENGTH
          The length of a block - DEPRECATED - use blockLength() instead.
static int KEY_LENGTH
          The length of a the user key - DEPRECATED - use keyLength() instead.
 
Constructor Summary
IDEA(byte[] userKey)
          Create an IDEA block cipher from a key in a byte array.
 
Method Summary
protected  void blockDecrypt(byte[] in, int in_offset, byte[] out, int out_offset)
          Perform a decryption in the extended class.
protected  void blockEncrypt(byte[] in, int in_offset, byte[] out, int out_offset)
          Perform an encryption in the extended class.
 int blockLength()
          Return the block length of this cipher.
static java.lang.String getLinkErrorString()
           
static boolean hasFileLibraryLoaded()
           
static boolean isLibraryCorrect()
           
 int keyLength()
          Return the key length of this cipher.
static void main(java.lang.String[] argv)
          Entry point for self_test.
 void native_dks()
          Place marker, untested, unworking.
 void native_encrypt(byte[] in, int in_offset, byte[] out, int out_offset, int[] key)
          Place marker, untested, unworking.
 void native_ks(byte[] userKey)
          Place marker, untested, unworking.
static void self_test(java.io.PrintStream out, java.lang.String[] argv)
          Runs algorithm through test data.
 
Methods inherited from class cryptix.BlockCipher
decrypt, decrypt, decrypt, encrypt, encrypt, encrypt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCK_LENGTH

public static final int BLOCK_LENGTH
The length of a block - DEPRECATED - use blockLength() instead.

KEY_LENGTH

public static final int KEY_LENGTH
The length of a the user key - DEPRECATED - use keyLength() instead.
Constructor Detail

IDEA

public IDEA(byte[] userKey)
Create an IDEA block cipher from a key in a byte array. The byte array must be keyLength bytes long.
Parameters:
userKey - the user key in a byte[ keyLength() ] array
Throws:
CryptoError - if length of key array is wrong
Method Detail

hasFileLibraryLoaded

public static final boolean hasFileLibraryLoaded()

isLibraryCorrect

public static final boolean isLibraryCorrect()

getLinkErrorString

public static final java.lang.String getLinkErrorString()

blockLength

public int blockLength()
Return the block length of this cipher.
Overrides:
blockLength in class BlockCipher
Returns:
the block length in bytes is 8

keyLength

public int keyLength()
Return the key length of this cipher.
Overrides:
keyLength in class BlockCipher
Returns:
the key length in bytes is 16

blockEncrypt

protected void blockEncrypt(byte[] in,
                            int in_offset,
                            byte[] out,
                            int out_offset)
Description copied from class: BlockCipher
Perform an encryption in the extended class. The plaintext in in is encrypted from in_offset to (in_offset + blockLength - 1) and the ciphertext is written into out from out_offset to (out_offset + blockLength - 1) Note that there will be at least blockLength bytes left in each array at the supplied offsets, this is checked in the superclass. The in and out buffers can be the same.

Overrides:
blockEncrypt in class BlockCipher
Following copied from class: cryptix.BlockCipher
Parameters:
in - buffer holding the plaintext to be encrypted
in_offset - the start of plaintext within in
out - buffer to hold the encrypted ciphertext result
out_offset - the start of cyphertext within out

blockDecrypt

protected void blockDecrypt(byte[] in,
                            int in_offset,
                            byte[] out,
                            int out_offset)
Description copied from class: BlockCipher
Perform a decryption in the extended class. The cyphertext in in is decrypted from in_offset to (in_offset + blockLength - 1) and the plaintext is written into out from out_offset to (out_offset + blockLength - 1) Note that there will be at least blockLength bytes left in each array at the supplied offsets, this is checked in the superclass. The in and out buffers can be the same.

Overrides:
blockDecrypt in class BlockCipher
Following copied from class: cryptix.BlockCipher
Parameters:
in - buffer holding the cyphertext to be decrypted
in_offset - the start of cyphertext within in
out - buffer to hold the decrypted plaintext result
out_offset - the start of plaintext within out

native_ks

public void native_ks(byte[] userKey)
Place marker, untested, unworking.

native_dks

public void native_dks()
Place marker, untested, unworking.

native_encrypt

public void native_encrypt(byte[] in,
                           int in_offset,
                           byte[] out,
                           int out_offset,
                           int[] key)
Place marker, untested, unworking.

main

public static final void main(java.lang.String[] argv)
Entry point for self_test.

self_test

public static void self_test(java.io.PrintStream out,
                             java.lang.String[] argv)
                      throws java.lang.Exception
Runs algorithm through test data.