This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.xml.crypto.dsig
interface XMLSignature

All Superinterfaces:
XMLStructure

Most common way to construct:

XMLSignatureFactory fac = …;
SignedInfo si = …;
KeyInfo ki = …;

XMLSignature signature = fac.newXMLSignature(si, ki);

Based on 56 examples


public interface XMLSignature
extends 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 {@link XMLSignatureFactory#newXMLSignature newXMLSignature} methods of the {@link 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 {@link Signature java.security.Signature} class.


Nested Class Summary
static interface

           A representation of the XML SignatureValue element as defined in the W3C Recommendation for XML-Signature Syntax and Processing.
 
Field Summary
static String XMLNS
          The XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing.
 
Method Summary
 String

          Returns the optional Id of this XMLSignature.
 KeyInfo

          Returns the key info of this XMLSignature.
 KeySelectorResult

          Returns the result of the javax.xml.crypto.KeySelector, if specified, after this XMLSignature has been signed or validated.
 List

          Returns an java.util.Collections.unmodifiableList of javax.xml.crypto.dsig.XMLObjects contained in this XMLSignature.
 XMLSignature.SignatureValue

          Returns the signature value of this XMLSignature.
 SignedInfo

          Returns the signed info of this XMLSignature.
 void
sign(XMLSignContext signContext)

          Signs this XMLSignature.
 boolean
validate(XMLValidateContext validateContext)

          Validates the signature according to the core validation processing rules.
 
Methods inherited from class javax.xml.crypto.XMLStructure
isFeatureSupported
 

Field Detail

XMLNS

public static final String XMLNS
The XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing.
Method Detail

getId

public String getId()
Returns the optional Id of this XMLSignature.

Returns:
the Id (may be null if not specified)

getKeyInfo

public KeyInfo getKeyInfo()
Returns the key info of this XMLSignature.

Returns:
the key info (may be null if not specified)

getKeySelectorResult

public KeySelectorResult getKeySelectorResult()
Returns the result of the {@link KeySelector}, if specified, after this XMLSignature has been signed or validated.

Returns:
the key selector result, or null if a key selector has not been specified or this XMLSignature has not been signed or validated

getObjects

public List getObjects()
Returns an {@link java.util.Collections#unmodifiableList unmodifiable list} of {@link XMLObject}s contained in this XMLSignature.

Returns:
an unmodifiable list of XMLObjects (may be empty but never null)

getSignatureValue

public XMLSignature.SignatureValue getSignatureValue()
Returns the signature value of this XMLSignature.

Returns:
the signature value

getSignedInfo

public SignedInfo getSignedInfo()
Returns the signed info of this XMLSignature.

Returns:
the signed info (never null)

sign

public void sign(XMLSignContext signContext)
          throws MarshalException,
                 XMLSignatureException
Signs this XMLSignature.

If this method throws an exception, this XMLSignature and the signContext parameter will be left in the state that it was in prior to the invocation.

Parameters:
signContext - the signing context
Throws:
MarshalException - if an exception occurs while marshalling
XMLSignatureException - if an unexpected exception occurs while generating the signature

validate

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 XMLSignature using 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:
true if the signature passed core validation, otherwise false
Throws:
XMLSignatureException - if an unexpected error occurs during validation that prevented the validation operation from completing


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.