-
- All Superinterfaces:
-
URIReference,XMLStructure
public interface Reference extends URIReference, XMLStructure
所述的表示Reference元件中的定义, W3C Recommendation for XML-Signature Syntax and Processing 。 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));
-
-
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 byte[]getCalculatedDigestValue()验证操作后,返回此Reference的计算摘要值。DatagetDereferencedData()如果启用了 reference caching ,则返回解除引用的数据。InputStreamgetDigestInputStream()如果启用了 reference caching ,则返回预先消化的输入流。DigestMethodgetDigestMethod()返回此Reference的摘要方法。byte[]getDigestValue()返回此Reference的摘要值。StringgetId()返回此Reference的可选Id属性,该属性允许从其他位置引用此引用。List<Transform>getTransforms()返回5178171395041 ,共Transforms,包含在Reference。booleanvalidate(XMLValidateContext validateContext)验证此引用。-
声明方法的接口 javax.xml.crypto.URIReference
getType, getURI
-
声明方法的接口 javax.xml.crypto.XMLStructure
isFeatureSupported
-
-
-
-
方法详细信息
-
getTransforms
List<Transform> getTransforms()
返回此Reference中包含的unmodifiable listofTransforms。- 结果
-
一个不可修改的清单
Transform(可能是空的,但从不是null)
-
getDigestMethod
DigestMethod getDigestMethod()
返回此Reference的摘要方法。- 结果
- 摘要方法
-
getId
String getId()
返回此Reference的可选Id属性,该属性允许从其他位置引用此引用。- 结果
-
Id属性(如果未指定,可能是null)
-
getDigestValue
byte[] getDigestValue()
返回此Reference的摘要值。- 结果
-
原始摘要值,如果尚未消化该引用,
null。 每次调用此方法都会返回一个新的克隆,以防止后续修改。
-
getCalculatedDigestValue
byte[] getCalculatedDigestValue()
验证操作后,返回此Reference的计算摘要值。 如果引用无法验证,此方法对于调试很有用。- 结果
-
计算的摘要值,如果尚未验证此引用,
null。 每次调用此方法都会返回一个新的克隆,以防止后续修改。
-
validate
boolean validate(XMLValidateContext validateContext) throws XMLSignatureException
验证此引用。 此方法验证此引用的摘要。此方法仅在第一次调用时验证引用。 在后续调用中,它返回缓存的结果。
- 参数
-
validateContext- 验证上下文 - 结果
-
true如果此引用已成功验证; 否则为false - 异常
-
NullPointerException- 如果validateContext是null -
XMLSignatureException- 如果在验证引用时发生意外异常
-
getDereferencedData
Data getDereferencedData()
如果启用了reference caching ,则返回解除引用的数据。 这是在验证或生成操作期间取消引用此引用的URI的结果。- 结果
-
解除引用的数据,或
null如果未启用引用缓存或尚未生成或验证此引用
-
getDigestInputStream
InputStream getDigestInputStream()
如果启用了reference caching ,则返回预先消化的输入流。 这是验证或签名操作期间摘要操作的输入。- 结果
-
an input stream containing the pre-digested input, or
nullif reference caching is not enabled or this reference has not been generated or validated
-
-