Package org.apache.xml.security.signature

Examples of org.apache.xml.security.signature.Manifest


        org.w3c.dom.Document doc = db.parse(f);

        Element manifestElement =
            (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,
                                                 Constants._TAG_SIGNEDINFO).item(0);
        Manifest manifest = new Manifest(manifestElement, f.toURI().toURL().toString(), secValidation);
        return manifest.verifyReferences();
    }
View Full Code Here


        org.w3c.dom.Document doc = db.parse(f);

        Element manifestElement =
            (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,
                                                 Constants._TAG_SIGNEDINFO).item(0);
        Manifest manifest = new Manifest(manifestElement, f.toURI().toURL().toString(), secValidation);
        return manifest.verifyReferences();
    }
View Full Code Here

     */
    public static Element createObject4(XMLSignature sig) throws Exception {

        Document doc = sig.getElement().getOwnerDocument();
        String BaseURI = sig.getBaseURI();
        Manifest manifest = new Manifest(doc);
        manifest.addResourceResolver(new OfflineResolver());

        manifest.setId("manifest-1");
        manifest.addDocument(BaseURI, "http://www.w3.org/TR/xml-stylesheet",
                             null, Constants.ALGO_ID_DIGEST_SHA1,
                             "manifest-reference-1", null);
        manifest.addDocument(BaseURI, "#reference-1", null,
                             Constants.ALGO_ID_DIGEST_SHA1, null,
                             "http://www.w3.org/2000/09/xmldsig#Reference");

        String xslt = ""
            + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n"
            + "                xmlns='http://www.w3.org/TR/xhtml1/strict' \n"
            + "                exclude-result-prefixes='foo' \n"
            + "                version='1.0'>\n"
            + "  <xsl:output encoding='UTF-8' \n"
            + "              indent='no' \n"
            + "              method='xml' />\n"
            + "  <xsl:template match='/'>\n"
            + "    <html>\n"
            + "      <head>\n"
            + "        <title>Notaries</title>\n"
            + "      </head>\n"
            + "      <body>\n"
            + "        <table>\n"
            + "          <xsl:for-each select='Notaries/Notary'>\n"
            + "            <tr>\n"
            + "              <th>\n"
            + "                <xsl:value-of select='@name' />\n"
            + "              </th>\n"
            + "            </tr>\n"
            + "          </xsl:for-each>\n"
            + "        </table>\n"
            + "      </body>\n"
            + "    </html>\n"
            + "  </xsl:template>\n"
            + "</xsl:stylesheet>\n"
            ;

        javax.xml.parsers.DocumentBuilderFactory dbf =
            javax.xml.parsers.DocumentBuilderFactory.newInstance();

        dbf.setNamespaceAware(true);

        javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
        org.w3c.dom.Document docxslt =
            db.parse(new ByteArrayInputStream(xslt.getBytes()));
        Node xslElem = docxslt.getDocumentElement();
        Node xslElemImported = doc.importNode(xslElem, true);
        Transforms transforms = new Transforms(doc);

        transforms.addTransform(Transforms.TRANSFORM_XSLT,
                                (Element) xslElemImported);
        manifest.addDocument(BaseURI, "#notaries", transforms,
                             Constants.ALGO_ID_DIGEST_SHA1, null, null);

        return manifest.getElement();
    }
View Full Code Here

     */
    public static Element createObject4(XMLSignature sig) throws Exception {

        Document doc = sig.getElement().getOwnerDocument();
        String BaseURI = sig.getBaseURI();
        Manifest manifest = new Manifest(doc);
        manifest.addResourceResolver(new OfflineResolver());

        manifest.setId("manifest-1");
        manifest.addDocument(BaseURI, "http://www.w3.org/TR/xml-stylesheet",
                             null, Constants.ALGO_ID_DIGEST_SHA1,
                             "manifest-reference-1", null);
        manifest.addDocument(BaseURI, "#reference-1", null,
                             Constants.ALGO_ID_DIGEST_SHA1, null,
                            "http://www.w3.org/2000/09/xmldsig#Reference");

        String xslt = ""
            + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n"
            + "                xmlns='http://www.w3.org/TR/xhtml1/strict' \n"
            + "                exclude-result-prefixes='foo' \n"
            + "                version='1.0'>\n"
            + "  <xsl:output encoding='UTF-8' \n"
            + "              indent='no' \n"
            + "              method='xml' />\n"
            + "  <xsl:template match='/'>\n"
            + "    <html>\n"
            + "      <head>\n"
            + "        <title>Notaries</title>\n"
            + "      </head>\n"
            + "      <body>\n"
            + "        <table>\n"
            + "          <xsl:for-each select='Notaries/Notary'>\n"
            + "            <tr>\n"
            + "              <th>\n"
            + "                <xsl:value-of select='@name' />\n"
            + "              </th>\n"
            + "            </tr>\n"
            + "          </xsl:for-each>\n"
            + "        </table>\n"
            + "      </body>\n"
            + "    </html>\n"
            + "  </xsl:template>\n"
            + "</xsl:stylesheet>\n"
            ;

        javax.xml.parsers.DocumentBuilderFactory dbf =
            javax.xml.parsers.DocumentBuilderFactory.newInstance();

        dbf.setNamespaceAware(true);

        javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
        org.w3c.dom.Document docxslt =
            db.parse(new ByteArrayInputStream(xslt.getBytes()));
        Node xslElem = docxslt.getDocumentElement();
        Node xslElemImported = doc.importNode(xslElem, true);
        Transforms transforms = new Transforms(doc);

        transforms.addTransform(Transforms.TRANSFORM_XSLT,
                                (Element) xslElemImported);
        manifest.addDocument(BaseURI, "#notaries", transforms,
                             Constants.ALGO_ID_DIGEST_SHA1, null, null);

        return manifest.getElement();
    }
View Full Code Here

     */
    public static Element createObject4(XMLSignature sig) throws Exception {

        Document doc = sig.getElement().getOwnerDocument();
        String BaseURI = sig.getBaseURI();
        Manifest manifest = new Manifest(doc);
        manifest.addResourceResolver(new OfflineResolver());

        manifest.setId("manifest-1");
        manifest.addDocument(BaseURI, "http://www.w3.org/TR/xml-stylesheet",
                             null, Constants.ALGO_ID_DIGEST_SHA1,
                             "manifest-reference-1", null);
        manifest.addDocument(BaseURI, "#reference-1", null,
                             Constants.ALGO_ID_DIGEST_SHA1, null,
                             "http://www.w3.org/2000/09/xmldsig#Reference");

        String xslt = ""
            + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n"
            + "                xmlns='http://www.w3.org/TR/xhtml1/strict' \n"
            + "                exclude-result-prefixes='foo' \n"
            + "                version='1.0'>\n"
            + "  <xsl:output encoding='UTF-8' \n"
            + "              indent='no' \n"
            + "              method='xml' />\n"
            + "  <xsl:template match='/'>\n"
            + "    <html>\n"
            + "      <head>\n"
            + "        <title>Notaries</title>\n"
            + "      </head>\n"
            + "      <body>\n"
            + "        <table>\n"
            + "          <xsl:for-each select='Notaries/Notary'>\n"
            + "            <tr>\n"
            + "              <th>\n"
            + "                <xsl:value-of select='@name' />\n"
            + "              </th>\n"
            + "            </tr>\n"
            + "          </xsl:for-each>\n"
            + "        </table>\n"
            + "      </body>\n"
            + "    </html>\n"
            + "  </xsl:template>\n"
            + "</xsl:stylesheet>\n"
            ;

        javax.xml.parsers.DocumentBuilderFactory dbf =
            javax.xml.parsers.DocumentBuilderFactory.newInstance();

        dbf.setNamespaceAware(true);

        javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
        org.w3c.dom.Document docxslt =
            db.parse(new ByteArrayInputStream(xslt.getBytes()));
        Node xslElem = docxslt.getDocumentElement();
        Node xslElemImported = doc.importNode(xslElem, true);
        Transforms transforms = new Transforms(doc);

        transforms.addTransform(Transforms.TRANSFORM_XSLT,
                                (Element) xslElemImported);
        manifest.addDocument(BaseURI, "#notaries", transforms,
                             Constants.ALGO_ID_DIGEST_SHA1, null, null);

        return manifest.getElement();
    }
View Full Code Here

     */
    public static Element createObject4(XMLSignature sig) throws Exception {

        Document doc = sig.getElement().getOwnerDocument();
        String BaseURI = sig.getBaseURI();
        Manifest manifest = new Manifest(doc);
        manifest.addResourceResolver(new OfflineResolver());

        manifest.setId("manifest-1");
        manifest.addDocument(BaseURI, "http://www.w3.org/TR/xml-stylesheet",
                             null, Constants.ALGO_ID_DIGEST_SHA1,
                             "manifest-reference-1", null);
        manifest.addDocument(BaseURI, "#reference-1", null,
                             Constants.ALGO_ID_DIGEST_SHA1, null,
                            "http://www.w3.org/2000/09/xmldsig#Reference");

        String xslt = ""
            + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n"
            + "                xmlns='http://www.w3.org/TR/xhtml1/strict' \n"
            + "                exclude-result-prefixes='foo' \n"
            + "                version='1.0'>\n"
            + "  <xsl:output encoding='UTF-8' \n"
            + "              indent='no' \n"
            + "              method='xml' />\n"
            + "  <xsl:template match='/'>\n"
            + "    <html>\n"
            + "      <head>\n"
            + "        <title>Notaries</title>\n"
            + "      </head>\n"
            + "      <body>\n"
            + "        <table>\n"
            + "          <xsl:for-each select='Notaries/Notary'>\n"
            + "            <tr>\n"
            + "              <th>\n"
            + "                <xsl:value-of select='@name' />\n"
            + "              </th>\n"
            + "            </tr>\n"
            + "          </xsl:for-each>\n"
            + "        </table>\n"
            + "      </body>\n"
            + "    </html>\n"
            + "  </xsl:template>\n"
            + "</xsl:stylesheet>\n"
            ;

        javax.xml.parsers.DocumentBuilderFactory dbf =
            javax.xml.parsers.DocumentBuilderFactory.newInstance();

        dbf.setNamespaceAware(true);

        javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
        org.w3c.dom.Document docxslt =
            db.parse(new ByteArrayInputStream(xslt.getBytes()));
        Node xslElem = docxslt.getDocumentElement();
        Node xslElemImported = doc.importNode(xslElem, true);
        Transforms transforms = new Transforms(doc);

        transforms.addTransform(Transforms.TRANSFORM_XSLT,
                                (Element) xslElemImported);
        manifest.addDocument(BaseURI, "#notaries", transforms,
                             Constants.ALGO_ID_DIGEST_SHA1, null, null);

        return manifest.getElement();
    }
View Full Code Here

    private boolean isDigested(NodeList nodeList, Element signatureElement)
            throws XMLSignatureException, XMLSecurityException {
        NodeList referenceNodeList = signatureElement.getElementsByTagNameNS(
                "http://www.w3.org/2000/09/xmldsig#", "Reference");
        Document document = nodeList.item(0).getOwnerDocument();
        Manifest manifest = new Manifest(document);
        VerifyReference[] references = new VerifyReference[referenceNodeList.getLength()];
        for (int referenceIdx = 0; referenceIdx < referenceNodeList.getLength(); referenceIdx++) {
            Element referenceElement = (Element) referenceNodeList.item(referenceIdx);
            VerifyReference reference = new VerifyReference(referenceElement,
                    manifest);
View Full Code Here

TOP

Related Classes of org.apache.xml.security.signature.Manifest

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.