#tcp #networking #net

simpletcp

Crate for simple and secure tcp communication

12 releases (4 stable)

1.2.1 Sep 15, 2020
1.1.0 Sep 10, 2020
0.5.1 Sep 8, 2020
0.4.1 Sep 1, 2020
0.1.0 Aug 21, 2020

#54 in #net


Used in sfshr

MIT license

61KB
1.5K SLoC

simpletcp

Crate for simple and secure TCP communication

Encryption

All traffic is encrypted with 256-bit AES-CBC

Initialization

  1. Server generates RSA key and sends it to client
  2. Client generates AES key, encrypts it with server key and send it to the server
  3. From now, all communication is encrypted with 256-bit AES in CBC mode

Usage

//Connect
let mut client = TcpStream::connect("127.0.0.1:4234").unwrap();

//Wait until connection is initialized
client.wait_until_ready().unwrap();

//Build message
let mut msg = Message::new();
msg.write_f64(1.23455);
msg.write_buffer(&[3, 1, 4, 56]);

//Send message
client.write(&msg).unwrap();

See examples

Dependencies

~2.4–5MB
~103K SLoC