I'm working on a client / server application. I want to encrypt the communication between the two. This GitHub project served as a starting point for me. It uses SSLEngine to establish a secure connection.

In this example project client and server KeyStore and TrustStore are attached as resources (.jks files) and loaded when they are needed. I could apply this method to my project as well. I'd have to generate two sets of keys. That way the server would have it's own KeyStore and TrustStore and the client would too (they mutually authenticate, so the client has its own certificate). The TrustStores would contain the other side respectively.

If I were then to build my project, I'd end up with a client.jar and a server.jar. Now I could distribute the Jars and every client would be able to connect to every server. That is exactly what I want! I do not want end users to have to handle certificates.

But then, someone could break into one or both of the Jars and compromise the certificates. The way I see it, I'd then have to issue an update and provide one or both side with new certificates. But that does not seem like a viable solution. How would I even know that a key has been compromised?

Again, I want every client instance to be able to securely connect to every server instance without end users having to struggle with certificates. Is there a way to do that? Should I maybe ditch certificates all together and use some other method of secure connection I don't know about yet?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.