Loop-AES-Crypto

For ubuntu, you need package 'loop-aes-utils' and 'cryptsetup'

apt-get install loop-aes-utils
apt-get install cryptsetup

First,

modprobe aes
modprobe cryptoloop


There are two ways to get this work:
Old way: using losetup

losetup -e aes /dev/loop0 $YOUR_LOOP_FILE

Format the loop device:

mkfs -t ext2 /dev/loop0

Journaled filesystems are reported to have bad problems with cryptoloops, so I use ext2 instead.

Now you can mount the crypted device

mount /dev/loop0 $MOUNT_POINT


umount:

umouunt /dev/loop0
losetup -d /dev/loop0


Usage:

Mount:
losetup /dev/loop0 $YOUR_LOOP_FILE
mount -t ext2 -o encryption=aes /dev/loop0 $MOUNT_POINT
Umount:
umouunt /dev/loop0
losetup -d /dev/loop0


New way
Using device mapping
You must enable two voices when compiling kernel: device mapper support and its sub-voice crypt target support.
ubuntu enabled these two options by default

First

modprobe loop
modprobe dm-crypt


Setup loop device

losetup /dev/loop0 $YOUR_LOOP_FILE


map the device to /dev/mapper

cryptsetup -c aes -y create $MAPPED_NAME /dev/loop0


create a filesystem

mkfs.ext4 /dev/mapper/$MAPPED_NAME

mount

mount /dev/mapper/MAPPED_NAME $MOUNT_POINT


umount

umount $MOUNT_POINT
cryptsetup remove $MAPPED_NAME
losetup -d /dev/loop0


Usage:

Mount:
losetup /dev/loop0 $YOUR_LOOP_FILE
cryptsetup create $MAPPED_NAME /dev/loop0
mount /dev/mapper/$MAPPED_NAME $MOUNT_POINT
Umount:
umount $MOUNT_POINT
cryptsetup remove $MAPPED_NAME
losetup -d /dev/loop0

that's it.

Rewrite and edit from http://www.ppcnerds.org/displayarticle186.html

留言

這個網誌中的熱門文章

成功安裝Vista & Ubuntu Linux 8.04 LTS 雙系統!!!

駕訓班~XD