KeyAgreementSpi (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.jcajce.provider.asymmetric.dh

## Class KeyAgreementSpi

- java.lang.Object
- - javax.crypto.KeyAgreementSpi
  - - org.bouncycastle.jcajce.provider.asymmetric.dh.KeyAgreementSpi

-     public class KeyAgreementSpi
      extends javax.crypto.KeyAgreementSpi

  Diffie-Hellman key agreement. There's actually a better way of doing this if you are using long term public keys, see the light-weight version for details.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyAgreementSpi()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.security.Key` | `engineDoPhase(java.security.Key key, boolean lastPhase)`
    `protected byte[]` | `engineGenerateSecret()`
    `protected int` | `engineGenerateSecret(byte[] sharedSecret, int offset)`
    `protected javax.crypto.SecretKey` | `engineGenerateSecret(java.lang.String algorithm)`
    `protected void` | `engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)`
    `protected void` | `engineInit(java.security.Key key, java.security.SecureRandom random)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KeyAgreementSpi

          public KeyAgreementSpi()

  - ### Method Detail

    - #### engineDoPhase

          protected java.security.Key engineDoPhase(java.security.Key key,
                                        boolean lastPhase)
                                             throws java.security.InvalidKeyException,
                                                    java.lang.IllegalStateException

      Specified by:
        `engineDoPhase` in class `javax.crypto.KeyAgreementSpi`
      Throws:
        `java.security.InvalidKeyException`
        `java.lang.IllegalStateException`

    - #### engineGenerateSecret

          protected byte[] engineGenerateSecret()
                                         throws java.lang.IllegalStateException

      Specified by:
        `engineGenerateSecret` in class `javax.crypto.KeyAgreementSpi`
      Throws:
        `java.lang.IllegalStateException`

    - #### engineGenerateSecret

          protected int engineGenerateSecret(byte[] sharedSecret,
                                 int offset)
                                      throws java.lang.IllegalStateException,
                                             javax.crypto.ShortBufferException

      Specified by:
        `engineGenerateSecret` in class `javax.crypto.KeyAgreementSpi`
      Throws:
        `java.lang.IllegalStateException`
        `javax.crypto.ShortBufferException`

    - #### engineGenerateSecret

          protected javax.crypto.SecretKey engineGenerateSecret(java.lang.String algorithm)

      Specified by:
        `engineGenerateSecret` in class `javax.crypto.KeyAgreementSpi`

    - #### engineInit

          protected void engineInit(java.security.Key key,
                        java.security.spec.AlgorithmParameterSpec params,
                        java.security.SecureRandom random)
                             throws java.security.InvalidKeyException,
                                    java.security.InvalidAlgorithmParameterException

      Specified by:
        `engineInit` in class `javax.crypto.KeyAgreementSpi`
      Throws:
        `java.security.InvalidKeyException`
        `java.security.InvalidAlgorithmParameterException`

    - #### engineInit

          protected void engineInit(java.security.Key key,
                        java.security.SecureRandom random)
                             throws java.security.InvalidKeyException

      Specified by:
        `engineInit` in class `javax.crypto.KeyAgreementSpi`
      Throws:
        `java.security.InvalidKeyException`