SSL Java java.io.IOException: Invalid keystore format

后端 未结 5 854
忘掉有多难
忘掉有多难 2020-12-15 23:08

I am testing SSL in java with SSLServerSocket and other classes in the java.ssl package. When I run the following code, I get the exception java.io.IOException: Invalid keys

5条回答
  •  醉话见心
    2020-12-16 00:06

    I faced with the same problem when load keystore with the following code:

    KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
    Resource resource = new ClassPathResource(file);
    trustStore.load(resource.getInputStream(), password.toCharArray());
    

    It turned out to be the JDK issue, it doesn't work with jre1.8.0_25. when I upgrade JDK version to the latest jre1.8.0_121, it works.

提交回复
热议问题