Package org.bouncycastle.crypto
Class StreamBlockCipher
- java.lang.Object
-
- org.bouncycastle.crypto.StreamBlockCipher
-
- All Implemented Interfaces:
BlockCipher,StreamCipher
- Direct Known Subclasses:
CFBBlockCipher,G3413CFBBlockCipher,G3413CTRBlockCipher,G3413OFBBlockCipher,GCFBBlockCipher,GOFBBlockCipher,KCTRBlockCipher,OFBBlockCipher,SICBlockCipher
public abstract class StreamBlockCipher extends java.lang.Object implements BlockCipher, StreamCipher
A parent class for block cipher modes that do not require block aligned data to be processed, but can function in a streaming mode.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStreamBlockCipher(BlockCipher cipher)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract bytecalculateByte(byte b)BlockCiphergetUnderlyingCipher()return the underlying block cipher that we are wrapping.intprocessBytes(byte[] in, int inOff, int len, byte[] out, int outOff)process a block of bytes from in putting the result into out.bytereturnByte(byte in)encrypt/decrypt a single byte returning the result.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bouncycastle.crypto.BlockCipher
getAlgorithmName, getBlockSize, init, processBlock, reset
-
Methods inherited from interface org.bouncycastle.crypto.StreamCipher
getAlgorithmName, init, reset
-
-
-
-
Constructor Detail
-
StreamBlockCipher
protected StreamBlockCipher(BlockCipher cipher)
-
-
Method Detail
-
getUnderlyingCipher
public BlockCipher getUnderlyingCipher()
return the underlying block cipher that we are wrapping.- Returns:
- the underlying block cipher that we are wrapping.
-
returnByte
public final byte returnByte(byte in)
Description copied from interface:StreamCipherencrypt/decrypt a single byte returning the result.- Specified by:
returnBytein interfaceStreamCipher- Parameters:
in- the byte to be processed.- Returns:
- the result of processing the input byte.
-
processBytes
public int processBytes(byte[] in, int inOff, int len, byte[] out, int outOff) throws DataLengthExceptionDescription copied from interface:StreamCipherprocess a block of bytes from in putting the result into out.- Specified by:
processBytesin interfaceStreamCipher- Parameters:
in- the input byte array.inOff- the offset into the in array where the data to be processed starts.len- the number of bytes to be processed.out- the output buffer the processed bytes go into.outOff- the offset into the output byte array the processed data starts at.- Returns:
- the number of bytes produced - should always be len.
- Throws:
DataLengthException- if the output buffer is too small.
-
calculateByte
protected abstract byte calculateByte(byte b)
-
-