Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to acess jvm default KeyStore?

I want to use java key store to save keys and certificates. can anybody share some code to help me with this?

like image 589
bhavesh1988 Avatar asked Mar 23 '12 10:03

bhavesh1988


People also ask

How do I open a Java Keystore?

If you cannot open your JKS file correctly, try to right-click or long-press the file. Then click "Open with" and choose an application. You can also display a JKS file directly in the browser: Just drag the file onto this browser window and drop it.

Where is the default Java truststore?

Java has bundled a truststore called cacerts, and it resides in the $JAVA_HOME/jre/lib/security directory.

What is the default keystore password?

In the Enter keystore password prompt, type the current password, which by default is changeit, and press Enter. The new password is saved to cacerts.


1 Answers

There should be enough example code in the KeyStore Javadocs page to get you started:

  • https://docs.oracle.com/javase/9/docs/api/java/security/KeyStore.html

As for the 'default' keystore - I'm not sure such a thing exists, normally you either load it explicitly from a file, or you can configure it using the following system properties:

  • javax.net.ssl.keyStore - Keystore location
  • javax.net.ssl.keyStorePassword - Keystore password
  • javax.net.ssl.keyStoreType - Keystore type (JKS, P12 etc)

And similar for the trust store:

  • javax.net.ssl.trustStore
  • javax.net.ssl.trustStorePassword
  • javax.net.ssl.trustStoreType
like image 134
Chris White Avatar answered Sep 19 '22 13:09

Chris White