Package org.apache.xml.security.utils

Examples of org.apache.xml.security.utils.UnsyncBufferedOutputStream


  if (context == null) {
            throw new NullPointerException("context cannot be null");
  }

  OutputStream os = new UnsyncBufferedOutputStream(bos);
        try {
            os.close();
        } catch (IOException e) {
            // Impossible
        }

  DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
View Full Code Here


            SignedInfo si = this.getSignedInfo();

            // generate digest values for all References in this SignedInfo
            si.generateDigestValues();
            OutputStream so=new UnsyncBufferedOutputStream(new SignerOutputStream(sa));
            try {
                so.close();
            } catch (IOException e) {
                //Imposible
            }
            // get the canonicalized bytes from SignedInfo
            si.signInOctectStream(so);
View Full Code Here

         }
         sa.initVerify(pk);

         // Get the canonicalized (normalized) SignedInfo
         SignerOutputStream so=new SignerOutputStream(sa);
         OutputStream bos=new UnsyncBufferedOutputStream(so);
         this._signedInfo.signInOctectStream(bos);
         try {
      bos.close();
    } catch (IOException e) {
      //Imposible
    }
        
         //retrieve the byte[] from the stored signature
View Full Code Here

        
         MessageDigestAlgorithm mda = this.getMessageDigestAlgorithm();

         mda.reset();
         DigesterOutputStream diOs=new DigesterOutputStream(mda);
         OutputStream os=new UnsyncBufferedOutputStream(diOs);
         XMLSignatureInput output=this.dereferenceURIandPerformTransforms(os);        
         output.updateOutputStream(os);
         os.flush();
         //this.getReferencedBytes(diOs);
         //mda.update(data);

         return diOs.getDigestValue();
      } catch (XMLSecurityException ex) {
View Full Code Here

  if (context == null) {
            throw new NullPointerException("context cannot be null");
  }

  OutputStream os = new UnsyncBufferedOutputStream(bos);
        try {
            os.close();
        } catch (IOException e) {
            // Impossible
        }

  DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
View Full Code Here

            this.derefData = copyDerefData(dereferencedData);
            dos = new DigesterOutputStream(md, true);
        } else {
            dos = new DigesterOutputStream(md);
        }
  OutputStream os = new UnsyncBufferedOutputStream(dos);
        Data data = dereferencedData;
        for (int i = 0, size = transforms.size(); i < size; i++) {
      DOMTransform transform = (DOMTransform) transforms.get(i);
      try {
                if (i < size - 1) {
                    data = transform.transform(data, context);
                } else {
                    data = transform.transform(data, context, os);
                }
      } catch (TransformException te) {
    throw new XMLSignatureException(te);
      }
        }
 
  try {
      if (data != null) {
          XMLSignatureInput xi;
          if (data instanceof ApacheData) {
              xi = ((ApacheData) data).getXMLSignatureInput();
          } else if (data instanceof OctetStreamData) {
              xi = new XMLSignatureInput
      (((OctetStreamData)data).getOctetStream());
          } else if (data instanceof NodeSetData) {
        TransformService spi = null;
        try {
            spi = TransformService.getInstance
                (CanonicalizationMethod.INCLUSIVE, "DOM");
        } catch (NoSuchAlgorithmException nsae) {
            spi = TransformService.getInstance
                (CanonicalizationMethod.INCLUSIVE, "DOM", provider);
        }
                    data = spi.transform(data, context);
              xi = new XMLSignatureInput
            (((OctetStreamData)data).getOctetStream());
          } else {
              throw new XMLSignatureException("unrecognized Data type");
          }
          xi.updateOutputStream(os);
      }
      os.flush();
      if (cache != null && cache.booleanValue() == true) {
                this.dis = dos.getInputStream();
            }
            return dos.getDigestValue();
  } catch (Exception e) {
View Full Code Here

        throws XMLSignatureException {
        if (context == null) {
            throw new NullPointerException("context cannot be null");
        }

        OutputStream os = new UnsyncBufferedOutputStream(bos);
        try {
            os.close();
        } catch (IOException e) {
            if (log.isDebugEnabled()) {
                log.debug(e.getMessage(), e);
            }
            // Impossible
View Full Code Here

            dos = new DigesterOutputStream(md);
        }
        OutputStream os = null;
        Data data = dereferencedData;
        try {
            os = new UnsyncBufferedOutputStream(dos);
            for (int i = 0, size = transforms.size(); i < size; i++) {
                DOMTransform transform = (DOMTransform)transforms.get(i);
                if (i < size - 1) {
                    data = transform.transform(data, context);
                } else {
View Full Code Here

        try {
            MessageDigestAlgorithm mda = this.getMessageDigestAlgorithm();

            mda.reset();
            DigesterOutputStream diOs = new DigesterOutputStream(mda);
            os = new UnsyncBufferedOutputStream(diOs);
            XMLSignatureInput output = this.dereferenceURIandPerformTransforms(os);        
            // if signing and c14n11 property == true explicitly add
            // C14N11 transform if needed
            if (Reference.useC14N11 && !validating && !output.isOutputStreamSet()
                && !output.isOctetStream()) {
View Full Code Here

                // initialize SignatureAlgorithm for signing
                sa.initSign(signingKey);           

                // generate digest values for all References in this SignedInfo
                si.generateDigestValues();
                so = new UnsyncBufferedOutputStream(new SignerOutputStream(sa));
                // get the canonicalized bytes from SignedInfo
                si.signInOctetStream(so);
            } catch (XMLSecurityException ex) {
                throw ex;
            } finally {
View Full Code Here

TOP

Related Classes of org.apache.xml.security.utils.UnsyncBufferedOutputStream

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.