|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
public interface KeyInfo
W3C Recommendation for XML-Signature Syntax and Processing 中定义的 XML KeyInfo 元素的表示形式。KeyInfo 包含 XMLStructure 的列表,其中每一个 XMLStructure 都包含支持接受方获取验证 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。
KeyInfoFactory.newKeyInfo(List),
KeyInfoFactory.newKeyInfo(List, String)| 方法摘要 | |
|---|---|
List |
getContent()
返回包含密钥信息的 unmodifiable list。 |
String |
getId()
返回此 KeyInfo 的可选 Id 属性,这对于从其他 XML 结构引用此 KeyInfo 可能很有用。 |
void |
marshal(XMLStructure parent,
XMLCryptoContext context)
将密钥信息编组为 XML。 |
| 从接口 javax.xml.crypto.XMLStructure 继承的方法 |
|---|
isFeatureSupported |
| 方法详细信息 |
|---|
List getContent()
unmodifiable list。列表中的每一项都是一个 XMLStructure。
如果有一个表示 XMLStructure 类型的公共子类,那么它将作为该类的实例返回(比如:X509Data 元素将作为 X509Data 的实例返回)。
KeyInfo 中的一个或多个 XMLStructure 的不可修改列表。不会返回 null 或空列表。String getId()
KeyInfo 的可选 Id 属性,这对于从其他 XML 结构引用此 KeyInfo 可能很有用。
KeyInfo 的 Id 属性(如果未指定,则返回 null)
void marshal(XMLStructure parent,
XMLCryptoContext context)
throws MarshalException
parent - 特定于机制的结构,包含将追加已编组密钥信息中的父节点context - 包含其他上下文的 XMLCryptoContext(如果不适用,则为 null)
ClassCastException - 如果 parent 或 context 的类型与此密钥信息不兼容
MarshalException - 如果无法编组密钥信息
NullPointerException - 如果 parent 为 null
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。