Basic self_encryptor example DIY instructions

parallels@ubuntu:~/self_encryption$ cargo run --example basic_encryptor – -e /home/parallels/Desktop/AMA.pdf
Updating registry https://github.com/rust-lang/crates.io-index
Downloading time v0.1.25
Downloading docopt v0.6.64
Downloading libc v0.1.6
Downloading rustc-serialize v0.3.14
Downloading rand v0.3.8
Downloading cbor v0.3.6
Downloading tempdir v0.3.4
Downloading rust-crypto v0.2.31
Downloading gcc v0.3.5
Downloading byteorder v0.3.9
Downloading strsim v0.3.0
Downloading regex v0.1.30
Compiling gcc v0.3.5
Compiling regex v0.1.30
Compiling byteorder v0.3.9
Compiling strsim v0.3.0
Compiling rustc-serialize v0.3.14
Compiling libc v0.1.6
Compiling time v0.1.25
Compiling rust-crypto v0.2.31
Compiling rand v0.3.8
Compiling tempdir v0.3.4
Compiling docopt v0.6.64
Compiling cbor v0.3.6
Compiling self_encryption v0.1.1 (file:///home/parallels/self_encryption)
Running target/debug/examples/basic_encryptor -e /home/parallels/Desktop/AMA.pdf
chunk written
chunk written
chunk written
chunk written
parallels@ubuntu:~/self_encryption$

However I don’t see anything in the examples folder except basic_encryptor

The output will be in the folder from which the commands was run. Looks like you are in self_encrypttion to me, so look there!

1 Like

parallels@ubuntu:~/self_encryption$ cargo run --example basic_encryptor – -d /home/parallels/self_encryption/data_map /home/parallels/self_encryption/AMA.pdf
Running target/debug/examples/basic_encryptor -d /home/parallels/self_encryption/data_map /home/parallels/self_encryption/AMA.pdf
! chunk_store_test AlreadyExists
chunk written

Working!

1 Like

Ok I installed rust and gcc (already have git) and I followed the instructions pretty much and get this.

[root@localhost blindsite]# cargo run --example basic_encryptor – -e /home/blindsite/02\ Track\ 02.m4a
Process didn’t exit successfully: rustc -vV (exit code: 127)
— stderr
rustc: error while loading shared libraries: librustc_driver-4e7c5e5c.so: cannot open shared object file: No such file or directory

[root@localhost blindsite]#

By the way I’m wondering what the other commands are. Obviously this is a command line program but what are all the commands and their oporators? Is there like a help file or manual?

I don’t know if this is your problem, but I notice that the path to the file that you’re encrypting has forward slashes and backslashes in it. Your path also appears to have spaces in it.

Backslashes cause me issue in git bash in windows. Perhaps they’re an issue in linux as well. I’ve been using \\ instead of just \ when I needed a backslash.

1 Like

[root@localhost self_encryption]# cargo run --example basic_encryptor – -e /home/blindsite/02_Track_02.m4a
Process didn’t exit successfully: rustc -vV (exit code: 127)
— stderr
rustc: error while loading shared libraries: librustc_driver-4e7c5e5c.so: cannot open shared object file: No such file or directory

[root@localhost self_encryption]#

I just googled for your error, and this popped up. It seems like you might have to set an environment variable to point to where rust is putting the libraries.

--help [POSIX compliant] is the default help screen. this is an example only so when we build libs we supply simple examples to show devs howto include it in their applications. So do not think of this as an application. It would take several hours, probably a whole day to make it into a nice wee app with a gui etc. but the point here is we just show how to use the API in as simple a way as possible.

In this case it probably does not cater for spaces in the command line I would think. that’s fixed by probably adding " marks around the path with spaces. It’s typical for command line parameters as the prog or parser for command line args has no way to tell if you are supplying multiple things.

Try " in this case, but better take the example and make yourself a secure dropbox addon or similar :slight_smile: Then it starts to get cool

[Edit - when we are feature complete in tesnet3 though these will turn into example applications that will hopefully inspire]

2 Likes

Okay I’m reading the link provided and quite frankly I’m confused as to what command I should issues or where to find the appropriate library to edit. God I feel like such an idiot.

How long would it take to make it a nice wee functional command line app with a readable man page? :smile:

I think you should edit .bashrc (if you use bash) and add the line

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib

You may need to close your terminal window and reopen it, or logout and log back in again, before it will read your .bashrc file to act on the line you just added. It only reads it when you log in I think.

Okay, stupid question but how do you edit .bshrc?

:smiley: Here you go GitHub - dirvine/self_encryption: file self encryptor
to build app then use this http://dirvine.github.io/self_encryption/self_encryption/

Try this

nano /home/blindsite/.bashrc

If you see something in the file (not an empty file), then proceed to add the line

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib

the hit

CTRL-X
Y
ENTER

to save the file.

Okay even after updating the bash file like you showed me I’m still getting this.

e /home/blindsite/02_Track_02.m4a
Process didn’t exit successfully: rustc -vV (exit code: 127)
— stderr
rustc: error while loading shared libraries: librustc_driver-4e7c5e5c.so: cannot open shared object file: No such file or directory

[root@localhost self_encryption]#

Very frustrating.

If you go into self_encryptor/target/debug/examples (I think)

You’ll find the basic_encryptor and can execute it to get the help, pretty basic! as follows

$ ./basic_encryptor -h
Usage: basic_encryptor -h
       basic_encryptor -e <target>
       basic_encryptor -d <target> <dest>

Options:
    -h, --help      This message.
    -e, --encrypt   encrypt a file.
    -d, --decrypt   decrypt a file,

Now if there was a file in here called “mysong.mp3” (note no spaces in the name) you could type:

$ ./basic_encryptor -e mysong.mp3

And after that to see the output $ ls -l should show a new file (datamap) and a new directory (chunk_store_test) which contains the chunks.

This is just a tiny demo program, really intended to help devs understand how to use this library to build other stuff. It isn’t for ordinary users so no point if providing copious docs. This forum is for that :smile: Good luck!

Ok I think we’re making progress but we’re still getting errors.

[blindsite@localhost self_encryption]$ cargo run --example basic_encryptor – -e /home/blindsite/02_Track_02.m4a
Updating registry https://github.com/rust-lang/crates.io-index
An unknown error occurred

To learn more, run the command again with --verbose.
[blindsite@localhost self_encryption]$ cargo run --example basic_encryptor – -e /home/blindsite/02_Track_02.m4a --verbose
Updating registry https://github.com/rust-lang/crates.io-index
An unknown error occurred

To learn more, run the command again with --verbose.
[blindsite@localhost self_encryption]$

looks like an issue with internet connection or crates.io (it’s OK for me)

Put the --verbose either after cargo or after run. It’s not clear which, but I think the former.

try running

cargo clean
cargo update
cargo run --example basic_encryptor -- -e /home/blindsite/02_Track_02.m4a

Are you running it as sudo because I had the same issue and was forgotten to sudoing…
After that no problems in here :smile: