I have my own SSL factory where I load my own private store.
Now, when I put the truststore.jks file in the root folder of the project, it works with the following line:
ks.load(new FileInputStream("/truststore.jks", passphrase);
But I want my trust store to be inside my resources folder, which was built using maven, where the path is src / main / resources .
Then I do this and it does not work with the following line:
ks.load(this.getClass().getResourcesAsStream("/truststore.jks"), passphrase);
Although the input stream exists. I checked it out. This only happens when ks.load (...) is executed.
Exception I get:
java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Why is this?
Regards, Dave
source share