chiru
chiru

Reputation: 832

how to generate a private key certificate using keytool

I am trying to generate a certificate with keytool of java 6 with private key any help?

1.   Generate private key, public key and keystore to store the keys.



       /usr/local/packages/jdk16/bin/keytool -genkeypair -keyalg RSA -validity 300 -alias sslcert -keystore weblogic.jks

2. Create self signed certificate

    /usr/local/packages/jdk16/bin/keytool -selfcert -keyalg RSA -alias sslcert -keystore weblogic.jks

3.  Export the self signed certificate to a file

$ `/usr/local/packages/jdk16/bin/keytool -export -alias sslcert -rfc -file ohs.crt -keystore weblogic.jks`
      Enter keystore password: 
      Certificate stored in file <ohs.crt>

when i try to import that certifate it says

Error in installing the server certificate.
 No private key found.

Upvotes: 0

Views: 8185

Answers (1)

user207421
user207421

Reputation: 310893

The exported certificate does not contain the private key. The private key remains in the keystore. You seem to be using a long-hand way to copy the keystore. Just copy the keystore to the server. In fact it should already be at the server, otherwise you have a risk of leaking the private key.

Upvotes: 1

Related Questions