Class CipherStreamServer


public class CipherStreamServer
extends CipherStream

This class can be used to apply an interactive key exchange protocol to a pair of streams and then encrypt all data going through them with the session key exchanged.

It can also execute interactive protocols on the streams once they are initialized.

This class expects to talk to an equivalent client class.

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
CipherStreamServer( in, out, InterKeyExServer kex, EncryptMode encrypt, DecryptMode decrypt)
          Create a new CipherStreamServer object and ecxhange keys.
Method Summary
 void execute(InterProtocolServer prot)
          Executes an interactive protocol.
Methods inherited from class
getDecryptKey, getEncryptKey, getInputStream, getOutputStream
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 CipherStreamServer( in,
                          InterKeyExServer kex,
                          EncryptMode encrypt,
                          DecryptMode decrypt)
                   throws CryptoProtocolException,
Create a new CipherStreamServer object and ecxhange keys.

Create a new object which uses kex to exchange keys with a remote client and then encrypt to encrypt the data to out and decrypt to decrypt data from in and out.

if kex==null then the key-exchange step is skipped and the encrypt and decrypt objects must have been initialized with a key beforethis call.

CryptoProtocolException - if there is a problem exchanging keys. - if there is a problem with the underlying streams.
Method Detail


public void execute(InterProtocolServer prot)
Executes an interactive protocol. If the encrypt/decrypt mode objects have been initialized with a session key, such as by executing a key-exchange protocol in the constructor, then the protocol will be executed through the encrypted link.
CryptoProtocolException - if there is a problem with the protocol keys. - if there is a problem with the underlying streams.

Copyright 1997-2000 Logi Ragnarsson