I am trying to understand the security problems when working with a game that needs an account for its players.
What is the problem of using a self-signed certificate?
If I understand the problem correctly, it's just that if the server private key is compromised, the users will still trust the certificate and the guy that stole the key could steal their passwords. (Until the game updates with the new certificate.)
But is that the only problem? And if it is, is it really possible for an attacker to steal the private key from a server with intensive firewalls (just open as few ports as possible?).
Here is what I have in mind for my game when a client wants to authenticate:
- The client encrypts it's username and password with RSA using the public key of the self signed-certificate.
- The client sends this encrypted message to the server.
- (So here technically only the master server could read the messages, except if the self-signed certificate is compromised)
- The server reads the message using it's private key from the self-signed certificate
- Then here the server do classic things, checks in the database if the username exists then hashes the password with something like bcrypt and checks if the password is correct, then he set the client in the authenticated state and now have access to other features like joining game servers, accessing the servers list etc...
And basically I need to make the clients trust the public key! Because if the master server send it's public key to the client then a man in the middle could take it, generate itself a public/private key and send it's public key. So now the client could think he talks to the server but instead he talks to the man in the middle. Am I thinking wrong?