Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.jce.provider.key
Class IDEAKeyGenerator  view IDEAKeyGenerator download IDEAKeyGenerator.java

java.lang.Object
  extended byjavax.crypto.KeyGeneratorSpi
      extended bycryptix.jce.provider.key.RawKeyGenerator
          extended bycryptix.jce.provider.key.IDEAKeyGenerator

public class IDEAKeyGenerator
extends RawKeyGenerator

A key generator for IDEA.

IDEA keys have a fixed length of 128 bits.

Since:
Cryptix 2.2.0a, 2.2.2
Version:
$Revision: 1.6 $

Constructor Summary
IDEAKeyGenerator()
           
 
Method Summary
protected  javax.crypto.SecretKey engineGenerateKey()
          Generate a key, returning it as a javax.crypto.SecretKey.
protected  void engineInit(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
          Initialize this key generator with parameters and a source of randomness.
protected  void engineInit(int keysize, java.security.SecureRandom random)
          Initialize this key generator with a key size (in bits) and a source of randomness.
protected  void engineInit(java.security.SecureRandom random)
          Initialize this key generator with a source of randomness; the implementation should use reasonable default parameters (such as generated key size).
protected  byte[] fixUp(byte[] key)
          Fix up the generated and purely random bytes.
protected  boolean isValidSize(int size)
          Is the given keysize valid for this algorithm?
protected  boolean isWeak(byte[] key)
          Returns true iff the byte array key represents a weak IDEA key.
protected  int strengthToBits(int strength)
          Translates strength (complexity, 56 for DES) to bit length (64 for DES).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDEAKeyGenerator

public IDEAKeyGenerator()
Method Detail

isWeak

protected boolean isWeak(byte[] key)
Returns true iff the byte array key represents a weak IDEA key.

IDEA has two non-overlapping classes of weak keys (bit numbering is from left to right, e.g. 0 denotes the most significant bit of the first byte):

  • Keys with zeros in bit positions 0-25, 29-71, and 75-110 (inclusive) and any value in bits 26-28, 72-74, and 111-127. There are 2^23 weak keys in this class.

  • Keys with zeros in bit positions 0-25, 41-71, 84-98, and 123-127 and any value in bit positions 26-40, 72-83, and 99-122. There are 2^51 weak keys in this class.

Specified by:
isWeak in class RawKeyGenerator

isValidSize

protected boolean isValidSize(int size)
Description copied from class: RawKeyGenerator
Is the given keysize valid for this algorithm?

Specified by:
isValidSize in class RawKeyGenerator

engineInit

protected void engineInit(java.security.SecureRandom random)
Description copied from class: javax.crypto.KeyGeneratorSpi
Initialize this key generator with a source of randomness; the implementation should use reasonable default parameters (such as generated key size).


engineInit

protected void engineInit(java.security.spec.AlgorithmParameterSpec params,
                          java.security.SecureRandom random)
                   throws java.security.InvalidAlgorithmParameterException
Description copied from class: javax.crypto.KeyGeneratorSpi
Initialize this key generator with parameters and a source of randomness.


engineInit

protected void engineInit(int keysize,
                          java.security.SecureRandom random)
Description copied from class: javax.crypto.KeyGeneratorSpi
Initialize this key generator with a key size (in bits) and a source of randomness.


engineGenerateKey

protected javax.crypto.SecretKey engineGenerateKey()
Description copied from class: javax.crypto.KeyGeneratorSpi
Generate a key, returning it as a javax.crypto.SecretKey.


strengthToBits

protected int strengthToBits(int strength)
Translates strength (complexity, 56 for DES) to bit length (64 for DES).


fixUp

protected byte[] fixUp(byte[] key)
Fix up the generated and purely random bytes. For DES this would fix the parity.