Class KeyAgreementKey

All Implemented Interfaces:
DecryptionKey<KeyAgreementKey>, EncryptionKey<KeyAgreementKey>

public class KeyAgreementKey extends CryptoKey implements EncryptionKey<KeyAgreementKey>, DecryptionKey<KeyAgreementKey>
A key that is used in a key-agreement protocol (such as Diffie-Hellman) to agree another key.
  • Constructor Details

  • Method Details

    • getKeyAgreement

      public KeyAgreement getKeyAgreement(String algorithm, AlgorithmParameterSpec parameterSpec)
      Obtains a key agreement protocol object initialized with this key.
      Parameters:
      algorithm - the key agreement algorithm, for instance "ECDH" for Elliptic Curve Diffie-Hellman.
      parameterSpec - the algorithm parameters.
      Returns:
      the initialized key agreement object.
      Throws:
      IllegalStateException - if this key object doesn't contain private key material.
    • getKeyAgreement

      public KeyAgreement getKeyAgreement(String algorithm)
      Obtains a key agreement protocol object initialized with this key.
      Parameters:
      algorithm - the key agreement algorithm, for instance "ECDH" for Elliptic Curve Diffie-Hellman.
      Returns:
      the initialized key agreement object.
    • getKeyAgreement

      public KeyAgreement getKeyAgreement()
      Obtains a key agreement protocol object for this key.
      Returns:
      the initialized key agreement object.
    • asCryptoKey

      public KeyAgreementKey asCryptoKey()
      Description copied from interface: EncryptionKey
      Returns the same object as a specific CryptoKey subclass.
      Specified by:
      asCryptoKey in interface DecryptionKey<KeyAgreementKey>
      Specified by:
      asCryptoKey in interface EncryptionKey<KeyAgreementKey>
      Returns:
      the same key as a CryptoKey.