Signature element as
defined in the
W3C Recommendation for XML-Signature Syntax and Processing.
This class contains methods for signing and validating XML signatures
with behavior as defined by the W3C specification. The XML Schema Definition
is defined as:
<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>
An XMLSignature instance may be created by invoking one of the
newXMLSignature methods of the
XMLSignatureFactory class.
If the contents of the underlying document containing the
XMLSignature are subsequently modified, the behavior is
undefined.
Note that this class is named XMLSignature rather than
Signature to avoid naming clashes with the existing
java. class.
XMLSignatureFactory#newXMLSignature(SignedInfo, KeyInfo), XMLSignatureFactory#newXMLSignature(SignedInfo, KeyInfo, List, String, String)
| Modifier and Type | Class and Description |
|---|---|
| public static interface | XMLSignature.
A representation of the XML |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | XMLNS
The XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing. |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public KeyInfo | Returns: the key info (may benull if not specified)Returns the key info of this |
| public KeySelectorResult | Returns: the key selector result, ornull if a key
selector has not been specified or this XMLSignature
has not been signed or validatedReturns the result of the |
| public List | Returns: an unmodifiable list ofXMLObjects (may be empty
but never null)Returns an |
| public XMLSignature. | |
| public SignedInfo | |
| public void | |
| public boolean | Returns: true if the signature passed core validation,
otherwise falsethe validating context validateContext)Validates the signature according to the core validation processing rules. |
| XMLNS | back to summary |
|---|---|
| public static final String XMLNS The XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing. | |
| getId | back to summary |
|---|---|
| public String getId() Returns the optional Id of this
| |
| getKeyInfo | back to summary |
|---|---|
| public KeyInfo getKeyInfo() Returns the key info of this
| |
| getKeySelectorResult | back to summary |
|---|---|
| public KeySelectorResult getKeySelectorResult() Returns the result of the
| |
| getObjects | back to summary |
|---|---|
| public List Returns an | |
| getSignatureValue | back to summary |
|---|---|
| public XMLSignature. Returns the signature value of this
| |
| getSignedInfo | back to summary |
|---|---|
| public SignedInfo getSignedInfo() Returns the signed info of this
| |
| sign | back to summary |
|---|---|
| public void sign(XMLSignContext signContext) throws MarshalException, XMLSignatureException Signs this If this method throws an exception, this
| |
| validate | back to summary |
|---|---|
| public boolean validate(XMLValidateContext validateContext) throws XMLSignatureException Validates the signature according to the
core validation processing rules. This method validates the
signature using the existing state, it does not unmarshal and
reinitialize the contents of the This method only validates the signature the first time it is invoked. On subsequent invocations, it returns a cached result.
| |
SignatureValue element as
defined in the
W3C Recommendation for XML-Signature Syntax and Processing.
The XML Schema Definition is defined as:
<element name="SignatureValue" type="ds:SignatureValueType"/>
<complexType name="SignatureValueType">
<simpleContent>
<extension base="base64Binary">
<attribute name="Id" type="ID" use="optional"/>
</extension>
</simpleContent>
</complexType>
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: theId attribute (may be null if
not specified)Returns the optional |
| public byte[] | Returns: the signature value (may benull if the
XMLSignature has not been signed yet). Each
invocation of this method returns a new clone of the array to
prevent subsequent modification.Returns the signature value of this |
| public boolean | Returns: true if the signature was
validated successfully; false otherwisethe validating context validateContext)Validates the signature value. |
| getId | back to summary |
|---|---|
| public String getId() Returns the optional
| |
| getValue | back to summary |
|---|---|
| public byte[] getValue() Returns the signature value of this
| |
| validate | back to summary |
|---|---|
| public boolean validate(XMLValidateContext validateContext) throws XMLSignatureException Validates the signature value. This method performs a
cryptographic validation of the signature calculated over the
This method only validates the signature the first time it is invoked. On subsequent invocations, it returns a cached result.
| |