Package org.apache.camel.component.xmlsecurity.api

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


    protected Element getParentForEnvelopedCase(Document doc, Message inMessage) throws Exception { //NOPMD

        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


        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

    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

            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

        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

        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

TOP

Related Classes of org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException

Copyright © 2018 www.massapicom. 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.