Tom Connery
Tom Connery

Reputation: 110

Path to specific Key/Truststore from classpath

I want to use SSL in one of my applications, however I have no clue how I shall refer to my trust- and keystores from within a jar.

My attempt was setting the path to "/ssl/keystore.jks", however that didn't work, despite of the existence of the file in the specified location.

Upvotes: 1

Views: 3185

Answers (1)

Tom Connery
Tom Connery

Reputation: 110

In order to understand why this didn't work, we have to investigate how the property value is used by the SSL framework. The path has to be absolute since that's how the file is imported.

A viable solution to this is to

  • export the file from within the classpath to a temporary file
  • and then specify the path to the location of the file

Source

Upvotes: 2

Related Questions