public interface Reference extends URIReference, XMLStructure
Reference元素的表示 。
XML模式定义为:
<element name="Reference" type="ds:ReferenceType"/>
<complexType name="ReferenceType">
<sequence>
<element ref="ds:Transforms" minOccurs="0"/>
<element ref="ds:DigestMethod"/>
<element ref="ds:DigestValue"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
<attribute name="URI" type="anyURI" use="optional"/>
<attribute name="Type" type="anyURI" use="optional"/>
</complexType>
<element name="DigestValue" type="ds:DigestValueType"/>
<simpleType name="DigestValueType">
<restriction base="base64Binary"/>
</simpleType>
可以通过调用XMLSignatureFactory类的newReference方法之一创建Reference实例。 例如:
XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
Reference ref = factory.newReference
("http://www.ietf.org/rfc/rfc3275.txt",
factory.newDigestMethod(DigestMethod.SHA1, null));
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getCalculatedDigestValue()
在验证
Reference后返回此Reference的计算摘要值。
|
Data |
getDereferencedData()
返回取消引用的数据,如果
reference caching启用。
|
InputStream |
getDigestInputStream()
如果启用了
reference caching ,则返回预消化的输入流。
|
DigestMethod |
getDigestMethod()
返回此
Reference的摘要方法。
|
byte[] |
getDigestValue()
返回此
Reference的摘要值。
|
String |
getId()
返回此
Reference的可选
Id属性,该
Reference允许从其他地方引用该引用。
|
List |
getTransforms()
返回此Reference中包含的 Transform s的Reference 。
|
boolean |
validate(XMLValidateContext validateContext)
验证此引用。
|
getType, getURIisFeatureSupportedList getTransforms()
Transform s的Reference 。
Transform S(可能是空的,但从来没有
null )
DigestMethod getDigestMethod()
Reference的摘要方法。
String getId()
Reference的可选
Id属性,该
Reference允许从其他地方引用该引用。
Id属性(可以是
null如果未指定)
byte[] getDigestValue()
Reference的摘要值。
null如果此引用尚未消化。
此方法的每次调用都将返回一个新的克隆以防止后续修改。
byte[] getCalculatedDigestValue()
Reference后返回此Reference的计算摘要值。
如果引用无法验证,此方法对于调试非常有用。
null如果此引用尚未验证)。
此方法的每次调用都将返回一个新的克隆以防止后续修改。
boolean validate(XMLValidateContext validateContext) throws XMLSignatureException
此方法仅在第一次调用时验证引用。 在随后的调用中,它返回缓存的结果。
validateContext - 验证上下文
true如果此引用已成功验证;
false否则
NullPointerException - 如果
validateContext是
null
XMLSignatureException - 如果在验证引用时发生意外异常
Data getDereferencedData()
null如果引用缓存未启用或该引用尚未生成或验证
InputStream getDigestInputStream()
null if reference caching is not enabled or this reference has not been generated or validated
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.