This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.xml.crypto
class KeySelector

java.lang.Object extended by javax.xml.crypto.KeySelector

public abstract class KeySelector
extends Object

A selector that finds and returns a key using the data contained in a {@link KeyInfo} object. An example of an implementation of this class is one that searchs a {@link java.security.KeyStore} for trusted keys that match information contained in a KeyInfo.

Whether or not the returned key is trusted and the mechanisms used to determine that is implementation-specific.


Nested Class Summary
static class

           The purpose of the key that is to be selected.
 
Constructor Summary
protected

          Default no-args constructor; intended for invocation by subclasses only.
 
Method Summary
abstract KeySelectorResult
select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context)

          Attempts to find a key that satisfies the specified constraints.
static KeySelector

          Returns a KeySelector that always selects the specified key, regardless of the KeyInfo passed to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeySelector

protected KeySelector()
Default no-args constructor; intended for invocation by subclasses only.

Method Detail

select

public abstract KeySelectorResult select(KeyInfo keyInfo,
                                         KeySelector.Purpose purpose,
                                         AlgorithmMethod method,
                                         XMLCryptoContext context)
                                  throws KeySelectorException
Attempts to find a key that satisfies the specified constraints.

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.
Returns:
the result of the key selector
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.

singletonKeySelector

public static KeySelector singletonKeySelector(Key key)
Returns a KeySelector that always selects the specified key, regardless of the KeyInfo passed to it.

Parameters:
key - the sole key to be stored in the key selector
Returns:
a key selector that always selects the specified key


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.