org.gudy.bouncycastle.jce.provider
Class JCEECDHKeyAgreement

java.lang.Object
  extended by javax.crypto.KeyAgreementSpi
      extended by org.gudy.bouncycastle.jce.provider.JCEECDHKeyAgreement
Direct Known Subclasses:
JCEECDHKeyAgreement.DH

public class JCEECDHKeyAgreement
extends KeyAgreementSpi

Diffie-Hellman key agreement using elliptic curve keys, ala IEEE P1363 both the simple one, and the simple one with cofactors are supported.


Nested Class Summary
static class JCEECDHKeyAgreement.DH
           
 
Constructor Summary
protected JCEECDHKeyAgreement(BasicAgreement agreement)
           
 
Method Summary
 Key doPhase(Key key, boolean lastPhase)
           
protected  Key engineDoPhase(Key key, boolean lastPhase)
           
protected  byte[] engineGenerateSecret()
           
protected  int engineGenerateSecret(byte[] sharedSecret, int offset)
           
protected  SecretKey engineGenerateSecret(String algorithm)
           
protected  void engineInit(Key key, AlgorithmParameterSpec params, SecureRandom random)
           
protected  void engineInit(Key key, SecureRandom random)
           
 byte[] generateSecret()
           
 void init(Key key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCEECDHKeyAgreement

protected JCEECDHKeyAgreement(BasicAgreement agreement)
Method Detail

doPhase

public Key doPhase(Key key,
                   boolean lastPhase)
            throws InvalidKeyException,
                   IllegalStateException
Throws:
InvalidKeyException
IllegalStateException

engineDoPhase

protected Key engineDoPhase(Key key,
                            boolean lastPhase)
                     throws InvalidKeyException,
                            IllegalStateException
Specified by:
engineDoPhase in class KeyAgreementSpi
Throws:
InvalidKeyException
IllegalStateException

generateSecret

public byte[] generateSecret()
                      throws IllegalStateException
Throws:
IllegalStateException

engineGenerateSecret

protected byte[] engineGenerateSecret()
                               throws IllegalStateException
Specified by:
engineGenerateSecret in class KeyAgreementSpi
Throws:
IllegalStateException

engineGenerateSecret

protected int engineGenerateSecret(byte[] sharedSecret,
                                   int offset)
                            throws IllegalStateException,
                                   ShortBufferException
Specified by:
engineGenerateSecret in class KeyAgreementSpi
Throws:
IllegalStateException
ShortBufferException

engineGenerateSecret

protected SecretKey engineGenerateSecret(String algorithm)
Specified by:
engineGenerateSecret in class KeyAgreementSpi

init

public void init(Key key)
          throws InvalidKeyException,
                 InvalidAlgorithmParameterException
Throws:
InvalidKeyException
InvalidAlgorithmParameterException

engineInit

protected void engineInit(Key key,
                          AlgorithmParameterSpec params,
                          SecureRandom random)
                   throws InvalidKeyException,
                          InvalidAlgorithmParameterException
Specified by:
engineInit in class KeyAgreementSpi
Throws:
InvalidKeyException
InvalidAlgorithmParameterException

engineInit

protected void engineInit(Key key,
                          SecureRandom random)
                   throws InvalidKeyException
Specified by:
engineInit in class KeyAgreementSpi
Throws:
InvalidKeyException