All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----is.hi.logir.cryptonite.Cryptonite | +----is.hi.logir.cryptonite.EncryptMode | +----is.hi.logir.cryptonite.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 actual time spent on encryption).
However, since
P = C ^ S, (with plaintext P, ciphertext C and xor-stream 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 wil not be able to tell directly what the plaintext is or control what P' is.
key
.
length
bytes from source
,
starting at i
and return the ciphertext.
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)
length
bytes from source
,
starting at i
and return the ciphertext. All data
is encrypted immediately.
All Packages Class Hierarchy This Package Previous Next Index