Class KeyResolver
java.lang.Object
org.apache.xml.security.keys.keyresolver.KeyResolver
KeyResolver is factory class for subclass of KeyResolverSpi that
represent child element of KeyInfo.
-
Method Summary
Modifier and TypeMethodDescriptiongetProperty
(String key) Method getPropertystatic final PublicKey
getPublicKey
(Element element, String baseURI, StorageResolver storage) Method getPublicKeystatic final X509Certificate
getX509Certificate
(Element element, String baseURI, StorageResolver storage) Method getX509Certificatestatic Iterator<KeyResolverSpi>
iterator()
static int
length()
Method lengthstatic void
This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects.static void
register
(KeyResolverSpi keyResolverSpi, boolean start) This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects.static void
registerAtStart
(String className, boolean globalResolver) This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects.static void
registerClassNames
(List<String> classNames) This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects.static void
This method registers the default resolvers.resolvePublicKey
(Element element, String baseURI, StorageResolver storage) Method resolvePublicKeyMethod resolverClassNameresolveSecretKey
(Element element, String baseURI, StorageResolver storage) resolveX509Certificate
(Element element, String baseURI, StorageResolver storage) Method resolveX509Certificatevoid
setProperty
(String key, String value) Method setPropertyboolean
understandsProperty
(String propertyToTest) Method understandsProperty
-
Method Details
-
length
public static int length()Method length- Returns:
- the length of resolvers registered
-
getX509Certificate
public static final X509Certificate getX509Certificate(Element element, String baseURI, StorageResolver storage) throws KeyResolverException Method getX509Certificate- Parameters:
element
-baseURI
-storage
-- Returns:
- The certificate represented by the element.
- Throws:
KeyResolverException
-
getPublicKey
public static final PublicKey getPublicKey(Element element, String baseURI, StorageResolver storage) throws KeyResolverException Method getPublicKey- Parameters:
element
-baseURI
-storage
-- Returns:
- the public key contained in the element
- Throws:
KeyResolverException
-
register
public static void register(String className, boolean globalResolver) throws ClassNotFoundException, IllegalAccessException, InstantiationException This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects. This means that personalizedKeyResolverSpi
s should only be registered directly to theKeyInfo
usingKeyInfo.registerInternalKeyResolver(org.apache.xml.security.keys.keyresolver.KeyResolverSpi)
. Please note that this method will create a new copy of the underlying array, as the underlying collection is a CopyOnWriteArrayList.- Parameters:
className
-globalResolver
- Whether the KeyResolverSpi is a global resolver or not- Throws:
InstantiationException
IllegalAccessException
ClassNotFoundException
SecurityException
- if a security manager is installed and the caller does not have permission to register the key resolver
-
registerAtStart
This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects. This means that personalizedKeyResolverSpi
s should only be registered directly to theKeyInfo
usingKeyInfo.registerInternalKeyResolver(org.apache.xml.security.keys.keyresolver.KeyResolverSpi)
. Please note that this method will create a new copy of the underlying array, as the underlying collection is a CopyOnWriteArrayList.- Parameters:
className
-globalResolver
- Whether the KeyResolverSpi is a global resolver or not- Throws:
SecurityException
- if a security manager is installed and the caller does not have permission to register the key resolver
-
register
This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects. This means that personalizedKeyResolverSpi
s should only be registered directly to theKeyInfo
usingKeyInfo.registerInternalKeyResolver(org.apache.xml.security.keys.keyresolver.KeyResolverSpi)
. Please note that this method will create a new copy of the underlying array, as the underlying collection is a CopyOnWriteArrayList.- Parameters:
keyResolverSpi
- a KeyResolverSpi instance to registerstart
- whether to register the KeyResolverSpi at the start of the list or not- Throws:
SecurityException
- if a security manager is installed and the caller does not have permission to register the key resolver
-
registerClassNames
public static void registerClassNames(List<String> classNames) throws ClassNotFoundException, IllegalAccessException, InstantiationException This method is used for registeringKeyResolverSpi
s which are available to allKeyInfo
objects. This means that personalizedKeyResolverSpi
s should only be registered directly to theKeyInfo
usingKeyInfo.registerInternalKeyResolver(org.apache.xml.security.keys.keyresolver.KeyResolverSpi)
. The KeyResolverSpi instances are not registered as a global resolver.- Parameters:
classNames
-- Throws:
InstantiationException
IllegalAccessException
ClassNotFoundException
SecurityException
- if a security manager is installed and the caller does not have permission to register the key resolver
-
registerDefaultResolvers
public static void registerDefaultResolvers()This method registers the default resolvers. -
resolvePublicKey
public PublicKey resolvePublicKey(Element element, String baseURI, StorageResolver storage) throws KeyResolverException Method resolvePublicKey- Parameters:
element
-baseURI
-storage
-- Returns:
- resolved public key from the registered from the elements
- Throws:
KeyResolverException
-
resolveX509Certificate
public X509Certificate resolveX509Certificate(Element element, String baseURI, StorageResolver storage) throws KeyResolverException Method resolveX509Certificate- Parameters:
element
-baseURI
-storage
-- Returns:
- resolved X509certificate key from the registered from the elements
- Throws:
KeyResolverException
-
resolveSecretKey
public SecretKey resolveSecretKey(Element element, String baseURI, StorageResolver storage) throws KeyResolverException - Parameters:
element
-baseURI
-storage
-- Returns:
- resolved SecretKey key from the registered from the elements
- Throws:
KeyResolverException
-
setProperty
Method setProperty- Parameters:
key
-value
-
-
getProperty
Method getProperty- Parameters:
key
-- Returns:
- the property set for this resolver
-
understandsProperty
Method understandsProperty- Parameters:
propertyToTest
-- Returns:
- true if the resolver understands property propertyToTest
-
resolverClassName
Method resolverClassName- Returns:
- the name of the resolver.
-
iterator
-