2

In one application i'm using three different connections by SSL. Two of them have signed certificates, but one I'm authenticating with:

System.setProperty("javax.net.ssl.trustStore","F:\\eclipse\\terefere\\testkeystore"); System.setProperty("javax.net.ssl.trustStorePassword","123456"); 

Question is - how to get rid of these settings at the end of connection so that next connection is using new server's certificate ?

1

1 Answer 1

1

You could of course remember the old values of these properties and re-set them after this call.

This would introduce a race condition though: if another thread makes an SSL connection while this trust store has been set, it will also use this trust store instead of the standard one.

Better would be to use this trust store for specifically this connection without touching the system properties. Whether this is easy (or even possible) depends on what library is making the SSL connection, though.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.