Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two-way folder sync with encryption to secure my Dropbox data

I'd like to write a little .NET script/tool which does at least mostly the same like SecretSync or BoxCryptor, but without storing the encryption key on a company's web servers.

First it sounds very simple: You have two folder - a "decryped"-folder and and "encrypted"-folder. On both folders there is an FileSystemWatcher so the tool gets notified when a file has changed. If a file changes in the "decryped"-folder, it encrypts the file and writes it to the "encrypted"-folder. If a file changes in the "encrypted"-folder, it decrypts the file and writes it to the "decrypted"-folder.

No problem so far.

But what happens if the users runs a application (like KeePass for example) directly from the "decryped"-folder? The sync and encryption process will now run into problems because the files are locked from the application. Is there someting i can do to avoid this problem handled, so the application can still run beside the sync and encryption process?

Thanks for any help!

Update: I still couldn't find a answer to this question. When using FileSystemWatcher-class for syncing it is easy to apply the encryption/decryption, but you are running into problems with file locks (because of the streams or applications blocking the files). I also tried Microsoft Sync Framework. File sync works with it, but i don't know how to encrypt/decrypt the files on the fly.

Maybe someone has a little working code sample.

like image 987
Alexander Avatar asked May 16 '11 11:05

Alexander


People also ask

Does Dropbox sync both ways?

You can sync Dropbox files and folders across devices with the Dropbox app. Sign in to your Dropbox account on each device, then add your files and folders to the Dropbox folder on your computer, phone, or tablet. The latest version of all your files and folders will be available across every device.

Is Dropbox sync encrypted?

Dropbox uses Secure Sockets Layer (SSL)/Transport Layer Security (TLS) to protect data in transit between Dropbox apps and our servers. SSL/TSL creates a secure tunnel protected by 128-bit or higher Advanced Encryption Standard (AES) encryption.

Can I encrypt a folder in Dropbox?

Your data is always encrypted when uploaded to Dropbox and you have the option of password protecting your files when you share them.

How do I protect my Dropbox data?

Dropbox offers several tools to protect your account from attacks. To help keep your files safe, enable two-step verification, monitor third-party apps and adjust your security settings.


2 Answers

Inspired by the answer of Ivanov you should maybe take a look into AlphaVSS. It is a .Net wrapper around the Volume Shadow Copy Service.

With this in hand you could make a snapshot in a regulary basis (like every 15 minutes) and copy the files instead from the decrypt folder out of the VSS copy into the encrypt folder. To increase the speed you could still use the FileSystemWatcher to simply log which files have been changed since the last copy and copy only these files from the shadow copy.

like image 78
Oliver Avatar answered Sep 27 '22 18:09

Oliver


look into using Volume Shadow Copy Service, make sure you get the SDK for your OS of choise

like image 36
Kris Ivanov Avatar answered Sep 27 '22 19:09

Kris Ivanov