org.logi.crypto.protocols
Class DHKeyEx

java.lang.Object
  extended byorg.logi.crypto.Crypto
      extended byorg.logi.crypto.protocols.DHKeyEx
Direct Known Subclasses:
DHKeyExClient, DHKeyExNoninter, DHKeyExServer

public class DHKeyEx
extends Crypto

Ancestor of Diffie-Hellman key exchange objects


Field Summary
protected  java.math.BigInteger g
           
protected  java.math.BigInteger hisPublic
           
protected  boolean keyDecided
           
protected  java.math.BigInteger m
           
protected  java.math.BigInteger myPrivate
           
protected  java.math.BigInteger myPublic
           
protected  Key sessionKey
           
 
Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
protected DHKeyEx(DHKey pri, java.lang.String keyType)
          Create a new DHKeyEx object which uses the private DH key from pri.
protected DHKeyEx(int n, java.lang.String keyType)
          Create a new DHKeyEx object which uses an n bit modulus and the named key type.
 
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.
 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
 

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

hisPublic

protected java.math.BigInteger hisPublic

keyDecided

protected boolean keyDecided

sessionKey

protected Key sessionKey
Constructor Detail

DHKeyEx

protected DHKeyEx(DHKey pri,
                  java.lang.String keyType)
           throws KeyException
Create a new DHKeyEx object which uses the private DH key from pri.

Throws:
KeyException - if the key is not private.

DHKeyEx

protected DHKeyEx(int n,
                  java.lang.String keyType)
Create a new DHKeyEx object which uses an n bit modulus and the named key type.

There are pre-computed public modulus and gnerator pairs for values these of n: 256, 512, 1024 usig these values speeds things up significantly. (I am calcualting the values for 2048)

Method Detail

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.