Home / GitHub Page

Decrypt single .md file


#1

I sync Android - Ubuntu via Nextcloud and use encryption.
In one of my notes I included a jpg, which was encrypted (same key) as well. Whatever went wrong the encrypted jpg got lost while syncing. I know the name (e5edcb5f0dcc48a49498cb00d2362a3c.md) and restored it from a backup. The reference in the editor is still there, but the link in the db is probably lost:

  • how can I reimport the (encrypted) file to Joplin
  • is there any option to decrypt a file outside Joplin

#2

On the sync target, is the JPEG file that matches e5edcb5f0dcc48a49498cb00d2362a3c.md still in the .resource folder? If so, I would just add the .md file on the sync target, then sync from the device and it should pick up the file.


#3

That was my problem: the file was in the .resource folder, was not attached to the note. Tried restarting Joplin several times.
Is there any way to decrypt from the linux shell?


#4

e5edcb5f0dcc48a49498cb00d2362a3c.md as well as .resource/e5edcb5f0dcc48a49498cb00d2362a3c are on the sync target?

If so, the issue is that they are not being decyrpted on your computer? or not being synced?

If not being synced, how do you know that’s the case? Did you open the SQLite database to confirm?

You can use joplin e2ee decryption <path> to decrypt a file but I’m not sure if this is what you need in this case


#5

Sorry for my late response, I did not want to seem too stupid, although I am still not wiser
I did look into the db, selected select * from notes where title like ‘%title%’; e5edcb5f0dcc48a49498cb00d2362a3c in the body, and then could not find
select * from notes where id like ‘e5edcb5f0dcc48a49498cb00d2362a3c%’;
I seem to have issues with the jopin e2ee as well:

joplin e2ee decrypt -v 007c0991648345409fce8ae3cf3a79db.md
Invalid encryption identifier. Data is not actually encrypted? ID was: 007c0

joplin e2ee status -v 007c0991648345409fce8ae3cf3a79db.md
Encryption is: Enabled


#6

As e5edc is an image (a resource) you would need to check in the resources table:

select * from resources where id = 'e5edcb5f0dcc48a49498cb00d2362a3c';

If you want to check if this resource is used in a note, you could use this query:

select * from notes where body like '%e5edcb5f0dcc48a49498cb00d2362a3c%';

Do any of these queries bring up anything?

Next could you check in ~/.config/joplin-desktop/resources if the file e5edcb5f0dcc48a49498cb00d2362a3c.jpg is there?

I don’t quite understand your decrypt query as you mentioned one ID (e5edcb5…) but you try to decrypt another (007c09…). If it says “Data is not actually encrypted?” maybe it’s indeed not encrypted. You can verify this by opening the .md file and check the encryption_applied field. It will be “1” if the data is actually encrypted.


#7

Thanks a lot for your effort and info!

cat 007c0991648345409fce8ae3cf3a79db.md

encryption_applied: 1
I understand it should be encrypted?

I blamed the nextcloud sync for loosing the encrypted jpg and had a nonencrypted version of theat jpg still and added that as a new jpg to the note. I changed my sync to “File System” and included it in my unison sync which I trust in for all my devices.

I will try to pull the old db and files from the zfs snapshot and try your the checks you recommend


#8

Now I looked into the data from Sep 12:

The only thing in ~/.config/joplin-desktop/resources is: /e5edcb5f0dcc48a49498cb00d2362a3c.crypted

select * from resources where id = ‘e5edcb5f0dcc48a49498cb00d2362a3c’;
delivers no match

select * from resources where id = ‘e5edcb5f0dcc48a49498cb00d2362a3c’;
matches with id 5b54fdc5b9714821b8f525044f06c6f8 (I assume the note?) and a parent id (Notebook?)
and body:
![Nusstrudel.jpg.jpg](:/e5edcb5f0dcc48a49498cb00d2362a3c)

the double jpg extension is because of my mistake specifying the filename converting a pdf to a jpg (the pdf seems to not be supported on Android yet)


#9

Regarding joplin e2ee decryption <path>:
I would be really happy to be able to use that, as it would be very helpfull to track encrypted synchronized files when I am not certain how well my sync worked or I end up with files that seem to belong nowhere
I really like Joplin and use it for (to me) important stuff