org.apache.abdera.security.util
Class DHContext

java.lang.Object
  extended by org.apache.abdera.security.util.DHContext
All Implemented Interfaces:
Serializable, Cloneable

public class DHContext
extends Object
implements Cloneable, Serializable

Implements the Diffie-Hellman Key Exchange details for both parties Party A: DHContext context_a = new DHContext(); String req = context_a.getRequestString(); Party B: DHContext context_b = new DHContext(req); EncryptionOptions options = context_b.getEncryptionOptions(enc); // encrypt String ret = context_b.getResponseString(); Party A: context_a.setPublicKey(ret); EncryptionOptions options = context_a.getEncryptionOptions(enc); // decrypt

See Also:
Serialized Form

Constructor Summary
DHContext()
           
DHContext(String dh)
           
 
Method Summary
 Object clone()
           
 Key generateSecret()
           
 EncryptionOptions getEncryptionOptions(Encryption enc)
           
 KeyPair getKeyPair()
           
 Key getPublicKey()
           
 String getRequestString()
           
 String getResponseString()
           
 DHContext setPublicKey(String dh)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DHContext

public DHContext()

DHContext

public DHContext(String dh)
Method Detail

getRequestString

public String getRequestString()

getResponseString

public String getResponseString()

getKeyPair

public KeyPair getKeyPair()

getPublicKey

public Key getPublicKey()

setPublicKey

public DHContext setPublicKey(String dh)
                       throws NoSuchAlgorithmException,
                              InvalidKeySpecException
Throws:
NoSuchAlgorithmException
InvalidKeySpecException

generateSecret

public Key generateSecret()
                   throws NoSuchAlgorithmException,
                          InvalidKeyException
Throws:
NoSuchAlgorithmException
InvalidKeyException

getEncryptionOptions

public EncryptionOptions getEncryptionOptions(Encryption enc)
                                       throws InvalidKeyException,
                                              NoSuchAlgorithmException
Throws:
InvalidKeyException
NoSuchAlgorithmException

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.