public abstract class KeyInfoFactory extends Object
KeyInfo个对象的工厂,或从相应的XML表示中解组KeyInfo对象。
KeyInfoFactory每个实例KeyInfoFactory支持特定的XML机制类型。 要创建一个KeyInfoFactory ,请调用静态getInstance方法之一,传递所需的XML机制类型,例如:
KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
该工厂生产的对象将基于DOM,并遵守API概述中DOM Mechanism Requirements部分定义的DOM互操作性要求。 有关标准机制类型的列表,请参阅API概述的Service Providers部分。
KeyInfoFactory机制注册和加载KeyInfoFactory实现。 例如,支持DOM机制的服务提供商将在Provider子类中Provider为:
put("KeyInfoFactory.DOM", "org.example.DOMKeyInfoFactory");
此外,由该工厂创建的XMLStructure s可能包含特定于KeyInfo状态,并不意图重复使用。
实现必须最低限度地支持默认机制类型:DOM。
注意,调用者必须使用相同KeyInfoFactory实例创建XMLStructure特定的第KeyInfo对象。 如果来自不同提供商的XMLStructure s或不同机制类型一起使用,行为是未定义的。
并发访问
该类的静态方法保证线程安全。 多个线程可以同时调用此类中定义的静态方法,而不会产生不良影响。
但是,对于此类定义的非静态方法,这不是真的。 除非特定提供者另有说明,否则需要同时访问单个KeyInfoFactory实例的线程应在其间同步并提供必要的锁定。 每个操作不同KeyInfoFactory实例的多个线程不需要同步。
| Modifier | Constructor and Description |
|---|---|
protected |
KeyInfoFactory()
默认构造函数,用于由子类调用。
|
| Modifier and Type | Method and Description |
|---|---|
static KeyInfoFactory |
getInstance()
返回一个
KeyInfoFactory支持默认XML处理机制和表示类型(“DOM”)。
|
static KeyInfoFactory |
getInstance(String mechanismType)
返回一个
KeyInfoFactory支持指定的XML处理机制和表示类型(比如:“DOM”)。
|
static KeyInfoFactory |
getInstance(String mechanismType, Provider provider)
返回一个
KeyInfoFactory ,它支持由指定的提供
KeyInfoFactory提供的请求的XML处理机制和表示类型(例如:“DOM”)。
|
static KeyInfoFactory |
getInstance(String mechanismType, String provider)
返回一个
KeyInfoFactory ,它支持由指定提供
KeyInfoFactory提供的请求的XML处理机制和表示类型(例如:“DOM”)。
|
String |
getMechanismType()
返回此
KeyInfoFactory (例如:“DOM”)支持的XML处理机制和表示形式
|
Provider |
getProvider()
返回此
KeyInfoFactory的提供者。
|
abstract URIDereferencer |
getURIDereferencer()
返回对URIDereferencer的引用,该 URIDereferencer默认情况下用于取消引用RetrievalMethod个对象中的URI。
|
abstract boolean |
isFeatureSupported(String feature)
指示是否支持指定的功能。
|
abstract KeyInfo |
newKeyInfo(List content)
创建包含
KeyInfo的关键信息类型列表的KeyInfo。
|
abstract KeyInfo |
newKeyInfo(List content, String id)
创建一个
KeyInfo其中包含指定的关键信息类型和可选标识列表。
|
abstract KeyName |
newKeyName(String name)
从指定的名称创建一个
KeyName 。
|
abstract KeyValue |
newKeyValue(PublicKey key)
从指定的公钥创建一个
KeyValue 。
|
abstract PGPData |
newPGPData(byte[] keyId)
创建一个
PGPData根据指定的PGP公钥标识符。
|
abstract PGPData |
newPGPData(byte[] keyId, byte[] keyPacket, List other)
根据指定的PGP公开密钥标识符和可选的密钥材料数据包和外部元素列表创建
PGPData 。
|
abstract PGPData |
newPGPData(byte[] keyPacket, List other)
从指定的PGP密钥材料数据包和外部元素的可选列表中创建
PGPData 。
|
abstract RetrievalMethod |
newRetrievalMethod(String uri)
从指定的URI创建一个
RetrievalMethod 。
|
abstract RetrievalMethod |
newRetrievalMethod(String uri, String type, List transforms)
创建
RetrievalMethod从指定的参数。
|
abstract X509Data |
newX509Data(List content)
创建一个
X509Data指定的X.509内容列表的X509Data。
|
abstract X509IssuerSerial |
newX509IssuerSerial(String issuerName, BigInteger serialNumber)
从指定的X.500发行人可分辨名称和序列号创建
X509IssuerSerial 。
|
abstract KeyInfo |
unmarshalKeyInfo(XMLStructure xmlStructure)
从机制特定的 XMLStructure (例如: DOMStructure )实例解组新的KeyInfo实例。
|
public static KeyInfoFactory getInstance(String mechanismType)
KeyInfoFactory支持指定的XML处理机制和表示类型(比如:“DOM”)。
此方法使用标准的JCA提供查找机制来查找并实例化KeyInfoFactory实现期望的机构的类型。 它通过注册安全性列表Provider s,从最优选的Provider 。 返回支持指定机制的第一个Provider新的KeyInfoFactory对象。
请注意,注册提供商的列表可以通过Security.getProviders()方法检索 。
mechanismType - XML处理机制和表示的类型。
有关标准机制类型的列表,请参阅API概述的Service Providers部分。
KeyInfoFactory
NullPointerException - 如果
mechanismType是
null
NoSuchMechanismException - 如果没有
Provider支持
KeyInfoFactory机制的KeyInfoFactory实现
Provider
public static KeyInfoFactory getInstance(String mechanismType, Provider provider)
KeyInfoFactory ,它支持由指定的提供KeyInfoFactory提供的请求的XML处理机制和表示类型(例如:“DOM”)。
请注意,指定的Provider对象不必在提供者列表中注册。
mechanismType - XML处理机制和表示的类型。
有关标准机制类型的列表,请参阅API概述的Service Providers部分。
provider -
Provider对象
KeyInfoFactory
NullPointerException - 如果
mechanismType或
provider是
null
NoSuchMechanismException - 如果指定
KeyInfoFactory KeyInfoFactory实现从指定的
Provider对象不可
Provider
Provider
public static KeyInfoFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException
KeyInfoFactory ,它支持由指定的提供KeyInfoFactory提供的请求的XML处理机制和表示类型(例如:“DOM”)。
指定的提供者必须在安全提供程序列表中注册。
请注意,注册提供商的列表可以通过Security.getProviders()方法检索 。
mechanismType - XML处理机制和表示的类型。
有关标准机制类型的列表,请参阅API概述的Service Providers部分。
provider - 提供者的字符串名称
KeyInfoFactory
NoSuchProviderException - 如果指定的提供程序未在安全提供程序列表中注册
NullPointerException - 如果
mechanismType或
provider是
null
NoSuchMechanismException - 如果指定
KeyInfoFactory KeyInfoFactory实现不能从指定的提供者
Provider
public static KeyInfoFactory getInstance()
KeyInfoFactory支持默认XML处理机制和表示类型(“DOM”)。
此方法使用标准的JCA提供者查找机制来查找并实例化一个KeyInfoFactory实现默认机制类型。 它通过注册安全性列表Provider s,从最优选的Provider 。 返回支持DOM机制的第一个Provider新的KeyInfoFactory对象。
请注意,注册提供商的列表可以通过Security.getProviders()方法检索 。
KeyInfoFactory
NoSuchMechanismException -如果没有
Provider支持
KeyInfoFactory实施DOM机制
Provider
public final String getMechanismType()
KeyInfoFactory (比如:“DOM”)
KeyInfoFactory
public final Provider getProvider()
KeyInfoFactory的提供者。
KeyInfoFactory的提供者
public abstract KeyInfo newKeyInfo(List content)
KeyInfo的关键信息类型列表的KeyInfo。
content - 表示密钥信息类型的一个或多个XMLStructure的列表。
该列表被防御复制以防止后续修改。
KeyInfo
NullPointerException - 如果
content是
null
IllegalArgumentException - 如果
content为空
ClassCastException - 如果content包含任何不是类型XMLStructure的条目
public abstract KeyInfo newKeyInfo(List content, String id)
KeyInfo其中包含指定的关键信息类型和可选标识列表。
所述id参数表示XML的值ID属性,是用于参考有用KeyInfo从其他XML结构。
content - 表示关键信息类型的一个或多个XMLStructure s的列表。
该列表被防御复制以防止后续修改。
id - 一个XML的值
ID (可能是
null )
KeyInfo
NullPointerException - 如果
content是
null
IllegalArgumentException - 如果
content为空
ClassCastException - 如果content包含任何不是类型XMLStructure的条目
public abstract KeyName newKeyName(String name)
KeyName 。
name - 标识密钥的名称
KeyName
NullPointerException - 如果
name是
null
public abstract KeyValue newKeyValue(PublicKey key) throws KeyException
KeyValue 。
key - 公钥
KeyValue
KeyException - 如果
key的算法未被该
KeyInfoFactory识别或
KeyInfoFactory
NullPointerException - 如果
key是
null
public abstract PGPData newPGPData(byte[] keyId)
PGPData根据指定的PGP公钥标识符。
keyId - RFC 2440第11.2节中定义的PGP公钥标识符。
克隆阵列以防止后续修改。
PGPData
NullPointerException - 如果
keyId是
null
IllegalArgumentException - 如果密钥ID不正确的格式
public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other)
PGPData 。
keyId - RFC 2440第11.2节中定义的PGP公钥标识符。
克隆阵列以防止后续修改。
keyPacket - RFC 2440第5.5节定义的PGP密钥资料包。
克隆阵列以防止后续修改。
可能是null 。
other - 表示来自外部命名空间的元素的XMLStructure s的列表。
该列表被防御复制以防止后续修改。
可能是null或空。
PGPData
NullPointerException - 如果
keyId是
null
IllegalArgumentException - 如果keyId或keyPacket不是正确的格式。
对于keyPacket ,检查数据包头的格式,并验证标签是否为密钥材料类型。
不检查数据包主体的内容和格式。
ClassCastException - 如果other包含任何不是类型XMLStructure的条目
public abstract PGPData newPGPData(byte[] keyPacket, List other)
PGPData 。
keyPacket - RFC 2440第5.5节定义的PGP密钥资料包。
克隆阵列以防止后续修改。
other - 表示来自外部命名空间的元素的XMLStructure s的列表。
该列表被防御复制以防止后续修改。
可能是null或空。
PGPData
NullPointerException - 如果
keyPacket是
null
IllegalArgumentException - 如果keyPacket不是正确的格式。
对于keyPacket ,检查分组报头的格式,并验证其是否是类型密钥材料的标签。
不检查数据包主体的内容和格式。
ClassCastException - 如果other包含任何不是XMLStructure类型的条目
public abstract RetrievalMethod newRetrievalMethod(String uri)
RetrievalMethod 。
uri - 标识要检索的
KeyInfo信息的URI
RetrievalMethod
NullPointerException - 如果
uri是
null
IllegalArgumentException - 如果
uri不符合RFC 2396标准
public abstract RetrievalMethod newRetrievalMethod(String uri, String type, List transforms)
RetrievalMethod从指定的参数。
uri - 标识要检索的
KeyInfo信息的URI
type -一个URI标识的类型
KeyInfo信息被检索(可以是
null )
transforms -列表Transform秒。
该列表被防御复制以防止后续修改。
可能是null或空。
RetrievalMethod
NullPointerException - 如果
uri是
null
IllegalArgumentException - 如果
uri不符合RFC 2396标准
ClassCastException - 如果transforms包含任何不是类型Transform的条目
public abstract X509Data newX509Data(List content)
X509Data指定的X.509内容列表的X509Data。
content - 一个或多个X.509内容类型的列表。
有效的类型是String (主题名称), byte[] (受试者密钥ID), X509Certificate , X509CRL ,或XMLStructure ( X509IssuerSerial从外部命名空间的物体或元件)。
主题名称是RFC 2253字符串格式的可分辨名称。
实现必须支持RFC 2253(CN,L,ST,O,OU,C,STREET,DC和UID)中定义的属性类型关键字。
实施可能支持其他关键字。
该列表被防御复制以防止后续修改。
X509Data
NullPointerException - 如果
content是
null
IllegalArgumentException - 如果
content为空,或者主题名称不符合RFC 2253或其中一个属性类型关键字未被识别。
ClassCastException - 如果
content包含不是上述有效类型之一的任何条目
public abstract X509IssuerSerial newX509IssuerSerial(String issuerName, BigInteger serialNumber)
X509IssuerSerial 。
issuerName - 发行人的RFC 2253字符串格式的可分辨名称。
实现必须支持RFC 2253(CN,L,ST,O,OU,C,STREET,DC和UID)中定义的属性类型关键字。
实施可能支持其他关键字。
serialNumber - 序列号
X509IssuerSerial
NullPointerException - 如果
issuerName或
serialNumber是
null
IllegalArgumentException - 如果发行人名称不符合RFC 2253或其中一个属性类型关键字未被识别。
public abstract boolean isFeatureSupported(String feature)
feature - 功能名称(作为绝对URI)
true如果指定的功能被支持,
false false
NullPointerException - 如果
feature是
null
public abstract URIDereferencer getURIDereferencer()
URIDereferencer ,默认情况下,它用于取消引用RetrievalMethod个对象中的URI。
URIDereferencer
public abstract KeyInfo unmarshalKeyInfo(XMLStructure xmlStructure) throws MarshalException
XMLStructure (例如: DOMStructure )实例解组新的KeyInfo实例。
xmlStructure - 从中解密keyinfo的机制特定的XML结构
KeyInfo
NullPointerException - 如果
xmlStructure是
null
ClassCastException -如果类型
xmlStructure不适合此工厂
MarshalException - 如果在解组时出现不可恢复的异常
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.