Package org.apache.xml.security.encryption

Examples of org.apache.xml.security.encryption.XMLCipher.doFinal()


        xmlCipher.setKEK(keyEncryptionkey);

        Document encodedDocument = exchange.getContext().getTypeConverter().convertTo(Document.class, exchange, is);

        if (secureTag.equalsIgnoreCase("")) {
            encodedDocument = xmlCipher.doFinal(encodedDocument, encodedDocument.getDocumentElement());
        } else {
            NodeIterator iter =
                    XPathAPI.selectNodeIterator(encodedDocument, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
View Full Code Here


        } else {
            NodeIterator iter =
                    XPathAPI.selectNodeIterator(encodedDocument, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
                Document temp = xmlCipher.doFinal(encodedDocument, (Element) node, getSecureTagContents());
                encodedDocument.importNode(temp.getDocumentElement().cloneNode(true), true);
            }
        }

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
View Full Code Here

        XMLCipher xmlCipher = XMLCipher.getInstance(xmlCipherAlgorithm);
        xmlCipher.init(XMLCipher.ENCRYPT_MODE, dataEncryptionkey);

        if (secureTag.equalsIgnoreCase("")) {
            embedKeyInfoInEncryptedData(document, keyCipher, xmlCipher, dataEncryptionkey);
            document = xmlCipher.doFinal(document, document.getDocumentElement());
        } else {
            NodeIterator iter = XPathAPI.selectNodeIterator(document, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
                embedKeyInfoInEncryptedData(document, keyCipher, xmlCipher, dataEncryptionkey);
View Full Code Here

        } else {
            NodeIterator iter = XPathAPI.selectNodeIterator(document, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
                embedKeyInfoInEncryptedData(document, keyCipher, xmlCipher, dataEncryptionkey);
                Document temp = xmlCipher.doFinal(document, (Element) node, getSecureTagContents());
                document.importNode(temp.getDocumentElement().cloneNode(true), true);
            }
        }

        DOMSource source = new DOMSource(document);
View Full Code Here

        xmlCipher.setKEK(keyEncryptionkey);

        Document encodedDocument = exchange.getContext().getTypeConverter().convertTo(Document.class, exchange, is);

        if (secureTag.equalsIgnoreCase("")) {
            encodedDocument = xmlCipher.doFinal(encodedDocument, encodedDocument.getDocumentElement());
        } else {
            NodeIterator iter =
                    XPathAPI.selectNodeIterator(encodedDocument, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
View Full Code Here

        } else {
            NodeIterator iter =
                    XPathAPI.selectNodeIterator(encodedDocument, secureTag);
            Node node;
            while ((node = iter.nextNode()) != null) {
                Document temp = xmlCipher.doFinal(encodedDocument, (Element) node, getSecureTagContents());
                encodedDocument.importNode(temp.getDocumentElement().cloneNode(true), true);
            }
        }

        DOMSource source = new DOMSource(encodedDocument);
View Full Code Here

        XMLCipher xmlCipher = XMLCipher.getInstance(xmlCipherAlgorithm);
        xmlCipher.init(XMLCipher.ENCRYPT_MODE, dataEncryptionKey);

        if (secureTag.equalsIgnoreCase("")) {
            embedKeyInfoInEncryptedData(document, keyCipher, xmlCipher, dataEncryptionKey);
            document = xmlCipher.doFinal(document, document.getDocumentElement());
        } else {
                         
            XPathBuilder xpathBuilder = new XPathBuilder(secureTag);
            xpathBuilder.setNamespaceContext(getNamespaceContext());
            NodeList nodeList = xpathBuilder.evaluate(exchange, NodeList.class);
View Full Code Here

           
            for (int i = 0; i < nodeList.getLength(); i++) {
                Node node = nodeList.item(i);
                document = node.getOwnerDocument();
                embedKeyInfoInEncryptedData(node.getOwnerDocument(), keyCipher, xmlCipher, dataEncryptionKey);
                Document temp = xmlCipher.doFinal(node.getOwnerDocument(), (Element) node, getSecureTagContents());
                document.importNode(temp.getDocumentElement().cloneNode(true), true);
            }   
        }

        try {
View Full Code Here

        xmlCipher.setSecureValidation(true);
        xmlCipher.init(XMLCipher.DECRYPT_MODE, null);
        xmlCipher.setKEK(keyEncryptionKey);

        if (secureTag.equalsIgnoreCase("")) {
            encodedDocument = xmlCipher.doFinal(encodedDocument, encodedDocument.getDocumentElement());
        } else {

            XPathBuilder xpathBuilder = new XPathBuilder(secureTag);
            xpathBuilder.setNamespaceContext(getNamespaceContext());
            NodeList nodeList = xpathBuilder.evaluate(exchange, NodeList.class);
View Full Code Here

            for (int i = 0; i < nodeList.getLength(); i++) {
                Node node = nodeList.item(i);
                encodedDocument = node.getOwnerDocument();
                if (getSecureTagContents()) {
                    Document temp = xmlCipher.doFinal(encodedDocument, (Element) node, true);
                    encodedDocument.importNode(temp.getDocumentElement().cloneNode(true), true);
                } else {
                    NodeList childNodes = node.getChildNodes();
                    for (int j = 0; j < childNodes.getLength(); j++) {
                        Node childNode = childNodes.item(j);
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.