-
- All Superinterfaces:
-
XMLStructure
public interface KeyInfo extends XMLStructure
KeyInfo中定义的XMLKeyInfo元素的表示 。 甲KeyInfo包含的列表XMLStructure个 S,其中的每一个包含能够使接收者(一个或多个),以获得验证XML签名所需的关键信息。 XML模式定义定义为:<element name="KeyInfo" type="ds:KeyInfoType"/> <complexType name="KeyInfoType" mixed="true"> <choice maxOccurs="unbounded"> <element ref="ds:KeyName"/> <element ref="ds:KeyValue"/> <element ref="ds:RetrievalMethod"/> <element ref="ds:X509Data"/> <element ref="ds:PGPData"/> <element ref="ds:SPKIData"/> <element ref="ds:MgmtData"/> <any processContents="lax" namespace="##other"/> <!-- (1,1) elements from (0,unbounded) namespaces --> </choice> <attribute name="Id" type="ID" use="optional"/> </complexType>可以通过调用KeyInfoFactory类的newKeyInfo方法之一并传递一个或多个XMLStructure的列表和可选的id参数来创建KeyInfo实例。 例如:KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM"); KeyInfo keyInfo = factory.newKeyInfo (Collections.singletonList(factory.newKeyName("Alice"), "keyinfo-1"));KeyInfo对象也可以通过调用marshal方法编组到XML。- 从以下版本开始:
- 1.6
- 另请参见:
-
KeyInfoFactory.newKeyInfo(List),KeyInfoFactory.newKeyInfo(List, String)
-
-
方法摘要
所有方法 接口方法 抽象方法 Modifier and Type 方法 描述 List<XMLStructure>getContent()返回包含密钥信息的unmodifiable list。StringgetId()返回此KeyInfo的可选Id属性,这对于从其他XML结构引用此KeyInfo可能很有用。voidmarshal(XMLStructure parent, XMLCryptoContext context)将关键信息传达给XML。-
Methods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
-
-
-
-
方法详细信息
-
getContent
List<XMLStructure> getContent()
返回包含密钥信息的unmodifiable list。 列表的每个条目是一个XMLStructure。如果有一个表示
XMLStructure类型的公共子类,则作为该类的实例返回(例如:X509Data元素将作为X509Data的实例返回)。- 结果
-
这个
KeyInfo中的一个或多个XMLStructure的不可修改的列表。 永远不会返回null或空列表。
-
getId
String getId()
返回此KeyInfo的可选Id属性,这对于从其他XML结构引用此KeyInfo可能很有用。- 结果
-
该
KeyInfo的Id属性(如果未指定,null)
-
marshal
void marshal(XMLStructure parent, XMLCryptoContext context) throws MarshalException
将关键信息传达给XML。- 参数
-
parent- 一个机制特定的结构,包含编组的密钥信息将被附加到的父节点 -
context- 包含附加上下文的XMLCryptoContext(如果不适用,可以为null) - 异常
-
ClassCastException- 如果parent或context的类型与此密钥信息不兼容 -
MarshalException- 如果密钥信息无法编组 -
NullPointerException- 如果parent是null
-
-