-
- All Superinterfaces:
- XMLStructure
public interface XMLSignature extends XMLStructure
A representation of the XMLSignature
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 thenewXMLSignature
methods of theXMLSignatureFactory
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 thanSignature
to avoid naming clashes with the existingjava.security.Signature
class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static interface
XMLSignature.SignatureValue
A representation of the XMLSignatureValue
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing.
-
Field Summary
Fields Modifier and Type Field and Description static String
XMLNS
The XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing.
-
Method Summary
Methods Modifier and Type Method and Description String
getId()
Returns the optional Id of thisXMLSignature
.KeyInfo
getKeyInfo()
Returns the key info of thisXMLSignature
.KeySelectorResult
getKeySelectorResult()
Returns the result of theKeySelector
, if specified, after thisXMLSignature
has been signed or validated.List
getObjects()
XMLSignature.SignatureValue
getSignatureValue()
Returns the signature value of thisXMLSignature
.SignedInfo
getSignedInfo()
Returns the signed info of thisXMLSignature
.void
sign(XMLSignContext signContext)
Signs thisXMLSignature
.boolean
validate(XMLValidateContext validateContext)
Validates the signature according to the core validation processing rules.-
Methods inherited from interface javax.xml.crypto.XMLStructure
isFeatureSupported
-
-
-
-
Field Detail
-
XMLNS
static final String XMLNS
The XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing.- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
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 theXMLSignature
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, otherwisefalse
- Throws:
ClassCastException
- if the type ofvalidateContext
is not compatible with thisXMLSignature
NullPointerException
- ifvalidateContext
isnull
XMLSignatureException
- if an unexpected error occurs during validation that prevented the validation operation from completing
-
getKeyInfo
KeyInfo getKeyInfo()
Returns the key info of thisXMLSignature
.- Returns:
- the key info (may be
null
if not specified)
-
getSignedInfo
SignedInfo getSignedInfo()
Returns the signed info of thisXMLSignature
.- Returns:
- the signed info (never
null
)
-
getObjects
List getObjects()
- Returns:
- an unmodifiable list of
XMLObject
s (may be empty but nevernull
)
-
getId
String getId()
Returns the optional Id of thisXMLSignature
.- Returns:
- the Id (may be
null
if not specified)
-
getSignatureValue
XMLSignature.SignatureValue getSignatureValue()
Returns the signature value of thisXMLSignature
.- Returns:
- the signature value
-
sign
void sign(XMLSignContext signContext) throws MarshalException, XMLSignatureException
Signs thisXMLSignature
.If this method throws an exception, this
XMLSignature
and thesignContext
parameter will be left in the state that it was in prior to the invocation.- Parameters:
signContext
- the signing context- Throws:
ClassCastException
- if the type ofsignContext
is not compatible with thisXMLSignature
NullPointerException
- ifsignContext
isnull
MarshalException
- if an exception occurs while marshallingXMLSignatureException
- if an unexpected exception occurs while generating the signature
-
getKeySelectorResult
KeySelectorResult getKeySelectorResult()
Returns the result of theKeySelector
, if specified, after thisXMLSignature
has been signed or validated.- Returns:
- the key selector result, or
null
if a key selector has not been specified or thisXMLSignature
has not been signed or validated
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/11/2024 21:29:37 Cette version de la page est en cache (à la date du 21/11/2024 21:29:37) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 11/06/2005, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/xml/crypto/dsig/XMLSignature.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.