- 所有超接口:
-
URIReference,XMLStructure
表示在W3C XML签名语法和处理推荐标准中定义的
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));
- 自版本:
- 1.6
- 参见:
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]在验证操作后返回此Reference的计算摘要值。如果启用了引用缓存,则返回解引用的数据。如果启用了引用缓存,则返回预摘要的输入流。返回此Reference的摘要方法。byte[]返回此Reference的摘要值。getId()返回此Reference的可选Id属性,允许从其他地方引用此引用。返回包含在此Reference中的一组不可修改的Transform列表。booleanvalidate(XMLValidateContext validateContext) 验证此引用。Methods declared in interface javax.xml.crypto.URIReference
getType, getURIMethods declared in interface javax.xml.crypto.XMLStructure
isFeatureSupported
-
Method Details
-
getTransforms
- 返回:
-
一个
Transform列表(可能为空但绝不为null)的不可修改列表
-
getDigestMethod
DigestMethod getDigestMethod()返回此Reference的摘要方法。- 返回:
- 摘要方法
-
getId
String getId()返回此Reference的可选Id属性,允许从其他地方引用此引用。- 返回:
-
Id属性(如果未指定可能为null)
-
getDigestValue
byte[] getDigestValue()返回此Reference的摘要值。- 返回:
-
原始摘要值,如果此引用尚未被摘要,则返回
null。每次调用此方法都会返回一个新的克隆以防止后续修改。
-
getCalculatedDigestValue
byte[] getCalculatedDigestValue()在验证操作后返回此Reference的计算摘要值。如果引用未能验证,此方法对于调试很有用。- 返回:
-
计算的摘要值,如果此引用尚未被验证,则返回
null。每次调用此方法都会返回一个新的克隆以防止后续修改。
-
validate
验证此引用。此方法验证此引用的摘要。此方法仅在首次调用时验证引用。在后续调用中,它会返回缓存的结果。
- 参数:
-
validateContext- 验证上下文 - 返回:
-
如果此引用验证成功,则返回
true;否则返回false - 抛出:
-
NullPointerException- 如果validateContext为null -
XMLSignatureException- 如果在验证引用时发生意外异常
-
getDereferencedData
Data getDereferencedData()如果启用了引用缓存,则返回解引用的数据。这是在验证或生成操作期间解引用此引用的结果。- 返回:
-
解引用的数据,如果未启用引用缓存或此引用尚未生成或验证,则返回
null
-
getDigestInputStream
InputStream getDigestInputStream()如果启用了引用缓存,则返回预摘要的输入流。这是在验证或签名操作期间摘要操作的输入。- 返回:
-
包含预摘要输入的输入流,如果未启用引用缓存或此引用尚未生成或验证,则返回
null
-