public interface XMLSignature extends XMLStructure
Signature
元在
W3C Recommendation for XML-Signature Syntax and Processing定义。这类包含签名和验证XML签名和行为由W3C规范定义的方法。XML架构定义的定义是:
<element name="Signature" type="ds:SignatureType"/>
<complexType name="SignatureType">
<sequence>
<element ref="ds:SignedInfo"/>
<element ref="ds:SignatureValue"/>
<element ref="ds:KeyInfo" minOccurs="0"/>
<element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
一个XMLSignature
实例可以通过调用一个类的方法创建的newXMLSignature
XMLSignatureFactory
。
如果基础文档包含的内容XMLSignature
随后进行修改,其行为是未定义的。
注意这个类命名为XMLSignature
而不是Signature
避免命名冲突与现有的java.security.Signature
类。
Modifier and Type | Interface and Description |
---|---|
static interface |
XMLSignature.SignatureValue
一个表示的XML
SignatureValue 元在
W3C Recommendation for XML-Signature Syntax and Processing定义。
|
Modifier and Type | Field and Description |
---|---|
static String |
XMLNS
对XML签名语法和处理W3C推荐的XML命名空间URI。
|
Modifier and Type | Method and Description |
---|---|
String |
getId()
返回该
XMLSignature 可选的id。
|
KeyInfo |
getKeyInfo()
返回该
XMLSignature 关键信息。
|
KeySelectorResult |
getKeySelectorResult()
如果指定返回的
KeySelector ,结果,在这
XMLSignature 已经签署或确认。
|
List |
getObjects()
|
XMLSignature.SignatureValue |
getSignatureValue()
返回该
XMLSignature 签名值。
|
SignedInfo |
getSignedInfo()
签署本
XMLSignature 返回信息。
|
void |
sign(XMLSignContext signContext)
这
XMLSignature 迹象。
|
boolean |
validate(XMLValidateContext validateContext)
根据
core validation processing rules验证签名。
|
isFeatureSupported
static final String XMLNS
boolean validate(XMLValidateContext validateContext) throws XMLSignatureException
XMLSignature
使用上下文中指定的位置信息。
此方法只在调用它的第一次时验证签名。在随后的调用,它返回一个缓存的结果。
validateContext
-验证的上下文
true
如果签名通过核心验证,否则
false
ClassCastException
-如果
validateContext
类型是不是与此
XMLSignature
兼容
null
validateContext
NullPointerException
XMLSignatureException
-如果验证,防止验证操作完成时发生意外错误
KeyInfo getKeyInfo()
XMLSignature
关键信息。
null
如果不指定)
SignedInfo getSignedInfo()
XMLSignature
返回信息。
null
)
List getObjects()
XMLObject
s的一个不可修改的列表(可能为空而不
null
)
String getId()
XMLSignature
可选的id。
null
如果不指定)
XMLSignature.SignatureValue getSignatureValue()
XMLSignature
签名值。
void sign(XMLSignContext signContext) throws MarshalException, XMLSignatureException
XMLSignature
迹象。
如果此方法抛出一个异常,这XMLSignature
和signContext
参数将剩下的状态,它是在调用之前。
signContext
-签约背景
ClassCastException
-如果
signContext
类型是不是与此
XMLSignature
兼容
null
signContext
NullPointerException
MarshalException
-如果发生异常而编组
XMLSignatureException
如果发生意外的异常而产生的签名
KeySelectorResult getKeySelectorResult()
KeySelector
,结果,在这
XMLSignature
已经签署或确认。
null
如果关键选择器没有指定或本
XMLSignature
尚未签署或确认
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.