Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted backups can't be decrypted, when password contains certain special characters #53

Open
kevinbbbb opened this issue Jun 29, 2023 · 7 comments
Assignees
Labels
bug Something isn't working upstream

Comments

@kevinbbbb
Copy link

kevinbbbb commented Jun 29, 2023

Edit: I am currently using Version 1.20 of the extension. I am currently not able to update so can't confirm whether this was fixed.

I am doing encrypted backups with your extension. Unfortunately, when I tried to access a backup file (.7z archive, which is password-protected) I was not able to although the password was 100% correct. I tried unpacking with WinRAR and 7-Zip. Both failed for the 5 backups I had from the last five days. If I understand the errors of WinRAR and 7-Zip correctly, either the password is not correct or the file is damaged.

I don't know if the files are damaged. If they are, then this must be inflicted by a password containing certain symbols (see later).
I definitely used the correct password (I checked it in the Joplin settings, where you can configure the password for the backups).

The password I used for the encryption was:
VCe`,=/P<_+.7]~;Ys("

When I changed my password to a 'simpler' one, it worked. I tried the following:
AAAA

With AAAA, 7-Zip had no problem decrypting the backup file. So in conclusion, I suspect that the special characters (or at least some of them) hinder the process at some point. Maybe it damages the file or certain characters are simply not allowed in passwords for .7z files (but I am not an expert on that).

Side note: luckily I could restore my notes from the 'trash can' of my cloud.

For completeness:

WinRAR told me:
! C:\Users\hp\AppData\Roaming\Joplin\Backup\202306291517\all_notebooks.jex.7z: Prüfsummenfehler der verschlüsselten Datei C:\Users\hp\AppData\Roaming\Joplin\Backup\202306291517\all_notebooks.jex.7z. Beschädigte Datei oder falsches Passwort.

7-Zip told me:
C:\Users\hp\AppData\Roaming\Joplin\Backup\202306251526\all_notebooks.jex.7z
Das verschlüsselte Archiv "" kann nicht geöffnet werden. Falsches Passwort?
Headers-Fehler

@JackGruber JackGruber added the bug Something isn't working label Jul 3, 2023
@JackGruber
Copy link
Owner

I'm currently away on holiday, but will have a look at this over the next few weeks.

@JackGruber
Copy link
Owner

Problem is the " in the password, but only on direct Joplin calls in the integration test " is working.

@JackGruber
Copy link
Owner

JackGruber commented Jul 7, 2023

Tested password VCe`,=/P<_+.7]~;Ys("

Zip With Open With Status
Joplin 7z Gui Error
Joplin 7z cli *1 OK
Joplin 7z cli *2 Error
integration test integration test OK
integration test 7z cli *1 OK
integration test 7z cli *2 Error
integration test 7z Gui Error
7z Gui 7z Gui OK
7z Gui 7z cli *1 Error
7z Gui 7z cli *2 OK

7z cli *1: 7za.exe l "file.7z" "-pVCe`,=/P<_+.7]~;Ys(\"" -y -bb3
7z cli *2: 7za.exe l "file.7z" -y -bb3 (password prompt)

The problem seems to be the escaping of " from the module node-7z.
Executed CLI from node-7z is 7za.exe a file.7z file.txt -mx0 -mhe "-pVCe`,=/P<_+.7]~;Ys(\"" -y -bb3

@JackGruber
Copy link
Owner

JackGruber commented Jul 7, 2023

Opened q2s2t/node-7z#132

@JackGruber
Copy link
Owner

Add workaround e9e361d (Passwords with " are not use for encryption)

@gshiba
Copy link

gshiba commented Jan 2, 2024

Thanks for this plugin -- saved me from a corrupt sync that wiped all tags.

I also couldn't unarchive using the built-in "/System/Library/CoreServices/Applications/Archive Utility.app". My password contained an asterisk (*), something like MyPassword*123. MacOS 13.5.2, Simple Backup 1.0.5.

I was able to unarchive with:

$ brew install p7zip
$ 7zz x path/to/backup.jex.7z '-pMyPassword*123'

@JackGruber
Copy link
Owner

I cannot reproduce this under windows. The * in passwords works fine there and I can open the file with the 7-zip gui and cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

3 participants