All Packages Class Hierarchy This Package Previous Next Index
Class iaik.security.cipher.RC4
java.lang.Object
|
+----java.security.Cipher
|
+----iaik.security.cipher.RC4
- public class RC4
- extends Cipher
- implements SymmetricCipher
The RC4 encryption method.
This may or may not be the real RC4 cipher. It's based on
code which showed up anonymously posted in sci.crypt.
Here's the start of the article:
Path: dog.ee.lbl.gov!overload.lbl.gov!lll-winken.llnl.gov!seismo!rsg1.er.usgs.gov!jobone!newsxfer.itd.umich.edu!europa.eng.gtefsd.com!howland.reston.ans.net!EU.net!sun4nl!hacktic!usenet
From: nobody@vox.xs4all.nl (An0nYm0Us UsEr)
Newsgroups: sci.crypt
Subject: RC4 ?
Date: 13 Sep 1994 21:30:36 GMT
Organization: Global Anonymous Remail Services Ltd.
Lines: 83
Message-ID: <3555ls$fsv@news.xs4all.nl>
NNTP-Posting-Host: xs1.xs4all.nl
X-Comment: This message did not originate from the above address.
X-Comment: It was automatically remailed by an anonymous mailservice.
X-Comment: Info: usura@xs4all.nl, Subject: remailer-help
X-Comment: Please report inappropriate use to <admin@vox.xs4all.nl>
SUBJECT: RC4 Source Code
I've tested this. It is compatible with the RC4 object module
that comes in the various RSA toolkits.
-
RC4()
- Constructor for a RC4 Cipher.
-
engineBlockSize()
- Returns the length of an output block, in bytes (=1, because it's a stream cipher).
-
engineInitDecrypt(Key)
- Initializes this cipher for decryption, using the specified key.
-
engineInitEncrypt(Key)
- Initializes this cipher for encryption, using the specified key.
-
engineUpdate(byte[], int, int, byte[], int)
- Add to the bytes to be processed.
RC4
public RC4()
- Constructor for a RC4 Cipher. This constructor is only for initializing the superclass.
Applications should not call this constructor to get a RC4 Cipher; they should call one of
the Cipher.getInstance factory methods instead.
- See Also:
- Cipher
engineInitEncrypt
protected void engineInitEncrypt(Key key) 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
engineInitDecrypt
protected void engineInitDecrypt(Key key) throws InvalidKeyException
- Initializes this cipher for decryption, 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:
- engineInitDecrypt in class Cipher
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
engineBlockSize
protected int engineBlockSize()
- Returns the length of an output block, in bytes (=1, because it's a stream cipher).
- 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