How to activate jvm default KeyStore?

I want to use the Java keystore to store keys and certificates. can anyone share some code to help me with this?

+4
source share
2 answers

The KeyStore Javadocs page should have enough sample code to get started:

As for the default β€œkeystore”, I’m not sure that such a thing exists, usually you either load it explicitly from a file, or you can configure it using the following system properties:

  • javax.net.ssl.keyStore - location of the keystore
  • javax.net.ssl.keyStorePassword - password for keys
  • javax.net.ssl.keyStoreType - type Keystore (JKS, P12, etc.)

And similarly for the trust store:

  • javax.net.ssl.trustStore
  • javax.net.ssl.trustStorePassword
  • javax.net.ssl.trustStoreType
+5
source

There is no default keystore in Java. This is described in the section in the JSSE Reference Guide configuration section .

Default trust store:

jssecacerts if it exists. Otherwise, cacerts

However, this does not mean that these are the repositories used by default SSLContext , since it is also possible to change the default SSLContext (starting with Java 6) with that which would be initialized using custom trust managers (For more details see.

+2
source

Source: https://habr.com/ru/post/1403049/


All Articles