Class SimpleKeyInfoReferenceEncryptedKeyResolver
- java.lang.Object
-
- org.opensaml.xmlsec.encryption.support.AbstractEncryptedKeyResolver
-
- org.opensaml.xmlsec.encryption.support.SimpleKeyInfoReferenceEncryptedKeyResolver
-
- All Implemented Interfaces:
EncryptedKeyResolver
public class SimpleKeyInfoReferenceEncryptedKeyResolver extends AbstractEncryptedKeyResolver
Implementation ofEncryptedKeyResolver
which findsEncryptedKey
elements by dereferencingKeyInfoReference
children of theKeyInfo
of theEncryptedData
context. TheURI
attribute value must be a same-document fragment identifier (via ID attribute). Processing of external resources is not supported. Furthermore, the target of the reference must itself contain either anEncryptedKey
or a subsequentKeyInfoReference
, up to a depth limit. Other forms of resolution cannot be mixed together with this one.
-
-
Field Summary
Fields Modifier and Type Field Description private int
depthLimit
Number of times to follow a reference before failing.private org.slf4j.Logger
log
Class logger.
-
Constructor Summary
Constructors Constructor Description SimpleKeyInfoReferenceEncryptedKeyResolver()
Constructor.SimpleKeyInfoReferenceEncryptedKeyResolver(String recipient)
Constructor.SimpleKeyInfoReferenceEncryptedKeyResolver(Set<String> recipients)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected KeyInfo
dereferenceURI(KeyInfoReference ref)
Dereference the URI attribute of the specified retrieval method into a KeyInfo.int
getDepthLimit()
Gets the reference depth limit.Iterable<EncryptedKey>
resolve(EncryptedData encryptedData)
Resolve the EncryptedKey elements containing the data encryption key used to encrypt the specified EncryptedData element.protected Iterable<EncryptedKey>
resolveKeyInfo(KeyInfo keyInfo, int limit)
Turn a KeyInfo into an EncryptedKey collection.void
setDepthLimit(int limit)
Sets the reference depth limit, to a minimum of 1.-
Methods inherited from class org.opensaml.xmlsec.encryption.support.AbstractEncryptedKeyResolver
getRecipients, matchCarriedKeyName, matchDataReference, matchRecipient
-
-
-
-
Constructor Detail
-
SimpleKeyInfoReferenceEncryptedKeyResolver
public SimpleKeyInfoReferenceEncryptedKeyResolver()
Constructor.
-
SimpleKeyInfoReferenceEncryptedKeyResolver
public SimpleKeyInfoReferenceEncryptedKeyResolver(@Nullable Set<String> recipients)
Constructor.- Parameters:
recipients
- the set of recipients
-
SimpleKeyInfoReferenceEncryptedKeyResolver
public SimpleKeyInfoReferenceEncryptedKeyResolver(@Nullable String recipient)
Constructor.- Parameters:
recipient
- the recipient
-
-
Method Detail
-
getDepthLimit
public int getDepthLimit()
Gets the reference depth limit.- Returns:
- the depth limit
-
setDepthLimit
public void setDepthLimit(int limit)
Sets the reference depth limit, to a minimum of 1.- Parameters:
limit
- limit to set
-
resolve
@Nonnull public Iterable<EncryptedKey> resolve(@Nonnull EncryptedData encryptedData)
Resolve the EncryptedKey elements containing the data encryption key used to encrypt the specified EncryptedData element.- Parameters:
encryptedData
- the EncryptedData element context in which to resolve- Returns:
- an iterable of EncryptedKey elements
-
resolveKeyInfo
@Nonnull protected Iterable<EncryptedKey> resolveKeyInfo(@Nullable KeyInfo keyInfo, int limit)
Turn a KeyInfo into an EncryptedKey collection.- Parameters:
keyInfo
- KeyInfo to processlimit
- depth of references to follow- Returns:
- encrypted keys
-
dereferenceURI
@Nullable protected KeyInfo dereferenceURI(@Nonnull KeyInfoReference ref)
Dereference the URI attribute of the specified retrieval method into a KeyInfo.- Parameters:
ref
- the KeyInfoReference to process- Returns:
- the dereferenced KeyInfo
-
-