org.logi.crypto.protocols
Class EncryptedKeyExServer

java.lang.Object
  |
  +--org.logi.crypto.Crypto
        |
        +--org.logi.crypto.protocols.EncryptedKeyExServer
All Implemented Interfaces:
InterKeyExServer, InterProtocolServer, NoninterKeyExServer, NoninterProtocolServer

public class EncryptedKeyExServer
extends Crypto
implements NoninterKeyExServer

Receive an encrypted key from the correstponding EncryptedKeyExClient and optionally check a signature.

This is a non-interactive protocol and the client sends one message to the server containing E(K) and optionally S(H(E(K)))). E is encryption with a CipherKey, S is signing with a Signature key, both set when the object is created. H is the default hash-function, which will be SHA1 unless changed.

If the key-exchange is performed with a public-key cryptosystem you will almost certainly want to authenticate the client in some way, such as by having him sign the session key.

In the case where a symmetric cipher is used for key-exchange and no signatures are used, attacks on the system, such as modified or dropped packages, etc., will be difficult to distinguish from transmission errors.

Author:
Logi Ragnarsson (logir@logi.org)

Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
EncryptedKeyExServer(DecryptionKey decryptKey)
          Creates a new EncryptedKeyExchangeServer object.
EncryptedKeyExServer(DecryptionKey key, VerificationKey verifyKey)
          Creates a new EncryptedKeyExchangeServer object.
 
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)
          Get the next message 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, 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
 

Constructor Detail

EncryptedKeyExServer

public EncryptedKeyExServer(DecryptionKey key,
                            VerificationKey verifyKey)
Creates a new EncryptedKeyExchangeServer object. It uses key to decrypt the session key sent to it by the client.

If verifyKey is not null, a signature is expected to accompany the session key. If none is found, it will be treated as if a signature was not verified.


EncryptedKeyExServer

public EncryptedKeyExServer(DecryptionKey decryptKey)
Creates a new EncryptedKeyExchangeServer object. It uses key to decrypt the session key sent to it by the client.
Method Detail

sessionKey

public Key sessionKey()
Returns the key if it has been decided upon, or null otherwise.
Specified by:
sessionKey in interface InterKeyExServer

completed

public boolean completed()
Returns true iff this end of the protocol i completed.
Specified by:
completed in interface InterProtocolServer

maxMessageSize

public int maxMessageSize()
Returns the maximum expected size of a message for this protocol.
Specified by:
maxMessageSize in interface InterProtocolServer

message

public byte[] message(byte[] received)
               throws CryptoProtocolException
Get the next message in the protocol.

process one message from the client. Since this protocol only requires a single message to be sent from the client to the server with no answer, the message method returns null and can be called independently, any number of times.

Specified by:
message in interface InterProtocolServer
Throws:
CryptoProtocolException - if a problem arises with the protocol.


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