Class DOMSignatureMethod

    • Constructor Detail

      • DOMSignatureMethod

        DOMSignatureMethod​(java.security.spec.AlgorithmParameterSpec params)
                    throws java.security.InvalidAlgorithmParameterException
        Creates a DOMSignatureMethod.
        Parameters:
        params - the algorithm-specific params (may be null)
        Throws:
        java.security.InvalidAlgorithmParameterException - if the parameters are not appropriate for this signature method
      • DOMSignatureMethod

        DOMSignatureMethod​(org.w3c.dom.Element smElem)
                    throws javax.xml.crypto.MarshalException
        Creates a DOMSignatureMethod from an element. This ctor invokes the unmarshalParams method to unmarshal any algorithm-specific input parameters.
        Parameters:
        smElem - a SignatureMethod element
        Throws:
        javax.xml.crypto.MarshalException
    • Method Detail

      • unmarshal

        static javax.xml.crypto.dsig.SignatureMethod unmarshal​(org.w3c.dom.Element smElem)
                                                        throws javax.xml.crypto.MarshalException
        Throws:
        javax.xml.crypto.MarshalException
      • getParameterSpec

        public final java.security.spec.AlgorithmParameterSpec getParameterSpec()
      • verify

        boolean verify​(java.security.Key key,
                       javax.xml.crypto.dsig.SignedInfo si,
                       byte[] sig,
                       javax.xml.crypto.dsig.XMLValidateContext context)
                throws java.security.InvalidKeyException,
                       java.security.SignatureException,
                       javax.xml.crypto.dsig.XMLSignatureException
        Description copied from class: AbstractDOMSignatureMethod
        Verifies the passed-in signature with the specified key, using the underlying Signature or Mac algorithm.
        Specified by:
        verify in class AbstractDOMSignatureMethod
        Parameters:
        key - the verification key
        si - the SignedInfo
        sig - the signature bytes to be verified
        context - the XMLValidateContext
        Returns:
        true if the signature verified successfully, false if not
        Throws:
        java.security.InvalidKeyException - if the key is improperly encoded, of the wrong type, or parameters are missing, etc
        java.security.SignatureException - if an unexpected error occurs, such as the passed in signature is improperly encoded
        javax.xml.crypto.dsig.XMLSignatureException - if an unexpected error occurs
      • sign

        byte[] sign​(java.security.Key key,
                    javax.xml.crypto.dsig.SignedInfo si,
                    javax.xml.crypto.dsig.XMLSignContext context)
             throws java.security.InvalidKeyException,
                    javax.xml.crypto.dsig.XMLSignatureException
        Description copied from class: AbstractDOMSignatureMethod
        Signs the bytes with the specified key, using the underlying Signature or Mac algorithm.
        Specified by:
        sign in class AbstractDOMSignatureMethod
        Parameters:
        key - the signing key
        si - the SignedInfo
        context - the XMLSignContext
        Returns:
        the signature
        Throws:
        java.security.InvalidKeyException - if the key is improperly encoded, of the wrong type, or parameters are missing, etc
        javax.xml.crypto.dsig.XMLSignatureException - if an unexpected error occurs