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 > > > > > > > > > > > > > > > > > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]