-
- All Superinterfaces:
- XMLStructure
public interface XMLSignature extends XMLStructure
A representation of the XMLSignatureelement 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
XMLSignatureinstance may be created by invoking one of thenewXMLSignaturemethods of theXMLSignatureFactoryclass.If the contents of the underlying document containing the
XMLSignatureare subsequently modified, the behavior is undefined.Note that this class is named
XMLSignaturerather thanSignatureto avoid naming clashes with the existingjava.security.Signatureclass.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static interfaceXMLSignature.SignatureValueA representation of the XMLSignatureValueelement as defined in the W3C Recommendation for XML-Signature Syntax and Processing.
-
Field Summary
Fields Modifier and Type Field and Description static StringXMLNSThe XML Namespace URI of the W3C Recommendation for XML-Signature Syntax and Processing.
-
Method Summary
Methods Modifier and Type Method and Description StringgetId()Returns the optional Id of thisXMLSignature.KeyInfogetKeyInfo()Returns the key info of thisXMLSignature.KeySelectorResultgetKeySelectorResult()Returns the result of theKeySelector, if specified, after thisXMLSignaturehas been signed or validated.ListgetObjects()XMLSignature.SignatureValuegetSignatureValue()Returns the signature value of thisXMLSignature.SignedInfogetSignedInfo()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 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 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, otherwisefalse- Throws:
ClassCastException- if the type ofvalidateContextis not compatible with thisXMLSignatureNullPointerException- ifvalidateContextisnullXMLSignatureException- 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
nullif 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
XMLObjects (may be empty but nevernull)
-
getId
String getId()
Returns the optional Id of thisXMLSignature.- Returns:
- the Id (may be
nullif 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
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 ofsignContextis not compatible with thisXMLSignatureNullPointerException- ifsignContextisnullMarshalException- 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 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
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/xml/crypto/dsig/xmlsignature.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.