org.logi.crypto.modes
Interface DecryptSession

All Known Implementing Classes:
org.logi.crypto.modes.DecryptMode

public interface DecryptSession

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

Author:
Logi Ragnarsson (logir@logi.org)
See Also:
EncryptSession

Method Summary
 byte[] decrypt(byte[] source, int i, int length)
          Send bytes to the DecryptMode for decryption.
 byte[] flush()
          Flush any buffers internal to the DecryptSession object and releases any and all resources.
 byte[] flush(byte[] source, int i, int length)
          Decrypt the last part of ciphertext and return plaintext.
 DecryptionKey getKey()
          Return the key used for decryption.
 int plainBlockSize()
          Return the size of the blocks of plaintext output by this object.
 void setKey(DecryptionKey key)
          Set the key to use for encryption.
 

Method Detail

getKey

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

setKey

public void setKey(DecryptionKey key)
            throws CryptoException
Set the key to use for encryption. Do not call this method when there may be data in the internal buffer.
Throws:
CryptoException - if there is data in the internal buffer which should be encrypted with the old key.

plainBlockSize

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

decrypt

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


flush

public byte[] flush(byte[] source,
                    int i,
                    int length)
             throws CryptoException
Decrypt the last part of ciphertext and return plaintext. This will flush any buffers internal to the DecryptSession object and release any and all resources.

flush

public byte[] flush()
             throws CryptoException
Flush any buffers internal to the DecryptSession object and releases any and all resources.


Copyright (c) 1997-2001 Logi Ragnarsson - Distributed under the GPL