Class DOMXMLSignature

  • All Implemented Interfaces:
    javax.xml.crypto.dsig.XMLSignature, javax.xml.crypto.XMLStructure

    public final class DOMXMLSignature
    extends DOMStructure
    implements javax.xml.crypto.dsig.XMLSignature
    DOM-based implementation of XMLSignature.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  DOMXMLSignature.DOMSignatureValue  
      • Nested classes/interfaces inherited from interface javax.xml.crypto.dsig.XMLSignature

        javax.xml.crypto.dsig.XMLSignature.SignatureValue
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String id  
      private javax.xml.crypto.dsig.keyinfo.KeyInfo ki  
      private javax.xml.crypto.KeySelectorResult ksr  
      private org.w3c.dom.Element localSigElem  
      private static org.slf4j.Logger LOG  
      private java.util.List<javax.xml.crypto.dsig.XMLObject> objects  
      private org.w3c.dom.Document ownerDoc  
      private javax.xml.crypto.dsig.SignedInfo si  
      private org.w3c.dom.Element sigElem  
      private java.util.Map<java.lang.String,​javax.xml.crypto.XMLStructure> signatureIdMap  
      private javax.xml.crypto.dsig.XMLSignature.SignatureValue sv  
      private boolean validated  
      private boolean validationStatus  
      • Fields inherited from interface javax.xml.crypto.dsig.XMLSignature

        XMLNS
    • Constructor Summary

      Constructors 
      Constructor Description
      DOMXMLSignature​(javax.xml.crypto.dsig.SignedInfo si, javax.xml.crypto.dsig.keyinfo.KeyInfo ki, java.util.List<? extends javax.xml.crypto.dsig.XMLObject> objs, java.lang.String id, java.lang.String signatureValueId)
      Creates a DOMXMLSignature from the specified components.
      DOMXMLSignature​(org.w3c.dom.Element sigElem, javax.xml.crypto.XMLCryptoContext context, java.security.Provider provider)
      Creates a DOMXMLSignature from XML.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void digestReference​(DOMReference ref, javax.xml.crypto.dsig.XMLSignContext signContext)  
      boolean equals​(java.lang.Object o)  
      java.lang.String getId()  
      javax.xml.crypto.dsig.keyinfo.KeyInfo getKeyInfo()  
      javax.xml.crypto.KeySelectorResult getKeySelectorResult()  
      java.util.List<javax.xml.crypto.dsig.XMLObject> getObjects()  
      javax.xml.crypto.dsig.XMLSignature.SignatureValue getSignatureValue()  
      javax.xml.crypto.dsig.SignedInfo getSignedInfo()  
      int hashCode()  
      void marshal​(org.w3c.dom.Node parent, java.lang.String dsPrefix, javax.xml.crypto.dom.DOMCryptoContext context)  
      void marshal​(org.w3c.dom.Node parent, org.w3c.dom.Node nextSibling, java.lang.String dsPrefix, javax.xml.crypto.dom.DOMCryptoContext context)  
      void sign​(javax.xml.crypto.dsig.XMLSignContext signContext)  
      boolean validate​(javax.xml.crypto.dsig.XMLValidateContext vc)  
      • 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

      • LOG

        private static final org.slf4j.Logger LOG
      • id

        private java.lang.String id
      • sv

        private javax.xml.crypto.dsig.XMLSignature.SignatureValue sv
      • ki

        private javax.xml.crypto.dsig.keyinfo.KeyInfo ki
      • objects

        private java.util.List<javax.xml.crypto.dsig.XMLObject> objects
      • si

        private javax.xml.crypto.dsig.SignedInfo si
      • ownerDoc

        private org.w3c.dom.Document ownerDoc
      • localSigElem

        private org.w3c.dom.Element localSigElem
      • sigElem

        private org.w3c.dom.Element sigElem
      • validationStatus

        private boolean validationStatus
      • validated

        private boolean validated
      • ksr

        private javax.xml.crypto.KeySelectorResult ksr
      • signatureIdMap

        private java.util.Map<java.lang.String,​javax.xml.crypto.XMLStructure> signatureIdMap
    • Constructor Detail

      • DOMXMLSignature

        public DOMXMLSignature​(javax.xml.crypto.dsig.SignedInfo si,
                               javax.xml.crypto.dsig.keyinfo.KeyInfo ki,
                               java.util.List<? extends javax.xml.crypto.dsig.XMLObject> objs,
                               java.lang.String id,
                               java.lang.String signatureValueId)
        Creates a DOMXMLSignature from the specified components.
        Parameters:
        si - the SignedInfo
        ki - the KeyInfo, or null if not specified
        objs - a list of XMLObjects or null if not specified. The list is copied to protect against subsequent modification.
        id - an optional id (specify null to omit)
        signatureValueId - an optional id (specify null to omit)
        Throws:
        java.lang.NullPointerException - if si is null
      • DOMXMLSignature

        public DOMXMLSignature​(org.w3c.dom.Element sigElem,
                               javax.xml.crypto.XMLCryptoContext context,
                               java.security.Provider provider)
                        throws javax.xml.crypto.MarshalException
        Creates a DOMXMLSignature from XML.
        Parameters:
        sigElem - Signature element
        Throws:
        javax.xml.crypto.MarshalException - if XMLSignature cannot be unmarshalled
    • Method Detail

      • getId

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

        public javax.xml.crypto.dsig.keyinfo.KeyInfo getKeyInfo()
        Specified by:
        getKeyInfo in interface javax.xml.crypto.dsig.XMLSignature
      • getSignedInfo

        public javax.xml.crypto.dsig.SignedInfo getSignedInfo()
        Specified by:
        getSignedInfo in interface javax.xml.crypto.dsig.XMLSignature
      • getObjects

        public java.util.List<javax.xml.crypto.dsig.XMLObject> getObjects()
        Specified by:
        getObjects in interface javax.xml.crypto.dsig.XMLSignature
      • getSignatureValue

        public javax.xml.crypto.dsig.XMLSignature.SignatureValue getSignatureValue()
        Specified by:
        getSignatureValue in interface javax.xml.crypto.dsig.XMLSignature
      • getKeySelectorResult

        public javax.xml.crypto.KeySelectorResult getKeySelectorResult()
        Specified by:
        getKeySelectorResult in interface javax.xml.crypto.dsig.XMLSignature
      • 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
      • marshal

        public void marshal​(org.w3c.dom.Node parent,
                            org.w3c.dom.Node nextSibling,
                            java.lang.String dsPrefix,
                            javax.xml.crypto.dom.DOMCryptoContext context)
                     throws javax.xml.crypto.MarshalException
        Throws:
        javax.xml.crypto.MarshalException
      • validate

        public boolean validate​(javax.xml.crypto.dsig.XMLValidateContext vc)
                         throws javax.xml.crypto.dsig.XMLSignatureException
        Specified by:
        validate in interface javax.xml.crypto.dsig.XMLSignature
        Throws:
        javax.xml.crypto.dsig.XMLSignatureException
      • sign

        public void sign​(javax.xml.crypto.dsig.XMLSignContext signContext)
                  throws javax.xml.crypto.MarshalException,
                         javax.xml.crypto.dsig.XMLSignatureException
        Specified by:
        sign in interface javax.xml.crypto.dsig.XMLSignature
        Throws:
        javax.xml.crypto.MarshalException
        javax.xml.crypto.dsig.XMLSignatureException
      • 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
      • digestReference

        private void digestReference​(DOMReference ref,
                                     javax.xml.crypto.dsig.XMLSignContext signContext)
                              throws javax.xml.crypto.dsig.XMLSignatureException
        Throws:
        javax.xml.crypto.dsig.XMLSignatureException