That's true!
When the program executes this line:
asn1Input = new ASN1InputStream(policyInformationOctetString.getOctets());

Checking the dedug mode, the variables assume this value:

asn1Input= ASN1InputStream  (id=74)
    END_OF_STREAM= ASN1InputStream$1  (id=75)
    eofFound= false
    in= ByteArrayInputStream  (id=77)

policyInformationOctetString= DEROctetString  (id=68)
    string= byte[9]  (id=82)
        [0]= 48
        [1]= 7
        [2]= 48
        [3]= 5
        [4]= 6
        [5]= 3
        [6]= 42
        [7]= 4
        [8]= 5


Then the next line would be where there is .getInstance().
At this point the execution stops and the thread is forced to terminate.

bye
pana

2005/7/21, David Hook <[EMAIL PROTECTED]>:

What exception is being thrown? What does the stack trace look like?

It's impossible to tell what's going on from the below information.

Regards,

David

On Thu, 2005-07-21 at 11:17 +0200, pana wrote:
> I tried also with ASN1Sequence.
> The exact problem is that when the program is going to execute
> PolicyInformation.getInstance(), it launches an exception and
> terminates.
> Can you help me?
>
> bye
> pana
>
> 2005/7/18, David Hook <[EMAIL PROTECTED]>:
> >
> > Can you tell me more about the exact problem you are seeing? As far as
> > I'm aware the PolicyInformation class is okay.
> >
> > One thing from the code below - a PolicyInformation extension contains
> > an ASN.1 Sequence not a BIT STRING...
> >
> > Regards,
> >
> > David
> >
> > On Sat, 2005-07-16 at 15:17 +0200, pana wrote:
> > > Thanks for reply Carlos!
> > > I tried something similar, but the problem is again with the method
> > > getInstance().
> > > The execution stops with it, there is a loop. I used getInstance()
> > > method for other extensions and it works well.
> > > I don't know why whit PolicyInformation class I can't obtain an object
> > > in this way.
> > > I tried to create certificate policies extensions either with only a
> > > field or with qualifiers field too. the end is the same.
> > > Any suggestion?
> > >
> > > 2005/7/14, Carlos Lozano <[EMAIL PROTECTED]>:
> > > > Hi pana,
> > > >      I think you are experiencing a very common problem that appear when
> > > > trying to read an extension value, this problem has been solved on this list
> > > > other times but refered to other extension values.
> > > >      The values for certificate extensions are encoded as Octect String so
> > > > for reading a real extension value (instead of the codification as octect
> > > > string) using Bouncy Castle you can use the following code (I didn't test it
> > > > but I think it could be useful to give an idea):
> > > >
> > > >        X509Certificate cert   //the certificate to examine
> > > >
> > > >       byte[] policyInformationExtensionValue = cert.getExtensionValue (/* OID
> > > > For Policy Information Extension */);
> > > >
> > > >       ASN1InputStream asn1Input = new
> > > > ASN1InputStream(policyInformationExtensionValue );
> > > >
> > > >       DEROctetString policyInformationOctetString = (DEROctetString)
> > > > asn1Input.readObject();
> > > >
> > > >       asn1Input = new ASN1InputStream(policyInformationOctetString
> > > > .getOctets());
> > > >
> > > >       PolicyInformation policyInformation =
> > > > PolicyInformation.getInstance((DERBitString) asn1Input.readObject());
> > > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "pana" <[EMAIL PROTECTED] >
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Thursday, July 14, 2005 3:46 PM
> > > > Subject: [dev-crypto] Re: Use PolicyInformation class
> > > >
> > > >
> > > > The problem is to get an instance of this class with the method
> > > > PolicyInformation.getInstance(). It doesn't work well.
> > > >
> > > > bye
> > > > pana
> > > >
> > > > 2005/7/13, pana <[EMAIL PROTECTED]>:
> > > > > I need to extract the Policy Constraints extension from my x.509 v3
> > > > certificate.
> > > > > I used getExtensionValue method and then I tried to create a
> > > > > PolicyInformation object with this data, but I can't. how can I read
> > > > > this extension?
> > > > > Someone can help me?
> > > > >
> > > > > thanks
> > > > > pana
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> >
>


Reply via email to