anon.crypto.tinytls.keyexchange
Class Key_Exchange

java.lang.Object
  extended by anon.crypto.tinytls.keyexchange.Key_Exchange
Direct Known Subclasses:
DHE_DSS_Key_Exchange, DHE_RSA_Key_Exchange

public abstract class Key_Exchange
extends java.lang.Object

Author:
stefan Abstract Class which is performs the key exchange

Constructor Summary
Key_Exchange()
          Constructor
 
Method Summary
abstract  byte[] calculateClientFinished(byte[] handshakemessages)
          generate the client finished message (see RFC2246)
abstract  byte[] calculateClientKeyExchange()
          generates the client key exchange message (see RFC2246)
abstract  byte[] calculateKeys()
          calculates the key material (see RFC2246 TLS Record Protocoll)
abstract  byte[] calculateServerFinished(byte[] handshakemessages)
          calculates server finished message
abstract  byte[] generateServerKeyExchange(IMyPrivateKey key, byte[] clientrandom, byte[] serverrandom)
           
abstract  void processClientFinished(byte[] verify_data, byte[] handshakemessages)
          checks the client finished message
abstract  void processClientKeyExchange(java.math.BigInteger dh_y)
          processes the client key exchange
abstract  void processServerFinished(byte[] b, int len, byte[] handshakemessages)
          checks the server finished message
abstract  void processServerKeyExchange(byte[] b, int b_offset, int b_len, byte[] clientrandom, byte[] serverrandom, JAPCertificate cert)
          Decode the server keys and check the certificate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Key_Exchange

public Key_Exchange()
Constructor

Method Detail

generateServerKeyExchange

public abstract byte[] generateServerKeyExchange(IMyPrivateKey key,
                                                 byte[] clientrandom,
                                                 byte[] serverrandom)
                                          throws TLSException
Throws:
TLSException

processServerKeyExchange

public abstract void processServerKeyExchange(byte[] b,
                                              int b_offset,
                                              int b_len,
                                              byte[] clientrandom,
                                              byte[] serverrandom,
                                              JAPCertificate cert)
                                       throws TLSException
Decode the server keys and check the certificate

Parameters:
bytes - server keys
clientrandom - clientrandom
serverrandom - serverrandom
servercertificate - servercertificate
Throws:
TLSException

calculateServerFinished

public abstract byte[] calculateServerFinished(byte[] handshakemessages)
calculates server finished message

Parameters:
handshakemessages - handshakemessages
Returns:
server finished message

processServerFinished

public abstract void processServerFinished(byte[] b,
                                           int len,
                                           byte[] handshakemessages)
                                    throws TLSException
checks the server finished message

Parameters:
b - server finished message
Throws:
TLSException

processClientKeyExchange

public abstract void processClientKeyExchange(java.math.BigInteger dh_y)
processes the client key exchange

Parameters:
dh_y - diffie hellman parameter

calculateClientKeyExchange

public abstract byte[] calculateClientKeyExchange()
                                           throws TLSException
generates the client key exchange message (see RFC2246)

Returns:
client key exchange message
Throws:
TLSException

processClientFinished

public abstract void processClientFinished(byte[] verify_data,
                                           byte[] handshakemessages)
                                    throws TLSException
checks the client finished message

Parameters:
verify_data - verify data
handshakemessages - handshakemessages
Throws:
TLSException

calculateClientFinished

public abstract byte[] calculateClientFinished(byte[] handshakemessages)
                                        throws TLSException
generate the client finished message (see RFC2246)

Parameters:
handshakemessages - all handshakemessages that have been send before this
Returns:
client finished message
Throws:
TLSException

calculateKeys

public abstract byte[] calculateKeys()
calculates the key material (see RFC2246 TLS Record Protocoll)

Returns:
key material