iaik.security.cipher
Class RC2

java.lang.Object
  |
  +--javax.crypto.CipherSpi
        |
        +--iaik.security.cipher.BufferedCipher
              |
              +--iaik.security.cipher.RC2
Direct Known Subclasses:
PbeWithSHAAnd40BitRC2_CBC

public class RC2
extends iaik.security.cipher.BufferedCipher

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

Ron Rivest's Cipher No.2 is word oriented, operating on a block of 64 bits divided into four 16-bit words, with a key table of 64 words. All data units are little-endian.

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

Applications shall use

Cipher.getInstance("RC2", "IAIK");
 
for creating a RC2 cipher 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 RC2 implementation without any mode specification (Cipher.getInstance("RC2")), the RC2 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:
BufferedCipher, Cipher

Constructor Summary
RC2()
          Creates a RC2 object by calling the BufferedCipher constructor for the RC2 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

RC2

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