com.dyuproject.util
Class DiffieHellman

java.lang.Object
  extended by com.dyuproject.util.DiffieHellman

public class DiffieHellman
extends Object

Diffie-Hellman key exchange is a cryptographic protocol that allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure communications channel.

Author:
David Yu

Field Summary
static DiffieHellman BASE_2
           
static DiffieHellman BASE_5
           
 
Method Summary
 BigInteger generatePublicKey(BigInteger privateKey, BigInteger modulus)
           
 BigInteger[] generateRandomKeys(BigInteger modulus)
           
static BigInteger getSharedSecretKey(BigInteger privateKey, BigInteger modulus, BigInteger responseKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_2

public static final DiffieHellman BASE_2

BASE_5

public static final DiffieHellman BASE_5
Method Detail

generateRandomKeys

public BigInteger[] generateRandomKeys(BigInteger modulus)
Parameters:
modulus -
Returns:
BigInteger array. Element 0 is privateKey. Element 1 is publicKey.

generatePublicKey

public BigInteger generatePublicKey(BigInteger privateKey,
                                    BigInteger modulus)

getSharedSecretKey

public static BigInteger getSharedSecretKey(BigInteger privateKey,
                                            BigInteger modulus,
                                            BigInteger responseKey)


Copyright © 2013. All Rights Reserved.