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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<javax.xml.crypto.dsig.Transform> allTransforms  
      private javax.xml.crypto.Data appliedTransformData  
      private byte[] calcDigestValue  
      private javax.xml.crypto.Data derefData  
      private boolean digested  
      private javax.xml.crypto.dsig.DigestMethod digestMethod  
      private byte[] digestValue  
      private java.io.InputStream dis  
      private org.w3c.dom.Attr here  
      private java.lang.String id  
      private static org.slf4j.Logger LOG  
      static int MAXIMUM_TRANSFORM_COUNT
      The maximum number of transforms per reference, if secure validation is enabled.
      private java.security.MessageDigest md  
      private java.security.Provider provider  
      private org.w3c.dom.Element refElem  
      private java.util.List<javax.xml.crypto.dsig.Transform> transforms  
      private java.lang.String type  
      private java.lang.String uri  
      private static boolean useC14N11
      Look up useC14N11 system property.
      private boolean validated  
      private boolean validationStatus  
    • 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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static javax.xml.crypto.Data copyDerefData​(javax.xml.crypto.Data dereferencedData)  
      private javax.xml.crypto.Data dereference​(javax.xml.crypto.XMLCryptoContext context)  
      void digest​(javax.xml.crypto.dsig.XMLSignContext signContext)  
      boolean equals​(java.lang.Object o)  
      byte[] getCalculatedDigestValue()  
      javax.xml.crypto.Data getDereferencedData()  
      java.io.InputStream getDigestInputStream()  
      javax.xml.crypto.dsig.DigestMethod getDigestMethod()  
      byte[] getDigestValue()  
      org.w3c.dom.Node getHere()  
      java.lang.String getId()  
      java.util.List<javax.xml.crypto.dsig.Transform> getTransforms()  
      java.lang.String getType()  
      java.lang.String getURI()  
      int hashCode()  
      (package private) boolean isDigested()  
      void marshal​(org.w3c.dom.Node parent, java.lang.String dsPrefix, javax.xml.crypto.dom.DOMCryptoContext context)  
      private byte[] transform​(javax.xml.crypto.Data dereferencedData, javax.xml.crypto.XMLCryptoContext context)  
      boolean validate​(javax.xml.crypto.dsig.XMLValidateContext validateContext)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.xml.crypto.XMLStructure

        isFeatureSupported
    • 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
      • useC14N11

        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.
      • LOG

        private static final org.slf4j.Logger LOG
      • digestMethod

        private final javax.xml.crypto.dsig.DigestMethod digestMethod
      • id

        private final java.lang.String id
      • transforms

        private final java.util.List<javax.xml.crypto.dsig.Transform> transforms
      • allTransforms

        private java.util.List<javax.xml.crypto.dsig.Transform> allTransforms
      • appliedTransformData

        private final javax.xml.crypto.Data appliedTransformData
      • here

        private org.w3c.dom.Attr here
      • uri

        private final java.lang.String uri
      • type

        private final java.lang.String type
      • digestValue

        private byte[] digestValue
      • calcDigestValue

        private byte[] calcDigestValue
      • refElem

        private org.w3c.dom.Element refElem
      • digested

        private boolean digested
      • validated

        private boolean validated
      • validationStatus

        private boolean validationStatus
      • derefData

        private javax.xml.crypto.Data derefData
      • dis

        private java.io.InputStream dis
      • md

        private java.security.MessageDigest md
      • provider

        private java.security.Provider provider
    • 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​(org.w3c.dom.Node parent,
                            java.lang.String dsPrefix,
                            javax.xml.crypto.dom.DOMCryptoContext 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
      • dereference

        private javax.xml.crypto.Data dereference​(javax.xml.crypto.XMLCryptoContext context)
                                           throws javax.xml.crypto.dsig.XMLSignatureException
        Throws:
        javax.xml.crypto.dsig.XMLSignatureException
      • transform

        private byte[] transform​(javax.xml.crypto.Data dereferencedData,
                                 javax.xml.crypto.XMLCryptoContext context)
                          throws javax.xml.crypto.dsig.XMLSignatureException
        Throws:
        javax.xml.crypto.dsig.XMLSignatureException
      • 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
      • isDigested

        boolean isDigested()
      • copyDerefData

        private static javax.xml.crypto.Data copyDerefData​(javax.xml.crypto.Data dereferencedData)