How to make Encrypted Connection in Java

43 views Asked by At

I am making a server in java using ServerSocket and Socket class. I wanted it encrypted so I used RSA encryption to encrypt and decrypt data in form of Strings. I got into a problem. The problem is that I can only encrypt maximum 500 bytes of data with 4096 key size and around 240 bytes with 2048 key size. Also I use Scanner and PrintWriter for reading and sending data. I found there is class SSL but I am not really sure if it can replace Socket. I tried sending large data by breaking it into pieces and then sending it but I don't really think it is really efficient. Please can anyone guide me how to make encrypted communication in server.

I want to find a way to encrypt my communication in server.

0

There are 0 answers