Top Description Methods
org.bouncycastle.crypto

public Interface BlockCipher

Known Direct Subinterfaces
org.bouncycastle.crypto.MultiBlockCipher
Known Direct Implementers
org.bouncycastle.crypto.modes.G3413CBCBlockCipher, org.bouncycastle.crypto.modes.OpenPGPCFBBlockCipher, org.bouncycastle.crypto.modes.PGPCFBBlockCipher, org.bouncycastle.crypto.engines.AESFastEngine, org.bouncycastle.crypto.engines.AESLightEngine, org.bouncycastle.crypto.engines.ARIAEngine, org.bouncycastle.crypto.engines.BlowfishEngine, org.bouncycastle.crypto.engines.CamelliaEngine, org.bouncycastle.crypto.engines.CamelliaLightEngine, org.bouncycastle.crypto.engines.CAST5Engine, org.bouncycastle.crypto.engines.DESedeEngine, org.bouncycastle.crypto.engines.DESEngine, org.bouncycastle.crypto.engines.DSTU7624Engine, org.bouncycastle.crypto.engines.RC532Engine, org.bouncycastle.crypto.engines.RC564Engine, org.bouncycastle.crypto.engines.RC6Engine, org.bouncycastle.crypto.engines.RijndaelEngine, org.bouncycastle.crypto.engines.SEEDEngine, org.bouncycastle.crypto.engines.GOST28147Engine, org.bouncycastle.crypto.engines.GOST3412_2015Engine, org.bouncycastle.crypto.engines.IDEAEngine, org.bouncycastle.crypto.engines.LEAEngine, org.bouncycastle.crypto.engines.NoekeonEngine, org.bouncycastle.crypto.engines.NullEngine, org.bouncycastle.crypto.engines.RC2Engine, org.bouncycastle.crypto.engines.Shacal2Engine, org.bouncycastle.crypto.engines.SkipjackEngine, org.bouncycastle.crypto.engines.SM4Engine, org.bouncycastle.crypto.engines.TEAEngine, org.bouncycastle.crypto.engines.ThreefishEngine, org.bouncycastle.crypto.engines.TwofishEngine, org.bouncycastle.crypto.engines.XTEAEngine, org.bouncycastle.crypto.engines.SerpentEngineBase

Block cipher engines are expected to conform to this interface.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the name of the algorithm the cipher implements.
getAlgorithmName
()

Return the name of the algorithm the cipher implements.

public int

Returns:

the block size for this cipher in bytes.
getBlockSize
()

Return the block size for this cipher (in bytes).

public void
init(boolean
if true the cipher is initialised for encryption, if false for decryption.
forEncryption
,
CipherParameters
the key and other data required by the cipher.
params
)

Initialise the cipher.

public int

Returns:

the number of bytes processed and produced.
processBlock
(byte[]
the array containing the input data.
input
,
int
offset into the in array the data starts at.
inOff
,
byte[]
the array the output data will be copied into.
output
,
int
the offset into the out array the output will start at.
outOff
)

Process one block of input from the array in and write it to the out array.

public void
reset()

Reset the cipher.

Method Detail

getAlgorithmNameback to summary
public String getAlgorithmName()

Return the name of the algorithm the cipher implements.

Returns:String

the name of the algorithm the cipher implements.

getBlockSizeback to summary
public int getBlockSize()

Return the block size for this cipher (in bytes).

Returns:int

the block size for this cipher in bytes.

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

Initialise the cipher.

Parameters
forEncryption:boolean

if true the cipher is initialised for encryption, if false for decryption.

params:CipherParameters

the key and other data required by the cipher.

Exceptions
IllegalArgumentException:
if the params argument is inappropriate.
processBlockback to summary
public int processBlock(byte[] input, int inOff, byte[] output, int outOff) throws DataLengthException, IllegalStateException

Process one block of input from the array in and write it to the out array.

Parameters
input:byte[]

the array containing the input data.

inOff:int

offset into the in array the data starts at.

output:byte[]

the array the output data will be copied into.

outOff:int

the offset into the out array the output will start at.

Returns:int

the number of bytes processed and produced.

Exceptions
DataLengthException:
if there isn't enough data in input , or space in out.
IllegalStateException:
if the cipher isn't initialised.
resetback to summary
public void reset()

Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).