- java.lang.Object
-
- javax.xml.crypto.KeySelector
-
-
嵌套类汇总
嵌套类 变量和类型 类 描述 static classKeySelector.Purpose要选择的密钥的目的。
-
构造方法摘要
构造方法 变量 构造器 描述 protectedKeySelector()默认的no-args构造函数; 仅供子类调用。
-
方法摘要
所有方法 静态方法 实例方法 抽象方法 具体的方法 变量和类型 方法 描述 abstract KeySelectorResultselect(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context)尝试查找满足指定约束的键。static KeySelectorsingletonKeySelector(Key key)返回KeySelector总是选择指定密钥,不管的KeyInfo传递给它。
-
-
-
方法详细信息
-
select
public abstract KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) throws KeySelectorException
尝试查找满足指定约束的键。- 参数
-
keyInfo- aKeyInfo(可能是null) -
purpose-密钥的目的(KeySelector.Purpose.SIGN,KeySelector.Purpose.VERIFY,KeySelector.Purpose.ENCRYPT,或KeySelector.Purpose.DECRYPT) -
method- 此密钥用于的算法方法。 只应返回与算法兼容并满足指定算法约束的密钥。 -
context-XMLCryptoContext,其中可能包含用于查找适当密钥的有用信息。 如果此键选择器支持解析RetrievalMethod类型,则选择器应使用上下文的baseURI和dereferencer参数(如果指定)来解析和取消引用URI。 - 结果
- 键选择器的结果
- 异常
-
KeySelectorException- 如果在尝试查找密钥时发生异常情况。 请注意,无法找到密钥不被视为例外(在这种情况下应返回null)。 但是,阻止KeySelector查找潜在密钥的错误情况(例如:网络通信故障)应被视为例外。 -
ClassCastException- 如果此密钥选择器不支持method的数据类型
-
singletonKeySelector
public static KeySelector singletonKeySelector(Key key)
返回KeySelector总是选择指定密钥,不管的KeyInfo传递给它。- 参数
-
key- 存储在密钥选择器中的唯一密钥 - 结果
- 一个始终选择指定键的键选择器
- 异常
-
NullPointerException- ifkeyisnull
-
-