Package org.bouncycastle.asn1

Examples of org.bouncycastle.asn1.ASN1StreamParser


    {
        _data = data;
       
        try
        {
            ASN1StreamParser in = new ASN1StreamParser(data, CMSUtils.getMaximumMemory());
   
            _contentInfo = new ContentInfoParser((ASN1SequenceParser)in.readObject());
        }
        catch (IOException e)
        {
            throw new CMSException("IOException reading content.", e);
        }
View Full Code Here


                throw new IllegalArgumentException("Can't find signing certificate with serial " + serialNumber.toString(16));
            }
            digestAlgorithm = ((DERObjectIdentifier)((ASN1Sequence)signerInfo.getObjectAt(2)).getObjectAt(0)).getId();
            next = 3;
            if (signerInfo.getObjectAt(next) instanceof ASN1TaggedObject) {
                ASN1TaggedObject tagsig = (ASN1TaggedObject)signerInfo.getObjectAt(next);
                ASN1Sequence sseq = (ASN1Sequence)tagsig.getObject();
                ByteArrayOutputStream bOut = new ByteArrayOutputStream();           
                ASN1OutputStream dout = new ASN1OutputStream(bOut);
                try {
                    ASN1EncodableVector attribute = new ASN1EncodableVector();
                    for (int k = 0; k < sseq.size(); ++k) {
View Full Code Here

    {
        Enumeration     e = seq.getObjects();

        while (e.hasMoreElements())
        {
            ASN1TaggedObject o = DERTaggedObject.getInstance(e.nextElement());

            switch (o.getTagNo())
            {
            case 0:
                this.keyidentifier = ASN1OctetString.getInstance(o, false);
                break;
            case 1:
View Full Code Here

                                        ecP.getN(),
                                        ecP.getH(),
                                        ecP.getSeed());
        }

        DERBitString    bits = info.getPublicKeyData();
        byte[]          data = bits.getBytes();
    ASN1OctetString  key = new DEROctetString(data);

        //
        // extra octet string - one of our old certs...
        //
View Full Code Here

        String  d = dateF.format(date) + "Z";
        int     year = Integer.parseInt(d.substring(0, 4));

        if (year < 1950 || year > 2049)
        {
            time = new DERGeneralizedTime(d);
        }
        else
        {
            time = new DERUTCTime(d.substring(2));
        }
View Full Code Here

    {
  super("X.509");
  try {
      if ( encoding.equals( "PkiPath" ) )
      {
    DERInputStream derInStream = new DERInputStream(inStream);
    DERObject derObject = derInStream.readObject();
    if ( derObject == null || ! ( derObject instanceof ASN1Sequence ) )
    {
        throw new CertificateException("input stream does not contain a ASN1 SEQUENCE while reading PkiPath encoded data to load CertPath" );
    }
    Enumeration enumx = ((ASN1Sequence)derObject).getObjects();
View Full Code Here

    private DERObject getEncodedX509Certificate( X509Certificate cert )
  throws CertificateEncodingException
    {
  try {
      ByteArrayInputStream inStream = new ByteArrayInputStream( cert.getEncoded() );
      DERInputStream derInStream = new DERInputStream( inStream );
      return derInStream.readObject();
  } catch ( IOException ex ) {
      throw new CertificateEncodingException( "IOException caught while encoding certificate\n" + ex.toString() );
  }
    }
View Full Code Here

            && (data[2] == 0x02 || data[2] == 0x03))
        {
            try
            {
                ByteArrayInputStream    bIn = new ByteArrayInputStream(data);
                DERInputStream          dIn = new DERInputStream(bIn);

                key = (ASN1OctetString)dIn.readObject();
            }
            catch (IOException ex)
            {
                throw new IllegalArgumentException("error recovering public key");
            }
View Full Code Here

    private DigestInfo derDecode(
        byte[]  encoding)
        throws IOException
    {
        ByteArrayInputStream    bIn = new ByteArrayInputStream(encoding);
        DERInputStream          dIn = new DERInputStream(bIn);

        return new DigestInfo((ASN1Sequence)dIn.readObject());
    }
View Full Code Here

     static PublicKey createPublicKeyFromDERStream(
            InputStream         in)
            throws IOException
        {
            return createPublicKeyFromPublicKeyInfo(
                    new SubjectPublicKeyInfo((ASN1Sequence)(new DERInputStream(in).readObject())));
        }
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.ASN1StreamParser

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.