APIdia Launch Partner
Top Description Fields Constructors Methods
javax.xml.crypto.dsig

public abstract Class XMLSignatureFactory

extends Object
Class Inheritance
Known Direct Subclasses
org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory
Imports
javax.xml.crypto.Data, .MarshalException, .NoSuchMechanismException, .URIDereferencer, .XMLStructure, javax.xml.crypto.dom.DOMStructure, javax.xml.crypto.dsig.keyinfo.KeyInfo, .KeyInfoFactory, javax.xml.crypto.dsig.spec.*, javax.xml.crypto.dsig.dom.DOMValidateContext, .DOMSignContext, java.security.InvalidAlgorithmParameterException, .NoSuchAlgorithmException, .NoSuchProviderException, .Provider, .Provider.Service, .Security, java.util.List

A factory for creating XMLSignature objects from scratch or for unmarshalling an XMLSignature object from a corresponding XML representation.

XMLSignatureFactory Type

Each instance of XMLSignatureFactory supports a specific XML mechanism type. To create an XMLSignatureFactory, call one of the static getInstance methods, passing in the XML mechanism type desired, for example:

XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");

The objects that this factory produces will be based on DOM and abide by the DOM interoperability requirements as defined in the DOM Mechanism Requirements. See the XMLSignatureFactory section in the Java Security Standard Algorithm Names Specification for a list of standard mechanism types.

XMLSignatureFactory implementations are registered and loaded using the java.security.Provider mechanism. For example, a service provider that supports the DOM mechanism would be specified in the Provider subclass as:

    put("XMLSignatureFactory.DOM", "org.example.DOMXMLSignatureFactory");

An implementation MUST minimally support the default mechanism type: DOM.

Note that a caller must use the same XMLSignatureFactory instance to create the XMLStructures of a particular XMLSignature that is to be generated. The behavior is undefined if XMLStructures from different providers or different mechanism types are used together.

Also, the XMLStructures that are created by this factory may contain state specific to the XMLSignature and are not intended to be reusable.

Creating XMLSignatures from scratch

Once the XMLSignatureFactory has been created, objects can be instantiated by calling the appropriate method. For example, a Reference instance may be created by invoking one of the newReference methods.

Unmarshalling XMLSignatures from XML

Alternatively, an XMLSignature may be created from an existing XML representation by invoking the unmarshalXMLSignature method and passing it a mechanism-specific XMLValidateContext instance containing the XML content:

DOMValidateContext context = new DOMValidateContext(key, signatureElement);
XMLSignature signature = factory.unmarshalXMLSignature(context);
Each XMLSignatureFactory must support the required XMLValidateContext types for that factory type, but may support others. A DOM XMLSignatureFactory must support DOMValidateContext objects.

Signing and marshalling XMLSignatures to XML

Each XMLSignature created by the factory can also be marshalled to an XML representation and signed, by invoking the sign method of the XMLSignature object and passing it a mechanism-specific XMLSignContext object containing the signing key and marshalling parameters (see DOMSignContext). For example:
   DOMSignContext context = new DOMSignContext(privateKey, document);
   signature.sign(context);
Concurrent Access

The static methods of this class are guaranteed to be thread-safe. Multiple threads may concurrently invoke the static methods defined in this class with no ill effects.

However, this is not true for the non-static methods defined by this class. Unless otherwise documented by a specific provider, threads that need to access a single XMLSignatureFactory instance concurrently should synchronize amongst themselves and provide the necessary locking. Multiple threads each manipulating a different XMLSignatureFactory instance need not synchronize.

Authors
Sean Mullan, JSR 105 Expert Group
Since
1.6
External Specification
Java Security Standard Algorithm Names

Field Summary

Modifier and TypeField and Description
private String
private Provider

Constructor Summary

AccessConstructor and Description
protected
XMLSignatureFactory()

Default constructor, for invocation by subclasses.

Method Summary

Modifier and TypeMethod and Description
public static XMLSignatureFactory

Returns:

a new XMLSignatureFactory
getInstance
(String
the type of the XML processing mechanism and representation. See the XMLSignatureFactory section in the Java Security Standard Algorithm Names Specification for a list of standard mechanism types.
mechanismType
)

Returns an XMLSignatureFactory that supports the specified XML processing mechanism and representation type (ex: "DOM").

public static XMLSignatureFactory

Returns:

a new XMLSignatureFactory
getInstance
(String
the type of the XML processing mechanism and representation. See the XMLSignatureFactory section in the Java Security Standard Algorithm Names Specification for a list of standard mechanism types.
mechanismType
,
Provider
the Provider object
provider
)

Returns an XMLSignatureFactory that supports the requested XML processing mechanism and representation type (ex: "DOM"), as supplied by the specified provider.

public static XMLSignatureFactory

Returns:

a new XMLSignatureFactory
getInstance
(String
the type of the XML processing mechanism and representation. See the XMLSignatureFactory section in the Java Security Standard Algorithm Names Specification for a list of standard mechanism types.
mechanismType
,
String
the string name of the provider
provider
)

Returns an XMLSignatureFactory that supports the requested XML processing mechanism and representation type (ex: "DOM"), as supplied by the specified provider.

public static XMLSignatureFactory

Returns:

a new XMLSignatureFactory
getInstance
()

Returns an XMLSignatureFactory that supports the default XML processing mechanism and representation type ("DOM").

public final KeyInfoFactory

Returns:

a KeyInfoFactory
getKeyInfoFactory
()

Returns a KeyInfoFactory that creates KeyInfo objects.

public final String

Returns:

the XML processing mechanism type supported by this XMLSignatureFactory
getMechanismType
()

Returns the type of the XML processing mechanism and representation supported by this XMLSignatureFactory (ex: "DOM").

public final Provider

Returns:

the provider of this XMLSignatureFactory
getProvider
()

Returns the provider of this XMLSignatureFactory.

public abstract URIDereferencer

Returns:

a reference to the default URIDereferencer (never null)
getURIDereferencer
()

Returns a reference to the URIDereferencer that is used by default to dereference URIs in Reference objects.

public abstract boolean

Returns:

true if the specified feature is supported, false otherwise
isFeatureSupported
(String
the feature name (as an absolute URI)
feature
)

Indicates whether a specified feature is supported.

public abstract CanonicalizationMethod

Returns:

the CanonicalizationMethod
newCanonicalizationMethod
(String
the URI identifying the canonicalization algorithm
algorithm
,
C14NMethodParameterSpec
algorithm-specific canonicalization parameters (may be null)
params
)

Creates a CanonicalizationMethod for the specified algorithm URI and parameters.

public abstract CanonicalizationMethod

Returns:

the CanonicalizationMethod
newCanonicalizationMethod
(String
the URI identifying the canonicalization algorithm
algorithm
,
XMLStructure
a mechanism-specific XML structure from which to unmarshal the parameters from (may be null if not required or optional)
params
)

Creates a CanonicalizationMethod for the specified algorithm URI and parameters.

public abstract DigestMethod

Returns:

the DigestMethod
newDigestMethod
(String
the URI identifying the digest algorithm
algorithm
,
DigestMethodParameterSpec
algorithm-specific digest parameters (may be null)
params
)

Creates a DigestMethod for the specified algorithm URI and parameters.

public abstract Manifest

Returns:

a Manifest
newManifest
(List<? extends Reference>
a list of one or more References. The list is defensively copied to protect against subsequent modification.
references
)

Creates a Manifest containing the specified list of References.

public abstract Manifest

Returns:

a Manifest
newManifest
(List<? extends Reference>
a list of one or more References. The list is defensively copied to protect against subsequent modification.
references
,
String
the id (may be null)
id
)

Creates a Manifest containing the specified list of References and optional id.

public abstract Reference

Returns:

a Reference
newReference
(String
the reference URI (may be null)
uri
,
DigestMethod
the digest method
dm
)

Creates a Reference with the specified URI and digest method.

public abstract Reference

Returns:

a Reference
newReference
(String
the reference URI (may be null)
uri
,
DigestMethod
the digest method
dm
,
List<? extends Transform>
a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.
transforms
,
String
the reference type, as a URI (may be null)
type
,
String
the reference ID (may be null)
id
)

Creates a Reference with the specified parameters.

public abstract Reference

Returns:

a Reference
newReference
(String
the reference URI (may be null)
uri
,
DigestMethod
the digest method
dm
,
List<? extends Transform>
a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.
transforms
,
String
the reference type, as a URI (may be null)
type
,
String
the reference ID (may be null)
id
,
byte[]
the digest value. The array is cloned to protect against subsequent modification.
digestValue
)

Creates a Reference with the specified parameters and pre-calculated digest value.

public abstract Reference

Returns:

a Reference
newReference
(String
the reference URI (may be null)
uri
,
DigestMethod
the digest method
dm
,
List<? extends Transform>
a list of Transforms that have already been applied. The list is defensively copied to protect against subsequent modification. The list must contain at least one entry.
appliedTransforms
,
Data
the result of processing the sequence of appliedTransforms
result
,
List<? extends Transform>
a list of Transforms that are to be applied when generating the signature. The list is defensively copied to protect against subsequent modification. May be null or empty.
transforms
,
String
the reference type, as a URI (may be null)
type
,
String
the reference ID (may be null)
id
)

Creates a Reference with the specified parameters.

public abstract SignatureMethod

Returns:

the SignatureMethod
newSignatureMethod
(String
the URI identifying the signature algorithm
algorithm
,
SignatureMethodParameterSpec
algorithm-specific signature parameters (may be null)
params
)

Creates a SignatureMethod for the specified algorithm URI and parameters.

public abstract SignatureProperties

Returns:

a SignatureProperties
newSignatureProperties
(List<? extends SignatureProperty>
a list of one or more SignaturePropertys. The list is defensively copied to protect against subsequent modification.
properties
,
String
the id (may be null)
id
)

Creates a SignatureProperties containing the specified list of SignaturePropertys and optional id.

public abstract SignatureProperty

Returns:

a SignatureProperty
newSignatureProperty
(List<? extends XMLStructure>
a list of one or more XMLStructures. The list is defensively copied to protect against subsequent modification.
content
,
String
the target URI of the Signature that this property applies to
target
,
String
the id (may be null)
id
)

Creates a SignatureProperty containing the specified list of XMLStructures, target URI and optional id.

public abstract SignedInfo

Returns:

a SignedInfo
newSignedInfo
(CanonicalizationMethod
the canonicalization method
cm
,
SignatureMethod
the signature method
sm
,
List<? extends Reference>
a list of one or more References. The list is defensively copied to protect against subsequent modification.
references
)

Creates a SignedInfo with the specified canonicalization and signature methods, and list of one or more references.

public abstract SignedInfo

Returns:

a SignedInfo
newSignedInfo
(CanonicalizationMethod
the canonicalization method
cm
,
SignatureMethod
the signature method
sm
,
List<? extends Reference>
a list of one or more References. The list is defensively copied to protect against subsequent modification.
references
,
String
the id (may be null)
id
)

Creates a SignedInfo with the specified parameters.

public abstract Transform

Returns:

the Transform
newTransform
(String
the URI identifying the transform algorithm
algorithm
,
TransformParameterSpec
algorithm-specific transform parameters (may be null)
params
)

Creates a Transform for the specified algorithm URI and parameters.

public abstract Transform

Returns:

the Transform
newTransform
(String
the URI identifying the transform algorithm
algorithm
,
XMLStructure
a mechanism-specific XML structure from which to unmarshal the parameters from (may be null if not required or optional)
params
)

Creates a Transform for the specified algorithm URI and parameters.

public abstract XMLObject

Returns:

an XMLObject
newXMLObject
(List<? extends XMLStructure>
a list of XMLStructures. The list is defensively copied to protect against subsequent modification. May be null or empty.
content
,
String
the Id (may be null)
id
,
String
the mime type (may be null)
mimeType
,
String
the encoding (may be null)
encoding
)

Creates an XMLObject from the specified parameters.

public abstract XMLSignature

Returns:

an XMLSignature
newXMLSignature
(SignedInfo
the signed info
si
,
KeyInfo
the key info (may be null)
ki
)

Creates an XMLSignature and initializes it with the contents of the specified SignedInfo and KeyInfo objects.

public abstract XMLSignature

Returns:

an XMLSignature
newXMLSignature
(SignedInfo
the signed info
si
,
KeyInfo
the key info (may be null)
ki
,
List<? extends XMLObject>
a list of XMLObjects (may be empty or null)
objects
,
String
the Id (may be null)
id
,
String
the SignatureValue Id (may be null)
signatureValueId
)

Creates an XMLSignature and initializes it with the specified parameters.

public abstract XMLSignature

Returns:

the XMLSignature
unmarshalXMLSignature
(XMLValidateContext
a mechanism-specific context from which to unmarshal the signature from
context
)

Unmarshals a new XMLSignature instance from a mechanism-specific XMLValidateContext instance.

public abstract XMLSignature

Returns:

the XMLSignature
unmarshalXMLSignature
(XMLStructure
a mechanism-specific XML structure from which to unmarshal the signature from
xmlStructure
)

Unmarshals a new XMLSignature instance from a mechanism-specific XMLStructure instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mechanismTypeback to summary
private String mechanismType
providerback to summary
private Provider provider

Constructor Detail

XMLSignatureFactoryback to summary
protected XMLSignatureFactory()

Default constructor, for invocation by subclasses.

Method Detail

getInstanceback to summary
public static XMLSignatureFactory getInstance(String mechanismType)

Returns an XMLSignatureFactory that supports the specified XML processing mechanism and representation type (ex: "DOM").

This method uses the standard JCA provider lookup mechanism to locate and instantiate an XMLSignatureFactory implementation of the desired mechanism type. It traverses the list of registered security Providers, starting with the most preferred Provider. A new XMLSignatureFactory object from the first Provider that supports the specified mechanism is returned.

Note that the list of registered providers may be retrieved via the Security.getProviders() method.

Implementation Note

The JDK Reference Implementation additionally uses the jdk.security.provider.preferred Security property to determine the preferred provider order for the specified algorithm. This may be different than the order of providers returned by Security.getProviders().

Parameters
mechanismType:String

the type of the XML processing mechanism and representation. See the XMLSignatureFactory section in the Java Security Standard Algorithm Names Specification for a list of standard mechanism types.

Returns:XMLSignatureFactory

a new XMLSignatureFactory

Exceptions
NullPointerException:
if mechanismType is null
NoSuchMechanismException:
if no Provider supports an XMLSignatureFactory implementation for the specified mechanism
External Specification
Java Security Standard Algorithm Names
See Also
Provider
getInstanceback to summary
public static XMLSignatureFactory getInstance(String mechanismType, Provider provider)

Returns an XMLSignatureFactory that supports the requested XML processing mechanism and representation type (ex: "DOM"), as supplied by the specified provider. Note that the specified Provider object does not have to be registered in the provider list.

Parameters
mechanismType:String

the type of the XML processing mechanism and representation. See the XMLSignatureFactory section in the Java Security Standard Algorithm Names Specification for a list of standard mechanism types.

provider:Provider

the Provider object

Returns:XMLSignatureFactory

a new XMLSignatureFactory

Exceptions
NullPointerException:
if provider or mechanismType is null
NoSuchMechanismException:
if an XMLSignatureFactory implementation for the specified mechanism is not available from the specified Provider object
External Specification
Java Security Standard Algorithm Names
See Also
Provider
getInstanceback to summary
public static XMLSignatureFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException

Returns an XMLSignatureFactory that supports the requested XML processing mechanism and representation type (ex: "DOM"), as supplied by the specified provider. The specified provider must be registered in the security provider list.

Note that the list of registered providers may be retrieved via the Security.getProviders() method.

Parameters
mechanismType:String

the type of the XML processing mechanism and representation. See the XMLSignatureFactory section in the Java Security Standard Algorithm Names Specification for a list of standard mechanism types.

provider:String

the string name of the provider

Returns:XMLSignatureFactory

a new XMLSignatureFactory

Exceptions
NoSuchProviderException:
if the specified provider is not registered in the security provider list
NullPointerException:
if provider or mechanismType is null
NoSuchMechanismException:
if an XMLSignatureFactory implementation for the specified mechanism is not available from the specified provider
External Specification
Java Security Standard Algorithm Names
See Also
Provider
getInstanceback to summary
public static XMLSignatureFactory getInstance()

Returns an XMLSignatureFactory that supports the default XML processing mechanism and representation type ("DOM").

This method uses the standard JCA provider lookup mechanism to locate and instantiate an XMLSignatureFactory implementation of the default mechanism type. It traverses the list of registered security Providers, starting with the most preferred Provider. A new XMLSignatureFactory object from the first Provider that supports the DOM mechanism is returned.

Note that the list of registered providers may be retrieved via the Security.getProviders() method.

Returns:XMLSignatureFactory

a new XMLSignatureFactory

Exceptions
NoSuchMechanismException:
if no Provider supports an XMLSignatureFactory implementation for the DOM mechanism
See Also
Provider
getKeyInfoFactoryback to summary
public final KeyInfoFactory getKeyInfoFactory()

Returns a KeyInfoFactory that creates KeyInfo objects. The returned KeyInfoFactory has the same mechanism type and provider as this XMLSignatureFactory.

Returns:KeyInfoFactory

a KeyInfoFactory

Exceptions
NoSuchMechanismException:
if a KeyFactory implementation with the same mechanism type and provider is not available
getMechanismTypeback to summary
public final String getMechanismType()

Returns the type of the XML processing mechanism and representation supported by this XMLSignatureFactory (ex: "DOM").

Returns:String

the XML processing mechanism type supported by this XMLSignatureFactory

getProviderback to summary
public final Provider getProvider()

Returns the provider of this XMLSignatureFactory.

Returns:Provider

the provider of this XMLSignatureFactory

getURIDereferencerback to summary
public abstract URIDereferencer getURIDereferencer()

Returns a reference to the URIDereferencer that is used by default to dereference URIs in Reference objects.

Returns:URIDereferencer

a reference to the default URIDereferencer (never null)

isFeatureSupportedback to summary
public abstract boolean isFeatureSupported(String feature)

Indicates whether a specified feature is supported.

Parameters
feature:String

the feature name (as an absolute URI)

Returns:boolean

true if the specified feature is supported, false otherwise

Exceptions
NullPointerException:
if feature is null
newCanonicalizationMethodback to summary
public abstract CanonicalizationMethod newCanonicalizationMethod(String algorithm, C14NMethodParameterSpec params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException

Creates a CanonicalizationMethod for the specified algorithm URI and parameters.

Parameters
algorithm:String

the URI identifying the canonicalization algorithm

params:C14NMethodParameterSpec

algorithm-specific canonicalization parameters (may be null)

Returns:CanonicalizationMethod

the CanonicalizationMethod

Exceptions
NoSuchAlgorithmException:
if an implementation of the specified algorithm cannot be found
InvalidAlgorithmParameterException:
if the specified parameters are inappropriate for the requested algorithm
NullPointerException:
if algorithm is null
newCanonicalizationMethodback to summary
public abstract CanonicalizationMethod newCanonicalizationMethod(String algorithm, XMLStructure params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException

Creates a CanonicalizationMethod for the specified algorithm URI and parameters. The parameters are specified as a mechanism-specific XMLStructure (ex: DOMStructure). This method is useful when the parameters are in XML form or there is no standard class for specifying the parameters.

Parameters
algorithm:String

the URI identifying the canonicalization algorithm

params:XMLStructure

a mechanism-specific XML structure from which to unmarshal the parameters from (may be null if not required or optional)

Returns:CanonicalizationMethod

the CanonicalizationMethod

Exceptions
NoSuchAlgorithmException:
if an implementation of the specified algorithm cannot be found
InvalidAlgorithmParameterException:
if the specified parameters are inappropriate for the requested algorithm
ClassCastException:
if the type of params is inappropriate for this XMLSignatureFactory
NullPointerException:
if algorithm is null
newDigestMethodback to summary
public abstract DigestMethod newDigestMethod(String algorithm, DigestMethodParameterSpec params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException

Creates a DigestMethod for the specified algorithm URI and parameters.

Parameters
algorithm:String

the URI identifying the digest algorithm

params:DigestMethodParameterSpec

algorithm-specific digest parameters (may be null)

Returns:DigestMethod

the DigestMethod

Exceptions
NoSuchAlgorithmException:
if an implementation of the specified algorithm cannot be found
InvalidAlgorithmParameterException:
if the specified parameters are inappropriate for the requested algorithm
NullPointerException:
if algorithm is null
newManifestback to summary
public abstract Manifest newManifest(List<? extends Reference> references)

Creates a Manifest containing the specified list of References.

Parameters
references:List<? extends Reference>

a list of one or more References. The list is defensively copied to protect against subsequent modification.

Returns:Manifest

a Manifest

Exceptions
NullPointerException:
if references is null
IllegalArgumentException:
if references is empty
ClassCastException:
if references contains any entries that are not of type Reference
newManifestback to summary
public abstract Manifest newManifest(List<? extends Reference> references, String id)

Creates a Manifest containing the specified list of References and optional id.

Parameters
references:List<? extends Reference>

a list of one or more References. The list is defensively copied to protect against subsequent modification.

id:String

the id (may be null)

Returns:Manifest

a Manifest

Exceptions
NullPointerException:
if references is null
IllegalArgumentException:
if references is empty
ClassCastException:
if references contains any entries that are not of type Reference
newReferenceback to summary
public abstract Reference newReference(String uri, DigestMethod dm)

Creates a Reference with the specified URI and digest method.

Parameters
uri:String

the reference URI (may be null)

dm:DigestMethod

the digest method

Returns:Reference

a Reference

Exceptions
IllegalArgumentException:
if uri is not RFC 2396 compliant
NullPointerException:
if dm is null
newReferenceback to summary
public abstract Reference newReference(String uri, DigestMethod dm, List<? extends Transform> transforms, String type, String id)

Creates a Reference with the specified parameters.

Parameters
uri:String

the reference URI (may be null)

dm:DigestMethod

the digest method

transforms:List<? extends Transform>

a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.

type:String

the reference type, as a URI (may be null)

id:String

the reference ID (may be null)

Returns:Reference

a Reference

Exceptions
ClassCastException:
if any of the transforms are not of type Transform
IllegalArgumentException:
if uri is not RFC 2396 compliant
NullPointerException:
if dm is null
newReferenceback to summary
public abstract Reference newReference(String uri, DigestMethod dm, List<? extends Transform> transforms, String type, String id, byte[] digestValue)

Creates a Reference with the specified parameters and pre-calculated digest value.

This method is useful when the digest value of a Reference has been previously computed. See for example, the OASIS-DSS (Digital Signature Services) specification.

Parameters
uri:String

the reference URI (may be null)

dm:DigestMethod

the digest method

transforms:List<? extends Transform>

a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.

type:String

the reference type, as a URI (may be null)

id:String

the reference ID (may be null)

digestValue:byte[]

the digest value. The array is cloned to protect against subsequent modification.

Returns:Reference

a Reference

Exceptions
ClassCastException:
if any of the transforms are not of type Transform
IllegalArgumentException:
if uri is not RFC 2396 compliant
NullPointerException:
if dm or digestValue is null
newReferenceback to summary
public abstract Reference newReference(String uri, DigestMethod dm, List<? extends Transform> appliedTransforms, Data result, List<? extends Transform> transforms, String type, String id)

Creates a Reference with the specified parameters.

This method is useful when a list of transforms have already been applied to the Reference. See for example, the OASIS-DSS (Digital Signature Services) specification.

When an XMLSignature containing this reference is generated, the specified transforms (if non-null) are applied to the specified result. The Transforms element of the resulting Reference element is set to the concatenation of the appliedTransforms and transforms.

Parameters
uri:String

the reference URI (may be null)

dm:DigestMethod

the digest method

appliedTransforms:List<? extends Transform>

a list of Transforms that have already been applied. The list is defensively copied to protect against subsequent modification. The list must contain at least one entry.

result:Data

the result of processing the sequence of appliedTransforms

transforms:List<? extends Transform>

a list of Transforms that are to be applied when generating the signature. The list is defensively copied to protect against subsequent modification. May be null or empty.

type:String

the reference type, as a URI (may be null)

id:String

the reference ID (may be null)

Returns:Reference

a Reference

Exceptions
ClassCastException:
if any of the transforms (in either list) are not of type Transform
IllegalArgumentException:
if uri is not RFC 2396 compliant or appliedTransforms is empty
NullPointerException:
if dm, appliedTransforms or result is null
newSignatureMethodback to summary
public abstract SignatureMethod newSignatureMethod(String algorithm, SignatureMethodParameterSpec params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException

Creates a SignatureMethod for the specified algorithm URI and parameters.

Parameters
algorithm:String

the URI identifying the signature algorithm

params:SignatureMethodParameterSpec

algorithm-specific signature parameters (may be null)

Returns:SignatureMethod

the SignatureMethod

Exceptions
NoSuchAlgorithmException:
if an implementation of the specified algorithm cannot be found
InvalidAlgorithmParameterException:
if the specified parameters are inappropriate for the requested algorithm
NullPointerException:
if algorithm is null
newSignaturePropertiesback to summary
public abstract SignatureProperties newSignatureProperties(List<? extends SignatureProperty> properties, String id)

Creates a SignatureProperties containing the specified list of SignaturePropertys and optional id.

Parameters
properties:List<? extends SignatureProperty>

a list of one or more SignaturePropertys. The list is defensively copied to protect against subsequent modification.

id:String

the id (may be null)

Returns:SignatureProperties

a SignatureProperties

Exceptions
NullPointerException:
if properties is null
IllegalArgumentException:
if properties is empty
ClassCastException:
if properties contains any entries that are not of type SignatureProperty
newSignaturePropertyback to summary
public abstract SignatureProperty newSignatureProperty(List<? extends XMLStructure> content, String target, String id)

Creates a SignatureProperty containing the specified list of XMLStructures, target URI and optional id.

Parameters
content:List<? extends XMLStructure>

a list of one or more XMLStructures. The list is defensively copied to protect against subsequent modification.

target:String

the target URI of the Signature that this property applies to

id:String

the id (may be null)

Returns:SignatureProperty

a SignatureProperty

Exceptions
NullPointerException:
if content or target is null
IllegalArgumentException:
if content is empty
ClassCastException:
if content contains any entries that are not of type XMLStructure
newSignedInfoback to summary
public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, List<? extends Reference> references)

Creates a SignedInfo with the specified canonicalization and signature methods, and list of one or more references.

Parameters
cm:CanonicalizationMethod

the canonicalization method

sm:SignatureMethod

the signature method

references:List<? extends Reference>

a list of one or more References. The list is defensively copied to protect against subsequent modification.

Returns:SignedInfo

a SignedInfo

Exceptions
ClassCastException:
if any of the references are not of type Reference
IllegalArgumentException:
if references is empty
NullPointerException:
if any of the parameters are null
newSignedInfoback to summary
public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, List<? extends Reference> references, String id)

Creates a SignedInfo with the specified parameters.

Parameters
cm:CanonicalizationMethod

the canonicalization method

sm:SignatureMethod

the signature method

references:List<? extends Reference>

a list of one or more References. The list is defensively copied to protect against subsequent modification.

id:String

the id (may be null)

Returns:SignedInfo

a SignedInfo

Exceptions
ClassCastException:
if any of the references are not of type Reference
IllegalArgumentException:
if references is empty
NullPointerException:
if cm, sm, or references are null
newTransformback to summary
public abstract Transform newTransform(String algorithm, TransformParameterSpec params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException

Creates a Transform for the specified algorithm URI and parameters.

Parameters
algorithm:String

the URI identifying the transform algorithm

params:TransformParameterSpec

algorithm-specific transform parameters (may be null)

Returns:Transform

the Transform

Exceptions
NoSuchAlgorithmException:
if an implementation of the specified algorithm cannot be found
InvalidAlgorithmParameterException:
if the specified parameters are inappropriate for the requested algorithm
NullPointerException:
if algorithm is null
newTransformback to summary
public abstract Transform newTransform(String algorithm, XMLStructure params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException

Creates a Transform for the specified algorithm URI and parameters. The parameters are specified as a mechanism-specific XMLStructure (ex: DOMStructure). This method is useful when the parameters are in XML form or there is no standard class for specifying the parameters.

Parameters
algorithm:String

the URI identifying the transform algorithm

params:XMLStructure

a mechanism-specific XML structure from which to unmarshal the parameters from (may be null if not required or optional)

Returns:Transform

the Transform

Exceptions
NoSuchAlgorithmException:
if an implementation of the specified algorithm cannot be found
InvalidAlgorithmParameterException:
if the specified parameters are inappropriate for the requested algorithm
ClassCastException:
if the type of params is inappropriate for this XMLSignatureFactory
NullPointerException:
if algorithm is null
newXMLObjectback to summary
public abstract XMLObject newXMLObject(List<? extends XMLStructure> content, String id, String mimeType, String encoding)

Creates an XMLObject from the specified parameters.

Parameters
content:List<? extends XMLStructure>

a list of XMLStructures. The list is defensively copied to protect against subsequent modification. May be null or empty.

id:String

the Id (may be null)

mimeType:String

the mime type (may be null)

encoding:String

the encoding (may be null)

Returns:XMLObject

an XMLObject

Exceptions
ClassCastException:
if content contains any entries that are not of type XMLStructure
newXMLSignatureback to summary
public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki)

Creates an XMLSignature and initializes it with the contents of the specified SignedInfo and KeyInfo objects.

Parameters
si:SignedInfo

the signed info

ki:KeyInfo

the key info (may be null)

Returns:XMLSignature

an XMLSignature

Exceptions
NullPointerException:
if si is null
newXMLSignatureback to summary
public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, List<? extends XMLObject> objects, String id, String signatureValueId)

Creates an XMLSignature and initializes it with the specified parameters.

Parameters
si:SignedInfo

the signed info

ki:KeyInfo

the key info (may be null)

objects:List<? extends XMLObject>

a list of XMLObjects (may be empty or null)

id:String

the Id (may be null)

signatureValueId:String

the SignatureValue Id (may be null)

Returns:XMLSignature

an XMLSignature

Exceptions
NullPointerException:
if si is null
ClassCastException:
if any of the objects are not of type XMLObject
unmarshalXMLSignatureback to summary
public abstract XMLSignature unmarshalXMLSignature(XMLValidateContext context) throws MarshalException

Unmarshals a new XMLSignature instance from a mechanism-specific XMLValidateContext instance.

Parameters
context:XMLValidateContext

a mechanism-specific context from which to unmarshal the signature from

Returns:XMLSignature

the XMLSignature

Exceptions
MarshalException:
if an unrecoverable exception occurs during unmarshalling
NullPointerException:
if context is null
ClassCastException:
if the type of context is inappropriate for this factory
unmarshalXMLSignatureback to summary
public abstract XMLSignature unmarshalXMLSignature(XMLStructure xmlStructure) throws MarshalException

Unmarshals a new XMLSignature instance from a mechanism-specific XMLStructure instance. This method is useful if you only want to unmarshal (and not validate) an XMLSignature.

Parameters
xmlStructure:XMLStructure

a mechanism-specific XML structure from which to unmarshal the signature from

Returns:XMLSignature

the XMLSignature

Exceptions
MarshalException:
if an unrecoverable exception occurs during unmarshalling
NullPointerException:
if xmlStructure is null
ClassCastException:
if the type of xmlStructure is inappropriate for this factory