All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----is.logi.crypto.Crypto | +----is.logi.crypto.modes.EncryptMode | +----is.logi.crypto.modes.EncryptOFB
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.
key
.
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.
public CipherKey getKey()
public synchronized void setKey(CipherKey key)
public synchronized byte[] flush()
public synchronized byte[] encrypt(byte source[], int i, int length)
Encrypt length
bytes from source
,
starting at i
and return the ciphertext.
All Packages Class Hierarchy This Package Previous Next Index