Top Fields Constructors Methods
org.bouncycastle.crypto.engines

public Class RC4Engine

extends Object
implements StreamCipher
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.StreamCipher
Imports
org.bouncycastle.crypto.CipherParameters, .CryptoServicesRegistrar, .DataLengthException, .OutputLengthException, .StreamCipher, org.bouncycastle.crypto.constraints.DefaultServiceProperties, org.bouncycastle.crypto.params.KeyParameter

Field Summary

Modifier and TypeField and Description
private byte[]
private boolean
private static final int
private byte[]
private int
x

private int
y

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getAlgorithmName()

Implements org.bouncycastle.crypto.StreamCipher.getAlgorithmName.

Return the name of the algorithm the cipher implements.

public void
init(boolean
whether or not we are for encryption.
forEncryption
,
CipherParameters
the parameters required to set up the cipher.
params
)

Implements org.bouncycastle.crypto.StreamCipher.init.

initialise a RC4 cipher.

public int
processBytes(byte[]
the input byte array.
in
,
int
the offset into the in array where the data to be processed starts.
inOff
,
int
the number of bytes to be processed.
len
,
byte[]
the output buffer the processed bytes go into.
out
,
int
the offset into the output byte array the processed data starts at.
outOff
)

Implements org.bouncycastle.crypto.StreamCipher.processBytes.

process a block of bytes from in putting the result into out.

public void
reset()

Implements org.bouncycastle.crypto.StreamCipher.reset.

reset the cipher.

public byte
returnByte(byte
the byte to be processed.
in
)

Implements org.bouncycastle.crypto.StreamCipher.returnByte.

encrypt/decrypt a single byte returning the result.

private void
setKey(byte[] keyBytes)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

engineStateback to summary
private byte[] engineState
forEncryptionback to summary
private boolean forEncryption
STATE_LENGTHback to summary
private static final int STATE_LENGTH
workingKeyback to summary
private byte[] workingKey
xback to summary
private int x
yback to summary
private int y

Constructor Detail

RC4Engineback to summary
public RC4Engine()

Method Detail

getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.StreamCipher.getAlgorithmName.

Doc from org.bouncycastle.crypto.StreamCipher.getAlgorithmName.

Return the name of the algorithm the cipher implements.

Returns:String

the name of the algorithm the cipher implements.

initback to summary
public void init(boolean forEncryption, CipherParameters params)

Implements org.bouncycastle.crypto.StreamCipher.init.

initialise a RC4 cipher.

Parameters
forEncryption:boolean

whether or not we are for encryption.

params:CipherParameters

the parameters required to set up the cipher.

Exceptions
IllegalArgumentException:
if the params argument is inappropriate.
processBytesback to summary
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)

Implements org.bouncycastle.crypto.StreamCipher.processBytes.

Doc from org.bouncycastle.crypto.StreamCipher.processBytes.

process a block of bytes from in putting the result into out.

Parameters
in:byte[]

the input byte array.

inOff:int

the offset into the in array where the data to be processed starts.

len:int

the number of bytes to be processed.

out:byte[]

the output buffer the processed bytes go into.

outOff:int

the offset into the output byte array the processed data starts at.

Returns:int

the number of bytes produced - should always be len.

resetback to summary
public void reset()

Implements org.bouncycastle.crypto.StreamCipher.reset.

Doc from org.bouncycastle.crypto.StreamCipher.reset.

reset the cipher. This leaves it in the same state it was at after the last init (if there was one).

returnByteback to summary
public byte returnByte(byte in)

Implements org.bouncycastle.crypto.StreamCipher.returnByte.

Doc from org.bouncycastle.crypto.StreamCipher.returnByte.

encrypt/decrypt a single byte returning the result.

Parameters
in:byte

the byte to be processed.

Returns:byte

the result of processing the input byte.

setKeyback to summary
private void setKey(byte[] keyBytes)