Package org.apache.commons.ssl.asn1

Examples of org.apache.commons.ssl.asn1.DERSequenceGenerator


    public void testNestedDerWriting()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       DerSequenceGenerator  seqGen1 = new DerSequenceGenerator(bOut);
      
       seqGen1.addObject(new Asn1Integer(BigInteger.valueOf(0)));
      
       seqGen1.addObject(new Asn1ObjectIdentifier("1.1"));
      
       DerSequenceGenerator seqGen2 = new DerSequenceGenerator(seqGen1.getRawOutputStream());
      
       seqGen2.addObject(new Asn1Integer(BigInteger.valueOf(1)));
      
       seqGen2.close();
      
       seqGen1.close();

       assertTrue("nested DER writing test failed.", Arrays.equals(nestedSeqData, bOut.toByteArray()));
    }
View Full Code Here


    public void testDerExplicitTaggedSequenceWriting()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       DerSequenceGenerator  seqGen = new DerSequenceGenerator(bOut, 1, true);
      
       seqGen.addObject(new Asn1Integer(BigInteger.valueOf(0)));
      
       seqGen.addObject(new Asn1ObjectIdentifier("1.1"));
      
       seqGen.close();

       assertTrue("explicit tag writing test failed.", Arrays.equals(expTagSeqData, bOut.toByteArray()));
    }
View Full Code Here

   
    public void testDerImplicitTaggedSequenceWriting()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       DerSequenceGenerator  seqGen = new DerSequenceGenerator(bOut, 1, false);
      
       seqGen.addObject(new Asn1Integer(BigInteger.valueOf(0)));
      
       seqGen.addObject(new Asn1ObjectIdentifier("1.1"));
      
       seqGen.close();

       assertTrue("implicit tag writing test failed.", Arrays.equals(implTagSeqData, bOut.toByteArray()));
    }
View Full Code Here

   
    public void testNestedExplicitTagDerWriting()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       DerSequenceGenerator  seqGen1 = new DerSequenceGenerator(bOut);
      
       seqGen1.addObject(new Asn1Integer(BigInteger.valueOf(0)));
      
       seqGen1.addObject(new Asn1ObjectIdentifier("1.1"));
      
       DerSequenceGenerator seqGen2 = new DerSequenceGenerator(seqGen1.getRawOutputStream(), 1, true);
      
       seqGen2.addObject(new Asn1Integer(BigInteger.valueOf(1)));
      
       seqGen2.close();
      
       seqGen1.close();

       assertTrue("nested explicit tagged DER writing test failed.", Arrays.equals(nestedSeqExpTagData, bOut.toByteArray()));
    }
View Full Code Here

   
    public void testNestedImplicitTagDerWriting()
        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       DerSequenceGenerator  seqGen1 = new DerSequenceGenerator(bOut);
      
       seqGen1.addObject(new Asn1Integer(BigInteger.valueOf(0)));
      
       seqGen1.addObject(new Asn1ObjectIdentifier("1.1"));
      
       DerSequenceGenerator seqGen2 = new DerSequenceGenerator(seqGen1.getRawOutputStream(), 1, false);
      
       seqGen2.addObject(new Asn1Integer(BigInteger.valueOf(1)));
      
       seqGen2.close();
      
       seqGen1.close();

       assertTrue("nested implicit tagged DER writing test failed.", Arrays.equals(nestedSeqImpTagData, bOut.toByteArray()));
    }
View Full Code Here

      
       seqGen1.addObject(new Asn1Integer(BigInteger.valueOf(0)));
      
       seqGen1.addObject(new Asn1ObjectIdentifier("1.1"));
      
       DerSequenceGenerator seqGen2 = new DerSequenceGenerator(seqGen1.getRawOutputStream());
      
       seqGen2.addObject(new Asn1Integer(BigInteger.valueOf(1)));
      
       seqGen2.close();
      
       seqGen1.close();

       assertTrue("nested BER/DER writing test failed.", Arrays.equals(berDerNestedSeqData, bOut.toByteArray()));
    }
View Full Code Here

        cGen.addObject(new Asn1Integer(0));
       
        //
        // AlgorithmIdentifier
        //
        DerSequenceGenerator algGen = new DerSequenceGenerator(cGen.getRawOutputStream());
       
        algGen.addObject(new Asn1ObjectIdentifier("1.2"));

        algGen.close();
       
        //
        // Encapsulated ContentInfo
        //
        BerSequenceGenerator eiGen = new BerSequenceGenerator(cGen.getRawOutputStream());
View Full Code Here

TOP

Related Classes of org.apache.commons.ssl.asn1.DERSequenceGenerator

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.