简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM