org.logi.crypto.protocols
Class DHEKEKeyExServer

java.lang.Object
  extended byorg.logi.crypto.Crypto
      extended byorg.logi.crypto.protocols.DHEKEKeyEx
          extended byorg.logi.crypto.protocols.DHEKEKeyExServer
All Implemented Interfaces:
InterAuthServer, InterKeyExServer, InterProtocolServer

public class DHEKEKeyExServer
extends org.logi.crypto.protocols.DHEKEKeyEx
implements InterKeyExServer, InterAuthServer

Diffie-Hellman EKE key exchange and authentication server. It expects to talk to a DHEKEKeyExClient object.

See Also:
DHEKEKeyExClient

Field Summary
protected  int cbs
           
protected  boolean completed
           
protected  java.math.BigInteger g
           
protected  java.math.BigInteger m
           
protected  java.math.BigInteger myPrivate
           
protected  java.math.BigInteger myPublic
           
protected  byte[] myRandom
           
protected  int pbs
           
protected  CipherKey secretKey
           
protected  CipherKey sessionKey
           
 
Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
DHEKEKeyExServer(int n, java.lang.String keyType, CipherKey secretKey)
          Create a new DHEKEKeyExClient object which uses an n bit modulus, the named key type and the specified secret key.
 
Method Summary
 boolean completed()
          Returns true iff this end of the protocol i completed.
 int maxMessageSize()
          Returns the maximum expected size of a message for this protocol.
 byte[] message(byte[] received)
          If the key has not been decided upon and received is the last message received from the other end, message(received) returns the message to send the other end as the next step in the protocol.
 Key sessionKey()
          Returns the key if it has been decided upon, or null otherwise.
 
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
 
Methods inherited from interface org.logi.crypto.protocols.InterKeyExServer
sessionKey
 
Methods inherited from interface org.logi.crypto.protocols.InterProtocolServer
completed, maxMessageSize
 

Field Detail

m

protected java.math.BigInteger m

g

protected java.math.BigInteger g

myPrivate

protected java.math.BigInteger myPrivate

myPublic

protected java.math.BigInteger myPublic

myRandom

protected byte[] myRandom

secretKey

protected CipherKey secretKey

completed

protected boolean completed

sessionKey

protected CipherKey sessionKey

pbs

protected int pbs

cbs

protected int cbs
Constructor Detail

DHEKEKeyExServer

public DHEKEKeyExServer(int n,
                        java.lang.String keyType,
                        CipherKey secretKey)
Create a new DHEKEKeyExClient object which uses an n bit modulus, the named key type and the specified secret key.

There are pre-computed public modulus and gnerator pairs for these values of n: 256, 512, 1024, 2048. Using one of these values saves you from a rather long wait.

Method Detail

message

public byte[] message(byte[] received)
               throws CryptoProtocolException
If the key has not been decided upon and received is the last message received from the other end, message(received) returns the message to send the other end as the next step in the protocol.

Specified by:
message in interface InterProtocolServer
Throws:
CryptoProtocolException - if a malformed message is received.
ValidationException - if validation fails.

sessionKey

public Key sessionKey()
Returns the key if it has been decided upon, or null otherwise.


completed

public boolean completed()
Returns true iff this end of the protocol i completed.


maxMessageSize

public int maxMessageSize()
Returns the maximum expected size of a message for this protocol.