Package org.forgerock.secrets.keys
Class KeyAgreementKey
java.lang.Object
org.forgerock.secrets.Secret
org.forgerock.secrets.keys.CryptoKey
org.forgerock.secrets.keys.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 Summary
ConstructorDescriptionKeyAgreementKey
(SecretBuilder builder) Initialises the key with the given secret data. -
Method Summary
Modifier and TypeMethodDescriptionReturns the same object as a specificCryptoKey
subclass.Obtains a key agreement protocol object for this key.getKeyAgreement
(String algorithm) Obtains a key agreement protocol object initialized with this key.getKeyAgreement
(String algorithm, AlgorithmParameterSpec parameterSpec) Obtains a key agreement protocol object initialized with this key.Methods inherited from class org.forgerock.secrets.keys.CryptoKey
allowsAlgorithm, export, getCertificate, getCertificate, getCertificateChain, getCertificateChain, getKeyAlgorithm, getKeyType, getKeyUsages, getPublicKey, getPublicKey, isExtractable, reveal, toBuilder, toString
Methods inherited from class org.forgerock.secrets.Secret
equals, getExpiryTime, getStableId, hashCode, isExpired
-
Constructor Details
-
KeyAgreementKey
Initialises the key with the given secret data.- Parameters:
builder
- the builder object.- Throws:
NoSuchSecretException
- if the secret could not be constructed from the builder.
-
-
Method Details
-
getKeyAgreement
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
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
Obtains a key agreement protocol object for this key.- Returns:
- the initialized key agreement object.
-
asCryptoKey
Description copied from interface:EncryptionKey
Returns the same object as a specificCryptoKey
subclass.- Specified by:
asCryptoKey
in interfaceDecryptionKey<KeyAgreementKey>
- Specified by:
asCryptoKey
in interfaceEncryptionKey<KeyAgreementKey>
- Returns:
- the same key as a CryptoKey.
-