- All Superinterfaces:
- XMLStructure
A representation of the XML 
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.security.Signature class.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA representation of the XMLSignatureValueelement as defined in the W3C Recommendation for XML-Signature Syntax and Processing.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptiongetId()Returns the optional Id of thisXMLSignature.Returns the key info of thisXMLSignature.Returns the result of theKeySelector, if specified, after thisXMLSignaturehas been signed or validated.Returns the signature value of thisXMLSignature.Returns the signed info of thisXMLSignature.voidsign(XMLSignContext signContext) Signs thisXMLSignature.booleanvalidate(XMLValidateContext validateContext) Validates the signature according to the core validation processing rules.Methods declared in interface javax.xml.crypto.XMLStructureisFeatureSupported
- 
Field Details- 
XMLNSThe XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing.- See Also:
 
 
- 
- 
Method Details- 
validateValidates 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 theXMLSignatureusing the location information specified in the context.This method only validates the signature the first time it is invoked. On subsequent invocations, it returns a cached result. - Parameters:
- validateContext- the validating context
- Returns:
- trueif the signature passed core validation, otherwise- false
- Throws:
- ClassCastException- if the type of- validateContextis not compatible with this- XMLSignature
- NullPointerException- if- validateContextis- null
- XMLSignatureException- if an unexpected error occurs during validation that prevented the validation operation from completing
 
- 
getKeyInfoKeyInfo getKeyInfo()Returns the key info of thisXMLSignature.- Returns:
- the key info (may be nullif not specified)
 
- 
getSignedInfoSignedInfo getSignedInfo()Returns the signed info of thisXMLSignature.- Returns:
- the signed info (never null)
 
- 
getObjects- Returns:
- an unmodifiable list of XMLObjects (may be empty but nevernull)
 
- 
getIdString getId()Returns the optional Id of thisXMLSignature.- Returns:
- the Id (may be nullif not specified)
 
- 
getSignatureValueXMLSignature.SignatureValue getSignatureValue()Returns the signature value of thisXMLSignature.- Returns:
- the signature value
 
- 
signSigns thisXMLSignature.If this method throws an exception, this XMLSignatureand thesignContextparameter will be left in the state that it was in prior to the invocation.- Parameters:
- signContext- the signing context
- Throws:
- ClassCastException- if the type of- signContextis not compatible with this- XMLSignature
- NullPointerException- if- signContextis- null
- MarshalException- if an exception occurs while marshalling
- XMLSignatureException- if an unexpected exception occurs while generating the signature
 
- 
getKeySelectorResultKeySelectorResult getKeySelectorResult()Returns the result of theKeySelector, if specified, after thisXMLSignaturehas been signed or validated.- Returns:
- the key selector result, or nullif a key selector has not been specified or thisXMLSignaturehas not been signed or validated
 
 
-