|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.xml.dsig.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 also may include transformations that produce the input to the digest operation. Reference validation involves the checking of the digest value against the identified data object.
Copyright © RSA Security Inc., 2001-2002. All rights reserved.
See Also
Field Summary |
|
static String |
MANIFEST_TYPE
Specifies that the URI of this reference contains a Manifest element. |
static String |
OBJECT_TYPE
Specifies that the URI of this reference contains an Object element. |
static String |
REFERENCE_TYPE
Specifies that the URI of this reference contains a Reference element. |
static String |
SIGNATURE_PROPERTY_TYPE
Specifies that the URI of this reference contains a SignatureProperties (this includes assertions about the signature itself, such as the time of signing or the serial number of hardware used in cryptographic processes). |
Constructor Summary |
|
Reference()
Creates an empty |
|
Reference(String uri)
Creates a |
|
Reference(String uri,
String digestMethod,
Transformer[] transforms)
Creates a Reference object and sets the attributes to the given values. |
|
Reference(String uri,
String digestMethod,
Transformer[] transforms,
String referenceType)
Creates a |
|
Reference(String uri,
String digestMethod,
Transformer[] transforms,
String referenceType,
Manifest manifest)
Creates a |
Method Summary |
|
void |
addTransform(Transformer transform)
Adds a transformation to this reference object by appending the
|
org.w3c.dom.Element |
generateReferenceElement(XMLSignature xmlSignature,
org.w3c.dom.Document document)
Generates the Reference element with its attribute values. |
getDigestMethod()
Gets the digest algorithm of this reference. |
|
byte[] |
getDigestValue()
Gets the digest value. |
getManifest()
Returns the manifest as a |
|
getReferenceID()
Returns the ID of the Reference as a |
|
getReferenceType()
Returns the reference type. |
|
getTransform(int index)
Gets the transformer located at index. |
|
int |
getTransformCount()
Gets the number of |
getTransforms()
Gets the ordered transformation list of this reference. |
|
getURI()
Returns the URI of this reference. |
|
void |
parseReference(org.w3c.dom.Element referenceNode,
String xmlNamespace)
This method retrieves the data from the passed in reference node, and sets
all the attributes of this |
static org.w3c.dom.Element |
resolveId(org.w3c.dom.Node inputNode,
String id)
Finds the element from the inputNode, the element should contain an attribute with value of id. |
void |
setDigestMethod(String digestMethod)
Sets the digest algorithm of this reference. |
void |
setManifest(Manifest manifest)
Sets the |
void |
setReferenceID(String id)
Sets the ID of this Reference to id. |
void |
setReferenceType(String type)
Sets the reference type. |
void |
setTransform(Transformer[] transforms)
Sets the tranformation list to this Reference object by overriding the existing ones. |
void |
setURI(String uri)
Sets the URI of this reference to the given value. |
boolean |
verify(XMLSignature signature,
StringBuffer description)
Validates references by performing transformations on the
identified data object, digesting the resulting data object by using
|
boolean |
verifyManifest(XMLSignature xmlSignature,
StringBuffer[] descriptions)
Validates each Reference element in the manifest of the current Reference instance. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SIGNATURE_PROPERTY_TYPE
public static final String MANIFEST_TYPE
public static final String OBJECT_TYPE
public static final String REFERENCE_TYPE
Constructor Detail |
public Reference()
Reference
object without initializing any
attributes. This is the default constructor.public Reference(String uri)
Reference
object and sets the URI setting
to uri.
Parameters
uri | A |
public Reference(String uri, String digestMethod, Transformer[] transforms)
Parameters
uri | The URI that identifies the data object. | ||
digestMethod | The digest algorithm. | ||
transforms | The list of transformations to perform on the data object. |
public Reference(String uri, String digestMethod, Transformer[] transforms, String referenceType)
Reference
object and initializes
it with the given values.
Parameters
uri | The URI that identifies the data object. | ||
digestMethod | The digest algorithm name. | ||
transforms | The list of transformations to be performed on the data object. | ||
referenceType | An optional |
public Reference(String uri, String digestMethod, Transformer[] transforms, String referenceType, Manifest manifest)
Reference
object with the given values.
Parameters
uri | The URI that identifies the data object. | ||
digestMethod | The digest algorithm name. | ||
transforms | The list of transformations to be performed on the data object. | ||
referenceType | An optional | ||
manifest | A |
Method Detail |
public void setReferenceType(String type)
Parameters
type | A |
public String getReferenceType()
Returns
String
can be one of the following:
OBJECT_TYPE
,
SIGNATURE_PROPERTY_TYPE
, or MANIFEST_TYPE
.public void setURI(String uri)
Parameters
uri | A |
public String getURI()
Returns
String
of this Reference
.public void addTransform(Transformer transform)
Transformer
object in 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) 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 for the digest algorithm.
Each transform consists of an algorithm attribute (the name of the algorithm
to perform), optional MimeType
and CharSet
attributes, and content parameters, if any, appropriate for the given
algorithm. Examples of transforms include Base 64 decoding, canonicalization,
and XPath filtering.
Note: The order of tranformers in the transformation list is critical.
If the tranformation list contains EnvelopedTransformer
, it should
be before C14NTransformer
and Base64Transformer
,
because it requires the original node-set pointed to by the URI as its input.
Otherwise, the reference digest value will not be generated correctly.
Parameters
transform | A |
public void setTransform(Transformer[] transforms)
EnvelopedTransformer
, it should
be before C14NTransformer
and Base64Transformer
,
because it requires the original node-set pointed to by the URI as its input.
Otherwise, the reference digest value will not be generated correctly.
Parameters
transforms | The list of transformations as
a |
public Transformer getTransform(int index)
Parameters
index | The position of the transform in the transform list. |
Returns
Transformer
object at the specified position, or
null
if the index is invalid.public int getTransformCount()
Tranformer
objects in this reference.
Returns
Transformer
objects in this reference.public Transformer[] getTransforms()
Returns
Transformer
object list.public void setDigestMethod(String digestMethod)
Parameters
digestMethod | The digest algorithm to apply to the signed object. Call this method only when signing the document. |
public String getDigestMethod()
Returns
String
.public byte[] getDigestValue()
Returns
byte
array.public String getReferenceID()
String
object.
Returns
String
object.public void setReferenceID(String id)
Parameters
id | A |
public void setManifest(Manifest manifest)
Manifest
of this Reference
instance as
the passed-in value.Parameters
manifest | A |
public Manifest getManifest()
Manifest
object.
Returns
Manifest
object.public void parseReference(org.w3c.dom.Element referenceNode, String xmlNamespace) throws XMLException
Reference
.
Internal method, do not useParameters
referenceNode | a DOM |
Throws
XMLException
- If there is error occured during parsing the
Reference node.public org.w3c.dom.Element generateReferenceElement(XMLSignature xmlSignature, org.w3c.dom.Document document) throws XMLException
Parameters
xmlSignature | the | ||
document | the |
Returns
Element
object storing the data of this
Reference
objectThrows
XMLException
- If there is an error ocurred during generating
the Reference element.public boolean verifyManifest(XMLSignature xmlSignature, StringBuffer[] descriptions) throws XMLException
true
if all the reference validations succeed.
It returns false
if any reference validations fail.
This method should be called only when
this Reference
object is a Manifest type.
If it is not a Manifest type, this method always returns
true
.Parameters
xmlSignature | An | ||
descriptions | A |
Returns
true
if each reference validation succeeds;
false
, otherwise.Throws
XMLException
- If an error occured while verifying
the manifest.public boolean verify(XMLSignature signature, StringBuffer description) throws XMLException
digestMethod
, and then comparing
the generated digest value against the
digest value in the reference.
Parameters
signature | An | ||
description | A |
Returns
true
if the validation is successful;
false
if there is any mismatch.Throws
XMLException
- If an error occurs during reference
validation. For example, this method throws an exception if
the XMLSignature
object that contains this reference
is not available.public static org.w3c.dom.Element resolveId(org.w3c.dom.Node inputNode, String id) throws XMLException
Parameters
inputNode | a | ||
id | the string value of the attribute node with node name "ID" or "id" or "Id". |
Returns
Throws
XMLException
- If there is an error occured during searching the
the element.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |