[][src]Crate ciph

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.



Salsa20 symmetric cypher stream.