Package org.bouncycastle.jcajce.provider.asymmetric.util

## Class BaseAgreementSpi

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

- Direct Known Subclasses:
    `KeyAgreementSpi`, `KeyAgreementSpi`, `KeyAgreementSpi`, `KeyAgreementSpi`, `KeyAgreementSpi`, `KeyAgreementSpi`

      public abstract class BaseAgreementSpi
      extends javax.crypto.KeyAgreementSpi

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.lang.String` | `kaAlgorithm` |
    `protected DerivationFunction` | `kdf` |
    `protected byte[]` | `ukmParameters` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BaseAgreementSpi​(java.lang.String kaAlgorithm, DerivationFunction kdf)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected abstract byte[]` | `calcSecret()` |
    `protected byte[]` | `engineGenerateSecret()` |
    `protected int` | `engineGenerateSecret​(byte[] sharedSecret, int offset)` |
    `protected javax.crypto.SecretKey` | `engineGenerateSecret​(java.lang.String algorithm)` |
    `protected static java.lang.String` | `getAlgorithm​(java.lang.String algDetails)` |
    `protected static int` | `getKeySize​(java.lang.String algDetails)` |
    `protected static byte[]` | `trimZeroes​(byte[] secret)` |

    - ### Methods inherited from class javax.crypto.KeyAgreementSpi

      `engineDoPhase, engineInit, engineInit`

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

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

- - ### Field Detail

    - #### kaAlgorithm

          protected final java.lang.String kaAlgorithm

    - #### kdf

          protected final DerivationFunction kdf

    - #### ukmParameters

          protected byte[] ukmParameters

  - ### Constructor Detail

    - #### BaseAgreementSpi

          public BaseAgreementSpi​(java.lang.String kaAlgorithm,
                                  DerivationFunction kdf)

  - ### Method Detail

    - #### getAlgorithm

          protected static java.lang.String getAlgorithm​(java.lang.String algDetails)

    - #### getKeySize

          protected static int getKeySize​(java.lang.String algDetails)

    - #### trimZeroes

          protected static byte[] trimZeroes​(byte[] secret)

    - #### 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)
                                                         throws java.security.NoSuchAlgorithmException

      Specified by:
        `engineGenerateSecret` in class `javax.crypto.KeyAgreementSpi`
      Throws:
        `java.security.NoSuchAlgorithmException`

    - #### calcSecret

          protected abstract byte[] calcSecret()