Class AgreementMethodKeyInfoProvider
- java.lang.Object
-
- org.opensaml.xmlsec.keyinfo.impl.provider.AbstractKeyInfoProvider
-
- org.opensaml.xmlsec.keyinfo.impl.provider.AgreementMethodKeyInfoProvider
-
- All Implemented Interfaces:
KeyInfoProvider
public class AgreementMethodKeyInfoProvider extends AbstractKeyInfoProvider
Implementation ofKeyInfoProviderwhich supportsAgreementMethod.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogLogger.private KeyAgreementParametersParserparametersParserParser for AgreementMethod parameters.
-
Constructor Summary
Constructors Constructor Description AgreementMethodKeyInfoProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhandles(XMLObject keyInfoChild)Evaluate whether the given provider should attempt to handle resolving a credential from the specified KeyInfo child.Collection<Credential>process(KeyInfoCredentialResolver resolver, XMLObject keyInfoChild, CriteriaSet criteriaSet, KeyInfoResolutionContext kiContext)Process a specified KeyInfo child (XMLobject) and attempt to resolve a credential from it.private StringresolveKeyAlgorithm(AgreementMethod agreementMethod)Resolve the encryption algorithm URI to be used with the derived key.private CredentialresolveOriginatorCredential(AgreementMethod agreementMethod, KeyInfoCredentialResolver resolver)Resolve the originatorCredentialfrom theOriginatorKeyInfoelement.private CredentialresolveRecipientCredential(AgreementMethod agreementMethod, KeyInfoCredentialResolver resolver)Resolve the recipientCredentialfrom theRecipientKeyInfoelement.-
Methods inherited from class org.opensaml.xmlsec.keyinfo.impl.provider.AbstractKeyInfoProvider
buildCredentialContext, extractKeyValue
-
-
-
-
Field Detail
-
log
private final org.slf4j.Logger log
Logger.
-
parametersParser
private final KeyAgreementParametersParser parametersParser
Parser for AgreementMethod parameters.
-
-
Method Detail
-
handles
public boolean handles(@Nonnull XMLObject keyInfoChild)Evaluate whether the given provider should attempt to handle resolving a credential from the specified KeyInfo child. An evaluation oftruedoes not guarantee that a credential can or will be extracted form the particular KeyInfo child, only that processing should be attempted.- Parameters:
keyInfoChild- the KeyInfo child object to consider- Returns:
- true if the provider should attempt to resolve credentials, false otherwise
-
process
@Nullable public Collection<Credential> process(@Nonnull KeyInfoCredentialResolver resolver, @Nonnull XMLObject keyInfoChild, @Nullable CriteriaSet criteriaSet, @Nonnull KeyInfoResolutionContext kiContext) throws SecurityException
Process a specified KeyInfo child (XMLobject) and attempt to resolve a credential from it.- Parameters:
resolver- reference to a resolver which is calling the providerkeyInfoChild- the KeyInfo child being processedcriteriaSet- the credential criteria the credential must satisfykiContext- the resolution context, used for sharing state amongst resolvers and providers- Returns:
- a resolved Credential collection, or null
- Throws:
SecurityException- if there is an error during credential resolution. Note: failure to resolve a credential is not an error.
-
resolveKeyAlgorithm
@Nonnull private String resolveKeyAlgorithm(@Nonnull AgreementMethod agreementMethod) throws SecurityException
Resolve the encryption algorithm URI to be used with the derived key.This comes from the AgreementMethod's grandparent's EncryptionMethod child element.
- Parameters:
agreementMethod- the AgreementMethod to process- Returns:
- the encryption algorithm URI
- Throws:
SecurityException- if the algorithm URI can not be resolved
-
resolveOriginatorCredential
@Nonnull private Credential resolveOriginatorCredential(@Nonnull AgreementMethod agreementMethod, @Nonnull KeyInfoCredentialResolver resolver) throws SecurityException
Resolve the originatorCredentialfrom theOriginatorKeyInfoelement.This will be the public key credential from the encrypting party.
- Parameters:
agreementMethod- the AgreementMethod to processresolver- the KeyInfoCredentialResolver to use- Returns:
- the originator credential
- Throws:
SecurityException- if the originator credential can not be resolved
-
resolveRecipientCredential
@Nonnull private Credential resolveRecipientCredential(@Nonnull AgreementMethod agreementMethod, @Nonnull KeyInfoCredentialResolver resolver) throws SecurityException
Resolve the recipientCredentialfrom theRecipientKeyInfoelement.This will be the private key credential from the decrypting party (this party).
- Parameters:
agreementMethod- the AgreementMethod to processresolver- the KeyInfoCredentialResolver to use- Returns:
- the recipient credential
- Throws:
SecurityException- if the recipient credential can not be resolved or does not contain a private key
-
-