stefankueng / CryptSync

CryptSync is a small utility that synchronizes two folders while encrypting the contents in one folder. That means one of the two folders has all files unencrypted (the files you work with) and the other folder has all the files encrypted.
https://tools.stefankueng.com/CryptSync.html
GNU General Public License v3.0
400 stars 72 forks source link

Feature Request - Import / Export Settings #35

Open Rorthron opened 4 years ago

Rorthron commented 4 years ago

I use your wonderful tool as a real time backup mechanism to cloud storage. What would help greatly would be the ability to import / export configuration so that in the event of a crash, I can just reload the settings and have CryptSync merrily restore everything in the background.

At the moment I would have to remember all the folders I have mapped and set each of the pairs up again manually. Some kind of backup feature would be useful.

Another perhaps less critical feature could be to duplicate an entry, allow it to be edited and saved. This is more of a usability improvement.

stefankueng commented 4 years ago

to export the settings: open regedit.exe, browse to HKCU\Software\CryptSync, then click File->Export and save the *.reg file somewhere. To import the settings again, a double click on the *.reg file should do, or import it with regedit.exe again.

ghrasc commented 3 years ago

Doesn't work like that in 1.41. Export creates CS.reg (see below for sample) but when importing the string value SyncPairPass0 (and all other SyncPairPass-es as well) is not imported back. The result: An empty interface (no folder pair(s) shown at all) in CS.

example-export:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\CryptSync]
"CheckNewerWeek"=dword:00000025
"SyncPairOrig0"="C:\\Temp\\Source"
"SyncPairCrypt0"="C:\\Temp\\Target"
"SyncPairCryptOnly0"=""
"SyncPairCopyOnly0"=""
"SyncPairNoSync0"=""
"SyncPairEncnames0"=dword:00000000
"SyncPairEncnamesNew0"=dword:00000000
"SyncPairDir0"=dword:00000001
"SyncPair7zExt0"=dword:00000001
"UseGPG0"=dword:00000000
"SyncPairFAT0"=dword:00000001
"SyncDeleted0"=dword:00000001
"SyncPairCompressSize0"=dword:00000064
"SyncPairEnabled0"=dword:00000001
"Ignores"="*.tmp*|~*.*|thumbs.db|desktop.ini"
"FullScanInterval"=dword:0001d4c0
"SyncPairPass0"="01 00 00 00 d0 8c 9d df  01 15 d1 11 8c 7a 00 c0

4f c2 97 eb 01 00 00 00  b8 96 9a c0 ff ed fd 41

a1 e3 ee 44 57 4b 78 0f  00 00 00 00 20 00 00 00

43 00 72 00 79 00 70 00  74 00 53 00 79 00 6e 00

63 00 52 00 65 00 67 00  50 00 57 00 73 00 00 00

10 66 00 00 00 01 00 00  20 00 00 00 41 a7 85 8a

17 52 99 31 76 17 eb 71  8a b6 1c 81 3c d5 59 41

6a df d0 9a 59 d2 2c 7b  d6 7b f4 b8 00 00 00 00

0e 80 00 00 00 02 00 00  20 00 00 00 52 cd 2a 88

de 84 b2 3c 6a 3b 59 e7  b5 a5 62 df 1d df cb ff

36 aa 89 71 ca 1d 6e a5  d8 15 9b b2 10 00 00 00

92 d7 0b be df ed 08 28  56 8a f6 b8 f1 99 f8 d7

40 00 00 00 dc 53 bd ce  fe 73 76 5b b6 8e 37 2a

13 7c 01 c6 b1 4b e7 66  63 43 bf 19 e5 52 f3 cb

f8 7e b8 91 1b 6b 52 d1  a1 0a a2 22 0c 93 06 4f

8a 9f b1 fa b6 59 bd 98  54 38 a1 c2 db 2c c3 35

99 b2 7c 88

"
ghrasc commented 3 years ago

...had a further look into this: The issue is that CryptSync 'abuses' a string value ("REG_SZ") to store binary data. When exporting to *.reg the "00 00" line(?) dividers get lost.

As I like to backup my config as well I 'developed' a workaround (bit of a PITA but I prefer this way over having to reconfigure all sync pairs).

How to backup config? 1) in regedit export HKCU\Software\CryptSync to e.g. "CS.reg" 2) edit CS.reg in notepad, delete the stored data for each SyncPairPassX (X == 0...n) so that the line looks like "SyncPairPassX"="" 3) open a hex editor (I use HxD - https://mh-nexus.de/en/), 4) for each SyncPairPassX

et voila! You saved your CryptSync config. Be aware!: Whenever you add/delete sync pairs CryptSync may change the order of the folder pairs in the registry (now SyncPairPassX is SyncPairPassX-1 or SyncPairPassX+1). To be safe you went again through the procedures 1-4.

How to restore config? 1) open regedit, make sure HKCU\Software\CryptSync doesn't already exist 2) import CS.reg to the registry 3) in regedit, open HKCU\Software\CryptSync 4) for each SyncPairPassX

et voila! You successfully restored your CryptSync config.

HTH!

playmobilmeister commented 1 year ago

Idea: A command line option to export/import settings as text or csv would also help a lot