APIdia Launch Partner
Top Description Fields Constructors Methods
org.jcp.xml.dsig.internal.dom

public final Class DOMReference

extends DOMStructure
implements Reference, DOMURIReference
Class Inheritance
All Implemented Interfaces
javax.xml.crypto.dom.DOMURIReference, javax.xml.crypto.URIReference, javax.xml.crypto.dsig.Reference, javax.xml.crypto.XMLStructure
Imports
java.io.IOException, .InputStream, .OutputStream, java.net.URI, .URISyntaxException, java.security.AccessController, .MessageDigest, .NoSuchAlgorithmException, .PrivilegedAction, .Provider, java.util.ArrayList, .Arrays, .Collections, .Iterator, .List, .Set, javax.xml.crypto.Data, .MarshalException, .NodeSetData, .OctetStreamData, .URIDereferencer, .URIReferenceException, .XMLCryptoContext, javax.xml.crypto.dom.DOMCryptoContext, .DOMURIReference, javax.xml.crypto.dsig.CanonicalizationMethod, .DigestMethod, .Reference, .Transform, .TransformException, .TransformService, .XMLSignContext, .XMLSignature, .XMLSignatureException, .XMLValidateContext, org.jcp.xml.dsig.internal.DigesterOutputStream, com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput, com.sun.org.apache.xml.internal.security.utils.UnsyncBufferedOutputStream, .XMLUtils, org.w3c.dom.Attr, .Document, .Element, .Node

DOM-based implementation of Reference.

Field Summary

Modifier and TypeField and Description
private List<Transform>
private final Data
private byte[]
private Data
private boolean
private final DigestMethod
private byte[]
private InputStream
private Attr
private final String
private static final Logger
public static final int
MAXIMUM_TRANSFORM_COUNT

The maximum number of transforms per reference, if secure validation is enabled.

private MessageDigest
private Provider
private Element
private final List<Transform>
private final String
private final String
private static boolean
useC14N11

Look up useC14N11 system property.

private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public
DOMReference(String
the URI (may be null)
uri
,
String
the type (may be null)
type
,
DigestMethod
the digest method
dm
,
List<? extends Transform>
a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.
transforms
,
String
the reference ID (may be null)
id
,
Provider provider)

Creates a Reference from the specified parameters.

public
DOMReference(String uri, String type, DigestMethod dm, List<? extends Transform> appliedTransforms, Data result, List<? extends Transform> transforms, String id, Provider provider)

public
DOMReference(String uri, String type, DigestMethod dm, List<? extends Transform> appliedTransforms, Data result, List<? extends Transform> transforms, String id, byte[] digestValue, Provider provider)

public
DOMReference(Element
a Reference element
refElem
,
XMLCryptoContext context, Provider provider)

Creates a DOMReference from an element.

Method Summary

Modifier and TypeMethod and Description
private static Data
copyDerefData(Data dereferencedData)

private Data
public void
digest(XMLSignContext signContext)

public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public byte[]
getCalculatedDigestValue()

Implements javax.xml.crypto.dsig.Reference.getCalculatedDigestValue.

Returns the calculated digest value of this Reference after a validation operation.

public Data
getDereferencedData()

Implements javax.xml.crypto.dsig.Reference.getDereferencedData.

Returns the dereferenced data, if reference caching is enabled.

public InputStream
getDigestInputStream()

Implements javax.xml.crypto.dsig.Reference.getDigestInputStream.

Returns the pre-digested input stream, if reference caching is enabled.

public DigestMethod
getDigestMethod()

Implements javax.xml.crypto.dsig.Reference.getDigestMethod.

Returns the digest method of this Reference.

public byte[]
getDigestValue()

Implements javax.xml.crypto.dsig.Reference.getDigestValue.

Returns the digest value of this Reference.

public Node
getHere()

Implements javax.xml.crypto.dom.DOMURIReference.getHere.

Returns the here node.

public String
getId()

Implements javax.xml.crypto.dsig.Reference.getId.

Returns the optional Id attribute of this Reference, which permits this reference to be referenced from elsewhere.

public List<Transform>
getTransforms()

Implements javax.xml.crypto.dsig.Reference.getTransforms.

Returns an unmodifiable list of Transforms that are contained in this Reference.

public String
getType()

Implements javax.xml.crypto.URIReference.getType.

Returns the type of data referenced by this URI.

public String
getURI()

Implements javax.xml.crypto.URIReference.getURI.

Returns the URI of the referenced data object.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv boolean
public void
private byte[]
transform(Data dereferencedData, XMLCryptoContext context)

public boolean
validate(XMLValidateContext validateContext)

Implements javax.xml.crypto.dsig.Reference.validate.

Validates this reference.

Inherited from org.jcp.xml.dsig.internal.dom.DOMStructure:
equalsContentisFeatureSupported

Field Detail

allTransformsback to summary
private List<Transform> allTransforms
appliedTransformDataback to summary
private final Data appliedTransformData
calcDigestValueback to summary
private byte[] calcDigestValue
derefDataback to summary
private Data derefData
digestedback to summary
private boolean digested
digestMethodback to summary
private final DigestMethod digestMethod
digestValueback to summary
private byte[] digestValue
disback to summary
private InputStream dis
hereback to summary
private Attr here
idback to summary
private final String id
LOGback to summary
private static final Logger LOG
MAXIMUM_TRANSFORM_COUNTback to summary
public static final int MAXIMUM_TRANSFORM_COUNT

The maximum number of transforms per reference, if secure validation is enabled.

mdback to summary
private MessageDigest md
providerback to summary
private Provider provider
refElemback to summary
private Element refElem
transformsback to summary
private final List<Transform> transforms
typeback to summary
private final String type
uriback to summary
private final String uri
useC14N11back to summary
private static boolean useC14N11

Look up useC14N11 system property. If true, an explicit C14N11 transform will be added if necessary when generating the signature. See section 3.1.1 of http://www.w3.org/2007/xmlsec/Drafts/xmldsig-core/ for more info. If true, overrides the same property if set in the XMLSignContext.

Annotations
@SuppressWarnings:removal
validatedback to summary
private boolean validated
validationStatusback to summary
private boolean validationStatus

Constructor Detail

DOMReferenceback to summary
public DOMReference(String uri, String type, DigestMethod dm, List<? extends Transform> transforms, String id, Provider provider)

Creates a Reference from the specified parameters.

Parameters
uri:String

the URI (may be null)

type:String

the type (may be null)

dm:DigestMethod

the digest method

transforms:List<? extends Transform>

a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.

id:String

the reference ID (may be null)

Exceptions
NullPointerException:
if dm is null
ClassCastException:
if any of the transforms are not of type Transform
DOMReferenceback to summary
public DOMReference(String uri, String type, DigestMethod dm, List<? extends Transform> appliedTransforms, Data result, List<? extends Transform> transforms, String id, Provider provider)
DOMReferenceback to summary
public DOMReference(String uri, String type, DigestMethod dm, List<? extends Transform> appliedTransforms, Data result, List<? extends Transform> transforms, String id, byte[] digestValue, Provider provider)
DOMReferenceback to summary
public DOMReference(Element refElem, XMLCryptoContext context, Provider provider) throws MarshalException

Creates a DOMReference from an element.

Parameters
refElem:Element

a Reference element

Method Detail

copyDerefDataback to summary
private static Data copyDerefData(Data dereferencedData)
dereferenceback to summary
private Data dereference(XMLCryptoContext context) throws XMLSignatureException
digestback to summary
public void digest(XMLSignContext signContext) throws XMLSignatureException
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getCalculatedDigestValueback to summary
public byte[] getCalculatedDigestValue()

Implements javax.xml.crypto.dsig.Reference.getCalculatedDigestValue.

Doc from javax.xml.crypto.dsig.Reference.getCalculatedDigestValue.

Returns the calculated digest value of this Reference after a validation operation. This method is useful for debugging if the reference fails to validate.

Annotations
@Override
getDereferencedDataback to summary
public Data getDereferencedData()

Implements javax.xml.crypto.dsig.Reference.getDereferencedData.

Doc from javax.xml.crypto.dsig.Reference.getDereferencedData.

Returns the dereferenced data, if reference caching is enabled. This is the result of dereferencing the URI of this reference during a validation or generation operation.

Annotations
@Override
getDigestInputStreamback to summary
public InputStream getDigestInputStream()

Implements javax.xml.crypto.dsig.Reference.getDigestInputStream.

Doc from javax.xml.crypto.dsig.Reference.getDigestInputStream.

Returns the pre-digested input stream, if reference caching is enabled. This is the input to the digest operation during a validation or signing operation.

Annotations
@Override
getDigestMethodback to summary
public DigestMethod getDigestMethod()

Implements javax.xml.crypto.dsig.Reference.getDigestMethod.

Doc from javax.xml.crypto.dsig.Reference.getDigestMethod.

Returns the digest method of this Reference.

Annotations
@Override
getDigestValueback to summary
public byte[] getDigestValue()

Implements javax.xml.crypto.dsig.Reference.getDigestValue.

Doc from javax.xml.crypto.dsig.Reference.getDigestValue.

Returns the digest value of this Reference.

Annotations
@Override
getHereback to summary
public Node getHere()

Implements javax.xml.crypto.dom.DOMURIReference.getHere.

Doc from javax.xml.crypto.dom.DOMURIReference.getHere.

Returns the here node.

Annotations
@Override
getIdback to summary
public String getId()

Implements javax.xml.crypto.dsig.Reference.getId.

Doc from javax.xml.crypto.dsig.Reference.getId.

Returns the optional Id attribute of this Reference, which permits this reference to be referenced from elsewhere.

Annotations
@Override
getTransformsback to summary
public List<Transform> getTransforms()

Implements javax.xml.crypto.dsig.Reference.getTransforms.

Doc from javax.xml.crypto.dsig.Reference.getTransforms.

Returns an unmodifiable list of Transforms that are contained in this Reference.

Annotations
@Override
getTypeback to summary
public String getType()

Implements javax.xml.crypto.URIReference.getType.

Doc from javax.xml.crypto.URIReference.getType.

Returns the type of data referenced by this URI.

Annotations
@Override
getURIback to summary
public String getURI()

Implements javax.xml.crypto.URIReference.getURI.

Doc from javax.xml.crypto.URIReference.getURI.

Returns the URI of the referenced data object.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
isDigestedback to summary
pack-priv boolean isDigested()
marshalback to summary
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context) throws MarshalException

Implements abstract org.jcp.xml.dsig.internal.dom.DOMStructure.marshal.

Annotations
@Override
transformback to summary
private byte[] transform(Data dereferencedData, XMLCryptoContext context) throws XMLSignatureException
validateback to summary
public boolean validate(XMLValidateContext validateContext) throws XMLSignatureException

Implements javax.xml.crypto.dsig.Reference.validate.

Doc from javax.xml.crypto.dsig.Reference.validate.

Validates this reference. This method verifies the digest of this reference.

This method only validates the reference the first time it is invoked. On subsequent invocations, it returns a cached result.

Annotations
@Override
Exceptions
XMLSignatureException:
if an unexpected exception occurs while validating the reference