com.dyuproject.util
Class DiffieHellman
java.lang.Object
com.dyuproject.util.DiffieHellman
public final 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
- Date created:
- Sep 7, 2008
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BASE_2
public static final DiffieHellman BASE_2
BASE_5
public static final DiffieHellman BASE_5
DiffieHellman
public DiffieHellman(BigInteger base)
generateRandomKeys
public BigInteger[] generateRandomKeys(BigInteger modulus)
- Generates a random private Key (element 0) and a random public key (element 1)
from the given
modulus
.
- Parameters:
modulus
-
- Returns:
- BigInteger array. Element 0 is privateKey. Element 1 is publicKey.
generatePublicKey
public BigInteger generatePublicKey(BigInteger privateKey,
BigInteger modulus)
- Generates a public key from the given
privateKey
and modulus
.
getSharedSecretKey
public static BigInteger getSharedSecretKey(BigInteger privateKey,
BigInteger modulus,
BigInteger responseKey)
- Gets/computes the shared secret key from the given
privateKey
,
modulus
and responseKey
- which is a public key.
Copyright © 2008-2013. All Rights Reserved.