IDEA

This algorithm is a 64-bit block cipher with a 128-bit key. The last patents on this algorithm expired in 2012, and IDEA is now free for all uses.

IDEA Cipher Initialization

This cipher supports both ECB and CBC modes, and may be used with NoPadding or PKCS5Padding. To create an instance of this class, use the Cipher.getInstance() method with “SAFENET” as the provider and one of the following strings as the transformation:

>IDEA

>IDEA/ECB/NoPadding

>IDEA/ECB/PKCS5Padding

>IDEA/CBC/NoPadding

>IDEA/CBC/PKCS5Padding

Using the “IDEA” transformation the Cipher will default to ECB and NoPadding.

If the NoPadding mode is selected, the input data must be a multiple of 8 bytes; otherwise, the encrypted or decrypted result will be truncated. In PKCS5Padding, arbitrary data lengths are accepted; the ciphertext will be padded to a multiple of 8 bytes, as described in PKCS#5. The decryption process will remove the padding from the data so that the correct plaintext is returned.

This Cipher will accept a javax.crypto.spec.SecretKeySpec or au.com.safenet.crypto.provider.CryptokiSecretKey as the key parameter during initialization.

When the Cipher is initialized in CBC mode, the Initialization Vector (IV) may be specified by passing a javax.crypto.spec.IvParameterSpec instance to the Cipher.init() method. When decrypting in this mode, a valid IV must be specified in the Cipher.init() method. For encryption, however, a random IV will be generated if none is specified (the IV may be retrieved using the Cipher.getIV() method).

The IV may be provided as a java.security.AlgorithmParameters or a javax.crypto.spec.IvParameterSpec instance. If the initialization is done using an AlgorithmParameters instance, it must be convertible to an IvParameterSpec using the AlgorithmParameters.getParameterSpec() method.

This Cipher does not support the Cipher.getParameters() method; this method will always return null. The only supported parameter for this class is the initialization vector, which may be determined using the Cipher.getIV() method.

IDEA Key

The IDEA Cipher requires either a SecretKeySpec or SafeNet ProtectToolkit-J provider IDEA Key during initialization. The IDEA key is always 128 bits long.

To create an appropriate SecretKeySpec, pass a 16 byte array and the algorithm name “IDEA” to the SecretKeySpec constructor.  For example:

byte[] keyBytes = { 0x41, 0x22, 0x35, 0x17,
                    0x39, 0xB6, 0xDC, 0x34,
                    0x11, 0x93, 0x55, 0x67,
                    0x39, 0xAC, 0xCD, 0xFF };
SecretKeySpec ideaKey = new SecretKeySpec(keyBytes, “IDEA”);

Alternatively, a random SafeNet ProtectToolkit-J IDEA key can be generated using the KeyGenerator as described in section Public Keys, or from a provider-independent form as described in section Key Specifications. The IDEA key may also be stored in the SafeNet ProtectToolkit-J KeyStore as described inKey Storage .

The SafeNet ProtectToolkit-J IDEA key will return the string “IDEA” as its algorithm name, “RAW” as its encoding. However, since the key is stored within the hardware, the actual key encoding may not be available.

The key value can only be extracted from a key if the associated Cryptoki key is not marked as Sensitive. The keys generated in SafeNet ProtectToolkit-J will always be marked as sensitive. It is possible, however, to access any Cryptoki keys stored on the device, and it is possible that the attributes of these keys have been modified.

IDEA KeyGenerator

The IDEA KeyGenerator is used to generate random IDEA keys. The generated key will be a hardware key that has the Cryptoki CKA_EXTRACTABLE and CKA_SENSITIVE attributes set. Since these keys are marked as sensitive their getEncoded() method will return null.

During initialization the strength and random parameters are ignored, as all keys are 128-bits and the hardware includes a cryptographically-secure random source.

Keys generated using the KeyGenerator are not thread-safe. That is, a SafeNet ProtectToolkit-J Key instance may only be used by a single Cipher instance (as well as a single MAC instance) at any given time. SeeKey Generation for information on threading and SafeNet ProtectToolkit-J keys.

IDEA SecretKeyFactory

The IDEA SecretKeyFactory is used to construct SafeNet ProtectToolkit-J keys from their provider-independent form. The provider-independent form of the IDEA key is the au.com.safenet.crypto.spec.IDEAKeySpec class.

Keys generated using the SecretKeyFactory are not thread-safe. That is, a SafeNet ProtectToolkit-J Key instance may only be used by a single Cipher instance (as well as a single MAC instance) at any given time. SeeKey Generation for information on threading and SafeNet ProtectToolkit-J keys.

For example, to create the provider-based key from its provider-independent form:

byte[] keyBytes = { 0x41, 0x22, 0x35, 0x17,
                    0x39, 0xDB, 0xDC, 0xEF
                    0x11, 0x93, 0x55, 0x67,
                    0x39, 0xAC, 0xCD, 0xFF };
IDEAKeySpec ideaKeySpec = new IDEAKeySpec(keyBytes);
SecretKeyFactory ideaKeyFact =
           SecretKeyFactory.getInstance(“IDEA”, “SAFENET”);
SecretKey ideaKey = ideaKeyFact.generateSecret(ideaKeySpec);

IDEA Example Code

See DES for the simple DES example. To convert the example to use IDEA, use “IDEA” in place of “DES”.