org.logi.crypto.modes
Class DecryptCFB

java.lang.Object
  extended byorg.logi.crypto.Crypto
      extended byorg.logi.crypto.modes.DecryptMode
          extended byorg.logi.crypto.modes.DecryptCFB

public class DecryptCFB
extends DecryptMode

Use this class to decrypt ciphertext generated by EncryptCFB.

Note that unlike ECB or CBC mode, CFB mode uses the same key to encrypt and decrypt, even with asymmetric ciphers.

See Also:
EncryptCFB

Field Summary
 
Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
DecryptCFB()
          Create a new CFB-mode decrypt session with no key.
DecryptCFB(CipherKey key)
          Create a new CFB-mode decrypt session with the specified key.
 
Method Summary
 byte[] decrypt(byte[] source, int i, int length)
          Send bytes to the DecryptCFB object for encryption.
 CipherKey getKey()
          Return the key used for decryption.
 int plainBlockSize()
          Return the size of the blocks of plaintext output by this object.
 void setKey(CipherKey key)
          Set the key to use for decryption.
 
Methods inherited from class org.logi.crypto.modes.DecryptMode
close, finalize
 
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, readBlock, readInt, writeBytes, writeBytes, writeInt
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecryptCFB

public DecryptCFB(CipherKey key)
Create a new CFB-mode decrypt session with the specified key.


DecryptCFB

public DecryptCFB()
Create a new CFB-mode decrypt session with no key. No decryption can be performed until a call to setKey() has been made.

Method Detail

getKey

public CipherKey getKey()
Return the key used for decryption.

Specified by:
getKey in class DecryptMode

setKey

public void setKey(CipherKey key)
Set the key to use for decryption. The key can only be set once in this version of the library. The 1.1.x and eventually 1.2.x series allows dynamic re-keying.

Specified by:
setKey in class DecryptMode

plainBlockSize

public int plainBlockSize()
Return the size of the blocks of plaintext output by this object.

Specified by:
plainBlockSize in class DecryptMode

decrypt

public byte[] decrypt(byte[] source,
                      int i,
                      int length)
Send bytes to the DecryptCFB object for encryption.

Decrypt length bytes from source, starting at i and return the plaintext.

Specified by:
decrypt in class DecryptMode