abstract class FeedbackMode extends Mode implements FeedbackCipher, SymmetricCipher
It is internal to Cryptix, and not intended to be used directly by applications.
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.5 $
Modifier and Type | Field and Description |
---|---|
protected int |
currentByte
Index into the ivBlock.
|
protected byte[] |
ivBlock
Value of the current feedback register/queue/buffer.
|
protected byte[] |
ivStart
Value of the IV at initialisation phase as supplied by user.
|
protected int |
length
Size of the feedback register/queue/buffer.
|
DECRYPT, ENCRYPT, UNINITIALIZED
Modifier | Constructor and Description |
---|---|
protected |
FeedbackMode(boolean implBuffering,
boolean implPadding,
java.lang.String provider)
Constructor for a Mode.
|
Modifier and Type | Method and Description |
---|---|
protected void |
engineSetCipher(Cipher cipher)
SPI: Sets the underlying cipher.
|
byte[] |
getInitializationVector()
Gets a copy of the starting initialization vector.
|
int |
getInitializationVectorLength()
Returns the size of the initialization vector expected by
setInitializationVector . |
void |
setInitializationVector(byte[] iv)
Sets the initialization vector.
|
engineGetParameter, engineSetParameter, getAlgorithms, getAlgorithms, getInstance, getInstance, toString
blockSize, clone, crypt, crypt, crypt, doFinal, doFinal, doFinal, doFinal, engineBlockSize, engineCiphertextBlockSize, engineCrypt, engineInBufferSize, engineInitDecrypt, engineInitEncrypt, engineOutBufferSize, enginePlaintextBlockSize, engineSetPaddingScheme, engineUpdate, getAlgorithm, getCiphertextBlockSize, getInputBlockSize, getInstance, getMode, getOutputBlockSize, getPadding, getPaddingScheme, getParameter, getPlaintextBlockSize, getProvider, getState, inBufferSize, inBufferSizeFinal, initDecrypt, initEncrypt, isPaddingBlockCipher, outBufferSize, outBufferSizeFinal, setParameter, update, update, update, update
protected byte[] ivBlock
protected byte[] ivStart
protected int currentByte
protected int length
protected FeedbackMode(boolean implBuffering, boolean implPadding, java.lang.String provider)
Cipher.getInstance
factory methods instead.implBuffering
- if true, this argument indicates that data
will be passed from update/crypt to
engineUpdate/engineCrypt without modification.implPadding
- if true, this argument indicates that the
implementation can perform padding, and that
the engineCrypt method will be called when
padding is required.provider
- the name of the provider of the underlying
cryptographic engine.java.lang.NullPointerException
- if provider == nullprotected void engineSetCipher(Cipher cipher)
For example, to create an IDEA cipher in CBC mode, the cipher for "IDEA" would be passed to the mode for "CBC" using this method. It is called once, immediately after the mode object is constructed.
Subclasses that override this method (to do initialization that
depends on the cipher being set) should call
super.engineSetCipher(cipher)
first.
engineSetCipher
in class Mode
cipher
- the underlying cipher objectjava.lang.NullPointerException
- if cipher == nullpublic void setInitializationVector(byte[] iv) throws java.security.InvalidParameterException
Note: in JavaSoft's version of JCE, this method may only be
called when the cipher is in the UNINITIALIZED
state.
In IJCE that is relaxed to also allow it to be called after
initEncrypt
/initDecrypt
, but before the
first call to update
or crypt
, provided
that the IV is not set twice.
setInitializationVector
in interface FeedbackCipher
iv
- the initialization vector.java.security.InvalidParameterException
- if the initialization vector
is of the wrong length or has already been set.public byte[] getInitializationVector()
getInitializationVector
in interface FeedbackCipher
public int getInitializationVectorLength()
setInitializationVector
. For this class, that is
the block size of the underlying cipher.getInitializationVectorLength
in interface FeedbackCipher
setInitializationVector
.