KeyAgreementSpi (Bouncy Castle Library 1.54 API Specification)
Date: 2015-12-29

org.bouncycastle.jcajce.provider.asymmetric.ec

## Class KeyAgreementSpi

- java.lang.Object
- - javax.crypto.KeyAgreementSpi
  - - org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi
    - - org.bouncycastle.jcajce.provider.asymmetric.ec.KeyAgreementSpi

- Direct Known Subclasses:
    KeyAgreementSpi.CDHwithSHA1KDFAndSharedInfo, KeyAgreementSpi.CDHwithSHA224KDFAndSharedInfo, KeyAgreementSpi.CDHwithSHA256KDFAndSharedInfo, KeyAgreementSpi.CDHwithSHA384KDFAndSharedInfo, KeyAgreementSpi.CDHwithSHA512KDFAndSharedInfo, KeyAgreementSpi.DH, KeyAgreementSpi.DHC, KeyAgreementSpi.DHwithSHA1CKDF, KeyAgreementSpi.DHwithSHA1KDF, KeyAgreementSpi.DHwithSHA1KDFAndSharedInfo, KeyAgreementSpi.DHwithSHA224KDFAndSharedInfo, KeyAgreementSpi.DHwithSHA256CKDF, KeyAgreementSpi.DHwithSHA256KDFAndSharedInfo, KeyAgreementSpi.DHwithSHA384CKDF, KeyAgreementSpi.DHwithSHA384KDFAndSharedInfo, KeyAgreementSpi.DHwithSHA512CKDF, KeyAgreementSpi.DHwithSHA512KDFAndSharedInfo, KeyAgreementSpi.MQV, KeyAgreementSpi.MQVwithSHA1CKDF, KeyAgreementSpi.MQVwithSHA1KDFAndSharedInfo, KeyAgreementSpi.MQVwithSHA224CKDF, KeyAgreementSpi.MQVwithSHA224KDFAndSharedInfo, KeyAgreementSpi.MQVwithSHA256CKDF, KeyAgreementSpi.MQVwithSHA256KDFAndSharedInfo, KeyAgreementSpi.MQVwithSHA384CKDF, KeyAgreementSpi.MQVwithSHA384KDFAndSharedInfo, KeyAgreementSpi.MQVwithSHA512CKDF, KeyAgreementSpi.MQVwithSHA512KDFAndSharedInfo

      public class KeyAgreementSpi
      extends BaseAgreementSpi

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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `KeyAgreementSpi.CDHwithSHA1KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.CDHwithSHA224KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.CDHwithSHA256KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.CDHwithSHA384KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.CDHwithSHA512KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.DH`
    `static class` | `KeyAgreementSpi.DHC`
    `static class` | `KeyAgreementSpi.DHwithSHA1CKDF`
    `static class` | `KeyAgreementSpi.DHwithSHA1KDF`
    `static class` | `KeyAgreementSpi.DHwithSHA1KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.DHwithSHA224KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.DHwithSHA256CKDF`
    `static class` | `KeyAgreementSpi.DHwithSHA256KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.DHwithSHA384CKDF`
    `static class` | `KeyAgreementSpi.DHwithSHA384KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.DHwithSHA512CKDF`
    `static class` | `KeyAgreementSpi.DHwithSHA512KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.MQV`
    `static class` | `KeyAgreementSpi.MQVwithSHA1CKDF`
    `static class` | `KeyAgreementSpi.MQVwithSHA1KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.MQVwithSHA224CKDF`
    `static class` | `KeyAgreementSpi.MQVwithSHA224KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.MQVwithSHA256CKDF`
    `static class` | `KeyAgreementSpi.MQVwithSHA256KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.MQVwithSHA384CKDF`
    `static class` | `KeyAgreementSpi.MQVwithSHA384KDFAndSharedInfo`
    `static class` | `KeyAgreementSpi.MQVwithSHA512CKDF`
    `static class` | `KeyAgreementSpi.MQVwithSHA512KDFAndSharedInfo`

  - ### Field Summary

    - ### Fields inherited from class org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi

      `result, ukmParameters`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `KeyAgreementSpi(java.lang.String kaAlgorithm, BasicAgreement agreement, DerivationFunction kdf)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected byte[]` | `bigIntToBytes(java.math.BigInteger r)`
    `protected java.security.Key` | `engineDoPhase(java.security.Key key, boolean lastPhase)`
    `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 org.bouncycastle.jcajce.provider.asymmetric.util.BaseAgreementSpi

      `engineGenerateSecret, engineGenerateSecret, engineGenerateSecret, getAlgorithm, getKeySize, trimZeroes`

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

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

- - ### Constructor Detail

    - #### KeyAgreementSpi

          protected KeyAgreementSpi(java.lang.String kaAlgorithm,
                         BasicAgreement agreement,
                         DerivationFunction kdf)

  - ### Method Detail

    - #### bigIntToBytes

          protected byte[] bigIntToBytes(java.math.BigInteger r)

      Specified by:
        `bigIntToBytes` in class `BaseAgreementSpi`

    - #### 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`

    - #### 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`