Examples of XmlSignatureFormatException


Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

        try {
            DocumentBuilder db = XmlSignatureHelper.newDocumentBuilder(disallowDoctypeDecl, schema);
            db.setErrorHandler(errorHandler);
            return db.parse(is);
        } catch (SAXException e) {
            throw new XmlSignatureFormatException(
                    "XML signature generation not possible. Sent message is not an XML document. Check the sent message.", e);
        } finally {
            IOHelper.close(is, "input stream");
        }
    }
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

    private NodeList getSignatureNodes(Document doc) throws IOException, ParserConfigurationException, XmlSignatureFormatException {

        // Find Signature element
        NodeList nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
        if (nl.getLength() == 0) {
            throw new XmlSignatureFormatException(
                    "Message is not a correct XML signature document: 'Signature' element is missing. Check the sent message.");
        }

        LOG.debug("{} signature elements found", nl.getLength());
        return nl;
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

            db.setErrorHandler(errorHandler);
            Document doc = db.parse(is);
            errorHandler.handleErrors(message.getExchange(), schema, null); // throws ValidationException
            return doc;
        } catch (SAXException e) {
            throw new XmlSignatureFormatException("Message has wrong format, it is not a XML signature document. Check the sent message.",
                    e);
        }
    }
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

        if (SignatureType.enveloping == sigType) {
            // enveloping case
            return null;
        }
        if (messageBodyNode.getParentNode() == null || messageBodyNode.getParentNode().getNodeType() != Node.DOCUMENT_NODE) {
            throw new XmlSignatureFormatException(
                    "Incomming message has wrong format: It is not an XML document. Cannot create an enveloped or detached XML signature.");
        }
        Document doc = (Document) messageBodyNode.getParentNode();
        if (SignatureType.detached == sigType) {
            return getParentForDetachedCase(doc, inMessage, contentReferenceURI);
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

            throw new XmlSignatureException("The parent XPath " + xp.getXPath() + " returned no element. Check the configuration of the XML signer component.");
        } else {
            // parent local name is not null!
            NodeList parents = doc.getElementsByTagNameNS(getConfiguration().getParentNamespace(), getConfiguration().getParentLocalName());
            if (parents == null || parents.getLength() == 0) {
                throw new XmlSignatureFormatException(
                        String.format(
                                "Incoming message has wrong format: The parent element with the local name %s and the namespace %s was not found in the message to build an enveloped XML signature.",
                                getConfiguration().getParentLocalName(), getConfiguration().getParentNamespace()));
            }
            // return the first element
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

    protected Element getParentOfSignature(Message inMessage, Node messageBodyNode) throws Exception { //NOPMD
        if (getConfiguration().getParentLocalName() == null) {
            return null;
        }
        if (messageBodyNode.getParentNode() == null || messageBodyNode.getParentNode().getNodeType() != Node.DOCUMENT_NODE) {
            throw new XmlSignatureFormatException(
                    "Incomming message has wrong format: It is not an XML document. Cannot create an enveloped XML signature.");
        }

        Document doc = (Document) messageBodyNode.getParentNode();
        NodeList parents = doc.getElementsByTagNameNS(getConfiguration().getParentNamespace(), getConfiguration().getParentLocalName());

        if (parents == null || parents.getLength() == 0) {
            throw new XmlSignatureFormatException(
                    String.format(
                            "Incoming message has wrong format: The parent element with the local name %s and the namespace %s was not found in the message to build an enveloped XML signature.",
                            getConfiguration().getParentLocalName(), getConfiguration().getParentNamespace()));
        }
        // return the first element
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

    protected Document parseInput(InputStream is, Boolean disallowDoctypeDecl) throws XmlSignatureFormatException,
            ParserConfigurationException, IOException {
        try {
            return XmlSignatureHelper.newDocumentBuilder(disallowDoctypeDecl).parse(is);
        } catch (SAXException e) {
            throw new XmlSignatureFormatException(
                    "XML signature generation not possible. Sent message is not an XML document. Check the sent message.", e);
        } finally {
            IOHelper.close(is, "input stream");
        }
    }
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

        ParserConfigurationException, XmlSignatureFormatException {

        // Find Signature element
        NodeList nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
        if (nl.getLength() == 0) {
            throw new XmlSignatureFormatException(
                "Message is not a correct XML signature document: 'Signature' element is missing. Check the sent message.");
        }

        if (nl.getLength() != 1) {
            throw new XmlSignatureFormatException(
                "XML signature document is not supported; it contains more than one signature element. Check the sent message.");
        }
        Node signatureNode = nl.item(0);
        LOG.debug("Signature element found");
        return signatureNode;
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

        try {
            Document doc =
                XmlSignatureHelper.newDocumentBuilder(getConfiguration().getDisallowDoctypeDecl()).parse(is);
            return doc;
        } catch (SAXException e) {
            throw new XmlSignatureFormatException(
                "Message has wrong format, it is not a XML signature document. Check the sent message.",
                 e
            );
        }
    }
View Full Code Here

Examples of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

        if (SignatureType.enveloping == sigType) {
            // enveloping case
            return null;
        }
        if (messageBodyNode.getParentNode() == null || messageBodyNode.getParentNode().getNodeType() != Node.DOCUMENT_NODE) {
            throw new XmlSignatureFormatException(
                    "Incomming message has wrong format: It is not an XML document. Cannot create an enveloped or detached XML signature.");
        }
        Document doc = (Document) messageBodyNode.getParentNode();
        if (SignatureType.detached == sigType) {
            return getParentForDetachedCase(doc, inMessage, contentReferenceURI);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.