Search code examples
javax509certificatekeystoretruststore

How to generate Java keystore from X.509 Certificate


I am trying to generate Java keystore from X.509 Certificate file, and don't know how. On other word, I want to convert X.509 (application/pkix-cert) to java Keystore (application/x-java-keystore). Do you have any idea how to do it ? Thanks


Solution

  • For add the certificate to your keystore is this:

        keytool -importcert -keystore [keystore location, varies, but can be e.g.
     /etc/pki/java/cacerts] -storepass changeit -file /tmp/lb.cert -alias 
    newSelfSignedKey -noprompt