org.apache.abdera.security.util
Class DHContext
java.lang.Object
org.apache.abdera.security.util.DHContext
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class DHContext
- extends java.lang.Object
- implements java.lang.Cloneable, java.io.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
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DHContext
public DHContext()
DHContext
public DHContext(java.lang.String dh)
getRequestString
public java.lang.String getRequestString()
getResponseString
public java.lang.String getResponseString()
getKeyPair
public java.security.KeyPair getKeyPair()
getPublicKey
public java.security.Key getPublicKey()
setPublicKey
public void setPublicKey(java.lang.String dh)
throws java.security.NoSuchAlgorithmException,
java.security.spec.InvalidKeySpecException
- Throws:
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
generateSecret
public java.security.Key generateSecret()
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
- Throws:
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
getEncryptionOptions
public EncryptionOptions getEncryptionOptions(Encryption enc)
throws java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException
- Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Overrides:
clone
in class java.lang.Object
- Throws:
java.lang.CloneNotSupportedException