Try reading in the certificate into a byte array and then see if you can
convert it the X509 spec. 

        KeyFactory kf = KeyFactory.getInstance("RSA");
        X509EncodedKeySpec x509spec = new X509EncodedKeySpec(ByteArray);
        PublicKey pk = kf.generatePublic(x509spec);

Maybe you can then write pk to file and try to import again.

If all you need is a self signed certificate, then you can create that with
the java key tool...

/Jason

-----Original Message-----
From: Peter Peltonen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 31, 2001 4:01 PM
To: Orion-Interest
Subject: Creating keystore file from an OpenSSL created cert



I have created and self-signed an X.509 cert with OpenSSL

--snip--
root# openssl genrsa -des3 -out mysite.key 1024

root# openssl req -new -key server.key -out mysite.csr

root# /usr/local/bin/sign.sh mysite.csr

root# # openssl verify -CAfile /etc/ssl/certs/ca.crt mysite.crt 
/etc/ssl/certs/fivesync.crt: OK
--snip--


I then tried to create the keystore file:

--snip--
orion]$ keytool -keystore keystore -keyalg "RSA" -import -trustcacerts -file
\
mysite.crt 
Enter keystore password: TestPass
keytool error: java.lang.Exception: Input not an X.509 certificate
--snip--

The keytool is from Sun's jdk-1.3.1-fcs package. I've tried it in both Linux
and Win2k with the same result.

What to do?

t: Peter

Reply via email to