is.logi.crypto.modes
Class EncryptCFB
java.lang.Object
|
+--is.logi.crypto.Crypto
|
+--is.logi.crypto.modes.EncryptMode
|
+--is.logi.crypto.modes.EncryptCFB
- public class EncryptCFB
- extends EncryptMode
This class implements 8-bit Cipherblock FeedBack mode which encrypts
a whole block for each plaintext character. This makes it much slower
than ECB or CBC mode, but it can be used for streaming and no garbage
is ever inserted.
- Author:
- Logi Ragnarsson
(logir@hi.is)
- See Also:
DecryptCFB
Constructor Summary |
EncryptCFB()
Create a new CBF-mode encrypt session with no key. |
EncryptCFB(CipherKey key)
Create a new CBF-mode encrypt session with the specified key. |
Method Summary |
byte[] |
encrypt(byte[] source,
int i,
int length)
Send bytes to the EncryptCFB object for encryption.
|
byte[] |
flush()
Pads the internal buffer, encrypts it and returns the ciphertext.
|
CipherKey |
getKey()
Return the key used for encryption. |
void |
setKey(CipherKey key)
Set the key to use for encryption. |
Methods inherited from class is.logi.crypto.Crypto |
binString,
binString,
equal,
equalRelaxed,
equalSub,
fromHexNibble,
fromHexString,
fromString,
fromString,
hexString,
hexString,
hexString,
hexString,
makeClass,
makeInt,
makeLong,
makeSessionKey,
pastSpace,
pickBits,
pickBits,
readInt,
writeBytes,
writeBytes,
writeInt |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
EncryptCFB
public EncryptCFB(CipherKey key)
- Create a new CBF-mode encrypt session with the specified key.
EncryptCFB
public EncryptCFB()
- Create a new CBF-mode encrypt session with no key. No
encryption can be performed until the
setKey()
method has been called.
getKey
public CipherKey getKey()
- Return the key used for encryption.
- Overrides:
- getKey in class EncryptMode
setKey
public void setKey(CipherKey key)
- Set the key to use for encryption.
- Overrides:
- setKey in class EncryptMode
flush
public byte[] flush()
- Pads the internal buffer, encrypts it and returns the ciphertext.
Since CBF mode doesn't use an internal buffer, an empty array is
returned.
- Overrides:
- flush in class EncryptMode
encrypt
public byte[] encrypt(byte[] source,
int i,
int length)
- Send bytes to the EncryptCFB object for encryption.
Encrypt length
bytes from source
,
starting at i
and return the ciphertext.
- Overrides:
- encrypt in class EncryptMode
Copyright 1997-1999 Logi Ragnarsson