04 October 2012

Linux Tip: Store data on CD / DVD using Strong AES encryption



You can try this steps to any Distro; example is written for ubuntu only! once can make small changes to this example and can store on a single file, that you can mount using same steps. Refer my next tip for mounting a binary image.

Installing necessary tools

sajan@sajan-desktop:~$ sudo apt-get install aespipe mkisofs loop-aes-utils

Chose a password
You need to chose a 20+ character password and DO NOT FORGET IT, you will NEVER get your data back if you forget the password.

Creating the CD/DVD image
Make a directory called backup then copy the files you want to burn into the backup directory.
We are using AES encryption, you can chose from 128 or 256 bit key lengths, I recommend 256.

sajan@sajan-desktop:~$ mkisofs -r backup | aespipe -e aes256 > backup.iso

or for 128 bit key length

sajan@sajan-desktop:~$ mkisofs -r backup | aespipe -e aes128 > backup.iso

Mounting the image
First we need to load some modules

sajan@sajan-desktop:~$ sudo modprobe aes
sajan@sajan-desktop:~$ sudo modprobe cryptoloop

For 128 bit key lengths:

sajan@sajan-desktop:~$ sudo mount -t iso9660 backup.iso /mnt/iso -o loop=/dev/loop0,encryption=aes128

For 256 bit key lengths:
sajan@sajan-desktop:~$ sudo mount -t iso9660 backup.iso /mnt/iso -o loop=/dev/loop0,encryption=aes256

This will mount the image in /mnt/iso (make sure you have the directory before you try to mount)

Burning
You can burn the image with your favorite program (gnomebaker, k3b), you might get some warnings about the image but you can ignore them.

Mounting the new CD/DVD
First make sure you loaded the aes and cryptoloop modules (see above)

sajan@sajan-desktop:~$ sudo mount -t iso9660 /dev/cdrom /mnt/iso -o loop=/dev/loop0,encryption=aes256


No comments:

Post a Comment