|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.logi.crypto.Crypto | +--org.logi.crypto.modes.EncryptMode | +--org.logi.crypto.modes.EncryptOFB
Output Fedback Mode iterates the encryption routine on the IV and xors the resulting stream with the plaintext to produce the ciphertext.
This is as fast as ECB or CBC mode, but has the streaming properties of CFB mode. In addition, the stream xored with the plaintext is precalculated in a separate thread, to give better response (although this does not not lower the total time spent calculating).
However, since (with plaintext P, ciphertext C and xor-stream S)
P = C ^ S,
the opponent can alter the plaintext received by changing
C' = C ^ A,
so that
P' = C' ^ S = C ^ A ^ S = P ^ A
is seen. But the opponent will not be able to learn P or control what P' is.
DecryptOFB
Fields inherited from class org.logi.crypto.Crypto |
BIT,
cdsPath,
EMPTY_ARRAY,
FOUR,
keySource,
NIBBLE,
ONE,
primeCertainty,
random,
TWO,
ZERO |
Constructor Summary | |
EncryptOFB(CipherKey key,
int bufSize)
Create a new OFB-mode encrypt session with the specified key . |
|
EncryptOFB(int bufSize)
Create a new OFB-mode encrypt session with no key. |
Method Summary | |
void |
close()
Close files and kill threads owned by the object. |
byte[] |
encrypt(byte[] source,
int i,
int length)
Send bytes to the EncryptOFB object for encryption. |
byte[] |
flush()
Pads the internal buffer, encrypts it and returns the ciphertext. |
CipherKey |
getKey()
Return the key used for encryption. |
int |
plainBlockSize()
Return the size of the blocks of plaintext encrypted by this object. |
void |
setKey(CipherKey key)
Set the key to use for encryption. |
Methods inherited from class org.logi.crypto.modes.EncryptMode |
finalize,
flush |
Methods inherited from class org.logi.crypto.Crypto |
binString,
binString,
equal,
equalRelaxed,
equalSub,
fromHexNibble,
fromHexString,
fromString,
fromString,
hexString,
hexString,
hexString,
hexString,
hexString,
initRandom,
initRandom,
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 |
Constructor Detail |
public EncryptOFB(CipherKey key, int bufSize)
key
. A buffer of bufSize
bytes is created
to hold a pre-calculated xor-stream.public EncryptOFB(int bufSize)
setKey()
method has been called.
A buffer of bufSize
bytes is created to hold a
pre-calculated xor-stream.
Method Detail |
public CipherKey getKey()
public void setKey(CipherKey key)
public int plainBlockSize()
public byte[] flush()
public byte[] encrypt(byte[] source, int i, int length)
Encrypt length
bytes from source
,
starting at i
and return the ciphertext.
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |