Class ClientServer


public class ClientServer
extends Crypto

This application launches multiple client threads connecting to a server thread, using key-exchange and encryption in OFB mode.

This makes use of the EncryptStream DecryptStream, EncryptOFB, DecryptOFB, TriDES, EncryptedKeyExClient, EncryptedKeyExServer, DHKeyExClient, DHKeyExServer, DHEKEKeyExClient and DHEKEKeyExClient classes.

10 client threads are created which each repeatedly connects to the main server thread. The main server thread spawns a sub-thread for each connection. Each client thread negotiates a TriDES session key with its corresponding server thread either the Diffie-Hellman protocol, the Diffie-Hellman EKE protocol or by recieving an encrypted key from the server. The client then uses this key in OFB mode to send a number to the server thread and recieve the square of the number. The result is then printed to the screen. Ocasionally a new key will be negotiated and the mode classes rekeyed.

Since each EncryptOFB and DecryptOFB object launches a thread to pre-calculate an xor-stream, more than 60 threads are created to perform the calculations.

Logi Ragnarsson (
See Also:
EncryptMode, CipherKey, InterKeyExClient

Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
Method Summary
static void main(java.lang.String[] arg)
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

Method Detail


public static void main(java.lang.String[] arg)

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