[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iaik-jce] Problem with PEM files




There is a space between "BEGIN CERTIFICATE" and "-----" which is not
allowed to be there. Furthermore you must ensure to close the
PemOutPutStream so that flush() is called for writing the end-line.

You alternatively may use the toPemString() method of iaik.utils.Util for
writing the certificate, e.g.:

FileOutputStream fos = new FileOutputStream(...);
fos.write(Util.toPemString(user).getBytes());
fos.close();

Dieter Bratko

----- Original Message -----
From: Oscar Canovas Reverte <ocanovas@fcu.um.es>
To: <iaik-jce@iaik.tu-graz.ac.at>
Sent: Wednesday, July 21, 1999 11:03 AM
Subject: [iaik-jce] Problem with PEM files


>     Hi all.
>
>     I'm trying to generate certs in PEM format, using PemOutputStream,
> but SSLeay don't recognises files created with this IAIK class. I attach
> a code digest and the corresponding error shown by SSLeay.
>
> [code]
>
> X509Certificate user = new X509Certificate();
> .....
> user.writeTo(new PemOutputStream(new
> FileOutputStream("cert.pem","-----BEGIN CERTIFICATE -----", "-----END
> CERTIFICATE-----"));
>
> [command-line]
> x509 -inform pem -in cert13.pem -text
>
> unable to load certificate
> 14302:error:0D06B08D:asn1 encoding routines:ASN1_get_object:too
> long:asn1_lib.c:140:
> 14302:error:0D09F065:asn1 encoding routines:D2I_X509:bad get
> object:x_x509.c:114:address=135109336 offset=-1208854424
> 14302:error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1
> lib:pem_lib.c:236:
>
> Certificates that are generated in DER format work properly, but PEM
> don't. Any idea??
>
>     Thanks in advance.
> --
> ==========================================================
> scar Cnovas Reverte
> Personal de Investigacin
> Universidad de Murcia - Espaa (Spain)
> Tlf: +34 968364644    Fax: +34 968364151
> ==========================================================
>
> 1SS?{?kjjjqjSjj'qS.-zzPD?

--
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

To unsubscribe send an email to listserv@iaik.tu-graz.ac.at with the folowing content: UNSUBSCRIBE iaik-jce