Examples of Canonicalizer


Examples of com.ibatis.sqlmap.engine.mapper.matcher.Canonicalizer

    }
    return matchedNames;
  }

  private Map buildCanonicalMap(String[] properties) {
    return new Canonicalizer().buildCanonicalMap(properties);
  }
View Full Code Here

Examples of com.sun.org.apache.xml.internal.security.c14n.Canonicalizer

          c14nMethodURI.equals("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments") ||
      c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#") ||
      c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#WithComments"))) {
        //The c14n is not a secure one and can rewrite the URIs or like that reparse the SignedInfo to be sure   
      try {
         Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

         this._c14nizedBytes =
            c14nizer.canonicalizeSubtree(this._constructionElement);
         javax.xml.parsers.DocumentBuilderFactory dbf =
            javax.xml.parsers.DocumentBuilderFactory.newInstance();

         dbf.setNamespaceAware(true);
View Full Code Here

Examples of com.sun.org.apache.xml.internal.security.c14n.Canonicalizer

           throws CanonicalizationException, InvalidCanonicalizerException,
                 XMLSecurityException {

      if ((this._c14nizedBytes == null)
              /*&& (this._state == ElementProxy.MODE_SIGN)*/) {
         Canonicalizer c14nizer =
            Canonicalizer.getInstance(this.getCanonicalizationMethodURI());

         this._c14nizedBytes =
            c14nizer.canonicalizeSubtree(this._constructionElement);
      }

      // make defensive copy
      byte[] output = new byte[this._c14nizedBytes.length];

View Full Code Here

Examples of com.sun.org.apache.xml.internal.security.c14n.Canonicalizer

   public void signInOctectStream(OutputStream os)           
       throws CanonicalizationException, InvalidCanonicalizerException,
     XMLSecurityException {

     if ((this._c14nizedBytes == null)) {
       Canonicalizer c14nizer =
          Canonicalizer.getInstance(this.getCanonicalizationMethodURI());
       c14nizer.setWriter(os);
       String inclusiveNamespaces = this.getInclusiveNamespaces();

       if(inclusiveNamespaces == null)
        c14nizer.canonicalizeSubtree(this._constructionElement);
       else
        c14nizer.canonicalizeSubtree(this._constructionElement, inclusiveNamespaces);
    } else {
        try {
      os.write(this._c14nizedBytes);
    } catch (IOException e) {
      throw new RuntimeException(""+e);
View Full Code Here

Examples of com.sun.xml.wss.impl.c14n.Canonicalizer

   private byte[] _canonicalize(XMLSignatureInput input) throws Exception {
       byte[] inputContentBytes = input.getBytes();
       //ContentType contentType = new ContentType(((AttachmentSignatureInput)input).getContentType());

       Canonicalizer canonicalizer =
                             CanonicalizerFactory.
                                   getCanonicalizer(((AttachmentSignatureInput)input).getContentType());

       return canonicalizer.canonicalize(inputContentBytes);   
   }
View Full Code Here

Examples of nokogiri.internals.c14n.Canonicalizer

        case 2: // XML_C14N_1_1 = 2
            if (with_comments) algorithmURI = Canonicalizer.ALGO_ID_C14N11_WITH_COMMENTS;
            else algorithmURI = Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS;
        }
        try {
            Canonicalizer canonicalizer = Canonicalizer.getInstance(algorithmURI);
            XmlNode startingNode = getStartingNode(block);
            byte[] result;
            CanonicalFilter filter = new CanonicalFilter(context, block);
            if (inclusive_namespace == null) {
                result = canonicalizer.canonicalizeSubtree(startingNode.getNode(), filter);
            } else {
                result = canonicalizer.canonicalizeSubtree(startingNode.getNode(), inclusive_namespace, filter);
            }
            String resultString = new String(result, "UTF-8");
            return stringOrNil(context.getRuntime(), resultString);
        } catch (CanonicalizationException e) {
            // TODO Auto-generated catch block
View Full Code Here

Examples of nu.xom.canonical.Canonicalizer

   * @return the bytes representing canonical XML
   * @see Canonicalizer
   */
  public static byte[] toCanonicalXML(Document doc) {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Canonicalizer canon = new Canonicalizer(out);
    try {
      canon.write(doc);
    } catch (IOException e) {
      throw new RuntimeException("should never happen", e);
    } catch (NoSuchMethodError e) {
      try { // xom < 1.1 uses write(Document) signature
        Canonicalizer.class.getMethod("write", new Class[] {Document.class});
View Full Code Here

Examples of nu.xom.canonical.Canonicalizer

            return;
        }
       
        Builder builder = new Builder();
        try {
            Canonicalizer outputter = new Canonicalizer(System.out);
            Document input = builder.build(args[0]);
            outputter.write(input);
        }
        catch (Exception ex) {
            System.err.println(ex);
            ex.printStackTrace();
        }
View Full Code Here

Examples of org.apache.xml.security.c14n.Canonicalizer

                canonAlgo = canonElem.getAttribute("Algorithm");
                if (doDebug) {
                    log.debug("CanonAlgo: " + canonAlgo);
                }
            }
            Canonicalizer canon = Canonicalizer.getInstance(canonAlgo);

            ByteArrayOutputStream bos = null;
            byte[] buf = null;
            if (doDebug) {
                buf = input.getBytes();
                bos = new ByteArrayOutputStream(buf.length);
                bos.write(buf, 0, buf.length);
                log.debug("canon bos: " + bos.toString());
            }

            /*
             * Get the input (node) to transform. Currently we support only an
             * Element as input format. If other formats are required we must
             * get it as bytes and probably reparse it into a DOM tree (How to
             * work with nodesets? how to select the right node from a nodeset?)
             */
            Element str = null;
            if (input.isElement()) {
                str = (Element) input.getSubNode();
            } else {
                throw (new CanonicalizationException(
                        "Wrong input format - only element input supported"));
            }

            if (doDebug) {
                log.debug("STR: " + str.toString());
            }
            /*
             * The element to transform MUST be a SecurityTokenReference
             * element.
             */
            SecurityTokenReference secRef = new SecurityTokenReference(str);
            /*
             * Third and forth step are performed by derefenceSTR()
             */
            Element dereferencedToken = dereferenceSTR(thisDoc, secRef);
            /*
             * C14n with specified algorithm. According to WSS Specification.
             */
            buf = canon.canonicalizeSubtree(dereferencedToken, "#default");
            if (doDebug) {
                bos = new ByteArrayOutputStream(buf.length);
                bos.write(buf, 0, buf.length);
                log.debug("after c14n: " + bos.toString());
            }
View Full Code Here

Examples of org.apache.xml.security.c14n.Canonicalizer

        documentBuilder.setErrorHandler(new org.apache.xml.security.utils.IgnoreAllErrorHandler());
        byte inputBytes[] = input.getBytes();
        Document doc =
            documentBuilder.parse(new ByteArrayInputStream(inputBytes));
       
        Canonicalizer c14n =
            Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS);
        Element nscontext = createDSctx(doc, "ds", Constants.SignatureSpecNS);

        Node signedInfo = XPathAPI.selectSingleNode(doc, "//ds:SignedInfo", nscontext);
        c14n.canonicalizeSubtree(signedInfo);

        NamedNodeMap attributes = signedInfo.getAttributes();
        boolean foundBase = false;
        for (int i = 0; i < attributes.getLength(); i++) {
            Node attribute = attributes.item(i);
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.