|
|||||||||
Home >> All >> cryptix >> jce >> provider >> [ cipher overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
cryptix.jce.provider.cipher
Class ModeCFB

java.lang.Objectcryptix.jce.provider.cipher.Mode
cryptix.jce.provider.cipher.ModeCFB
- Direct Known Subclasses:
- ModeOpenpgpCFB
- class ModeCFB
- extends Mode
- Version:
- $Revision: 1.5 $
Field Summary | |
protected int |
bufCount
How many bytes the buffer holds |
protected long |
byteCount
How many bytes we have processed. |
protected BlockCipher |
cipher
Underlying block cipher |
protected int |
CIPHER_BLOCK_SIZE
Block size of underlying cipher |
private boolean |
decrypt
Decrypt mode? |
private int |
feedbackSize
Feedback size in bytes. |
private byte[] |
iVec
IV. |
private byte[] |
keyStreamBuf
Key stream aka encrypted shift register. |
private int |
keyStreamPtr
Ptr to next usable byte in key stream buffer. |
private byte[] |
shiftReg
Shift register. |
private int |
shiftRegPtr
Where the next shifted-in byte will be put. |
Constructor Summary | |
(package private) |
ModeCFB(BlockCipher cipher)
Construct CFB mode with a feedback size equal to the block size of the underlying cipher. |
(package private) |
ModeCFB(BlockCipher cipher,
int feedbackSize)
Construct CFB mode with the given feedback size. |
Method Summary | |
(package private) byte[] |
coreGetIV()
|
(package private) int |
coreGetOutputSize(int inputLen)
|
(package private) java.security.spec.AlgorithmParameterSpec |
coreGetParamSpec()
|
(package private) void |
coreInit(boolean decrypt,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
|
(package private) int |
coreUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
|
private void |
crank()
Sync aka encrypt the shift register to yield the next block of key stream bytes. |
protected byte[] |
extractIV(java.security.spec.AlgorithmParameterSpec params)
|
protected byte[] |
generateIV()
|
(package private) int |
getBlockSize()
|
(package private) int |
getBufSize()
|
(package private) static Mode |
getInstance(java.lang.String mode,
BlockCipher cipher)
|
(package private) byte[] |
getIV()
|
(package private) int |
getOutputSize(int inputLen)
|
(package private) java.security.spec.AlgorithmParameterSpec |
getParamSpec()
|
(package private) void |
init(boolean decrypt,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
|
protected boolean |
needCrank()
Sync policy, can be overridden in subclasses. |
(package private) boolean |
needsPadding()
|
private void |
shiftInByte(byte b)
Shift a byte into the shift register and 'sync' (encrypt shift reg) if neccessary. |
(package private) int |
update(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
keyStreamBuf
private final byte[] keyStreamBuf
- Key stream aka encrypted shift register.
keyStreamPtr
private int keyStreamPtr
- Ptr to next usable byte in key stream buffer.
shiftReg
private final byte[] shiftReg
- Shift register. Implemented as a circular buffer.
shiftRegPtr
private int shiftRegPtr
- Where the next shifted-in byte will be put.
byteCount
protected long byteCount
- How many bytes we have processed. Used to determine when to 'sync'.
feedbackSize
private int feedbackSize
- Feedback size in bytes. Valid settings are between 1 and
the underlying cipher's blocksize inclusive.
decrypt
private boolean decrypt
- Decrypt mode?
iVec
private byte[] iVec
- IV.
cipher
protected final BlockCipher cipher
- Underlying block cipher
CIPHER_BLOCK_SIZE
protected final int CIPHER_BLOCK_SIZE
- Block size of underlying cipher
bufCount
protected int bufCount
- How many bytes the buffer holds
Constructor Detail |
ModeCFB
ModeCFB(BlockCipher cipher)
- Construct CFB mode with a feedback size equal to the block size of
the underlying cipher.
ModeCFB
ModeCFB(BlockCipher cipher, int feedbackSize) throws java.security.NoSuchAlgorithmException
- Construct CFB mode with the given feedback size. Feedback size must
be expressed in bits, be a multiple of 8, greater than 0 and smaller
than the underlying cipher's block size.
Method Detail |
shiftInByte
private void shiftInByte(byte b)
- Shift a byte into the shift register and 'sync' (encrypt shift reg) if
neccessary.
crank
private void crank()
- Sync aka encrypt the shift register to yield the next block of
key stream bytes.
needCrank
protected boolean needCrank()
- Sync policy, can be overridden in subclasses.
coreGetOutputSize
final int coreGetOutputSize(int inputLen)
- Specified by:
coreGetOutputSize
in classMode
coreInit
void coreInit(boolean decrypt, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
coreUpdate
int coreUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
- Specified by:
coreUpdate
in classMode
coreGetIV
final byte[] coreGetIV()
coreGetParamSpec
final java.security.spec.AlgorithmParameterSpec coreGetParamSpec()
- Specified by:
coreGetParamSpec
in classMode
needsPadding
final boolean needsPadding()
- Specified by:
needsPadding
in classMode
getInstance
static Mode getInstance(java.lang.String mode, BlockCipher cipher) throws java.security.NoSuchAlgorithmException
init
void init(boolean decrypt, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
getIV
final byte[] getIV()
getParamSpec
final java.security.spec.AlgorithmParameterSpec getParamSpec()
getOutputSize
final int getOutputSize(int inputLen)
getBlockSize
final int getBlockSize()
update
final int update(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
getBufSize
final int getBufSize()
generateIV
protected byte[] generateIV()
extractIV
protected final byte[] extractIV(java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidAlgorithmParameterException
|
|||||||||
Home >> All >> cryptix >> jce >> provider >> [ cipher overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |