iaik.security.cipher
Class CAST128

java.lang.Object
  |
  +--javax.crypto.CipherSpi
        |
        +--iaik.security.cipher.BufferedCipher
              |
              +--iaik.security.cipher.CAST128

public class CAST128
extends iaik.security.cipher.BufferedCipher

Extends the BufferedCipher class for adding a buffering mechanism to the underlying CAST128 cipher.

CAST128, also known as CAST5, is a Feistel type block cipher with a block size of 64 bit and a 128 bit key. It can also be used with shorter keys, valid are 40-128 bit in 8 bit increments. For key sizes up to and including 80 bit the algorithm uses 12 rounds, for longer keys 16 rounds. The algorithm is available from the IAIK provider under the name CAST128 and the aliases CAST5 and CAST. It was developed by Carlisle Adams for Entrust Technologies and is described in RFC2144.

This class only creates a BufferedCipher object for the CAST128 cipher.

Applications shall use

Cipher.getInstance("CAST128", "IAIK");
 
for creating a CAST128 object. They optionally may specifiy operation mode (ECB (default), CBC, PCBC, OFB, CFB) and padding scheme (NoPadding (default), or PKCS5Padding as described in the PKCS #5: Password-Based Encryption Standard).

When requesting this CAST128 implementation without any mode specification (Cipher.getInstance("CAST128")), the CAST128 algorithm is used in pure ECB (Electronic Code Book) mode encrypting plaintext blocks into ciphertext blocks independently from each other. The ECB mode is prone to codebook attacks and block replay. A codebook attack may be successfully when being able to read plain- and corresponding ciphertext blocks for a certain quantity of messages making it possible to generate a codebook for decrypting blocks of further messages without knowing the key. For being effective against codebook analyses and block replay (often messages contain common sub-parts making it possible to unnoticed replace these blocks) one can use the CBC mode makes the encryption of one block of plain data conditional on all previously encrypted data blocks.

Since ECB encrypts each single block independently, it enables random access to encrypted data blocks which may be preferable for database encrypting. Often ECB is used for key-encrypting.

See Also:
Cipher

Constructor Summary
CAST128()
          Creates a CAST128 object by calling the BufferedCipher constructor for the CAST128 cipher.
 
Methods inherited from class iaik.security.cipher.BufferedCipher
engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CAST128

public CAST128()
Creates a CAST128 object by calling the BufferedCipher constructor for the CAST128 cipher. This constructor is only internally used for initializing a CAST128 Cipher. Applications should not call this constructor to get a CAST128 Cipher; they should call one of the Cipher.getInstance factory methods instead.

See Also:
Cipher.getInstance(java.lang.String)