I have a very simple scenario:
public class Main {
public static void main(String[] args) {
System.setProperty("javax.net.debug", "ssl");
System.setProperty("javax.net.ssl.trustStore", "H:/data/serverkeystore.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "somestuff");
try {
ServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
SSLServerSocket serverSocket = (SSLServerSocket) ssf.createServerSocket(1337);
... code goes on here ...
It does not matter if I comment the line
System.setProperty("javax.net.ssl.trustStorePassword", "somestuff");
out or if I use it. In the answers to this question, it was well described what the password is used for (even if the source information is missing there) and that if a password is not given, the integrity of the TrustStore can not be verified. So in my sample code, if you uncomment that line, Java will use the TrustStore without checking its integrity. Through my own tests, I could determine that if I give a wrong password and use the code, as shown above, that it comes to an error message (which is a desired result). I am just surprised that it is possible to omit the password and then Java apparently works with an unchecked TrustStore. Can anyone explain the initialization routine of the TrustStore with regard to my question?
As already mentioned in the question, I use my own password for the TrustStore, which differs from the standard password "changeit".