Class DecryptMode

Direct Known Subclasses:
DecryptCBC, DecryptCFB, DecryptECB, DecryptOFB

public abstract class DecryptMode
extends Crypto

DecryptMode objects are used to decrypt ciphertext generated with a correpsonding EncryptMode object. They must in most cases be initialized with the appropriate key.

Logi Ragnarsson (
See Also:

Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
Constructor Summary
Method Summary
 void close()
          Close files and kill threads owned by the object.
abstract  byte[] decrypt(byte[] source, int i, int length)
          Send bytes to the DecryptMode for decryption.
 void finalize()
          This finalizer calls close().
abstract  CipherKey getKey()
          Return the key used for decryption.
abstract  int plainBlockSize()
          Return the size of the blocks of plaintext output by this object.
abstract  void setKey(CipherKey key)
          Set the key to use for decryption.
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DecryptMode()
Method Detail


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


public abstract 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.


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


public abstract byte[] decrypt(byte[] source,
                               int i,
                               int length)
Send bytes to the DecryptMode for decryption.

Decrypt length bytes from source, starting at i and return the plaintext. Data may be encrypted in blocks in which case only whole blocks of plaintext are written to dest. Any remaining data will be stored and prepended to source in the next call to decrypt.


public void close()
Close files and kill threads owned by the object. This should be called to make sure all resources are freed.


public void finalize()
This finalizer calls close(). Note, however, that java offers no guarantee that the finalizer is ever called.

Copyright 1997-2000 Logi Ragnarsson