org.logi.crypto.io
Class CipherStream

java.lang.Object
  |
  +--org.logi.crypto.Crypto
        |
        +--org.logi.crypto.io.CipherStream
Direct Known Subclasses:
CipherStreamClient, CipherStreamServer

public class CipherStream
extends Crypto

Parent of CipherStreamClient and CipherStreamServer.

Author:
Logi Ragnarsson (logir@logi.org)
See Also:
CipherStreamServer, CipherStreamClient

Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
CipherStream()
           
 
Method Summary
 void close()
          Closes all streams and releases their resources.
 EncryptionKey getDecryptKey()
          Get the key used for decryption.
 EncryptionKey getEncryptKey()
          Get the key used for encryption.
 DecryptStream getInputStream()
          Get the encrypted input-stream.
 EncryptStream getOutputStream()
          Get the encrypted output-stream.
 void setDecryptKey(CipherKey key)
          Re-key the DecryptSession used by this DecryptStream.
 void setEncryptKey(CipherKey key)
          Re-key the EncryptSession used by this CipherStream.
 
Methods inherited from class org.logi.crypto.Crypto
binString, binString, ensureArrayLength, ensureArrayLength, equal, equalRelaxed, equalSub, fromHexNibble, fromHexString, fromString, fromString, hexString, hexString, hexString, hexString, hexString, initRandom, initRandom, makeClass, makeInt, makeLong, makeSessionKey, pastSpace, pickBits, pickBits, prettyPrint, prettyPrint, readBlock, readInt, trimArrayLength, trimArrayLength, trimLeadingZeroes, writeBytes, writeBytes, writeInt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CipherStream

public CipherStream()
Method Detail

getInputStream

public DecryptStream getInputStream()
Get the encrypted input-stream.

getEncryptKey

public EncryptionKey getEncryptKey()
Get the key used for encryption.

setEncryptKey

public void setEncryptKey(CipherKey key)
                   throws java.io.IOException,
                          CryptoException
Re-key the EncryptSession used by this CipherStream. This induces a flush of the outgoing stream.
Throws:
java.io.IOException - if there is a low-level problem.
CryptoException - if the internal buffer in the EncryptSession is not empty.

getOutputStream

public EncryptStream getOutputStream()
Get the encrypted output-stream.

getDecryptKey

public EncryptionKey getDecryptKey()
Get the key used for decryption.

setDecryptKey

public void setDecryptKey(CipherKey key)
                   throws CryptoException
Re-key the DecryptSession used by this DecryptStream. This causes the incoming stream to be drained.
Throws:
CryptoException - if the internal buffer in the DecryptSession is not empty.

close

public void close()
           throws java.io.IOException
Closes all streams and releases their resources.
Throws:
java.io.IOException - if one of the underlying objects refuse to be closed.


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