public class ECDHKeyAgreementParameters extends KeyEncryptionParameters
KeyEncryptionParameters that is to be used for Elliptic-curves Diffie-Hellman
(Ephemeral-Static) key agreement ().
Note: This class is mainly intended to be used when you invoke the Encrypter without using an
EncryptionParametersResolver that handles key agreement (see below). The implementation of this class is
really not how we would like things to be done, but in order for the OpenSAML Encrypter to work for
we introduce this solution where we really bend things
for our needs. And hope that generic ECDH key agreement will be supported in OpenSAML soon.
In order to get everything to play along with OpenSAML's Encrypter we let the DataEncryptionParameters.getAlgorithm() return
the algorithm for the key wrapping method. Normally, the DataEncryptionParameters.getAlgorithm() returns the
key encryption algorithm, but in our case this is always .
Furthermore, the key derivation algorithm is hard-wired to
and its parameters are not currently possible to
configure (other than the digest method, see setConcatKDFParameters(ConcatKDFParameters).
| Constructor and Description |
|---|
ECDHKeyAgreementParameters()
Constructor.
|
ECDHKeyAgreementParameters(EncryptionParameters params,
String recipientId)
Convenience constructor which allows copying the relevant key encryption parameters from an instance of
EncryptionParameters. |
| Modifier and Type | Method and Description |
|---|---|
ConcatKDFParameters |
getConcatKDFParameters()
Returns the ConcatKDF parameters to use.
|
Credential |
getEncryptionCredential()
Instead of returning the credential assigned (
setEncryptionCredential(Credential)), the method will return
the key agreement credential (getKeyAgreementCredential()). |
Credential |
getKeyAgreementCredential()
Returns the key agreement credential.
|
String |
getKeyDerivationAlgorithm()
Gets the key derivation algorithm.
|
KeyInfoGenerator |
getKeyInfoGenerator()
If a
KeyInfoGenerator has not been explicitly assigned, a default KeyAgreementKeyInfoGeneratorFactory.KeyAgreementKeyInfoGenerator
(@link ExtendedDefaultSecurityConfigurationBootstrap.buildDefaultKeyAgreementKeyInfoGeneratorFactory())
will be created. |
Credential |
getPeerCredential()
Returns the peer credential.
|
void |
setConcatKDFParameters(ConcatKDFParameters concatKDFParameters)
Assigns the ConcatKDF parameters to use.
|
void |
setEncryptionCredential(Credential encryptionCredential)
For the
ECDHKeyAgreementParameters class, this means setPeerCredential(Credential). |
void |
setKeyAgreementCredential(Credential keyAgreementCredential)
Assigns the key agreement credential.
|
void |
setKeyDerivationAlgorithm(String keyDerivationAlgorithm)
Sets the key derivation algorithm.
|
void |
setPeerCredential(Credential peerCredential)
Assigs the peer credential (this is the same as
DataEncryptionParameters.setEncryptionCredential(Credential). |
getRecipient, getRSAOAEPParameters, setRecipient, setRSAOAEPParametersgetAlgorithm, setAlgorithm, setKeyInfoGeneratorpublic ECDHKeyAgreementParameters()
public ECDHKeyAgreementParameters(EncryptionParameters params, String recipientId)
EncryptionParameters.
If the supplied params contains a key transport encryption credential of type
KeyAgreementCredential the setKeyAgreementCredential(Credential) will be invoked. This means that
the key agreement credential will not be created by the getKeyAgreementCredential() method.
params - the encryption parameters instancerecipientId - the recipient of the keypublic Credential getKeyAgreementCredential()
If the key agreement has not been assigned, the method will attempt to generate it using the key derivation parameters and peer credential of this instance.
null if it could not generate such a credentialpublic void setKeyAgreementCredential(Credential keyAgreementCredential)
KeyAgreementCredential.
If this credential is not assigned, it will be generated. See getKeyAgreementCredential().
keyAgreementCredential - the key agreement credentialpublic Credential getEncryptionCredential()
setEncryptionCredential(Credential)), the method will return
the key agreement credential (getKeyAgreementCredential()). The reason for this is a work-around so that
we can squeeze key agreement functionality into the OpenSAML Encrypter.getEncryptionCredential in class DataEncryptionParameterspublic void setEncryptionCredential(Credential encryptionCredential)
ECDHKeyAgreementParameters class, this means setPeerCredential(Credential).setEncryptionCredential in class DataEncryptionParameterspublic Credential getPeerCredential()
setEncryptionCredential(Credential).public void setPeerCredential(Credential peerCredential)
DataEncryptionParameters.setEncryptionCredential(Credential).peerCredential - the peer credentialspublic KeyInfoGenerator getKeyInfoGenerator()
KeyInfoGenerator has not been explicitly assigned, a default KeyAgreementKeyInfoGeneratorFactory.KeyAgreementKeyInfoGenerator
(@link ExtendedDefaultSecurityConfigurationBootstrap.buildDefaultKeyAgreementKeyInfoGeneratorFactory())
will be created.getKeyInfoGenerator in class DataEncryptionParameterspublic String getKeyDerivationAlgorithm()
public void setKeyDerivationAlgorithm(String keyDerivationAlgorithm)
Currently, the only supported algorithm is EcEncryptionConstants.ALGO_ID_KEYDERIVATION_CONCAT.
keyDerivationAlgorithm - the key derivation algorithmpublic ConcatKDFParameters getConcatKDFParameters()
public void setConcatKDFParameters(ConcatKDFParameters concatKDFParameters)
concatKDFParameters - parametersCopyright © 2020 Sweden Connect. All rights reserved.