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
Constructors Constructor Description KeyAgreementKey(SecretBuilder builder)
Initialises the key with the given secret data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyAgreementKey
asCryptoKey()
Returns the same object as a specificCryptoKey
subclass.KeyAgreement
getKeyAgreement()
Obtains a key agreement protocol object for this key.KeyAgreement
getKeyAgreement(String algorithm)
Obtains a key agreement protocol object initialized with this key.KeyAgreement
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 Detail
-
KeyAgreementKey
public KeyAgreementKey(SecretBuilder builder) throws NoSuchSecretException
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 Detail
-
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 specificCryptoKey
subclass.- Specified by:
asCryptoKey
in interfaceDecryptionKey<KeyAgreementKey>
- Specified by:
asCryptoKey
in interfaceEncryptionKey<KeyAgreementKey>
- Returns:
- the same key as a CryptoKey.
-
-