sslkeytoolshajetty-8

How to generate trusted self signed certificate with SHA2 signing algorithm using keytool?


I am trying to establish a secure connection for my application using jetty http server version 8.1.8.v20121106 with self signed certificate.

I am generating self signed certificate with the following command,

  1. keytool -genkey -alias mykey -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -validity 365 -keypass password -keystore keystore.jks -storepass password

  2. keytool -export -alias mykey -file server.cer -keystore keystore.jks -storepass password

  3. keytool -import -alias mykey -file server.cer -keystore truststore.jks -storepass password

So, totally 3 files generate (keystore.jks,server.cer,truststore.jks)

After the server gets started, I got the following error in my browser. There are issues with the site's certificate chain (net::ERR_CERT_AUTHORITY_INVALID).

enter image description here

enter image description here

Could anyone help me to generate a trusted self signed certificate using keytool.

Thanks in advance.


Solution

  • It is the problem with java jdk. I have verified using java 1.8 and jdk1.7.0_79 it is working fyn for me. Change your java jdk version and verify. For further clarification, Please refer this link. https://bugs.eclipse.org/bugs/show_bug.cgi?id=398644