Class cryptix.security.CipherFeedback
All Packages Class Hierarchy This Package Previous Next Index
Class cryptix.security.CipherFeedback
java.lang.Object
|
+----cryptix.security.StreamCipher
|
+----cryptix.security.CipherFeedback
- public class CipherFeedback
- extends StreamCipher
Implements a byte-based stream cipher using n-bit CFB with an
n-bit-sized block cipher.
The full block size of the supplied cipher is used for the
Cipher Feedback Mode.
The bytes supplied are processed and returned immediately.
Note that this is Variant A.
It needs to be rationalised with #CFB
References
See also:
Schneier, B., Applied Cryptography, Wiley, 1996, 2nd Ed.
Copyright © 1995, 1996, 1997
Systemics Ltd
on behalf of the
Cryptix Development Team.
All rights reserved.
- Author:
- Systemics Ltd
- See Also:
- StreamCipher
-
cipher
-
-
currentByte
-
-
ivBlock
-
-
length
-
-
xorBlock
-
-
CipherFeedback(BlockCipher, byte[])
- This implements variant A: a unique initial value for the
feedback register must be provided in the constructor.
-
decrypt(byte[], int, byte[], int, int)
- This function decrypts a block of data.
-
encrypt(byte[], int, byte[], int, int)
- This function encrypts a block of data.
-
keyLength()
- This function returns the length of the key for this cipher.
-
reset(byte[])
- Reset the stream feedback register with a new unique IV
and sets position in stream back to zero.
ivBlock
protected byte ivBlock[]
xorBlock
protected byte xorBlock[]
cipher
protected BlockCipher cipher
currentByte
protected int currentByte
length
protected int length
CipherFeedback
public CipherFeedback(BlockCipher cipher0,
byte iv0[])
- This implements variant A: a unique initial value for the
feedback register must be provided in the constructor.
If the IV is not unique, the plaintext can be recovered.
- Parameters:
- cipher0 - the block cipher to use
- iv0 - the initial value for the shift register (IV)
keyLength
public int keyLength()
- This function returns the length of the key for this cipher.
- Overrides:
- keyLength in class StreamCipher
reset
public void reset(byte iv0[])
- Reset the stream feedback register with a new unique IV
and sets position in stream back to zero.
- Parameters:
- iv0 - the initial value for the shift register (IV)
encrypt
public void encrypt(byte in[],
int in_offset,
byte out[],
int out_offset,
int length)
- This function encrypts a block of data.
The contents of the array in will not be changed,
but will instead store the result in the array out.
The arrays can, however, be the same.
- Parameters:
- in - The plain text to be encrypted.
- in_offset - The offset within the in buffer.
- out - Where the encrypted cipher text will be stored.
- out_offset - The offset within the out buffer.
- length - The length to encrypt.
- Overrides:
- encrypt in class StreamCipher
decrypt
public void decrypt(byte in[],
int in_offset,
byte out[],
int out_offset,
int length)
- This function decrypts a block of data.
The contents of the array in will not be changed,
but will instead store the result in the array out.
The arrays can, however, be the same.
- Parameters:
- in - The cipher text to be decrypted.
- in_offset - The offset within the in buffer.
- out - Where the decrypted plain text will be stored.
- out_offset - The offset within the out buffer.
- length - The length to decrypt.
- Overrides:
- decrypt in class StreamCipher
All Packages Class Hierarchy This Package Previous Next Index