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:
 AutoCloseable,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 KeyAgreementKeyasCryptoKey()Returns the same object as a specificCryptoKeysubclass.KeyAgreementgetKeyAgreement()Obtains a key agreement protocol object for this key.KeyAgreementgetKeyAgreement(String algorithm)Obtains a key agreement protocol object initialized with this key.KeyAgreementgetKeyAgreement(String algorithm, AlgorithmParameterSpec parameterSpec)Obtains a key agreement protocol object initialized with this key.- 
Methods inherited from class org.forgerock.secrets.keys.CryptoKey
allowsAlgorithm, close, export, getCertificate, getCertificate, getCertificateChain, getCertificateChain, getKeyAlgorithm, getKeyType, getKeyUsages, getPublicKey, getPublicKey, isClosed, isExtractable, reveal, revealAndClose, 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:EncryptionKeyReturns the same object as a specificCryptoKeysubclass.- Specified by:
 asCryptoKeyin interfaceDecryptionKey<KeyAgreementKey>- Specified by:
 asCryptoKeyin interfaceEncryptionKey<KeyAgreementKey>- Returns:
 - the same key as a CryptoKey.
 
 
 - 
 
 -