Package org.apache.xml.security.signature

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


         }

         log.debug("Fetched " + summarized + " bytes from URI "
                   + uriNew.toString());

         XMLSignatureInput result = new XMLSignatureInput(baos.toByteArray());

         // XMLSignatureInput result = new XMLSignatureInput(inputStream);
         result.setSourceURI(uriNew.toString());
         result.setMIMEType(mimeType);

         // switch off proxy usage
         if (switchBackProxy) {
            System.getProperties().put("http.proxySet", oldProxySet);
            System.getProperties().put("http.proxyHost", oldProxyHost);
View Full Code Here


        String fileName =
           ResolverLocalFilesystem
              .translateUriToFilename(uriNewNoFrag.toString());
        FileInputStream inputStream = new FileInputStream(fileName);
        XMLSignatureInput result = new XMLSignatureInput(inputStream);

        result.setSourceURI(uriNew.toString());

        return result;
     } catch (Exception e) {
        throw new ResourceResolverException("generic.EmptyMessage", e, uri,
                                            BaseURI);
View Full Code Here

         }
         if (log.isDebugEnabled())
           log.debug("Try to catch an Element with ID " + id + " and Element was " + selectedElem);
      }

      XMLSignatureInput result = new XMLSignatureInput(selectedElem);
      result.setExcludeComments(true);

      //log.debug("We return a nodeset with " + resultSet.size() + " nodes");
      result.setMIMEType("text/xml");   
    result.setSourceURI((BaseURI != null) ? BaseURI.concat(uri.getNodeValue()) :
      uri.getNodeValue());     
      return result;
   }
View Full Code Here

    * @param filename
     * @throws FileNotFoundException
     * @throws IOException
     */
   public ResolverAnonymous(String filename) throws FileNotFoundException, IOException {
      this._input = new XMLSignatureInput(new FileInputStream(filename));
   }
View Full Code Here

   /**
    * @param is
     */
   public ResolverAnonymous(InputStream is) {
      this._input = new XMLSignatureInput(is);
   }
View Full Code Here

         }
         byte []result;
         input.setNeedsToBeExpanded(true);
         result =c14n.engineCanonicalize(input, inclusiveNamespaces);
             
         XMLSignatureInput output=new XMLSignatureInput(result);
         if (os!=null) {
            output.setOutputStream(os);
         }
         return output;     
      } catch (XMLSecurityException ex) {
         throw new CanonicalizationException("empty", ex);
      }
View Full Code Here

        }
       
         byte[] result = null;
         input.setNeedsToBeExpanded(true);
         result=c14n.engineCanonicalize(input);                                
         XMLSignatureInput output=new XMLSignatureInput(result);        
         if (os!=null) {
           output.setOutputStream(os);
         }
         return output;     
   }
View Full Code Here

         }
         StringBuffer sb=new StringBuffer();
         traverseElement((Element)el,sb);
         if (os==null) {
           byte[] decodedBytes = Base64.decode(sb.toString());           
           return new XMLSignatureInput(decodedBytes);
         }
           Base64.decode(sb.toString().getBytes(),os);
            XMLSignatureInput output=new XMLSignatureInput((byte[])null);
            output.setOutputStream(os);
            return output;
        
      }
      if (input.isOctetStream() || input.isNodeSet()) {
                   
       
        if (os==null) {
            byte[] base64Bytes = input.getBytes();
            byte[] decodedBytes = Base64.decode(base64Bytes);           
            return new XMLSignatureInput(decodedBytes);
         }
        if (input.isByteArray() || input.isNodeSet()) {
               Base64.decode(input.getBytes(),os);
        } else {
            Base64.decode(new BufferedInputStream(input.getOctetStreamReal())
                    ,os);
        }
            XMLSignatureInput output=new XMLSignatureInput((byte[])null);
            output.setOutputStream(os);
            return output;
        
       
      }
      
   try {
            //Exceptional case there is current not text case testing this(Before it was a
         //a common case).
            Document doc =
               DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
                  input.getOctetStream());
                 
            Element rootNode = doc.getDocumentElement();
            StringBuffer sb = new StringBuffer();
            traverseElement(rootNode,sb);
            byte[] decodedBytes = Base64.decode(sb.toString());
     
            return new XMLSignatureInput(decodedBytes);
      } catch (ParserConfigurationException e) {
        throw new TransformationException("c14n.Canonicalizer.Exception",e);
      } catch (SAXException e) {
        throw new TransformationException("SAX exception", e);
      }     
View Full Code Here

         Transformer transformer = tFactory.newTransformer(stylesheet);
         if (baos==null) {
               ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
               StreamResult outputTarget = new StreamResult(baos1);
               transformer.transform(xmlSource, outputTarget);
               return new XMLSignatureInput(baos1.toByteArray());

         }
         StreamResult outputTarget = new StreamResult(baos);

         transformer.transform(xmlSource, outputTarget);        
         XMLSignatureInput output=new XMLSignatureInput((byte[])null);
         output.setOutputStream(baos);
         return output;
      } catch (XMLSecurityException ex) {
         Object exArgs[] = { ex.getMessage() };

         throw new TransformationException("generic.EmptyMessage", exArgs, ex);
View Full Code Here

    */
   public XMLSignatureInput performTransform(XMLSignatureInput input)
           throws IOException, CanonicalizationException,
                  InvalidCanonicalizerException, TransformationException {

      XMLSignatureInput result = null;

      try {
         result = transformSpi.enginePerformTransform(input);
      } catch (ParserConfigurationException ex) {
         Object exArgs[] = { this.getURI(), "ParserConfigurationException" };
View Full Code Here

TOP

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

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.