cryptix.provider.mode
Class CFB_PGP
java.lang.Object
|
+--xjava.security.IJCE_Traceable
|
+--xjava.security.Cipher
|
+--xjava.security.Mode
|
+--cryptix.provider.mode.FeedbackMode
|
+--cryptix.provider.mode.CFB
|
+--cryptix.provider.mode.CFB_PGP
- All Implemented Interfaces:
- FeedbackCipher, Parameterized, SymmetricCipher
- public class CFB_PGP
- extends CFB
Use of this feedback mode is deprecated, use it for compatibility only!
This class implements PGP's (i.e. Zimmerman's) non-standard CFB mode.
(For the standard method, see the Applied Cryptography reference below).
It replaces cryptix.pgp.CFB in version 2.2, and
cryptix.pgp.PGP_CFB in version Cryptix 2.2.0a.
The differences between this and standard CFB are that:
- The IV passed to the underlying CFB class is always zero.
An additional IV should be included as the first block of
the input stream (when encrypting), and this additional IV
should be unique.
- Before each encryption or decryption operation (i.e. each
call to
update
or crypt
), the CFB
shift register is encrypted, regardless of the current position
within a block.
Note that it is unusual for the output of a cipher to depend on
the exact boundaries between data passed to each encryption/decryption
call. Normally, the lengths of data passed to each call do not matter
as long as they make up the correct input when concatenated together -
but this class is an exception.
As a result, using this mode with CipherInputStream and CipherOutputStream
may produce unexpected output, and is not recommended.
References
- Bruce Schneier,
"Section 9.6 Cipher Feedback Mode,"
Applied Cryptography, 2nd edition,
John Wiley & Sons, 1996
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.9 $
- Since:
- Cryptix 2.2.2
- Author:
- Systemics Ltd, Raif Naffah, David Hopwood
Fields inherited from class xjava.security.Mode |
cipher |
Constructor Summary |
CFB_PGP()
Constructs a CFB-PGP cipher, assuming that the IV will be provided
as the first getInitializationVectorLength()
bytes of the stream (it will be visible as cleartext at the start
of the output stream).
|
CFB_PGP(Cipher cipher)
Constructs a CFB-PGP cipher, assuming that the IV will be provided
as the first getInitializationVectorLength()
bytes of the stream. |
Method Summary |
protected int |
engineUpdate(byte[] in,
int inOffset,
int inLen,
byte[] out,
int outOffset)
SPI: This is the main engine method for updating data.
|
Methods inherited from class xjava.security.Cipher |
blockSize, clone, crypt, crypt, crypt, doFinal, doFinal, doFinal, doFinal, engineCiphertextBlockSize, engineCrypt, engineInBufferSize, engineOutBufferSize, enginePlaintextBlockSize, engineSetPaddingScheme, getAlgorithm, getCiphertextBlockSize, getInputBlockSize, getInstance, getMode, getOutputBlockSize, getPadding, getPaddingScheme, getParameter, getPlaintextBlockSize, getProvider, getState, inBufferSize, inBufferSizeFinal, initDecrypt, initEncrypt, isPaddingBlockCipher, outBufferSize, outBufferSizeFinal, setParameter, update, update, update, update |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
CFB_PGP
public CFB_PGP()
- Constructs a CFB-PGP cipher, assuming that the IV will be provided
as the first
getInitializationVectorLength()
bytes of the stream (it will be visible as cleartext at the start
of the output stream).
The IV must be unique during the lifetime of the key.
If it is not unique, at least the first block
of the plaintext can be recovered.
CFB_PGP
public CFB_PGP(Cipher cipher)
- Constructs a CFB-PGP cipher, assuming that the IV will be provided
as the first
getInitializationVectorLength()
bytes of the stream. See the previous constructor for more details.
- Throws:
NullPointerException
- if cipher == nullIllegalBlockSizeException
- if cipher.getPlaintextBlockSize() !=
cipher.getCiphertextBlockSize()
engineUpdate
protected int engineUpdate(byte[] in,
int inOffset,
int inLen,
byte[] out,
int outOffset)
- Description copied from class:
CFB
- SPI: This is the main engine method for updating data.
It may be called with any size of input.
in
and out
may be the same array, and the
input and output regions may overlap.
- Overrides:
engineUpdate
in class CFB
- Following copied from class:
cryptix.provider.mode.CFB
- Parameters:
in
- the input data.inOffset
- the offset into in
specifying where
the data starts.inLen
- the length of the subarray.out
- the output array.outOffset
- the offset indicating where to start writing into
the out
array.- Returns:
- the number of bytes written.