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 :/

  1. read bytes, not lines. there no lines in cipher text.
  2. move cipher init ahead of read loop. don't want re initialize every time around loop.
  3. don't use dofinal(), use update(), assuming sender did same, rather likely.

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -