[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Rm: [dev-crypto] SOLUTION: ExceptionConverter: org.bouncycastle.x509.util.StreamParsingException: ja
From:       Pere_Joseph_Rodríguez <seguretat4 () dgtic ! caib ! es>
Date:       2012-12-21 14:05:13
Message-ID: OF8CFED33D.ECCC02FD-ONC1257ADB.004D55E7-C1257ADB.004D61E7 () correu ! caib ! es
[Download RAW message or body]


Sorry,
I'm very confused today.... I'ts already done in CVS.


Pere Joseph Rodríguez

Servei de Seguretat
Direcció General de Tecnologia I Comunicacions
Govern de les Illes Balears

tel 971177601
extensió 67892

----- Remitido por Pere Joseph Rodríguez/dgtic/caib con fecha 21/12/2012
15:04 -----

De:	Pere Joseph Rodríguez/dgtic/caib
Para:	dev-crypto@bouncycastle.org
Fecha:	21/12/2012 15:02
Asunto:	Re: [dev-crypto] SOLUTION: ExceptionConverter:
            org.bouncycastle.x509.util.StreamParsingException:
            java.lang.ClassCastException:
            org.bouncycastle.asn1.BERTaggedObject cannot be cast to
            org.bouncycastle.asn1.ASN1Set


Hi,
I've been searching on last version of BouncyCastle in CVS and provlem's
not solved.


To solve this problem, replace org.bouncycastle.asn1.pkcs.SignedData

    public SignedData(
        ASN1Sequence seq)
    {
        Enumeration     e = seq.getObjects();

        version = (ASN1Integer)e.nextElement();
        digestAlgorithms = ((ASN1Set)e.nextElement());
        contentInfo = ContentInfo.getInstance(e.nextElement());

        while (e.hasMoreElements())
        {
            ASN1Primitive o = (ASN1Primitive)e.nextElement();

            //
            // an interesting feature of SignedData is that there appear to
be varying implementations...
            // for the moment we ignore anything which doesn't fit.
            //
            if (o instanceof DERTaggedObject)
            {
                DERTaggedObject tagged = (DERTaggedObject)o;

                switch (tagged.getTagNo())
                {
                case 0:
                    certificates = ASN1Set.getInstance(tagged, false);
                    break;
                case 1:
                    crls = ASN1Set.getInstance(tagged, false);
                    break;
                default:
                    throw new IllegalArgumentException("unknown tag value "
+ tagged.getTagNo());
                }
            }
            else
            {
                signerInfos = (ASN1Set)o;
            }
        }
    }





with:



   public SignedData(
        ASN1Sequence seq)
    {
        Enumeration     e = seq.getObjects();

        version = (ASN1Integer)e.nextElement();
        digestAlgorithms = ((ASN1Set)e.nextElement());
        contentInfo = ContentInfo.getInstance(e.nextElement());

        while (e.hasMoreElements())
        {
            ASN1Primitive o = (ASN1Primitive)e.nextElement();

            //
            // an interesting feature of SignedData is that there appear to
be varying implementations...
            // for the moment we ignore anything which doesn't fit.
            //
            if (o instanceof ASN1TaggedObject)
            {
            	ASN1TaggedObject tagged = (ASN1TaggedObject)o;

                switch (tagged.getTagNo())
                {
                case 0:
                    certificates = ASN1Set.getInstance(tagged, false);
                    break;
                case 1:
                    crls = ASN1Set.getInstance(tagged, false);
                    break;
                default:
                    throw new IllegalArgumentException("unknown tag value "
+ tagged.getTagNo());
                }
            }
            else
            {
                signerInfos = (ASN1Set)o;
            }
        }
    }


Thanks
Pere Joseph Rodríguez

Servei de Seguretat
Direcció General de Tecnologia I Comunicacions
Govern de les Illes Balears

tel 971177601
extensió 67892


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic