java.net.SocketException: Connection reset server-client -
although have read posts didnt have manage solve issue!
i trying make client server application symmetric encryption. here do.
this while server
while ((inputline = in.readline()) != null) { aes_cipher.init (cipher.decrypt_mode, aes_key); plaintext_decrypted = aes_cipher.dofinal (inputline.getbytes("utf-8")); system.out.println("server receive : "+ plaintext_decrypted); system.out.println("type message :"); outputline = stdin.readline(); out.println(outputline); }
before put line plaintext_decrypted = aes_cipher.dofinal (inputline.getbytes("utf-8"));
everything works. when try decrypt message crushes :/
- read bytes, not lines. there no lines in cipher text.
- move cipher init ahead of read loop. don't want re initialize every time around loop.
- don't use
dofinal(),
useupdate(),
assuming sender did same, rather likely.
Comments
Post a Comment