org.logi.crypto.io
Class CipherStreamServer
java.lang.Object
org.logi.crypto.Crypto
org.logi.crypto.io.CipherStream
org.logi.crypto.io.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.
- See Also:
CipherStreamClient
Fields inherited from class org.logi.crypto.Crypto |
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO |
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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CipherStreamServer
public CipherStreamServer(java.io.InputStream in,
java.io.OutputStream out,
InterKeyExServer kex,
EncryptMode encrypt,
DecryptMode decrypt)
throws CryptoProtocolException,
java.io.IOException
- 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.
- Throws:
CryptoProtocolException
- if there is a problem exchanging keys.
java.io.IOException
- if there is a problem with the underlying streams.
execute
public void execute(InterProtocolServer prot)
throws java.io.IOException,
CryptoProtocolException
- 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.
- Throws:
CryptoProtocolException
- if there is a problem with the protocol keys.
java.io.IOException
- if there is a problem with the underlying streams.