Package org.bouncycastle.sasn1

Examples of org.bouncycastle.sasn1.Asn1Object


    }
   
    public void testDerReading()
        throws Exception
    {
        Asn1InputStream aIn = new Asn1InputStream(seqData);
       
        Asn1Sequence    seq = (Asn1Sequence)aIn.readObject();
        Object          o = null;
        int             count = 0;
       
        assertNotNull("null sequence returned", seq);
       
View Full Code Here


    public void testNestedReading(
        byte[] data)
        throws Exception
    {
        Asn1InputStream aIn = new Asn1InputStream(data);
       
        Asn1Sequence    seq = (Asn1Sequence)aIn.readObject();
        Object          o = null;
        int             count = 0;
       
        assertNotNull("null sequence returned", seq);
       
View Full Code Here

    }
   
    public void testBerReading()
        throws Exception
    {
        Asn1InputStream aIn = new Asn1InputStream(berSeqData);
       
        Asn1Sequence    seq = (Asn1Sequence)aIn.readObject();
        Object          o = null;
        int             count = 0;
       
        assertNotNull("null sequence returned", seq);
       
View Full Code Here

    }
   
    public void testLongTag()
        throws IOException
    {
        Asn1InputStream aIn = new Asn1InputStream(longTagged);
       
        Asn1TaggedObject tagged = (Asn1TaggedObject)aIn.readObject();
       
        assertEquals(31, tagged.getTagNumber());
    }
View Full Code Here

        assertEquals(31, tagged.getTagNumber());
    }
   
    private void parseEnveloped(byte[] data) throws IOException
    {
        Asn1InputStream aIn = new Asn1InputStream(data);
       
        ContentInfoParser cP = new ContentInfoParser((Asn1Sequence)aIn.readObject());
       
        EnvelopedDataParser eP = new EnvelopedDataParser((Asn1Sequence)cP.getContent(BerTag.SEQUENCE));
       
        eP.getRecipientInfos();
       
View Full Code Here

       out.write(new byte[] { 1, 2, 3, 4 });
       out.write(new byte[4]);
      
       out.close();
      
       Asn1InputStream aIn = new Asn1InputStream(bOut.toByteArray());
      
       BerOctetString s = (BerOctetString)aIn.readObject();
      
       InputStream in = s.getOctetStream();
       int         count = 0;
      
       while (in.read() >= 0)
View Full Code Here

       out.write(new byte[] { 1, 2, 3, 4 });
       out.write(new byte[512])// forces a zero to appear in length
      
       out.close();
      
       Asn1InputStream aIn = new Asn1InputStream(bOut.toByteArray());
      
       BerOctetString s = (BerOctetString)aIn.readObject();
      
       InputStream in = s.getOctetStream();
       int         count = 0;
      
       while (in.read() >= 0)
View Full Code Here

      
       out.close();
      
       sGen.close();
      
       Asn1InputStream aIn = new Asn1InputStream(bOut.toByteArray());
      
       BerSequence     sq = (BerSequence)aIn.readObject();
      
       BerOctetString s = (BerOctetString)sq.readObject();
      
       Asn1InputStream aIn2 = new Asn1InputStream(s.getOctetStream());
      
       BerSequence sq2 = (BerSequence)aIn2.readObject();
      
       BerOctetString inS = (BerOctetString)sq2.readObject();
      
       InputStream in = inS.getOctetStream();
       int         count = 0;
View Full Code Here

        sGen.close();
       
        //
        // reading back
        //
        Asn1InputStream aIn = new Asn1InputStream(bOut.toByteArray());

        ContentInfoParser cp = new ContentInfoParser((Asn1Sequence)aIn.readObject());
       
        CompressedDataParser  comData = new CompressedDataParser((Asn1Sequence)cp.getContent(BerTag.SEQUENCE));
        ContentInfoParser     content = comData.getEncapContentInfo();

        Asn1OctetString bytes = (Asn1OctetString)content.getContent(BerTag.OCTET_STRING);
View Full Code Here

        throws Exception
    {
       ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       DerSequenceGenerator  seqGen = new DerSequenceGenerator(bOut);
      
       seqGen.addObject(new Asn1Integer(BigInteger.valueOf(0)));
      
       seqGen.addObject(new Asn1ObjectIdentifier("1.1"));
      
       seqGen.close();
View Full Code Here

TOP

Related Classes of org.bouncycastle.sasn1.Asn1Object

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.