I'm writing an authentication system and would like some suggestions on improving its security. Currently, I use RSA to communicate data between the client and the server. Here's the process:

1. The client and server each have their public and private keys.
2. The client encrypts data using its private key and sends it to the server.
3. The server decrypts the data using the client's public key to read the message.

Now, I'm wondering if there's a more secure way to handle this. Specifically, I'd like to know if it's possible to avoid hard-coding keys in the client and server and instead establish them securely without the need for direct key transfer.

Feel free to share any insights or ideas for improving the authentication system.