Class DOMReference

  • All Implemented Interfaces:
    javax.xml.crypto.dom.DOMURIReference, javax.xml.crypto.dsig.Reference, javax.xml.crypto.URIReference, javax.xml.crypto.XMLStructure

    public final class DOMReference
    extends DOMStructure
    implements javax.xml.crypto.dsig.Reference, javax.xml.crypto.dom.DOMURIReference
    DOM-based implementation of Reference.
    Author:
    Sean Mullan, Joyce Leung
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAXIMUM_TRANSFORM_COUNT
      The maximum number of transforms per reference, if secure validation is enabled.
    • Constructor Summary

      Constructors 
      Constructor Description
      DOMReference​(java.lang.String uri, java.lang.String type, javax.xml.crypto.dsig.DigestMethod dm, java.util.List<? extends javax.xml.crypto.dsig.Transform> transforms, java.lang.String id, java.security.Provider provider)
      Creates a Reference from the specified parameters.
      DOMReference​(java.lang.String uri, java.lang.String type, javax.xml.crypto.dsig.DigestMethod dm, java.util.List<? extends javax.xml.crypto.dsig.Transform> appliedTransforms, javax.xml.crypto.Data result, java.util.List<? extends javax.xml.crypto.dsig.Transform> transforms, java.lang.String id, byte[] digestValue, java.security.Provider provider)  
      DOMReference​(java.lang.String uri, java.lang.String type, javax.xml.crypto.dsig.DigestMethod dm, java.util.List<? extends javax.xml.crypto.dsig.Transform> appliedTransforms, javax.xml.crypto.Data result, java.util.List<? extends javax.xml.crypto.dsig.Transform> transforms, java.lang.String id, java.security.Provider provider)  
      DOMReference​(org.w3c.dom.Element refElem, javax.xml.crypto.XMLCryptoContext context, java.security.Provider provider)
      Creates a DOMReference from an element.
    • Field Detail

      • MAXIMUM_TRANSFORM_COUNT

        public static final int MAXIMUM_TRANSFORM_COUNT
        The maximum number of transforms per reference, if secure validation is enabled.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DOMReference

        public DOMReference​(java.lang.String uri,
                            java.lang.String type,
                            javax.xml.crypto.dsig.DigestMethod dm,
                            java.util.List<? extends javax.xml.crypto.dsig.Transform> transforms,
                            java.lang.String id,
                            java.security.Provider provider)
        Creates a Reference from the specified parameters.
        Parameters:
        uri - the URI (may be null)
        type - the type (may be null)
        dm - the digest method
        transforms - a list of Transforms. The list is defensively copied to protect against subsequent modification. May be null or empty.
        id - the reference ID (may be null)
        Throws:
        java.lang.NullPointerException - if dm is null
        java.lang.ClassCastException - if any of the transforms are not of type Transform
      • DOMReference

        public DOMReference​(java.lang.String uri,
                            java.lang.String type,
                            javax.xml.crypto.dsig.DigestMethod dm,
                            java.util.List<? extends javax.xml.crypto.dsig.Transform> appliedTransforms,
                            javax.xml.crypto.Data result,
                            java.util.List<? extends javax.xml.crypto.dsig.Transform> transforms,
                            java.lang.String id,
                            java.security.Provider provider)
      • DOMReference

        public DOMReference​(java.lang.String uri,
                            java.lang.String type,
                            javax.xml.crypto.dsig.DigestMethod dm,
                            java.util.List<? extends javax.xml.crypto.dsig.Transform> appliedTransforms,
                            javax.xml.crypto.Data result,
                            java.util.List<? extends javax.xml.crypto.dsig.Transform> transforms,
                            java.lang.String id,
                            byte[] digestValue,
                            java.security.Provider provider)
      • DOMReference

        public DOMReference​(org.w3c.dom.Element refElem,
                            javax.xml.crypto.XMLCryptoContext context,
                            java.security.Provider provider)
                     throws javax.xml.crypto.MarshalException
        Creates a DOMReference from an element.
        Parameters:
        refElem - a Reference element
        Throws:
        javax.xml.crypto.MarshalException
    • Method Detail

      • getDigestMethod

        public javax.xml.crypto.dsig.DigestMethod getDigestMethod()
        Specified by:
        getDigestMethod in interface javax.xml.crypto.dsig.Reference
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface javax.xml.crypto.dsig.Reference
      • getURI

        public java.lang.String getURI()
        Specified by:
        getURI in interface javax.xml.crypto.URIReference
      • getType

        public java.lang.String getType()
        Specified by:
        getType in interface javax.xml.crypto.URIReference
      • getTransforms

        public java.util.List<javax.xml.crypto.dsig.Transform> getTransforms()
        Specified by:
        getTransforms in interface javax.xml.crypto.dsig.Reference
      • getDigestValue

        public byte[] getDigestValue()
        Specified by:
        getDigestValue in interface javax.xml.crypto.dsig.Reference
      • getCalculatedDigestValue

        public byte[] getCalculatedDigestValue()
        Specified by:
        getCalculatedDigestValue in interface javax.xml.crypto.dsig.Reference
      • marshal

        public void marshal​(XmlWriter xwriter,
                            java.lang.String dsPrefix,
                            javax.xml.crypto.XMLCryptoContext context)
                     throws javax.xml.crypto.MarshalException
        Specified by:
        marshal in class DOMStructure
        Throws:
        javax.xml.crypto.MarshalException
      • digest

        public void digest​(javax.xml.crypto.dsig.XMLSignContext signContext)
                    throws javax.xml.crypto.dsig.XMLSignatureException
        Throws:
        javax.xml.crypto.dsig.XMLSignatureException
      • validate

        public boolean validate​(javax.xml.crypto.dsig.XMLValidateContext validateContext)
                         throws javax.xml.crypto.dsig.XMLSignatureException
        Specified by:
        validate in interface javax.xml.crypto.dsig.Reference
        Throws:
        javax.xml.crypto.dsig.XMLSignatureException
      • getDereferencedData

        public javax.xml.crypto.Data getDereferencedData()
        Specified by:
        getDereferencedData in interface javax.xml.crypto.dsig.Reference
      • getDigestInputStream

        public java.io.InputStream getDigestInputStream()
        Specified by:
        getDigestInputStream in interface javax.xml.crypto.dsig.Reference
      • getHere

        public org.w3c.dom.Node getHere()
        Specified by:
        getHere in interface javax.xml.crypto.dom.DOMURIReference
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object