Reputation: 549
The code as below
System.setProperty("javax.net.ssl.keyStore", "WS12345._.1.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "jNY9vp6iTQ");
Authenticator.setDefault(new MyAuthenticator("WS12345._.1","password"));
When I keep the WS12345._.1.ks file in my project folder (while working on eclipse), the code works fine. However, when I need to make similar code changes and get it working on a Jar, it fails to identify the keystore file.
How to add this private key with the code while working with a Jar?
Upvotes: 1
Views: 910
Reputation: 310840
You can't. It is a filename, not a URL. But you don't want to do this anyway. You want your certificate out there in a keystore file, where it can be renewed, revoked, etc.
Upvotes: 1