Backup to Microsoft SkyDrive – But Encrypted!

 

The Challenge:
I'm using a notebook for my work and mostly save my data to the local disc. For security reasons, this drive is encrypted using EFS technology which is build-in in Windows 7. When I'm in the office in Cologne, I'm able to sync my business related data against the file server. But I also carry some personal files on the disk. For these files (like banking data) I searched for a simple solution to save them.
Microsoft SkyDrive
I found Microsoft's service SkyDrive (http://skydrive.live.com), which offers a capacity of 25 GByte for files, photos, videos and documents for free. There is also a tool from Microsoft called Mesh, which can synchronize local folders from different computers with SkyDrive.
Improve Security – But how?
This works well, but I'm not sure if it is a good idea to copy sensitive personal data to the cloud. But what could I do? My first idea was to use an encryption software which can map a virtual drive to an encrypted container.
But there are two disadvantages for this simple solution:

The Challenge:

I'm using a notebook for my work and mostly save my data to the local disc. For security reasons, this drive is encrypted using EFS technology which is build-in in Windows 7. When I'm in the office in Cologne, I'm able to sync my business related data against the file server. But I also carry some personal files on the disk. For these files (like banking data) I searched for a simple solution to save them.

 

Microsoft SkyDrive

I found Microsoft's service SkyDrive (http://skydrive.live.com), which offers a capacity of 25 GByte for files, photos, videos and documents for free. There is also a tool from Microsoft called Mesh, which can synchronize local folders from different computers with SkyDrive.

 

Improve Security – But how?

This works well, but I'm not sure if it is a good idea to copy sensitive personal data to the cloud. But what could I do? My first idea was to use an encryption software which can map a virtual drive to an encrypted container.

But there are two disadvantages for this simple solution:

  1. I must un-map the virtual drive to sync it with SkyDrive
  2. Most important: If you change a single file you must synchronize the whole container

 

My Solution

I decided to write a powershell script which is able to copy a source folder into a target folder file by file and also compress and encrypt each file with 7-Zip (http://www.7-zip.org).  I found some sample scripts on the internet but all of them (I found) are missing some key-features I needed for SkyDrive:

 

  • Compress and encrypt each single file (not whole folders) in a target folder
  • Include files in subdirectories (recursiv)
  • Only update existing files/archives if last-change timestamp differs
  • Delete all files/archives in the target folder which are not in the source (like robocopy /MIR)

My powershell script is implemented as a task in Windows Task Sheduler, which runs every hour and syncs my private files from one folder into another:

SkyDrive-FolderOriginal

SkyDrive-FolderEncrypted

 

As you can see, the files in folder "D:\_SYNC-ENCRYPTED\D\Private Data\Our Wedding" have a new extension. In my case .AES.7z, which indicates its encryption and compression.

I configured Windows Mesh to synchronize only my folder with the encrypted files in "D:\_SYNC-ENCRYPTED". This works very well, because only updates to files will result in updated archives.

SkyDrive-MySkyDrive

You can download the script and use it at your own responsibility. Remember that all files in the target directory will be deleted if they not part of the source. If you want to avoid this for testing, set $vSimulateDeletingExtra to $true.

You can start the script in the body (sample is at its bottom) with this parameters (the parameter $ExcludeFilter is not implemented yet):

Mirror-Folder $SourcePath $DestinationPath $EncryptionKey $ExcludeFilter

SkyDrive-Script

 

 

AnhangGröße
mirrorfolders-v001.zip2.32 KB

++++ Wir suchen Verstärkung ++++ Arbeitskultur, IT Kompetenz und Innovation werden bei sepago zum Wohle unserer Mitarbeiter und Kunden maximal gefördert. Das ist der Sinn der sepago. Wenn Dich das anspricht, dann schau doch mal im Karrierebereich.

6 responses for "Backup to Microsoft SkyDrive – But Encrypted!"

Really helpful! Thanks a lot!

Really helpful! Thanks a lot!

This is great! Good work!

This is great! Good work! However, what about a batch decrypt for a restore process? Have you thought of coding this?

Thanks a lot. Unfortunately I

Thanks a lot. Unfortunately I do not have such a script yet. But it's a good idea to do this.

Excellent Script, thank you!

Excellent Script, thank you! This will be a great help for me as want a cloud backup but have trust issues :)

I like your solution and I've

I like your solution and I've used it for a while. But I wanted something a little more automatic so I wrote myself a tool to do that. Also using 7zip for the encryption. I named the tool CryptSync and it's available here (including source code):
http://tools.tortoisesvn.net/CryptSync.html

This script is really what I

This script is really what I was looking for. In 2 words : thank you !

I modified the line #170 to switch from LZMA (limited to 2 threads) to LZMA2 and be sure to set the number of threads equivalent to the physical cores of my CPU (-mmt=4) in order to speed up the compression with 7-zip 9.20. Now this line looks like as follow :

& $7ZipProgramPath "a" "-t7z" $vsubDestination\$vsubSourceItem$vAppendFileExtension $vsubSourceItem.FullName "-p$vEncryptionKey" "-mx=9" "-m0=LZMA2" "-mhe=on" "-mhc=on" "-ms=off" "-mmt=4" | Out-Null

Microsoft Competence Blog

Application Infrastructure mit Microsoft Technologien ist ein wichtiges Fokusthema der sepago. Wir haben langjährige Projekterfahrung, sind neugierig auf neue Technologien und möchten diese bis in letzte Detail verstehen. Die Competence Blogs berichten davon.

RSS-Feed Alle Artikel des Competence Blogs abonnieren.

 

About the author

Bild von Marcel Meurer
Marcel Meurer
Abteilungsleiter Consulting Services

All articles