Package javax.xml.crypto.dsig
XMLSignature
, SignedInfo
, CanonicalizationMethod
, SignatureMethod
, Reference
, DigestMethod
, XMLObject
, Manifest
, SignatureProperties
, and SignatureProperty
. KeyInfo
types are defined in the javax.xml.crypto.dsig.keyinfo
subpackage. XMLSignatureFactory
is an abstract factory that creates XMLSignature
objects from scratch or from a pre-existing XML representation, such as a DOM node. TransformService
is a service provider interface for creating and plugging in implementations of transform and canonicalization algorithms.Of primary significance in this package is the XMLSignature
class, which allows you to sign and validate an XML digital signature.
Service Providers
A service provider is a concrete implementation of the abstractXMLSignatureFactory
and KeyInfoFactory
classes and is responsible for creating objects and algorithms that parse, generate and validate XML Signatures and KeyInfo structures. A concrete implementation of XMLSignatureFactory
MUST provide support for each of the REQUIRED algorithms as specified by the W3C recommendation for XML Signatures. It MAY support other algorithms as defined by the W3C recommendation or other specifications.The API leverages the JCA provider model (see the Provider class
) for registering and loading XMLSignatureFactory
and KeyInfoFactory
implementations.
Each concrete XMLSignatureFactory
or KeyInfoFactory
implementation supports a specific XML mechanism type that identifies the XML processing mechanism that an implementation uses internally to parse and generate XML signature and KeyInfo structures.
A service provider implementation SHOULD use underlying JCA engine classes, such as Signature
and MessageDigest
to perform cryptographic operations.
In addition to the XMLSignatureFactory
and KeyInfoFactory
classes, the API supports a service provider interface for transform and canonicalization algorithms. The TransformService
class allows you to develop and plug in an implementation of a specific transform or canonicalization algorithm for a particular XML mechanism type. The TransformService
class uses the standard JCA provider model for registering and loading implementations. Each service provider implementation SHOULD use the TransformService
class to find a provider that supports transform and canonicalization algorithms in XML Signatures that it is generating or validating.
DOM Mechanism Requirements
The following requirements MUST be abided by when implementing a DOM-basedXMLSignatureFactory
, KeyInfoFactory
or TransformService
in order to minimize interoperability problems:- The
unmarshalXMLSignature
method ofXMLSignatureFactory
MUST supportDOMValidateContext
types. If the type isDOMValidateContext
, it SHOULD contain anElement
of type Signature. Additionally, theunmarshalXMLSignature
method MAY populate the Id/Element mappings of the passed-inDOMValidateContext
. - The
sign
method ofXMLSignature
s produced byXMLSignatureFactory
MUST supportDOMSignContext
types and thevalidate
method MUST supportDOMValidateContext
types. This requirement also applies to thevalidate
method ofSignatureValue
and thevalidate
method ofReference
. - The implementation MUST support
DOMStructure
s as the mechanism for the application to specify extensible content (any elements or mixed content). - If the
dereference
method of user-specifiedURIDereferencer
s returnsNodeSetData
objects, theiterator
method MUST return an iteration over objects of typeorg.w3c.dom.Node
. -
URIReference
objects passed to thedereference
method of user-specifiedURIDereferencer
s MUST be of typeDOMURIReference
andXMLCryptoContext
objects MUST implementDOMCryptoContext
. - The previous 2 requirements also apply to
URIDereferencer
s returned by thegetURIDereferencer
method ofXMLSignatureFactory
andKeyInfoFactory
. - The
unmarshalKeyInfo
method ofKeyInfoFactory
MUST supportDOMStructure
types. If the type isDOMStructure
, it SHOULD contain anElement
of typeKeyInfo
. - The
transform
method ofTransform
MUST supportDOMCryptoContext
context parameter types. - The
newtransform
andnewCanonicalizationMethod
methods ofXMLSignatureFactory
MUST supportDOMStructure
parameter types. - The
init
, andmarshalParams
methods ofTransformService
MUST supportDOMStructure
andDOMCryptoContext
types. - The
unmarshalXMLSignature
method ofXMLSignatureFactory
MUST supportDOMStructure
types. If the type isDOMStructure
, it SHOULD contain anElement
of typeSignature
. - The
marshal
method ofKeyInfo
MUST supportDOMStructure
andDOMCryptoContext
parameter types.
Note that a DOM implementation MAY internally use other XML parsing APIs other than DOM as long as it doesn't affect interoperability. For example, a DOM implementation of XMLSignatureFactory
might use a SAX parser internally to canonicalize data.
Package Specification
- Since:
- 1.6
-
Interface Summary Interface Description CanonicalizationMethod A representation of the XMLCanonicalizationMethod
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .DigestMethod A representation of the XMLDigestMethod
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .Manifest A representation of the XMLManifest
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .Reference A representation of theReference
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .SignatureMethod A representation of the XMLSignatureMethod
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .SignatureProperties A representation of the XMLSignatureProperties
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .SignatureProperty A representation of the XMLSignatureProperty
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .SignedInfo An representation of the XMLSignedInfo
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .Transform A representation of the XMLTransform
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .XMLObject A representation of the XMLObject
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .XMLSignature A representation of the XMLSignature
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .XMLSignature.SignatureValue A representation of the XMLSignatureValue
element as defined in the W3C Recommendation for XML-Signature Syntax and Processing .XMLSignContext Contains context information for generating XML Signatures.XMLValidateContext Contains context information for validating XML Signatures. -
Class Summary Class Description TransformService A Service Provider Interface for transform and canonicalization algorithms.XMLSignatureFactory A factory for creatingXMLSignature
objects from scratch or for unmarshalling anXMLSignature
object from a corresponding XML representation. -
Exception Summary Exception Description TransformException Indicates an exceptional condition that occurred while executing a transform algorithm.XMLSignatureException Indicates an exceptional condition that occurred during the XML signature generation or validation process.