Package com.sun.org.apache.xml.internal.security.signature

Examples of com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput


    */
   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


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

         XMLSignatureInput result = null;

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

           c14n.setWriter(os);
         }
         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

      // Need to wrap the uri in an Attribute node so that we can
      // Pass to the resource resolvers

      Attr uriAttr = cr.getURIAsAttr();
      XMLSignatureInput input = null;

      try {
        ResourceResolver resolver =
          ResourceResolver.getInstance(uriAttr, null);
        input = resolver.resolve(uriAttr, null);
      } catch (ResourceResolverException ex) {
        throw new XMLEncryptionException("empty", ex);
      }

      if (input != null) {
        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Managed to resolve URI \"" + cr.getURI() + "\"");
      }
      else {
        if (logger.isLoggable(java.util.logging.Level.FINE))                                     logger.log(java.util.logging.Level.FINE, "Failed to resolve URI \"" + cr.getURI() + "\"");
      }
   
      // Lets see if there are any transforms
      Transforms transforms = cr.getTransforms();
      if (transforms != null) {
        if (logger.isLoggable(java.util.logging.Level.FINE))                                  logger.log(java.util.logging.Level.FINE, "Have transforms in cipher reference");
        try {
             com.sun.org.apache.xml.internal.security.transforms.Transforms dsTransforms =
            transforms.getDSTransforms();
            input =  dsTransforms.performTransforms(input);
        } catch (TransformationException ex) {
          throw new XMLEncryptionException("empty", ex);
        }
      }

      try {
        return input.getBytes();
      }
      catch (IOException ex) {
        throw new XMLEncryptionException("empty", ex);
      } catch (CanonicalizationException ex) {
        throw new XMLEncryptionException("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

           c14n.setWriter( os);
        }
        input.setNeedsToBeExpanded(true);
        byte []result; 
        result =c14n.engineCanonicalize(input, inclusiveNamespaces);
        XMLSignatureInput output=new XMLSignatureInput(result);
       
        return output;
     } catch (XMLSecurityException ex) {
        throw new CanonicalizationException("empty", ex);
     }
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

         String type = rm.getType();
         Transforms transforms = rm.getTransforms();
         ResourceResolver resRes = ResourceResolver.getInstance(uri, BaseURI);

         if (resRes != null) {
            XMLSignatureInput resource = resRes.resolve(uri, BaseURI);
            if (true)
              if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Before applying Transforms, resource has "
                      + resource.getBytes().length + "bytes");

            if (transforms != null) {
               if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "We have Transforms");

               resource = transforms.performTransforms(resource);
            }
            if (true) {
              if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "After applying Transforms, resource has "
                      + resource.getBytes().length + "bytes");
              if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "Resolved to resource " + resource.getSourceURI());
            }

            byte inputBytes[] = resource.getBytes();

            if ((type != null) && type.equals(RetrievalMethod.TYPE_RAWX509)) {

               // if the resource stores a raw certificate, we have to handle it
               CertificateFactory certFact =
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xml.internal.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.