Closed bytecod3r closed 4 years ago
@bytecod3r I have a feeling that you're experiencing this issue because you're attempting to reuse the same Cipher[]
for every Client
that connects to your Server
. However, because you've specified UPDATE
instead of DO_FINAL
, then you need to provide every Client
with their own unique Cipher[]
.
The solution should be as simple as moving var ciphers = initCiphers("AES/CFB8/NoPadding");
into Server#onConnect
in your startServer()
method.
Thanks, the suggestion above solved the problem.
There is a problem with Encryption when there are more than 2 clients connected to the same server.
By using the below code, the first client connect to the server without any issues, and there is encryption, but second client onward throwing the below error.
FYI, I am just sending a small amount of bytes, and I am not sure where the below number (e.g. 1892643530) is coming from.
My machine has enough ram and I set "XX:MaxDirectMemorySize=4096m" but it didn't help.
Server.java:
Client: