org.logi.crypto.protocols
Class DHKeyExNoninter

java.lang.Object
  |
  +--org.logi.crypto.Crypto
        |
        +--org.logi.crypto.protocols.DHKeyEx
              |
              +--org.logi.crypto.protocols.DHKeyExNoninter
All Implemented Interfaces:
InterKeyExClient, InterKeyExServer, InterProtocolClient, InterProtocolServer, NoninterKeyExClient, NoninterKeyExServer, NoninterProtocolClient, NoninterProtocolServer

public class DHKeyExNoninter
extends org.logi.crypto.protocols.DHKeyEx
implements NoninterKeyExClient, NoninterKeyExServer

Diffie-Hellman key exchange without exchanging keys. Both parties need to know the other party's public DHKey. No messages are sent in either direction, but a unique session key is created for each pair of Diffie-Hellman keys used.

This class is both the client and server for the protocol.

Author:
Logi Ragnarsson (logir@logi.org)
See Also:
DHKeyExServer, DHKeyExClient

Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
DHKeyExNoninter(DHPrivateKey pri, DHPublicKey pub, java.lang.String keyType)
          Create a new DHKeyExClient object which uses the private DH key from pri and the public DH key from pri to generate a session 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)
          Expects and sends null, since no messages are needed 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, 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
 
Methods inherited from interface org.logi.crypto.protocols.InterProtocolClient
completed, maxMessageSize
 
Methods inherited from interface org.logi.crypto.protocols.InterKeyExClient
sessionKey
 
Methods inherited from interface org.logi.crypto.protocols.InterProtocolServer
completed, maxMessageSize
 
Methods inherited from interface org.logi.crypto.protocols.InterKeyExServer
sessionKey
 

Constructor Detail

DHKeyExNoninter

public DHKeyExNoninter(DHPrivateKey pri,
                       DHPublicKey pub,
                       java.lang.String keyType)
                throws KeyException,
                       InvalidCDSException
Create a new DHKeyExClient object which uses the private DH key from pri and the public DH key from pri to generate a session key.
Throws:
KeyException - if the public/private flag of either key is wrong.
InvalidCDSException - if the session key object can not be created.
Method Detail

message

public byte[] message(byte[] received)
               throws CryptoProtocolException
Expects and sends null, since no messages are needed for this protocol.
Specified by:
message in interface InterProtocolClient
Throws:
CryptoProtocolException - if called with a parameter other than null.

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.


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