Rshare
A file sharing program written in Rust.
ed25519 with SHA2512 is used to provide integrity and AES256GCM 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
- Install Git.
- Follow the instruction here.
- Run
git clone https://github.com/cedenday/rshare.git
.
- Run
cd rshare
.
Linux
- Install Clang and Musl.
- 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 4msKqmNmgAAFKJ33WPq5u-L9mxtsLezEtL7vzYudt931mZvR8YAg0u2M3OE2-xuttw91w0A
status 4msKqmNmgAAFKJ33WPq5u-L9mxtsLezEtL7vzYudt931mZvR8YAg0u2M3OE2-xuttw91w0A
3/3
```
Inner Workings
Creation
What happens when you use the create
command:
- An ed25519 key pair and a 64 bit nonce are generated.
- The number of parts, the public key of the aforementioned key pair,
and the aforementioned nonce are encoded into the link.
- 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 SHA2512 and then signed
with the aforementioned key pair.
- The result of the previous step is written to the persistent storage as metadata.
Downloading
What happens when you use the download
command:
- The public signing key and the nonce from the link are added to the current
downloads list.
- 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.
- 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.
- The part is encrypted with AES256GCM and the exchanged key by the sending peer and is decrypted by the
receiving peer.
- The received SHA2512 hash is verified with the public key from the link.
- The part's data's integrity is checked with the verified hash.
- The part's data and it's metadata is written to disk.
Contributing
- Fork this repository.
- Create a branch for your change(s).
- Add some commits; don't overwrite your Git history.
- Create a pull request.
License
See LICENSE.