Decrypt file locally

What is the problem you are having with rclone?

I would like to decrypt a file locally on Windows. I have rclone.exe, the encrypted file, and the password and seed. I have researched this for several hours now. While I found numerous posts on the topic, but the solutions simply do not work for me. So I must be doing something stupid. If someone can help with with step by step instructions, I would very much appreciate it.

What is your rclone version (output from rclone version)

v1.51.3

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Files were encrypted by FreeNAS 11.3. I want to decrypt on Windows 10, 64 bit.

Which cloud storage system are you using? (eg Google Drive)

Files are stored on Backblaze. Sample file for decryption was downloaded from there.

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copyto file.dat.bin file.dat -v --crypt-remote=lc: --crypt-filename-encryption=off --crypt-directory-name-encryption=false --crypt-password=PASSWORD --crypt-password2=SEED

Log output:

2020/10/06 08:11:54 DEBUG : Creating backend with remote "file.dat.bin"
2020/10/06 08:11:54 NOTICE: Config file "C:\\Users\\test\\.config\\rclone\\rclone.conf" not found - using defaults
2020/10/06 08:11:54 DEBUG : fs cache: adding new entry for parent of "file.dat.bin", "//?/C:/Users/test/Desktop/rclone"
2020/10/06 08:11:54 DEBUG : Creating backend with remote "."
2020/10/06 08:11:54 DEBUG : fs cache: renaming cache item "." to be canonical "//?/C:/Users/test/Desktop/rclone"
2020/10/06 08:11:54 DEBUG : file.dat.bin: Need to transfer - File not found at Destination
2020/10/06 08:11:54 DEBUG : file.dat.bin: MD5 = 55a7c7f9d949cbe5ba6320b2f11d5d68 OK
2020/10/06 08:11:54 INFO  : file.dat.bin: Copied (new)
2020/10/06 08:11:54 INFO  :
Transferred:        2.974k / 2.974 kBytes, 100%, 127.808 kBytes/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         0.1s

That apparently copied the file? Did it work?

Note that the PASSWORD and SEED here needs to have been run through rclone obscure. If you copied it from a config file then it will be fine.

1 Like

here is sample code for windows

set source=C:\ex\testcrypt\source
set dest=C:\ex\testcrypt\dest
set rclone_config_thecrypt_type=crypt
set rclone_config_thecrypt_remote=%source%
set rclone_config_thecrypt_filename_encryption=standard
set rclone_config_thecrypt_directory_name_encryption=true

FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure password1`) DO (SET password=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure password2`) DO (SET password2=%%F)

set rclone_config_thecrypt_password=%password%
set rclone_config_thecrypt_password2=%password2%

rclone copy THECRYPT: %dest%

Thank you for the responses.
@ncw: Yes, the output file was created, but the file was still encrypted. I did find out along the way that I needed to run the password through "rclone obsure", but this did not seem to work either. My seed is very long autogenerated random jibberish and has an "&" in it. "Rclone obscure" did not like this so I put the seed in quotes, which seemed to work although I do not know if that altered the seed.

@asdffdsa: Thank you so much for the example code. I will give this a try and report back here.

sure,

if you use these two lines, instead from my first post, it will handle the & character

FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure "1&1"`) DO (SET password=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure "2&2"`) DO (SET password2=%%F)

@asdffdsa: I am not quite there yet. when running the example code, I get errors "unexpected EOF". Below is the full output of your code with much of password and seed replaced by "..." I left a few letters so that it is apparent that password and seed are appropriately obscured. I turned off file name and directory encryption as I do not use this; I only encrypt the file content. Further help greatly appreciated. Thank you!

C:\Users\xyz\Desktop\rclone>set source=C:\Users\xyz\Desktop\rclone\src

C:\Users\xyz\Desktop\rclone>set dest=C:\Users\xyz\Desktop\rclone\dst

C:\Users\xyz\Desktop\rclone>set rclone_config_thecrypt_type=crypt

C:\Users\xyz\Desktop\rclone>set rclone_config_thecrypt_remote=C:\Users\xyz\Desktop\rclone\src

C:\Users\xyz\Desktop\rclone>set rclone_config_thecrypt_filename_encryption=off

C:\Users\xyz\Desktop\rclone>set rclone_config_thecrypt_directory_name_encryption=false

C:\Users\xyz\Desktop\rclone>FOR /F "tokens=* USEBACKQ" %F IN (`rclone obscure "t4tYb......................................"`) DO (SET password=%F )

C:\Users\xyz\Desktop\rclone>(SET password=I_FM_l4...................................................... )

C:\Users\xyz\Desktop\rclone>FOR /F "tokens=* USEBACKQ" %F IN (`rclone obscure "14xI8......................................"`) DO (SET password2=%F )

C:\Users\xyz\Desktop\rclone>(SET password2=OhA8kv....................................................... )

C:\Users\xyz\Desktop\rclone>set rclone_config_thecrypt_password=I_FM_l4......................................................

C:\Users\xyz\Desktop\rclone>set rclone_config_thecrypt_password2=OhA8kv.......................................................

C:\Users\xyz\Desktop\rclone>rclone copy THECRYPT: C:\Users\xyz\Desktop\rclone\dst -v
2020/10/06 18:51:05 NOTICE: Config file "C:\\Users\\xyz\\.config\\rclone\\rclone.conf" not found - using defaults
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 ERROR : file.dat: Failed to copy: unexpected EOF
2020/10/06 18:51:05 INFO  : There was nothing to transfer
2020/10/06 18:51:05 ERROR : Attempt 1/3 failed with 1 errors and: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 ERROR : file.dat: Failed to copy: unexpected EOF
2020/10/06 18:51:05 INFO  : There was nothing to transfer
2020/10/06 18:51:05 ERROR : Attempt 2/3 failed with 1 errors and: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 NOTICE: file.dat: Removing partially written file on error: unexpected EOF
2020/10/06 18:51:05 ERROR : file.dat: Failed to copy: unexpected EOF
2020/10/06 18:51:05 INFO  : There was nothing to transfer
2020/10/06 18:51:05 ERROR : Attempt 3/3 failed with 1 errors and: unexpected EOF
2020/10/06 18:51:05 INFO  :
Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.2s

2020/10/06 18:51:05 Failed to copy: unexpected EOF

very confusing?
as the files are local to you, not sure why you need to edit the passwords out.
can you post the batch file itself as is.
use three backticks before the code and three backticks after the code like this

image

I use this password for backing up my entire FreeNAS server to Backblaze. Recovering a single file is easiest to accomplish by downloading the encrypted file and decrypting it locally. This is what I am trying to accomplish. Please see the batch file below.

set source=C:\Users\xyz\Desktop\rclone\src
set dest=C:\Users\xyz\Desktop\rclone\dst
set rclone_config_thecrypt_type=crypt
set rclone_config_thecrypt_remote=%source%
set rclone_config_thecrypt_filename_encryption=off
set rclone_config_thecrypt_directory_name_encryption=false

FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure "t4tYb......................................"`) DO (SET password=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure "14xI8......................................"`) DO (SET password2=%%F)

set rclone_config_thecrypt_password=%password%
set rclone_config_thecrypt_password2=%password2%

rclone copy THECRYPT: %dest% -v

I got a step further that led to success but now I am confused. I was able to grab the rclone.conf file of the FreeNAS server and used the password and password2 from that file and voila the decryption succeeded!

I then played with "rclone obscure" and found that it returns a different value every time. So password and password2 were changing constantly and I do not understand why the output is not deterministic. So the problem seems to be that the obscured password and password2 generated by the batch file are incorrect.

I am puzzled and appreciate if you could explain.

that is the way it works so that is not the problem

More insight: I reenabled the "FOR /F "tokens=..." line for the password but set password2 from the rclone.conf retrieved from the FreeNAS server and that works as well. It work with and without quotes around the filename.

The problem arises when I use the "FOR /F "tokens=..." line for password2. This is the password that contains the "&" character. I wonder if there could be a bug here?

up above, i posted the updated code, both passwords have the & in them and my code decrypts as expected.

FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure "1&1"`) DO (SET password=%%F)
FOR /F "tokens=* USEBACKQ" %%F IN (`rclone obscure "2&2"`) DO (SET password2=%%F)

I am using the quotes around password and password2 as I indicated in the batch file. It seems though that in my case the obscured "password" is valid while the obscured "password2" is not. Which is why I suspect a bug.

I assume that the obscured password2 cannot be unobscured so that I can compare it to the original password, correct?

could be another character that is causing a problem for password2

There are indeed a number of special characters in the password: &, *, %, ^, @, !

Could any of these be the problem?

are those the only special characters?

Yes, these are the only special characters. The rest are numbers and lower and upper case letters. The total length of the seed is 64 characters.

Minor detail: The * character is used twice.

The above was for password2 giving issues. The password contains ^, @, *, !, # and here the obscured version works. There is quite a bit of overlap in special characters between password and password2. The character that sticks out is %. Could this be the issue?

do you have this combo %^