Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • Have a look here: stackoverflow.com/questions/18621508/… You can load the key into the KeyStore using a stream. In the linked question, they stream a resource, but you should be able to use any InputStream. Commented Feb 23, 2015 at 18:39
  • But again this is loading it off the applications file structure as I am doing now. I need to load it from the actual system. What I'm also looking for in the answer is where on the system it should be placed for Linux. Commented Feb 23, 2015 at 18:44
  • Have you tried a FileInputStream? You should be able to place the p12 file anywhere that makes sense for you (and is accessible) Commented Feb 23, 2015 at 18:47
  • Some examples of sensible places is what I am looking for, as well as a code example showing how to read the file in a relative manner that will work across environments (assuming it's placed in the same location) Commented Feb 23, 2015 at 18:49
  • FileInputStream(string path) will allow a relative path. As for location, if you're deploying supporting files along with your JAR, you may have a conf/ directory or something similar, and that might be a good location. Or, you could include the path to the p12 in a configuration file. "Sensible places" is a subjective question, though, so you're probably not going to get a good answer. Are you trying to use keyrings? Commented Feb 23, 2015 at 19:00