-  
       
- All Superinterfaces:
 -  
         
XMLStructure 
public interface KeyInfo extends XMLStructure
在XML的表示KeyInfo元件中的定义, W3C Recommendation for XML-Signature Syntax and Processing 。 甲KeyInfo包含的列表XMLStructure个 S,其中的每一个包含能够使接收者(一个或多个),以获得验证XML签名所需的关键信息。 XML Schema Definition定义为:<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"));也可以通过调用
marshal方法将KeyInfo对象编组为XML。- 从以下版本开始:
 - 1.6
 - 另请参见:
 -  
         
KeyInfoFactory.newKeyInfo(List),KeyInfoFactory.newKeyInfo(List, String) 
 
-  
        
       
-  
             
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 List<XMLStructure>getContent()返回包含密钥信息的unmodifiable list。StringgetId()返回此KeyInfo的可选Id属性,这可能对从其他XML结构引用此KeyInfo非常有用。voidmarshal(XMLStructure parent, XMLCryptoContext context)将关键信息编组为XML。-  
               
声明方法的接口 javax.xml.crypto.XMLStructure
isFeatureSupported 
 -  
               
 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
getContent
List<XMLStructure> getContent()
返回包含密钥信息的unmodifiable list。 列表的每个条目都是XMLStructure。如果存在表示类型
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 
 
 -  
 
 -