0

I want to create a java program for server client communication. Therefore first the client creates a RSA keypair. Then the client sends the public key to the server. After that the server will create a RSA keypair and also send its public key to the client. Is it safe to say that now (after key exchange) it is safe to send all kind of data between server and client?

Or is it smart to create a SSLSocket? I honestly have no idea how the authentication with the certificats work and I also do not want to have a certificate which needs an update every now and then.

1 Answer 1

2

... it is safe to send all kind of data between server and client?

No. You just blindly assumed that you've send your key to the right server and that you get a key from the right server back. But it could have been actually some man in the middle, you simply don't know.

Or is it smart to create a SSLSocket?

Much better. This is using an established standard where lots of experts had a closer look at. Don't run your own crypto.

I honestly have no idea how the authentication with the certificats work ...

So you think you are better at designing something yourself when you don't even have an idea how established secure communication methods work and why specific security related design decisions were made? Unlikely that this will actually result in something secure.

... and I also do not want to have a certificate which needs an update every now and then.

TLS is not actually tied to certificates but it scales much better with publicly issued certificates since it can derive trust relationships from this instead of just blindly hoping that no attacker is there when exchanging the key as you do.

For comparison just rephrase your question in the context of health: would you recommend to design your own medicine with practically no understanding of how this stuff works or would it be better to rely on established methods even if they require that you visit the doctor from time to time?

1
  • No, I don't think that I can do better than experts that created TLS. That was not what I wanted to express. Thank you for the tip, I will then focus on SSLSocket and try to understand the java structres to implement a secure connection!
    – F_Schmidt
    Commented Mar 20, 2020 at 22:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .