Class AbstractKeyAgreementProcessor
- java.lang.Object
-
- org.opensaml.xmlsec.agreement.impl.AbstractKeyAgreementProcessor
-
- All Implemented Interfaces:
KeyAgreementProcessor
- Direct Known Subclasses:
AbstractDerivationKeyAgreementProcessor,DHWithLegacyKDFKeyAgreementProcessor
public abstract class AbstractKeyAgreementProcessor extends Object implements KeyAgreementProcessor
Abstract base class forKeyAgreementProcessorimplementations.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogLogger.
-
Constructor Summary
Constructors Constructor Description AbstractKeyAgreementProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected KeyAgreementCredentialbuildKeyAgreementCredential(SecretKey derivedKey, Credential publicCredential, Credential privateCredential, KeyAgreementParameters parameters)Build the finalKeyAgreementCredentialfrom the given inputs.protected abstract SecretKeyderiveSecretKey(byte[] secret, String keyAlgorithm, KeyAgreementParameters parameters)Derive aSecretKeyfrom a given secret.KeyAgreementCredentialexecute(Credential publicCredential, String keyAlgorithm, KeyAgreementParameters inputParameters)protected abstract byte[]generateAgreementSecret(Credential publicCredential, Credential privateCredential, KeyAgreementParameters parameters)Generate the agreement secret according to the key algorithm and using the supplied public and private credentials.protected CredentialobtainPrivateCredential(Credential publicCredential, KeyAgreementParameters parameters)Obtain the private credential which is compatible with the given public credential.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opensaml.xmlsec.agreement.KeyAgreementProcessor
getAlgorithm
-
-
-
-
Method Detail
-
execute
@Nonnull public KeyAgreementCredential execute(@Nonnull Credential publicCredential, @Nonnull String keyAlgorithm, @Nonnull KeyAgreementParameters inputParameters) throws KeyAgreementException
- Specified by:
executein interfaceKeyAgreementProcessor- Throws:
KeyAgreementException
-
obtainPrivateCredential
@Nonnull protected Credential obtainPrivateCredential(@Nonnull Credential publicCredential, @Nonnull KeyAgreementParameters parameters) throws KeyAgreementException
Obtain the private credential which is compatible with the given public credential.- Parameters:
publicCredential- the public credentialparameters- the key agreement parameters- Returns:
- the obtained private credential
- Throws:
KeyAgreementException- if private credential can not be obtained
-
generateAgreementSecret
@Nonnull protected abstract byte[] generateAgreementSecret(@Nonnull Credential publicCredential, @Nonnull Credential privateCredential, @Nonnull KeyAgreementParameters parameters) throws KeyAgreementExceptionGenerate the agreement secret according to the key algorithm and using the supplied public and private credentials.- Parameters:
publicCredential- the public credentialprivateCredential- the private credentialparameters- the key agreement parameters- Returns:
- the secret produced by the key agreement operation
- Throws:
KeyAgreementException- if secret generation fails
-
deriveSecretKey
@Nonnull protected abstract SecretKey deriveSecretKey(@Nonnull byte[] secret, @Nonnull String keyAlgorithm, @Nonnull KeyAgreementParameters parameters) throws KeyAgreementException
Derive aSecretKeyfrom a given secret.- Parameters:
secret- the input secretkeyAlgorithm- the JCA key algorithm for the derived keyparameters- the key agreement parameters- Returns:
- the derived secret key
- Throws:
KeyAgreementException- if key derivation operation does not complete successfully
-
buildKeyAgreementCredential
@Nonnull protected KeyAgreementCredential buildKeyAgreementCredential(@Nonnull SecretKey derivedKey, @Nonnull Credential publicCredential, @Nonnull Credential privateCredential, @Nonnull KeyAgreementParameters parameters) throws KeyAgreementException
Build the finalKeyAgreementCredentialfrom the given inputs.- Parameters:
derivedKey- the derived secret keypublicCredential- the public credentialprivateCredential- the private credentialparameters- the key agreement parameters- Returns:
- the new key agreement credential
- Throws:
KeyAgreementException- if credential can not be successfully constructed
-
-