Reputation: 413
I want to write client-server using SSL with eclipse. I generate key using this command:
keytool -genkey -keystore mySrvKeystore -keyalg RSA
Then I want to import key to jre keystore to use eclipse to start applications using SSL. I use this command:
C:\jdk1.6.0_21\bin>keytool -import -alias klucz -file C:\mySrvKeystore -keystore C:\jre6\lib\security\cacerts
Next I type passoword 'changeit' and I get error:
keytool error: java.lang.Exception: Input not an X.509 certificate
Do someone know how can I handle with that? Thanks for any help
Upvotes: 0
Views: 345
Reputation: 54074
The error is self explanatory.
You are trying to import a keystore to a keystore.
This is not possible.
You can import only a certificate to a keystore.
So in your case you should first export the certificate from mySrvKeystore
and then you can import it to cacerts.
But why don't you tell us what you are trying to do here?
For a client/server using SSL you don't need to import anything to cacerts
You can use your keystore.
Upvotes: 1
Reputation: 6120
I think you are looking for the steps to create a self-signed certificate. You can follow the procedure shown below or simply google "keytool self signed certs"
http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-using-java-keytool.html
Upvotes: 1