Now encrypting and decrypting in Socket. Fixed some memory leaks.