Crate gday_encryption
source ·Expand description
A simple encrypted wrapper around an IO stream.
Uses a streaming chacha20poly1305 cipher.
This library is used by gday_file_transfer, which is used by gday.
In general, I recommend using the well-established rustls for encryption. gday_file_transfer chose this library because rustls didn’t support peer-to-peer connections with a shared key.
§Example
let shared_key: [u8; 32] = [42; 32];
//////// Peer A ////////
let mut encrypted_stream = EncryptedStream::encrypt_connection(&mut tcp_stream, &shared_key)?;
encrypted_stream.write_all(b"Hello!")?;
encrypted_stream.flush()?;
//////// Peer B (on a different computer) ////////
let mut encrypted_stream = EncryptedStream::encrypt_connection(&mut tcp_stream, &shared_key)?;
let mut received = [0u8; 6];
encrypted_stream.read_exact(&mut received)?;Structs§
- A simple encrypted wrapper around an IO stream. Uses
chacha20poly1305with thechacha20poly1305::aead::stream.