public abstract class KeySelector extends Object
KeyInfoobject. An example of an implementation of this class is one that searches a
KeyStorefor trusted keys that match information contained in a
Whether or not the returned key is trusted and the mechanisms used to determine that is implementation-specific.
|Modifier and Type||Class and Description|
The purpose of the key that is to be selected.
|Modifier||Constructor and Description|
Default no-args constructor; intended for invocation by subclasses only.
|Modifier and Type||Method and Description|
Attempts to find a key that satisfies the specified constraints.
public abstract KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) throws KeySelectorException
purpose- the key's purpose (
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.
XMLCryptoContextthat may contain useful information for finding an appropriate key. If this key selector supports resolving
RetrievalMethodtypes, the context's
dereferencerparameters (if specified) should be used by the selector to resolve and dereference the URI.
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 (
nullshould be returned in that case). However, an error condition (ex: network communications failure) that prevented the
KeySelectorfrom finding a potential key should be considered an exception.
ClassCastException- if the data type of
methodis not supported by this key selector
public static KeySelector singletonKeySelector(Key key)
KeySelectorthat always selects the specified key, regardless of the
KeyInfopassed to it.
key- the sole key to be stored in the key selector
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.