com.rsa.certj.xml.dsig

Class XMLSignature

java.lang.Object
  |
  +--com.rsa.certj.xml.dsig.XMLSignature
All Implemented Interfaces:
Cloneable, Serializable

public class XMLSignature
extends Object
implements Cloneable, Serializable

This class builds and stores XML Signatures. XML Signatures are applied to arbitrary digital content data (data objects) via an indirection. Data objects are digested; the resulting value is placed in an element and that element is then digested and cryptographically signed. Enveloped or enveloping signatures are over data within the same XML document as the signature. Detached signatures are over data external to the signature element. XML digital signatures are represented by the Signature element which has the following structure. The following conventions are used: "?" denotes zero or one occurrence; "+" denotes one or more occurrences; and "*" denotes zero or more occurrences.

 < Signature >
   < SignedInfo >
      (CanonicalizationMethod)?
      (SignatureMethod)
      (< Reference (URI=)? >
            (Transforms)?
            (DigestMethod)
            (DigestValue)
      < /Reference >)+
   < /SignedInfo >
   (SignatureValue)
 (keyInfo)?
 (Object)*
 < /Signature >
Copyright © RSA Security Inc., 2001-2002. All rights reserved.

See Also

Serialized Form

Field Summary

static String

DEFAULT_DIGEST_ALGORITHM

MD5 is not recommended for XML signatures.

static String

DEFAULT_MAC_ALGORITHM

The default MAC algorithm HMAC-SHA1 is used.

static String

DEFAULT_XML_NAMESPACE

The default XML namespace.

static int

DETACHED_SIGNATURE

Specifies that the signature is detached: the signature is over content external to the signature element.

static String

DSA_SIGNATURE_ALGORITHM

The DSAwithSHA1 signature algorithm.

static int

ENVELOPED_SIGNATURE

Specifies that the signature is enveloped: the signature is over XML content that contains the signature as an element.

static int

ENVELOPING_SIGNATURE

Specifies that the signature is enveloping: the signature is over content found within an Object element of the signature itself.

 boolean

foundET

A flag to track the existence of the enveloped signature transform in any given element within a Added 12/01.

static String

RSA_SIGNATURE_ALGORITHM

The RSAwithSHA1 signature algorithm.

static int

SIGNATURE_MASK

Indicates which bits of the signature to check.

static String[]

SUPPORTED_DIGEST_ALGORITHMS

All supported digest algorithms.

static String[]

SUPPORTED_MAC_ALGORITHMS

All supported MAC algorithms.

static String[]

SUPPORTED_SIGNATURE_ALGORITHMS

All supported signature algorithms.

static String[]

SUPPORTED_XML_NAMESPACES

All supported XML namespace values.

 boolean

useTemplate

Internal member, do not use

 

Constructor Summary

XMLSignature()

Creates an empty XMLSignature object.

XMLSignature(File file)

Constructs an instance of XMLSignature and intializes it with the file to sign.

XMLSignature(InputStream inputStream)

Constructs an instance of XMLSignature and intializes it with the inputStream to sign.

XMLSignature(String fileName)

Constructs an instance of XMLSignature and initializes it with the fileName to sign.

 

Method Summary

 void

addKeyInfo(KeyInfo keyInfo)

Adds the given KeyInfo object to this XMLSignature instance by appending it to the KeyInfo list.

 void

addReference(Reference reference)

Adds a Reference object to the reference list belonging to this XMLSignature instance.

 void

addXMLObject(org.w3c.dom.Element xmlObject)

Adds the given xmlObject by appending it to the xmlObject list of this XMLSignature instance.

 byte[]

generateSignedInfo()

Creates an incomplete Signature element (with an empty SignatureValue element or no SignatureValue element) in the document and returns the canonicalized SignedInfo value.

 String

getCanonicalizationMethod()

Returns the canonicalization method.

 byte[]

getCanonicalizedSignedInfo()

Calculates the canonicalized value of an existing SignedInfo element.

 org.w3c.dom.Document

getDocument()

Returns the Document object.

 int

getFlags()

Gets the current state of internal behavior flags.

 int

getHMACOutputLen()

Returns the HMAC output length, in bits, as an integer.

 KeyInfo[]

getKeyInfos()

Returns the keyInfo object list of this XMLSignature object.

 String

getNamespacePrefix()

Returns the prefix of the signature as a String object.

 Reference[]

getReferences()

Returns the references.

 org.w3c.dom.Element

getSignatureElement()

Returns the signature element containing all the information of this XMLSignature object to the passed in value.

 String

getSignatureID()

Returns the ID of the signature as a String object.

 String

getSignatureMethod()

Returns the signature method.

 int

getSignatureType()

Returns the signature type as an integer value.

 byte[]

getSignatureValue()

Returns the signature value as a byte array.

 Certificate

getVerifyingCert()

Retrieves the certificate used to verify the signature.

 String

getXMLNamespace()

Returns the xml namespace as a string.

 org.w3c.dom.Element

getXMLObjectByID(String ID)

Retrieves the xmlObject with the given ID value.

 org.w3c.dom.Element[]

getXMLObjects()

Returns the xmlObjects as a DOM Element array.

 void

includeCommentsForXPointer(boolean commentXPointer)

Sets the boolean to indicate if comment nodes should be removed while processing XPointer or not.

 void

setCanonicalizationMethod(String c14nMethod)

Sets the canonicalization method to c14nMethod.

 void

setCertificates(Certificate[] certs)

Sets the certificates, which contain the key information to use for verification, by assigning the certificate list in this XMLSignature instance to the given certificate list.

 void

setDocument(org.w3c.dom.Document document)

Sets the Document object.

 void

setDocument(org.w3c.dom.Document document, boolean useTemplate)

Sets the Document object.

 void

setFlags(int flags)

Sets the internal behavior flags to the specified flag values.

 void

setHMACOutputLen(int length)

Sets the HMAC output length, in bits, to the given value.

 void

setKey(com.rsa.jsafe.JSAFE_PublicKey key)

Sets the verification key to the given value.

 void

setKeyInfos(KeyInfo[] keyInfos)

Sets the keyInfos of this XMLSignature to the given value.

 void

setNamespacePrefix(String prefix)

Sets the prefix of this signature to prefix.

 void

setReferences(Reference[] references)

Sets the Reference object list with the values given in references by overriding the existing reference array.

 void

setSignatureElement(org.w3c.dom.Element sigElement)

Sets the signature element containing all the information of this XMLSignature object to the passed in value.

 void

setSignatureID(String Id)

Sets the ID of this signature to Id.

 void

setSignatureMethod(String signatureMethod)

Sets the signature method to signatureMethod.

 void

setSignatureType(int type)

Sets the signature type to type.

 void

setSignatureValue(byte[] signature)

Sets the signatureValue of this XMLSignature.

 void

setSignatureValueElement(byte[] newSignatureValue)

Sets the SignatureValue element to the value specified by newSignatureValue.

 void

setSignedInfo(org.w3c.dom.Node signedInfo)

Sets the signedInfo element of this XMLSignature object to the passed in value.

 void

setXMLNamespace(String namespace)

Sets the xml namespace to the passed in string value.

 void

setXMLObjects(org.w3c.dom.Element[] xmlObjects)

Sets the xmlObjects of this XMLSignature to xmlObjects.

 void

sign(CertJ certj)

Signs the XML document, specified in a constructor.

 void

sign(CertJ theCertJ, com.rsa.jsafe.JSAFE_Key signKey, com.rsa.jsafe.JSAFE_SecureRandom random, String device)

Signs the XML document with the specified CertJ context.

 void

sign(com.rsa.jsafe.JSAFE_Key signKey, com.rsa.jsafe.JSAFE_SecureRandom random, String device)

Signs the document with the private key given in signKey, without validating it against the information stored in keyInfo.

 boolean

useTemplate()

Returns true if it is a template signing; falseotherwise.

 VerificationInfo

verify(CertJ certj, CertPathCtx certPathCtx)

Verifies the signature in the document, specified in the constructor, and returns a VerificationInfo object with detailed information such as signature verification failure or reference validation failure.

 VerificationInfo

verify(CertJ certj, com.rsa.jsafe.JSAFE_Key verifyKey, String device)

Verifies the signature with the CertJ context specified.

 VerificationInfo

verify(com.rsa.jsafe.JSAFE_Key verifyKey, String device)

Verifies the signature contained in the XML document.

 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGNATURE_MASK

public static final int SIGNATURE_MASK
Indicates which bits of the signature to check.

DETACHED_SIGNATURE

public static final int DETACHED_SIGNATURE
Specifies that the signature is detached: the signature is over content external to the signature element.

ENVELOPING_SIGNATURE

public static final int ENVELOPING_SIGNATURE
Specifies that the signature is enveloping: the signature is over content found within an Object element of the signature itself.

ENVELOPED_SIGNATURE

public static final int ENVELOPED_SIGNATURE
Specifies that the signature is enveloped: the signature is over XML content that contains the signature as an element.

DEFAULT_DIGEST_ALGORITHM

public static final String DEFAULT_DIGEST_ALGORITHM
MD5 is not recommended for XML signatures. The default digest algorithm SHA-1 is used.

DEFAULT_MAC_ALGORITHM

public static final String DEFAULT_MAC_ALGORITHM
The default MAC algorithm HMAC-SHA1 is used.

DSA_SIGNATURE_ALGORITHM

public static final String DSA_SIGNATURE_ALGORITHM
The DSAwithSHA1 signature algorithm. It is required by the XML signature specification.

RSA_SIGNATURE_ALGORITHM

public static final String RSA_SIGNATURE_ALGORITHM
The RSAwithSHA1 signature algorithm. It is recommended by the XML signature specification.

SUPPORTED_MAC_ALGORITHMS

public static final String[] SUPPORTED_MAC_ALGORITHMS
All supported MAC algorithms.

SUPPORTED_SIGNATURE_ALGORITHMS

public static final String[] SUPPORTED_SIGNATURE_ALGORITHMS
All supported signature algorithms.

DEFAULT_XML_NAMESPACE

public static final String DEFAULT_XML_NAMESPACE
The default XML namespace.

SUPPORTED_XML_NAMESPACES

public static final String[] SUPPORTED_XML_NAMESPACES
All supported XML namespace values.

SUPPORTED_DIGEST_ALGORITHMS

public static final String[] SUPPORTED_DIGEST_ALGORITHMS
All supported digest algorithms.

useTemplate

public boolean useTemplate
Internal member, do not use

foundET

public boolean foundET
A flag to track the existence of the enveloped signature transform in any given element within a Added 12/01. BHD Internal member, do not use
Constructor Detail

XMLSignature

public XMLSignature()
Creates an empty XMLSignature object. This constructor should be used for detached signatures. If this constructor is used for enveloped or enveloping signatures, then call the setDocument (Document document) method to set the Document object explicitly to specify what is the root document that envelops or is enveloped.

XMLSignature

public XMLSignature(String fileName)
             throws XMLException
Constructs an instance of XMLSignature and initializes it with the fileName to sign.

Parameters

         fileName  

A String value of the name of the file to be signed.

Throws

XMLException - If an error occurs while reading the input file.

XMLSignature

public XMLSignature(File file)
             throws XMLException
Constructs an instance of XMLSignature and intializes it with the file to sign.

Parameters

         file  

The File object to be signed.

Throws

XMLException - If an error occurs while reading the file.

XMLSignature

public XMLSignature(InputStream inputStream)
             throws XMLException
Constructs an instance of XMLSignature and intializes it with the inputStream to sign.

Parameters

         inputStream  

The InputStream object to sign.

Throws

XMLException - If an error occurs while reading the inputStream.
Method Detail

setSignedInfo

public void setSignedInfo(org.w3c.dom.Node signedInfo)
Sets the signedInfo element of this XMLSignature object to the passed in value.

Internal method, do not use

Parameters

         signedInfo  

a DOM Node object storing the SignedInfo element data.


setSignatureType

public void setSignatureType(int type)
Sets the signature type to type.

Call this method only when signing the document.

Parameters

         type  

An integer containing the value of the signature type, defined in this class. The signature may be described as detached, enveloping, or enveloped.


getSignatureType

public int getSignatureType()
Returns the signature type as an integer value.

Returns

The integer value containing the value of the signature type.

setSignatureID

public void setSignatureID(String Id)
Sets the ID of this signature to Id.

Parameters

         Id  

A String object used to set the ID of the XMLSignature object.


getSignatureID

public String getSignatureID()
Returns the ID of the signature as a String object.

Returns

The ID of this signature as a String object.

setNamespacePrefix

public void setNamespacePrefix(String prefix)
Sets the prefix of this signature to prefix.

Parameters

         prefix  

A String object used to set the prefix of the XMLSignature object.


getNamespacePrefix

public String getNamespacePrefix()
Returns the prefix of the signature as a String object.

Returns

The prefix of this signature as a String object.

setCertificates

public void setCertificates(Certificate[] certs)
Sets the certificates, which contain the key information to use for verification, by assigning the certificate list in this XMLSignature instance to the given certificate list. This method can be useful for explicit signature validation. If the signature omits keyInfo, either this method or setKey(JSAFE_PublicKey key) should be called.

Parameters

         certs  

A Certificate array containing the key information to use for verification.


setKey

public void setKey(com.rsa.jsafe.JSAFE_PublicKey key)
Sets the verification key to the given value. This method is used to set the verification key explicitly. If the signature omits keyInfo, call this method or setCertificates(Certificate[] certs). Otherwise, signature verification will fail.

Parameters

         key  

A JSAFE_PublicKey to use for signature verification.


addReference

public void addReference(Reference reference)
Adds a Reference object to the reference list belonging to this XMLSignature instance.

Parameters

         reference  

The reference element including the optional identification of the data object, any optional transform elements, the digest algorithm and the digest value.


setReferences

public void setReferences(Reference[] references)
Sets the Reference object list with the values given in references by overriding the existing reference array.

Call this method or addReference () before signing; otherwise, the signing will fail.

Parameters

         references  

The references to put in the Reference object list.


getReferences

public Reference[] getReferences()
Returns the references.

Returns

The Reference object list in this XML signature. Each Reference contains a URI referring to the data object, the digest method, and the resulting digest value calculated over the identified data object. It may also include the transformations that produced the input to the digest operation.

setHMACOutputLen

public void setHMACOutputLen(int length)
Sets the HMAC output length, in bits, to the given value. HMAC output length is optional. The length should be a positive integer, a multiple of 8, and should not be larger than 160. This method should be called before HMAC signing.

Parameters

         length  

The integer value of the required HMAC output length, in bits.


getHMACOutputLen

public int getHMACOutputLen()
Returns the HMAC output length, in bits, as an integer. If the HMAC output length is not set, then it returns 0.

Returns

The HMAC output length, in bits, as an integer.

setKeyInfos

public void setKeyInfos(KeyInfo[] keyInfos)
Sets the keyInfos of this XMLSignature to the given value. For X509Data keyInfo, if the verification side uses an IBM toolkit, the DSA certificates stored in the X509Certificate element should be in X957 format.

Parameters

         keyInfos  

An array that contains a list of KeyInfo objects.


addKeyInfo

public void addKeyInfo(KeyInfo keyInfo)
Adds the given KeyInfo object to this XMLSignature instance by appending it to the KeyInfo list.

Parameters

         keyInfo  

A KeyInfo object, which can contain a key, a certificate, or other data.


getKeyInfos

public KeyInfo[] getKeyInfos()
Returns the keyInfo object list of this XMLSignature object.

Returns

A list of KeyInfo objects that can contain keys, names, certificates, and other public key management information, such as in-band key distribution or key-agreement data.

setSignatureMethod

public void setSignatureMethod(String signatureMethod)
                        throws XMLException
Sets the signature method to signatureMethod.

Parameters

         signatureMethod  

A String value that specifies the algorithm used for signature generation and validation. This algorithm identifies all cryptographic functions involved in the signature operation (for example, hashing, public-key algorithms, padding, and so on.)

Throws

XMLException - If the given signature method value is not supported.

getSignatureMethod

public String getSignatureMethod()
Returns the signature method.

Returns

The signature algorithm name as a String.

setCanonicalizationMethod

public void setCanonicalizationMethod(String c14nMethod)
                               throws XMLException
Sets the canonicalization method to c14nMethod.

Parameters

         c14nMethod  

The required element as a String that specifies the canonicalization algorithm applied to the SignedInfo element prior to performing signature calculations. Options include a minimal canonicalization and more extensive Canonical XML, defined in [XML - C14N].

Throws

XMLException - If the given canonicalization method value is not supported.

getCanonicalizationMethod

public String getCanonicalizationMethod()
Returns the canonicalization method.

Returns

The canonicalization algorithm as a String.

setSignatureValue

public void setSignatureValue(byte[] signature)
Sets the signatureValue of this XMLSignature.

Internal method, do not use

Parameters

         signature  

The byte array used to set the signatureValue of this XMLSignature.


getSignatureValue

public byte[] getSignatureValue()
Returns the signature value as a byte array.

Returns

The signatureValue of this XMLSignature as a byte array.

setXMLObjects

public void setXMLObjects(org.w3c.dom.Element[] xmlObjects)
Sets the xmlObjects of this XMLSignature to xmlObjects. Call this method before calling the sign() method; otherwise, the XML object element will not be included in the resulting signing document. All the XML object elements to set should attach to the same root document owned by this XMLSignature instance.

Parameters

         xmlObjects  

A DOM Element array that contains a list of object data.


addXMLObject

public void addXMLObject(org.w3c.dom.Element xmlObject)
Adds the given xmlObject by appending it to the xmlObject list of this XMLSignature instance. Call this method before calling the sign() method; otherwise, this XML object element will not be included in the resulting signing document. The XML Object element to add should attach to the same root document owned by this XMLSignature instance.

Parameters

         xmlObject  

A DOM Element that contains the data to include in the signature element.


getXMLObjects

public org.w3c.dom.Element[] getXMLObjects()
Returns the xmlObjects as a DOM Element array.

Returns

A list of data objects as a DOM Element within the signature element or elsewhere.

getXMLObjectByID

public org.w3c.dom.Element getXMLObjectByID(String ID)
Retrieves the xmlObject with the given ID value.

Parameters

         ID  

A String object used to identify the XML Object element.

Returns

A particular xmlObject containing ID as a DOM Element.

includeCommentsForXPointer

public void includeCommentsForXPointer(boolean commentXPointer)
Sets the boolean to indicate if comment nodes should be removed while processing XPointer or not. true value means to leave comment nodes, false means to remove them. The default behavior is to remove comment nodes.

Parameters

         commentXPointer  

the boolean indicating if comment nodes should be removed while processing XPointer or not.


sign

public void sign(CertJ certj)
          throws XMLException
Signs the XML document, specified in a constructor. Use this method if the keyInfo is set with a public key or certificates. It retrieves the signing private key from the database by the public key or certificates stored in the keyInfo. If the verification side uses an IBM toolkit, then the DSA certificates stored in X509Certificate element should be in X957 format. If no keyInfo is specified, call the sign method that takes a private key as an argument.

Parameters

         certj  

A CertJ object used to retrieve a private key. If it is null, signing will fail.

Throws

XMLException - If an error occurs while signing the XML signature. For example, if a signing key is not available, this method throws an exception.

sign

public void sign(com.rsa.jsafe.JSAFE_Key signKey,
                 com.rsa.jsafe.JSAFE_SecureRandom random,
                 String device)
          throws XMLException
Signs the document with the private key given in signKey, without validating it against the information stored in keyInfo. Call this method only if keyInfo is omitted from the signature. The application should be aware that the private key to sign and the key stored in keyInfo are a pair. Since keyInfo is not present in the signature, the key to validate the signature is identified based on application context information.

Parameters

         signKey  

A JSAFE_Key object used to sign the XML document.

         random  

A JSAFE_SecureRandom object that contains random bytes that will be used for padding, if the signature algorithm requires padding.

         device  

A String object indicating which device the signing operation used.

Throws

XMLException - If an error occurs while signing the document.

sign

public void sign(CertJ theCertJ,
                 com.rsa.jsafe.JSAFE_Key signKey,
                 com.rsa.jsafe.JSAFE_SecureRandom random,
                 String device)
          throws XMLException
Signs the XML document with the specified CertJ context.

Parameters

         theCertJ  

A CertJ reference.

         signKey  

A JSAFE_Key object that is used to sign the XML document.

         random  

A JSAFE_SecureRandom object that contains random bytes that will be used for padding, if the signature algorithm requires padding.

         device  

A String object indicating which device the signing operation used.

Throws

XMLException - If an error occurs while signing the document.

generateSignedInfo

public byte[] generateSignedInfo()
                          throws XMLException
Creates an incomplete Signature element (with an empty SignatureValue element or no SignatureValue element) in the document and returns the canonicalized SignedInfo value. Use the returned canonicalized SignedInfo value as the input to a private key operation. Once a binary signature value is calculated it can be added to the document's Signature element using the setSignatureValueElement() method. Call the generateSignedInfo() method only once and never call it in conjunction with the sign() method.

Returns

A byte array containing the canonicalized SignedInfo, which is ready to have the signature operation applied.

Throws

XMLException - If an error occurs while signing the document.

getCanonicalizedSignedInfo

public byte[] getCanonicalizedSignedInfo()
                                  throws XMLException
Calculates the canonicalized value of an existing SignedInfo element. Call this method any time after calling the sign() or generateSignedInfo() methods.

Returns

A byte array containing the canonicalized value of the SignedInfo element. The private key operation is applied to this value.

setSignatureValueElement

public void setSignatureValueElement(byte[] newSignatureValue)
                              throws XMLException
Sets the SignatureValue element to the value specified by newSignatureValue. This method creates a new SignatureValue element or overwrites an existing one. Call this method only after calling the generateSignedData() method (after a signature is calculated). Do not call this method in conjunction with the sign() method.

Parameters

         newsignatureValue  

A byte array (not a base64 string) that contains the binary signature value to set in the SignatureValue element. It is the application's responsibility to ensure this value corresponds to the SignedInfo element.


verify

public VerificationInfo verify(CertJ certj,
                               CertPathCtx certPathCtx)
                        throws XMLException
Verifies the signature in the document, specified in the constructor, and returns a VerificationInfo object with detailed information such as signature verification failure or reference validation failure.

Parameters

         certj  

The CertJ object used to verify the certificate against the database. It is required for signature verification.

         certPathCtx  

The CertPathCtx object used to verify the certificate path. It can be null, if certificate validation is not required. If this XMLSignature instance contains both key and certificates, then this object is required for key and certificate validation; otherwise, the signature verification fails.

Returns

A VerificationInfo object with detailed signature validation information.

Throws

XMLException - If an error occurs while verifing the signature.

verify

public VerificationInfo verify(com.rsa.jsafe.JSAFE_Key verifyKey,
                               String device)
                        throws XMLException
Verifies the signature contained in the XML document. Returns a VerificationInfo object with detailed information, such as signature verification or reference validation failure.

Parameters

         verifyKey  

A JSAFE_Key object used for signature verification.

         device  

A string value that specifies on which device the Crypto JSAFE operates.

Returns

A VerificationInfo object with detailed signature validation information.

Throws

XMLException - If an error occurs during signature verification.

verify

public VerificationInfo verify(CertJ certj,
                               com.rsa.jsafe.JSAFE_Key verifyKey,
                               String device)
                        throws XMLException
Verifies the signature with the CertJ context specified.

Parameters

         certj  

The CertJ reference. If a PKCS #11 device is used for storing the key, then it must be set to provide the right PKC11Session, otherwise it could be null.

         verifyKey  

A JSAFE_Key object to be used for signature verification.

         device  

A string value that specifies on which device the crypto jsafe operations on.

Returns

A VerificationInfo object with detailed signature validation information.

Throws

XMLException - If an error occured during signature verification.

getVerifyingCert

public Certificate getVerifyingCert()
                             throws CloneNotSupportedException
Retrieves the certificate used to verify the signature.

Returns

A copy of the certificate used to verify the signature. This is null if a certificate was not used, for example, the public key was provided directly. The existence of this certificate does not mean the signature was verified, rather that it was the certificate used in the verification process.

setSignatureElement

public void setSignatureElement(org.w3c.dom.Element sigElement)
Sets the signature element containing all the information of this XMLSignature object to the passed in value.

Internal method, do not use

Parameters

         sigElement  

a DOM Element object containing the Signature element


getSignatureElement

public org.w3c.dom.Element getSignatureElement()
Returns the signature element containing all the information of this XMLSignature object to the passed in value.

Internal method, do not use

Returns

a DOM Element object containing the Signature element.

setXMLNamespace

public void setXMLNamespace(String namespace)
                     throws XMLException
Sets the xml namespace to the passed in string value. It must be consistent with the prefix in signatureMethod and digestMethod. For example, if the signatureMethod is: http://www.w3.org/2000/07/xmldsig#dsa-sha1, then the namespace value could only be http://www.w3.org/07/xmldsig.

internal method, do not use

Parameters

         namespace  

a String object containing the default xml namespace value

Throws

XMLException - will be throwed if the value passed in is not a supported one.

getXMLNamespace

public String getXMLNamespace()
Returns the xml namespace as a string.

Internal method, do not use

Returns

the xml namespace value used by this XMLSignature instance

setDocument

public void setDocument(org.w3c.dom.Document document)
Sets the Document object. If an empty XMLSignature constructor is used and the signature type is either Enveloped or Enveloping, use this method to specify the root of the Signature element. For a detached signature, this method can also be used to specify explicitly the root of the signature element.

Parameters

         document  

A Document object.


setDocument

public void setDocument(org.w3c.dom.Document document,
                        boolean useTemplate)
Sets the Document object. This method should be called for template signing. If useTemplate is set to true, the document contains an XML signature template.

Parameters

         document  

A Document object containing an XML signature template when useTemplate is true.

         useTemplate  

A boolean varible indicating whether the document contains an XML signature template or not.


useTemplate

public boolean useTemplate()
Returns true if it is a template signing; falseotherwise.

Returns

true if it is a template signing; falseotherwise.

getDocument

public org.w3c.dom.Document getDocument()
Returns the Document object. It should be the root of the XML Object element. To generate an XML Object element, call this method to get the root document.

Returns

A Document object.

setFlags

public void setFlags(int flags)
Sets the internal behavior flags to the specified flag values.

Parameters

         flags  

Specified behavior flags.


getFlags

public int getFlags()
Gets the current state of internal behavior flags.

Returns

The current behavior flag settings.


RSA BSAFE ® Cert-J 2.1.1 001-047007-211-001-000