Package org.apache.commons.ssl.asn1

Examples of org.apache.commons.ssl.asn1.BEROctetStringGenerator$BufferedBEROctetStream


            AlgorithmIdentifier encAlgId = getAlgorithmIdentifier(encryptionOID, params);
                       
            eiGen.getRawOutputStream().write(encAlgId.getEncoded());
           
            BEROctetStringGenerator octGen = new BEROctetStringGenerator(eiGen.getRawOutputStream(), 0, false);
           
            CipherOutputStream      cOut;
           
            if (_bufferSize != 0)
            {
                cOut = new CipherOutputStream(octGen.getOctetOutputStream(new byte[_bufferSize]), cipher);
            }
            else
            {
                cOut = new CipherOutputStream(octGen.getOctetOutputStream(), cipher);
            }

            return new CmsEnvelopedDataOutputStream(cOut, cGen, envGen, eiGen);
        }
        catch (InvalidKeyException e)
View Full Code Here


{
    public void testReadingWriting()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       BerOctetStringGenerator octGen = new BerOctetStringGenerator(bOut);
      
       OutputStream out = octGen.getOctetOutputStream();
      
       out.write(new byte[] { 1, 2, 3, 4 });
       out.write(new byte[4]);
      
       out.close();
View Full Code Here

   
    public void testReadingWritingZeroInLength()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       BerOctetStringGenerator octGen = new BerOctetStringGenerator(bOut);
      
       OutputStream out = octGen.getOctetOutputStream();
      
       out.write(new byte[] { 1, 2, 3, 4 });
       out.write(new byte[512])// forces a zero to appear in length
      
       out.close();
View Full Code Here

    public void testReadingWritingNested()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       BerSequenceGenerator sGen = new BerSequenceGenerator(bOut);
       BerOctetStringGenerator octGen = new BerOctetStringGenerator(sGen.getRawOutputStream());
      
       OutputStream out = octGen.getOctetOutputStream();
      
       BerSequenceGenerator inSGen = new BerSequenceGenerator(out);
      
       BerOctetStringGenerator inOctGen = new BerOctetStringGenerator(inSGen.getRawOutputStream());
      
       OutputStream inOut = inOctGen.getOctetOutputStream();
      
       inOut.write(new byte[] { 1, 2, 3, 4 });
       inOut.write(new byte[10]);
      
       inOut.close();
View Full Code Here

        //
        BerSequenceGenerator eiGen = new BerSequenceGenerator(cGen.getRawOutputStream());
       
        eiGen.addObject(new Asn1ObjectIdentifier("1.1"));
       
        BerOctetStringGenerator octGen = new BerOctetStringGenerator(eiGen.getRawOutputStream(), 0, true);
       
        //
        // output containing zeroes
        //
        OutputStream out = octGen.getOctetOutputStream();
       
        out.write(new byte[] { 1, 2, 3, 4 });
        out.write(new byte[4]);
        out.write(new byte[20]);
       
View Full Code Here

TOP

Related Classes of org.apache.commons.ssl.asn1.BEROctetStringGenerator$BufferedBEROctetStream

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.