Class XMLSignatureFactory
- java.lang.Object
-
- javax.xml.crypto.dsig.XMLSignatureFactory
-
public abstract class XMLSignatureFactory extends java.lang.ObjectA factory for creatingXMLSignatureobjects from scratch or for unmarshalling anXMLSignatureobject from a corresponding XML representation.XMLSignatureFactory Type
Each instance of
XMLSignatureFactorysupports a specific XML mechanism type. To create anXMLSignatureFactory, call one of the staticgetInstancemethods, 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 section of the API overview. See the Service Providers section of the API overview for a list of standard mechanism types.
XMLSignatureFactoryimplementations are registered and loaded using theProvidermechanism. For example, a service provider that supports the DOM mechanism would be specified in theProvidersubclass 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
XMLSignatureFactoryinstance to create theXMLStructures of a particularXMLSignaturethat is to be generated. The behavior is undefined ifXMLStructures from different providers or different mechanism types are used together.Also, the
XMLStructures that are created by this factory may contain state specific to theXMLSignatureand are not intended to be reusable.Creating XMLSignatures from scratch
Once the
XMLSignatureFactoryhas been created, objects can be instantiated by calling the appropriate method. For example, aReferenceinstance may be created by invoking one of thenewReferencemethods.Unmarshalling XMLSignatures from XML
Alternatively, an
XMLSignaturemay be created from an existing XML representation by invoking theunmarshalXMLSignaturemethod and passing it a mechanism-specificXMLValidateContextinstance containing the XML content:DOMValidateContext context = new DOMValidateContext(key, signatureElement); XMLSignature signature = factory.unmarshalXMLSignature(context);
EachXMLSignatureFactorymust support the requiredXMLValidateContexttypes for that factory type, but may support others. A DOMXMLSignatureFactorymust supportDOMValidateContextobjects.Signing and marshalling XMLSignatures to XML
EachXMLSignaturecreated by the factory can also be marshalled to an XML representation and signed, by invoking thesignmethod of theXMLSignatureobject and passing it a mechanism-specificXMLSignContextobject containing the signing key and marshalling parameters (seeDOMSignContext). For example:DOMSignContext context = new DOMSignContext(privateKey, document); signature.sign(context);Concurrent AccessThe 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
XMLSignatureFactoryinstance concurrently should synchronize amongst themselves and provide the necessary locking. Multiple threads each manipulating a differentXMLSignatureFactoryinstance need not synchronize.
-
-
Field Summary
Fields Modifier and Type Field and Description private static java.lang.Classclprivate static java.lang.reflect.MethodgetImplMethodprivate static java.lang.Class[]getImplParamsprivate java.lang.StringmechanismTypeprivate java.security.Providerprovider
-
Constructor Summary
Constructors Modifier Constructor and Description protectedXMLSignatureFactory()Default constructor, for invocation by subclasses.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description private static XMLSignatureFactoryfindInstance(java.lang.String mechanismType, java.security.Provider provider)static XMLSignatureFactorygetInstance()Returns anXMLSignatureFactorythat supports the default XML processing mechanism and representation type ("DOM").static XMLSignatureFactorygetInstance(java.lang.String mechanismType)Returns anXMLSignatureFactorythat supports the specified XML processing mechanism and representation type (ex: "DOM").static XMLSignatureFactorygetInstance(java.lang.String mechanismType, java.security.Provider provider)Returns anXMLSignatureFactorythat supports the requested XML processing mechanism and representation type (ex: "DOM"), as supplied by the specified provider.static XMLSignatureFactorygetInstance(java.lang.String mechanismType, java.lang.String provider)Returns anXMLSignatureFactorythat supports the requested XML processing mechanism and representation type (ex: "DOM"), as supplied by the specified provider.KeyInfoFactorygetKeyInfoFactory()Returns aKeyInfoFactorythat createsKeyInfoobjects.java.lang.StringgetMechanismType()Returns the type of the XML processing mechanism and representation supported by thisXMLSignatureFactory(ex: "DOM").java.security.ProvidergetProvider()Returns the provider of thisXMLSignatureFactory.abstract URIDereferencergetURIDereferencer()Returns a reference to theURIDereferencerthat is used by default to dereference URIs inReferenceobjects.abstract booleanisFeatureSupported(java.lang.String feature)Indicates whether a specified feature is supported.abstract CanonicalizationMethodnewCanonicalizationMethod(java.lang.String algorithm, C14NMethodParameterSpec params)Creates aCanonicalizationMethodfor the specified algorithm URI and parameters.abstract CanonicalizationMethodnewCanonicalizationMethod(java.lang.String algorithm, XMLStructure params)Creates aCanonicalizationMethodfor the specified algorithm URI and parameters.abstract DigestMethodnewDigestMethod(java.lang.String algorithm, DigestMethodParameterSpec params)Creates aDigestMethodfor the specified algorithm URI and parameters.abstract ManifestnewManifest(java.util.List references)Creates aManifestcontaining the specified list ofReferences.abstract ManifestnewManifest(java.util.List references, java.lang.String id)Creates aManifestcontaining the specified list ofReferences and optional id.abstract ReferencenewReference(java.lang.String uri, DigestMethod dm)Creates aReferencewith the specified URI and digest method.abstract ReferencenewReference(java.lang.String uri, DigestMethod dm, java.util.List appliedTransforms, Data result, java.util.List transforms, java.lang.String type, java.lang.String id)Creates aReferencewith the specified parameters.abstract ReferencenewReference(java.lang.String uri, DigestMethod dm, java.util.List transforms, java.lang.String type, java.lang.String id)Creates aReferencewith the specified parameters.abstract ReferencenewReference(java.lang.String uri, DigestMethod dm, java.util.List transforms, java.lang.String type, java.lang.String id, byte[] digestValue)Creates aReferencewith the specified parameters and pre-calculated digest value.abstract SignatureMethodnewSignatureMethod(java.lang.String algorithm, SignatureMethodParameterSpec params)Creates aSignatureMethodfor the specified algorithm URI and parameters.abstract SignaturePropertiesnewSignatureProperties(java.util.List properties, java.lang.String id)Creates aSignaturePropertiescontaining the specified list ofSignaturePropertys and optional id.abstract SignaturePropertynewSignatureProperty(java.util.List content, java.lang.String target, java.lang.String id)Creates aSignaturePropertycontaining the specified list ofXMLStructures, target URI and optional id.abstract SignedInfonewSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, java.util.List references)Creates aSignedInfowith the specified canonicalization and signature methods, and list of one or more references.abstract SignedInfonewSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, java.util.List references, java.lang.String id)Creates aSignedInfowith the specified parameters.abstract TransformnewTransform(java.lang.String algorithm, TransformParameterSpec params)Creates aTransformfor the specified algorithm URI and parameters.abstract TransformnewTransform(java.lang.String algorithm, XMLStructure params)Creates aTransformfor the specified algorithm URI and parameters.abstract XMLObjectnewXMLObject(java.util.List content, java.lang.String id, java.lang.String mimeType, java.lang.String encoding)Creates anXMLObjectfrom the specified parameters.abstract XMLSignaturenewXMLSignature(SignedInfo si, KeyInfo ki)Creates anXMLSignatureand initializes it with the contents of the specifiedSignedInfoandKeyInfoobjects.abstract XMLSignaturenewXMLSignature(SignedInfo si, KeyInfo ki, java.util.List objects, java.lang.String id, java.lang.String signatureValueId)Creates anXMLSignatureand initializes it with the specified parameters.abstract XMLSignatureunmarshalXMLSignature(XMLStructure xmlStructure)Unmarshals a newXMLSignatureinstance from a mechanism-specificXMLStructureinstance.abstract XMLSignatureunmarshalXMLSignature(XMLValidateContext context)Unmarshals a newXMLSignatureinstance from a mechanism-specificXMLValidateContextinstance.
-
-
-
Field Detail
-
mechanismType
private java.lang.String mechanismType
-
provider
private java.security.Provider provider
-
cl
private static java.lang.Class cl
-
getImplParams
private static final java.lang.Class[] getImplParams
-
getImplMethod
private static java.lang.reflect.Method getImplMethod
-
-
Constructor Detail
-
XMLSignatureFactory
protected XMLSignatureFactory()
Default constructor, for invocation by subclasses.
-
-
Method Detail
-
getInstance
public static XMLSignatureFactory getInstance(java.lang.String mechanismType)
Returns anXMLSignatureFactorythat 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
XMLSignatureFactoryimplementation of the desired mechanism type. It traverses the list of registered securityProviders, starting with the most preferredProvider. A newXMLSignatureFactoryobject from the firstProviderthat supports the specified mechanism is returned.Note that the list of registered providers may be retrieved via the
Security.getProviders()method.- Parameters:
mechanismType- the type of the XML processing mechanism and representation. See the Service Providers section of the API overview for a list of standard mechanism types.- Returns:
- a new
XMLSignatureFactory - Throws:
java.lang.NullPointerException- ifmechanismTypeisnullNoSuchMechanismException- if noProvidersupports anXMLSignatureFactoryimplementation for the specified mechanism- See Also:
Provider
-
findInstance
private static XMLSignatureFactory findInstance(java.lang.String mechanismType, java.security.Provider provider)
-
getInstance
public static XMLSignatureFactory getInstance(java.lang.String mechanismType, java.security.Provider provider)
Returns anXMLSignatureFactorythat supports the requested XML processing mechanism and representation type (ex: "DOM"), as supplied by the specified provider. Note that the specifiedProviderobject does not have to be registered in the provider list.- Parameters:
mechanismType- the type of the XML processing mechanism and representation. See the Service Providers section of the API overview for a list of standard mechanism types.provider- theProviderobject- Returns:
- a new
XMLSignatureFactory - Throws:
java.lang.NullPointerException- ifproviderormechanismTypeisnullNoSuchMechanismException- if anXMLSignatureFactoryimplementation for the specified mechanism is not available from the specifiedProviderobject- See Also:
Provider
-
getInstance
public static XMLSignatureFactory getInstance(java.lang.String mechanismType, java.lang.String provider) throws java.security.NoSuchProviderException
Returns anXMLSignatureFactorythat 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- the type of the XML processing mechanism and representation. See the Service Providers section of the API overview for a list of standard mechanism types.provider- the string name of the provider- Returns:
- a new
XMLSignatureFactory - Throws:
java.security.NoSuchProviderException- if the specified provider is not registered in the security provider listjava.lang.NullPointerException- ifproviderormechanismTypeisnullNoSuchMechanismException- if anXMLSignatureFactoryimplementation for the specified mechanism is not available from the specified provider- See Also:
Provider
-
getInstance
public static XMLSignatureFactory getInstance()
Returns anXMLSignatureFactorythat supports the default XML processing mechanism and representation type ("DOM").This method uses the standard JCA provider lookup mechanism to locate and instantiate an
XMLSignatureFactoryimplementation of the default mechanism type. It traverses the list of registered securityProviders, starting with the most preferredProvider. A newXMLSignatureFactoryobject from the firstProviderthat supports the DOM mechanism is returned.Note that the list of registered providers may be retrieved via the
Security.getProviders()method.- Returns:
- a new
XMLSignatureFactory - Throws:
NoSuchMechanismException- if noProvidersupports anXMLSignatureFactoryimplementation for the DOM mechanism- See Also:
Provider
-
getMechanismType
public final java.lang.String getMechanismType()
Returns the type of the XML processing mechanism and representation supported by thisXMLSignatureFactory(ex: "DOM").- Returns:
- the XML processing mechanism type supported by this
XMLSignatureFactory
-
getProvider
public final java.security.Provider getProvider()
Returns the provider of thisXMLSignatureFactory.- Returns:
- the provider of this
XMLSignatureFactory
-
newXMLSignature
public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki)
Creates anXMLSignatureand initializes it with the contents of the specifiedSignedInfoandKeyInfoobjects.- Parameters:
si- the signed infoki- the key info (may benull)- Returns:
- an
XMLSignature - Throws:
java.lang.NullPointerException- ifsiisnull
-
newXMLSignature
public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki, java.util.List objects, java.lang.String id, java.lang.String signatureValueId)
Creates anXMLSignatureand initializes it with the specified parameters.- Parameters:
si- the signed infoki- the key info (may benull)objects- a list ofXMLObjects (may be empty ornull)id- the Id (may benull)signatureValueId- the SignatureValue Id (may benull)- Returns:
- an
XMLSignature - Throws:
java.lang.NullPointerException- ifsiisnulljava.lang.ClassCastException- if any of theobjectsare not of typeXMLObject
-
newReference
public abstract Reference newReference(java.lang.String uri, DigestMethod dm)
Creates aReferencewith the specified URI and digest method.- Parameters:
uri- the reference URI (may benull)dm- the digest method- Returns:
- a
Reference - Throws:
java.lang.IllegalArgumentException- ifuriis not RFC 2396 compliantjava.lang.NullPointerException- ifdmisnull
-
newReference
public abstract Reference newReference(java.lang.String uri, DigestMethod dm, java.util.List transforms, java.lang.String type, java.lang.String id)
Creates aReferencewith the specified parameters.- Parameters:
uri- the reference URI (may benull)dm- the digest methodtransforms- a list ofTransforms. The list is defensively copied to protect against subsequent modification. May benullor empty.type- the reference type, as a URI (may benull)id- the reference ID (may benull)- Returns:
- a
Reference - Throws:
java.lang.ClassCastException- if any of thetransformsare not of typeTransformjava.lang.IllegalArgumentException- ifuriis not RFC 2396 compliantjava.lang.NullPointerException- ifdmisnull
-
newReference
public abstract Reference newReference(java.lang.String uri, DigestMethod dm, java.util.List transforms, java.lang.String type, java.lang.String id, byte[] digestValue)
Creates aReferencewith the specified parameters and pre-calculated digest value.This method is useful when the digest value of a
Referencehas been previously computed. See for example, the OASIS-DSS (Digital Signature Services) specification.- Parameters:
uri- the reference URI (may benull)dm- the digest methodtransforms- a list ofTransforms. The list is defensively copied to protect against subsequent modification. May benullor empty.type- the reference type, as a URI (may benull)id- the reference ID (may benull)digestValue- the digest value. The array is cloned to protect against subsequent modification.- Returns:
- a
Reference - Throws:
java.lang.ClassCastException- if any of thetransformsare not of typeTransformjava.lang.IllegalArgumentException- ifuriis not RFC 2396 compliantjava.lang.NullPointerException- ifdmordigestValueisnull
-
newReference
public abstract Reference newReference(java.lang.String uri, DigestMethod dm, java.util.List appliedTransforms, Data result, java.util.List transforms, java.lang.String type, java.lang.String id)
Creates aReferencewith 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
XMLSignaturecontaining this reference is generated, the specifiedtransforms(if non-null) are applied to the specifiedresult. TheTransformselement of the resultingReferenceelement is set to the concatenation of theappliedTransformsandtransforms.- Parameters:
uri- the reference URI (may benull)dm- the digest methodappliedTransforms- a list ofTransforms that have already been applied. The list is defensively copied to protect against subsequent modification. The list must contain at least one entry.result- the result of processing the sequence ofappliedTransformstransforms- a list ofTransforms that are to be applied when generating the signature. The list is defensively copied to protect against subsequent modification. May benullor empty.type- the reference type, as a URI (may benull)id- the reference ID (may benull)- Returns:
- a
Reference - Throws:
java.lang.ClassCastException- if any of the transforms (in either list) are not of typeTransformjava.lang.IllegalArgumentException- ifuriis not RFC 2396 compliant orappliedTransformsis emptyjava.lang.NullPointerException- ifdm,appliedTransformsorresultisnull
-
newSignedInfo
public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, java.util.List references)
Creates aSignedInfowith the specified canonicalization and signature methods, and list of one or more references.- Parameters:
cm- the canonicalization methodsm- the signature methodreferences- a list of one or moreReferences. The list is defensively copied to protect against subsequent modification.- Returns:
- a
SignedInfo - Throws:
java.lang.ClassCastException- if any of the references are not of typeReferencejava.lang.IllegalArgumentException- ifreferencesis emptyjava.lang.NullPointerException- if any of the parameters arenull
-
newSignedInfo
public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, java.util.List references, java.lang.String id)
Creates aSignedInfowith the specified parameters.- Parameters:
cm- the canonicalization methodsm- the signature methodreferences- a list of one or moreReferences. The list is defensively copied to protect against subsequent modification.id- the id (may benull)- Returns:
- a
SignedInfo - Throws:
java.lang.ClassCastException- if any of the references are not of typeReferencejava.lang.IllegalArgumentException- ifreferencesis emptyjava.lang.NullPointerException- ifcm,sm, orreferencesarenull
-
newXMLObject
public abstract XMLObject newXMLObject(java.util.List content, java.lang.String id, java.lang.String mimeType, java.lang.String encoding)
Creates anXMLObjectfrom the specified parameters.- Parameters:
content- a list ofXMLStructures. The list is defensively copied to protect against subsequent modification. May benullor empty.id- the Id (may benull)mimeType- the mime type (may benull)encoding- the encoding (may benull)- Returns:
- an
XMLObject - Throws:
java.lang.ClassCastException- ifcontentcontains any entries that are not of typeXMLStructure
-
newManifest
public abstract Manifest newManifest(java.util.List references)
Creates aManifestcontaining the specified list ofReferences.- Parameters:
references- a list of one or moreReferences. The list is defensively copied to protect against subsequent modification.- Returns:
- a
Manifest - Throws:
java.lang.NullPointerException- ifreferencesisnulljava.lang.IllegalArgumentException- ifreferencesis emptyjava.lang.ClassCastException- ifreferencescontains any entries that are not of typeReference
-
newManifest
public abstract Manifest newManifest(java.util.List references, java.lang.String id)
Creates aManifestcontaining the specified list ofReferences and optional id.- Parameters:
references- a list of one or moreReferences. The list is defensively copied to protect against subsequent modification.id- the id (may benull)- Returns:
- a
Manifest - Throws:
java.lang.NullPointerException- ifreferencesisnulljava.lang.IllegalArgumentException- ifreferencesis emptyjava.lang.ClassCastException- ifreferencescontains any entries that are not of typeReference
-
newSignatureProperty
public abstract SignatureProperty newSignatureProperty(java.util.List content, java.lang.String target, java.lang.String id)
Creates aSignaturePropertycontaining the specified list ofXMLStructures, target URI and optional id.- Parameters:
content- a list of one or moreXMLStructures. The list is defensively copied to protect against subsequent modification.target- the target URI of the Signature that this property applies toid- the id (may benull)- Returns:
- a
SignatureProperty - Throws:
java.lang.NullPointerException- ifcontentortargetisnulljava.lang.IllegalArgumentException- ifcontentis emptyjava.lang.ClassCastException- ifcontentcontains any entries that are not of typeXMLStructure
-
newSignatureProperties
public abstract SignatureProperties newSignatureProperties(java.util.List properties, java.lang.String id)
Creates aSignaturePropertiescontaining the specified list ofSignaturePropertys and optional id.- Parameters:
properties- a list of one or moreSignaturePropertys. The list is defensively copied to protect against subsequent modification.id- the id (may benull)- Returns:
- a
SignatureProperties - Throws:
java.lang.NullPointerException- ifpropertiesisnulljava.lang.IllegalArgumentException- ifpropertiesis emptyjava.lang.ClassCastException- ifpropertiescontains any entries that are not of typeSignatureProperty
-
newDigestMethod
public abstract DigestMethod newDigestMethod(java.lang.String algorithm, DigestMethodParameterSpec params) throws java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates aDigestMethodfor the specified algorithm URI and parameters.- Parameters:
algorithm- the URI identifying the digest algorithmparams- algorithm-specific digest parameters (may benull)- Returns:
- the
DigestMethod - Throws:
java.security.InvalidAlgorithmParameterException- if the specified parameters are inappropriate for the requested algorithmjava.security.NoSuchAlgorithmException- if an implementation of the specified algorithm cannot be foundjava.lang.NullPointerException- ifalgorithmisnull
-
newSignatureMethod
public abstract SignatureMethod newSignatureMethod(java.lang.String algorithm, SignatureMethodParameterSpec params) throws java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates aSignatureMethodfor the specified algorithm URI and parameters.- Parameters:
algorithm- the URI identifying the signature algorithmparams- algorithm-specific signature parameters (may benull)- Returns:
- the
SignatureMethod - Throws:
java.security.InvalidAlgorithmParameterException- if the specified parameters are inappropriate for the requested algorithmjava.security.NoSuchAlgorithmException- if an implementation of the specified algorithm cannot be foundjava.lang.NullPointerException- ifalgorithmisnull
-
newTransform
public abstract Transform newTransform(java.lang.String algorithm, TransformParameterSpec params) throws java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates aTransformfor the specified algorithm URI and parameters.- Parameters:
algorithm- the URI identifying the transform algorithmparams- algorithm-specific transform parameters (may benull)- Returns:
- the
Transform - Throws:
java.security.InvalidAlgorithmParameterException- if the specified parameters are inappropriate for the requested algorithmjava.security.NoSuchAlgorithmException- if an implementation of the specified algorithm cannot be foundjava.lang.NullPointerException- ifalgorithmisnull
-
newTransform
public abstract Transform newTransform(java.lang.String algorithm, XMLStructure params) throws java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates aTransformfor the specified algorithm URI and parameters. The parameters are specified as a mechanism-specificXMLStructure(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- the URI identifying the transform algorithmparams- a mechanism-specific XML structure from which to unmarshal the parameters from (may benullif not required or optional)- Returns:
- the
Transform - Throws:
java.lang.ClassCastException- if the type ofparamsis inappropriate for thisXMLSignatureFactoryjava.security.InvalidAlgorithmParameterException- if the specified parameters are inappropriate for the requested algorithmjava.security.NoSuchAlgorithmException- if an implementation of the specified algorithm cannot be foundjava.lang.NullPointerException- ifalgorithmisnull
-
newCanonicalizationMethod
public abstract CanonicalizationMethod newCanonicalizationMethod(java.lang.String algorithm, C14NMethodParameterSpec params) throws java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates aCanonicalizationMethodfor the specified algorithm URI and parameters.- Parameters:
algorithm- the URI identifying the canonicalization algorithmparams- algorithm-specific canonicalization parameters (may benull)- Returns:
- the
CanonicalizationMethod - Throws:
java.security.InvalidAlgorithmParameterException- if the specified parameters are inappropriate for the requested algorithmjava.security.NoSuchAlgorithmException- if an implementation of the specified algorithm cannot be foundjava.lang.NullPointerException- ifalgorithmisnull
-
newCanonicalizationMethod
public abstract CanonicalizationMethod newCanonicalizationMethod(java.lang.String algorithm, XMLStructure params) throws java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates aCanonicalizationMethodfor the specified algorithm URI and parameters. The parameters are specified as a mechanism-specificXMLStructure(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- the URI identifying the canonicalization algorithmparams- a mechanism-specific XML structure from which to unmarshal the parameters from (may benullif not required or optional)- Returns:
- the
CanonicalizationMethod - Throws:
java.lang.ClassCastException- if the type ofparamsis inappropriate for thisXMLSignatureFactoryjava.security.InvalidAlgorithmParameterException- if the specified parameters are inappropriate for the requested algorithmjava.security.NoSuchAlgorithmException- if an implementation of the specified algorithm cannot be foundjava.lang.NullPointerException- ifalgorithmisnull
-
getKeyInfoFactory
public final KeyInfoFactory getKeyInfoFactory()
Returns aKeyInfoFactorythat createsKeyInfoobjects. The returnedKeyInfoFactoryhas the same mechanism type and provider as thisXMLSignatureFactory.- Returns:
- a
KeyInfoFactory - Throws:
NoSuchMechanismException- if aKeyFactoryimplementation with the same mechanism type and provider is not available
-
unmarshalXMLSignature
public abstract XMLSignature unmarshalXMLSignature(XMLValidateContext context) throws MarshalException
Unmarshals a newXMLSignatureinstance from a mechanism-specificXMLValidateContextinstance.- Parameters:
context- a mechanism-specific context from which to unmarshal the signature from- Returns:
- the
XMLSignature - Throws:
java.lang.NullPointerException- ifcontextisnulljava.lang.ClassCastException- if the type ofcontextis inappropriate for this factoryMarshalException- if an unrecoverable exception occurs during unmarshalling
-
unmarshalXMLSignature
public abstract XMLSignature unmarshalXMLSignature(XMLStructure xmlStructure) throws MarshalException
Unmarshals a newXMLSignatureinstance from a mechanism-specificXMLStructureinstance. This method is useful if you only want to unmarshal (and not validate) anXMLSignature.- Parameters:
xmlStructure- a mechanism-specific XML structure from which to unmarshal the signature from- Returns:
- the
XMLSignature - Throws:
java.lang.NullPointerException- ifxmlStructureisnulljava.lang.ClassCastException- if the type ofxmlStructureis inappropriate for this factoryMarshalException- if an unrecoverable exception occurs during unmarshalling
-
isFeatureSupported
public abstract boolean isFeatureSupported(java.lang.String feature)
Indicates whether a specified feature is supported.- Parameters:
feature- the feature name (as an absolute URI)- Returns:
trueif the specified feature is supported,falseotherwise- Throws:
java.lang.NullPointerException- iffeatureisnull
-
getURIDereferencer
public abstract URIDereferencer getURIDereferencer()
Returns a reference to theURIDereferencerthat is used by default to dereference URIs inReferenceobjects.- Returns:
- a reference to the default
URIDereferencer(nevernull)
-
-