Package org.conscrypt

Class OpenSSLECDHKeyAgreement


  • public final class OpenSSLECDHKeyAgreement
    extends KeyAgreementSpi
    Elliptic Curve Diffie-Hellman key agreement backed by the OpenSSL engine.
    • Constructor Detail

      • OpenSSLECDHKeyAgreement

        public OpenSSLECDHKeyAgreement()
    • Method Detail

      • engineDoPhase

        public Key engineDoPhase​(Key key,
                                 boolean lastPhase)
                          throws InvalidKeyException
        Description copied from class: KeyAgreementSpi
        Does the next (or the last) phase of the key agreement, using the specified key.
        Specified by:
        engineDoPhase in class KeyAgreementSpi
        Parameters:
        key - the key received from the other party for this phase.
        lastPhase - set to true if this is the last phase of this key agreement.
        Returns:
        the intermediate key from this phase or null if there is no intermediate key for this phase.
        Throws:
        InvalidKeyException - if the specified key cannot be used in this key agreement or this phase,
      • engineGenerateSecret

        protected int engineGenerateSecret​(byte[] sharedSecret,
                                           int offset)
                                    throws ShortBufferException
        Description copied from class: KeyAgreementSpi
        Generates the shared secret and stores it into the buffer sharedSecred at offset.
        Specified by:
        engineGenerateSecret in class KeyAgreementSpi
        Parameters:
        sharedSecret - the buffer to store the shared secret.
        offset - the offset in the buffer.
        Returns:
        the number of bytes stored in the buffer.
        Throws:
        ShortBufferException - if the specified buffer is too small for the shared secret.
      • engineGenerateSecret

        protected SecretKey engineGenerateSecret​(String algorithm)
        Description copied from class: KeyAgreementSpi
        Generates the shared secret.
        Specified by:
        engineGenerateSecret in class KeyAgreementSpi
        Parameters:
        algorithm - the algorithm to for the SecretKey
        Returns:
        the shared secret as a SecretKey of the specified algorithm.
      • engineInit

        protected void engineInit​(Key key,
                                  SecureRandom random)
                           throws InvalidKeyException
        Description copied from class: KeyAgreementSpi
        Initializes this KeyAgreementSpi with the specified key and the specified randomness source.
        Specified by:
        engineInit in class KeyAgreementSpi
        Parameters:
        key - the key to initialize this key agreement.
        random - the source for any randomness needed.
        Throws:
        InvalidKeyException - if the specified key cannot be used to initialize this key agreement.