All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.security.cipher.RC2

java.lang.Object
   |
   +----java.security.Cipher
           |
           +----iaik.security.cipher.RC2

public class RC2
extends Cipher
implements SymmetricCipher
The RC2 encryption method.

It's based on code which showed up in sci.crypt. Here's the start of the article:

 >From cygnus.mincom.oz.au!minbne.mincom.oz.au!bunyip.cc.uq.oz.au!munnari.OZ.AU!comp.vuw.ac.nz!waikato!auckland.ac.nz!news Mon Feb 12 18:48:17 EST 1996
 Article 23601 of sci.crypt:
 Path: cygnus.mincom.oz.au!minbne.mincom.oz.au!bunyip.cc.uq.oz.au!munnari.OZ.AU!comp.vuw.ac.nz!waikato!auckland.ac.nz!news
 >From: pgut01@cs.auckland.ac.nz (Peter Gutmann)
 Newsgroups: sci.crypt
 Subject: Specification for Ron Rivests Cipher No.2
 Date: 11 Feb 1996 06:45:03 GMT
 Organization: University of Auckland
 Lines: 203
 Sender: pgut01@cs.auckland.ac.nz (Peter Gutmann)
 Message-ID: <4fk39f$f70@net.auckland.ac.nz>
 NNTP-Posting-Host: cs26.cs.auckland.ac.nz
 X-Newsreader: NN version 6.5.0 #3 (NOV)
                         Ron Rivest's Cipher No.2
                         ------------------------
  Ron Rivest's Cipher No.2 (hereafter referred to as RRC.2, other people may
 refer to it by other names) 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 functional description of the algorithm is based in
 the paper "The RC5 Encryption Algorithm" (RC5 is a trademark of RSADSI), using
 the same general layout, terminology, and pseudocode style.
 


Constructor Index

 o RC2()
Constructor for a RC2 Cipher.

Method Index

 o engineBlockSize()
Returns the length of an output block, in bytes.
 o engineInitDecrypt(Key)
Initializes this cipher for decryption, using the specified key.
 o engineInitEncrypt(Key)
Initializes this cipher for encryption, using the specified key.
 o engineUpdate(byte[], int, int, byte[], int)
Add to the bytes to be processed.

Constructors

 o RC2
 public RC2()
Constructor for a RC2 Cipher. This constructor is only for initializing the superclass. 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

Methods

 o engineInitEncrypt
 protected void engineInitEncrypt(Key rc2Key) throws InvalidKeyException
Initializes this cipher for encryption, using the specified key. The format of the key must be "RAW".

Parameters:
key - the key to use for encryption
Throws: InvalidKeyException
if the key is invalid
Overrides:
engineInitEncrypt in class Cipher
 o engineInitDecrypt
 protected void engineInitDecrypt(Key rc2Key) throws InvalidKeyException
Initializes this cipher for decryption, using the specified key. The format of the key must be "RAW" and the length must be 16 bytes or 128 bits.

Parameters:
key - the key to use for encryption
Throws: InvalidKeyException
if the key is invalid
Overrides:
engineInitDecrypt in class Cipher
 o engineUpdate
 public int engineUpdate(byte in[],
                         int inOff,
                         int inLen,
                         byte out[],
                         int outOff)
Add to the bytes to be processed. The result is written to the provided out buffer. The implementation is free to buffer any data, if the number of bytes passed is insufficient to process a whole block.

Parameters:
in - the input data
inOff - the offset indicating where the subarray starts in the in array
inLen - the length of the subarray
out - the output buffer.
outOff - the offset indicating where to start writing the result into the output buffer
Returns:
the number of bytes written to out.
Throws: IllegalBlockSizeException
if the length of the input data is not 64 bit
Overrides:
engineUpdate in class Cipher
 o engineBlockSize
 protected int engineBlockSize()
Returns the length of an output block, in bytes.

Returns:
the length in bytes of a block for this cipher
Overrides:
engineBlockSize in class Cipher

All Packages  Class Hierarchy  This Package  Previous  Next  Index