CertificateException DerInputStream.getLength lengthTag=127 too big

  • Follow


Hi All,

I am getting a valid PEM encoded cert issued by a CA and then use IE
Xenroll to install it into the browser. All these work well.
Now in between, I try to get the serial number out of the cert which
is where it fails.

1. I first convert the PEM encoded String to a byte array and then PEM
decode the byte array. Then I pass this byte array to X509Certificate
getInstance method which throws the Certificate exception saying
DerInputStream.getLength lengthTag=127 too big
Has anybody faced this problem? 

2. I am pretty sure the PEM encoded certificate is alright because I
can install it on the browser after wrapping it with BEGIN CERTIFICATE
and END CERTIFICATE. Is there any other way I can programmatically get
the certificate serial number from teh PEM encoded Certificate String.

Thanks in advance for your help.
-Yash
0
Reply iamr00t1974 1/14/2004 4:32:01 AM

> 1. I first convert the PEM encoded String to a byte array and then PEM
> decode the byte array. Then I pass this byte array to X509Certificate
> getInstance method which throws the Certificate exception saying
> DerInputStream.getLength lengthTag=127 too big
> Has anybody faced this problem? 

Seems you're using an old javax.security.cert.Certificate class. Use
java.security.cert.CertifcateFactory instead and see if you get the
same error. 

-Hans
0
Reply hgranqvistx 1/14/2004 10:35:42 PM


Thanks, Hans.
I suspect that the certificate is in base64 CMC encoded certificate.
None of the OpenSSL utilites was able to parse this certificate as it
seems to be a propriety Microsoft format. Do you have any idea if
there are any tools or utilites which can be used to programmatically
extract the serial number from such certificates.?


hgranqvistx-google@yahoo.com (Hans Granqvist) wrote in message news:<f2c05086.0401141435.35f3b137@posting.google.com>...
> > 1. I first convert the PEM encoded String to a byte array and then PEM
> > decode the byte array. Then I pass this byte array to X509Certificate
> > getInstance method which throws the Certificate exception saying
> > DerInputStream.getLength lengthTag=127 too big
> > Has anybody faced this problem? 
> 
> Seems you're using an old javax.security.cert.Certificate class. Use
> java.security.cert.CertifcateFactory instead and see if you get the
> same error. 
> 
> -Hans
0
Reply iamr00t1974 1/15/2004 5:24:56 PM

2 Replies
1976 Views

(page loaded in 0.092 seconds)

Similiar Articles:












7/21/2012 3:45:46 AM


Reply: