#file-sharing #download #ed25519 #x25519 #server #link

app rshare

A file sharing program written in Rust

3 releases

Uses old Rust 2015

0.1.16 Jun 10, 2017
0.1.15 Jun 9, 2017
0.1.14 Jun 8, 2017

#1806 in Cryptography

GPL-3.0 license

78KB
1.5K SLoC

Rshare

A file sharing program written in Rust.

ed25519 with SHA_2_512 is used to provide integrity and AES_256_GCM with X25519 is used to provide privacy.

Supported Platforms

Basic x86_64 instruction set or better.

Linux

Linux 2.6 or later, 3.17 or later recommended.

Windows

64 bit, seven or later.

Installation

Install With Your Package Manager

Arch Linux

Rshare is in the AUR. Link.

Download Precompiled Binary

Download the most applicable binary from here.

Compile from source

  1. Install Git.
  2. Follow the instruction here.
  3. Run git clone https://github.com/cedenday/rshare.git.
  4. Run cd rshare.

Install from the Crate Repository

Run cargo install --force rshare.

Linux

  1. Install Clang and Musl.
  2. Run ./build_linux.sh.

Usage

Test server IPv6: 2601:184:300:500::3612.

Test server IPv4: 73.143.75.225.

Test Link: Filename: sintel.mkv. Link: p8e-_-NggAAFKC3-715NfNnfDdJLrhesiT9_vnOfefrsp7-aLix-KNTX_PEfTL2z02aDBsHuZwA=.

A Simple Example

Machine One

[test-one@test-one ~]$ rshare -q -s 2601:184:300:500::3612
> create /home/test-one/Documents/linux-4.11.2.tar.xz
4msKqmNmgAAFKJ3_3WPq5u-L9mxtsLezEtL7vzYudt931mZvR8YAg0u2M3OE2-xuttw91w0A

Machine Two

[test-two@test-two ~]$ rshare -q -s 2601:184:300:500::3612
> download /home/test-two/Downloads/linux-4.11.2.tar.xz 4msKqmNmgAAFKJ3_3WPq5u-L9mxtsLezEtL7vzYudt931mZvR8YAg0u2M3OE2-xuttw91w0A
> status 4msKqmNmgAAFKJ3_3WPq5u-L9mxtsLezEtL7vzYudt931mZvR8YAg0u2M3OE2-xuttw91w0A
3/3

Inner Workings

Creation

What happens when you use the create command:

  1. An ed25519 key pair and a 64 bit nonce are generated.
  2. The number of parts, the public key of the aforementioned key pair, and the aforementioned nonce are encoded into the link.
  3. Rayon is used to iterate over the parts of the file. Each part is appended by the aforementioned nonce and then the part's respective index. This is then hashed with SHA_2_512 and then signed with the aforementioned key pair.
  4. The result of the previous step is written to the persistent storage as metadata.

Downloading

What happens when you use the download command:

  1. The public signing key and the nonce from the link are added to the current downloads list.
  2. Every 15 seconds keys that don't have a high number of part advertisements are sent to the inputted servers to get more adverts from peers connected to that server.
  3. Every second a random wanted advert is selected to start key exchange. X25519 is used for key agreement and HKDF is used for extraction and expansion of agreed keys, with the link nonce used as the shared info.
  4. The part is encrypted with AES_256_GCM and the exchanged key by the sending peer and is decrypted by the receiving peer.
  5. The received SHA_2_512 hash is verified with the public key from the link.
  6. The part's data's integrity is checked with the verified hash.
  7. The part's data and it's metadata is written to disk.

Contributing

  1. Fork this repository.
  2. Create a branch for your change(s).
  3. Add some commits; don't overwrite your Git history.
  4. Create a pull request.

License

See LICENSE.

Dependencies

~42MB
~787K SLoC