com.rsa.swsj
Class Reference

java.lang.Object
  extended bycom.rsa.swsj.Reference
Direct Known Subclasses:
RetrievalMethod, SigReference

public class Reference
extends java.lang.Object

This class is used by the application to identify the element on which to perform the security operation. This class handles URI processing to identify input data and transformations on that input data. For security operations of type XMLSignature, the SigReference type of reference must be used.


Field Summary

static java.lang.String

ALG_TRANSFORM_BASE64

Specifies the Base64 transform algorithm.

static java.lang.String

ALG_TRANSFORM_C14N

Specifies the canonicalization without comments transform.

static java.lang.String

ALG_TRANSFORM_C14N_WITH_COMMENTS

Specifies the canonicalization with comments transform.

static java.lang.String

ALG_TRANSFORM_ENVELOPED_SIGNATURE

Specifies the Enveloped-Signature transform algorithm.

static java.lang.String

ALG_TRANSFORM_EXCLC14N

Specifies the exclusive canonicalization transform.

static java.lang.String

ALG_TRANSFORM_EXCLC14N_WITH_COMMENTS

Specifies the exclusive canonicalization with comments transform.

static java.lang.String

ALG_TRANSFORM_XPATH

Specifies the XPath transform algorithm.

 
Constructor Summary
Reference(SWSJContext context)

The default constructor that creates an empty Reference object that is initialized only with context.

Reference(SWSJContext context, java.lang.String uri)

Creates a Reference object and sets the URI setting to uri.

 
Method Summary

 void

addTransform(java.lang.String transform, java.lang.Object param)

Adds a transformation to this reference object by appending the transform to the existing transformations.

 SWSJContext

getContext()

Gets the SWSJContext, that is used to carry a number of common parameters and state variables.

 java.lang.String

getId()

Returns the Id of this Reference as a String object.

 java.lang.Object[]

getTransformParams()

Get the array of transformation parameters.

 java.lang.String[]

getTransforms()

Gets the array of transform algorithms.

 java.lang.String

getURI()

Returns the URI of this reference.

 void

setId(java.lang.String id)

Sets the optional Id of this Reference to id.

 void

setURI(java.lang.String uri)

Sets the URI of this reference to the given value.

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

Field Detail

ALG_TRANSFORM_BASE64

public static final java.lang.String ALG_TRANSFORM_BASE64
Specifies the Base64 transform algorithm. No parameters are required.


ALG_TRANSFORM_C14N

public static final java.lang.String ALG_TRANSFORM_C14N
Specifies the canonicalization without comments transform. No parameters are required.


ALG_TRANSFORM_C14N_WITH_COMMENTS

public static final java.lang.String ALG_TRANSFORM_C14N_WITH_COMMENTS
Specifies the canonicalization with comments transform. No parameters are required.


ALG_TRANSFORM_EXCLC14N

public static final java.lang.String ALG_TRANSFORM_EXCLC14N
Specifies the exclusive canonicalization transform. There is one required parameter: a String containing a white space delimited list of namespace prefixes, where #default indicates the default namespace. "dsig soap #default" is an example.


ALG_TRANSFORM_EXCLC14N_WITH_COMMENTS

public static final java.lang.String ALG_TRANSFORM_EXCLC14N_WITH_COMMENTS
Specifies the exclusive canonicalization with comments transform. There is one optional parameter: a String of white space delimited list of namespace prefixes, where #default indicates the default namespace. "dsig soap #default" is an example.


ALG_TRANSFORM_XPATH

public static final java.lang.String ALG_TRANSFORM_XPATH
Specifies the XPath transform algorithm. There is one optional parameter: a String containing the XPath expression. For more information on XPath expressions, see the Basic XML Concepts section of the online Reference.


ALG_TRANSFORM_ENVELOPED_SIGNATURE

public static final java.lang.String ALG_TRANSFORM_ENVELOPED_SIGNATURE
Specifies the Enveloped-Signature transform algorithm. No parameters are required.

Constructor Detail

Reference

public Reference(SWSJContext context)
          throws InvalidParameterException
The default constructor that creates an empty Reference object that is initialized only with context.

Parameters:
context - An object that collects a number of common parameters and state variables; for example, JCE provider.
Throws:
InvalidParameterException - If context is invalid.

Reference

public Reference(SWSJContext context,
                 java.lang.String uri)
          throws InvalidParameterException
Creates a Reference object and sets the URI setting to uri.

Parameters:
context - An object that collects a number of common parameters and state variables; for example, JCE provider.
uri - A String containing the URI that identifies the data object.
Throws:
InvalidParameterException - If any paramter is invalid.
Method Detail

getContext

public SWSJContext getContext()
Gets the SWSJContext, that is used to carry a number of common parameters and state variables.

Returns:
An object that collects a number of common parameters and state variables; for example, JCE provider.

setURI

public void setURI(java.lang.String uri)
Sets the URI of this reference to the given value. For this version, the only two supported xpointer uris are of type "#xpointer(/)" and "#xpointer(id("ID"))" where ID is the value of an element's id attribute in the same document.

Parameters:
uri - A String value that contains the URI.

getURI

public java.lang.String getURI()
Returns the URI of this reference. Note: In case of signatures, null is a possible return value from this method.

Returns:
The URI String of this Reference.

addTransform

public void addTransform(java.lang.String transform,
                         java.lang.Object param)
                  throws InvalidParameterException
Adds a transformation to this reference object by appending the transform to the existing transformations.

Transformations describe how the signer obtained the data object that was digested. This argument is optional. There can be any number of transforms. The output of each transform (octets/nodesets) serves as input to the next transform. The input for the first transform is the source data. The output from the last transform is the input to the digest algorithm (in case of XMLSignature).

Each transform consists of the name of the algorithm to perform and content parameters, if any, appropriate for the given algorithm. Examples of transforms include Base64 encoding, canonicalization, and XPath filtering.

Note: The order of tranformers in the transformation list is critical. If the tranformation list contains an enveloped signature transform, it must appear before any canonicalization and Base64 transforms, as it requires the original node-set to which the URI points as its input.

Parameters:
transform - The name of transform algorithm.
param - The parameter for this transform algorithm. For an XPATH transform pass an array of String expressions as described above. Pass null if this algorithm does not take any parameters.
Throws:
InvalidParameterException - If the specified transform algorithm is null or not supported.

getTransforms

public java.lang.String[] getTransforms()
Gets the array of transform algorithms.

Returns:
The array of transform algorithms.

getTransformParams

public java.lang.Object[] getTransformParams()
Get the array of transformation parameters.

Returns:
An array of the parameters for the transformation algorithms. Some parameters can be null, if the corresponding transformation algorithm does not require parameters.

getId

public java.lang.String getId()
Returns the Id of this Reference as a String object.

Returns:
The Id of this Reference as a String object.

setId

public void setId(java.lang.String id)
Sets the optional Id of this Reference to id.

Note: It is the user's responsibility not to duplicate ID values in XML and WSS documents to which security will be added.

Parameters:
id - A String object containing the ID for this Reference object.