#stream-cipher #salsa20 #crypto #async-io

ciph

Symmetric cipher layer for async read/write connections

1 unstable release

0.1.0 Jan 4, 2021

#38 in #stream-cipher

MIT license

52KB
1K SLoC

Symmetric Cipher Layer

Symmetric cipher wrapper for types that implement AsyncRead and AsyncWrite from tokio.

Currently only the Salsa20 cipher is supported. hyper connection helper included with "hyper" feature.

Please look at examples to see how to use.


lib.rs:

Symmetric Cipher Layer

This library intends to encrypt a bidirectional stream with two symmetric ciphers of the same type.

Currently the only cipher available is Salsa20.

#
#
      let psk = Psk::from_str(PSK_B64)?;
      let addr = spawn_server(psk.clone(), Randomness::Entropy).await?;
      let connector = Connector::new(psk, Randomness::Entropy);
      let tcp_stream = TcpStream::connect(addr).await?;
      let connect = connector.connect(tcp_stream);
      let mut encrypted_stream = connect.await?;

Unix timestamp is used for initial handshake cipher nonce. This is the cipher produced from the key in the Psk. CLient and Server must have synchronized clocks. A variance of 60 seconds is tolerated.

Dependencies

~6–16MB
~180K SLoC