Attempts to find a key that satisfies the specified constraints.
Returns:
the result of the key selector
Parameters:
-
keyInfo - a
KeyInfo
(may be
null
)
-
purpose - the key's purpose ({@link Purpose#SIGN},
{@link Purpose#VERIFY}, {@link Purpose#ENCRYPT}, or
{@link Purpose#DECRYPT})
-
method - the algorithm method that this key is to be used for.
Only keys that are compatible with the algorithm and meet the
constraints of the specified algorithm should be returned.
-
context - an
XMLCryptoContext
that may contain
useful information for finding an appropriate key. If this key
selector supports resolving {@link RetrievalMethod} types, the
context's
baseURI
and
dereferencer
parameters (if specified) should be used by the selector to
resolve and dereference the URI.
Throws:
-
KeySelectorException - if an exceptional condition occurs while
attempting to find a key. Note that an inability to find a key is not
considered an exception (
null
should be
returned in that case). However, an error condition (ex: network
communications failure) that prevented the
KeySelector
from finding a potential key should be considered an exception.
-
ClassCastException - if the data type of
method
is not supported by this key selector