com.rsa.swsj.signature
Class SigReference

java.lang.Object
  extended bycom.rsa.swsj.Reference
      extended bycom.rsa.swsj.signature.SigReference

public final class SigReference
extends Reference

This class creates and stores the Reference element in an XML signature. It includes the digest method and resulting digest value calculated over the identified data object. It can also include transformations that produce the input to the digest operation. Reference validation involves checking the digest value against the identified data object. If the digest algorithm is not set, the default SHA1 hashing algorithm is used.

Note: Use the setURI() method from the Reference base class to set the URI of the Reference object.


Field Summary

static java.lang.String

ALG_DIGEST_SHA1

Specifies the SHA-1 digest algorithm.

 
Fields inherited from class com.rsa.swsj.Reference
ALG_TRANSFORM_BASE64, ALG_TRANSFORM_C14N, ALG_TRANSFORM_C14N_WITH_COMMENTS, ALG_TRANSFORM_ENVELOPED_SIGNATURE, ALG_TRANSFORM_EXCLC14N, ALG_TRANSFORM_EXCLC14N_WITH_COMMENTS, ALG_TRANSFORM_XPATH
 
Constructor Summary
SigReference(SWSJContext context)

Creates a SigReference object and initializes it with the context only.

SigReference(SWSJContext context, java.lang.String uri, java.lang.String digestMethod)

Creates a SigReference object and initializes it with the given values.

 
Method Summary

 java.lang.String

getDigestMethod()

Gets the digest algorithm of this reference.

 byte[]

getDigestValue()

Gets the digest value.

 void

setDigestMethod(java.lang.String digestMethod)

Sets the digest algorithm of this reference.

 
Methods inherited from class com.rsa.swsj.Reference
addTransform, getContext, getId, getTransformParams, getTransforms, getURI, setId, setURI
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALG_DIGEST_SHA1

public static final java.lang.String ALG_DIGEST_SHA1
Specifies the SHA-1 digest algorithm.

Constructor Detail

SigReference

public SigReference(SWSJContext context)
             throws InvalidParameterException
Creates a SigReference object and initializes it with the context only. If the digest algorithm is not set later, the default SHA1 hashing algorithm is used.

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

SigReference

public SigReference(SWSJContext context,
                    java.lang.String uri,
                    java.lang.String digestMethod)
             throws InvalidParameterException
Creates a SigReference object and initializes it with the given values.

Parameters:
context - An object that collects a number of common parameters and state variables; for example, JCE provider.
uri - The URI that identifies the data object.
digestMethod - The digest algorithm.
Throws:
InvalidParameterException - If any of the parameters are invalid.
Method Detail

setDigestMethod

public void setDigestMethod(java.lang.String digestMethod)
                     throws InvalidParameterException
Sets the digest algorithm of this reference. Call this method only when signing the document.

Parameters:
digestMethod - The digest algorithm to apply to the signed object.
Throws:
InvalidParameterException - If the digest algorithm is no supported.

getDigestMethod

public java.lang.String getDigestMethod()
Gets the digest algorithm of this reference.

Returns:
The digest algorithm as a String.

getDigestValue

public byte[] getDigestValue()
Gets the digest value.

Returns:
A byte array containing the digest value.