Martins Blog

This answer explains how to create a crypted file that can be mounted via a loopback device using AES encryption.

Author photo Martin Feuersänger

This answer explains how to create a crypted file that can be mounted via a loopback device using AES encryption.

First, create a file of the appropriate size. Let’s say we want to create a file the size of a DVD-R, i. e. 4.37 GByte.

  dd if=/dev/urandom of=./cryptfile bs=1024k count=4100

Now create the loopback device

  losetup -e AES128 -T /dev/loop1 ./cryptfile

A 128 key demands a passphrase of 20 characters, 192 and 256 keys need 32 and 43 respectively. Next, you need to establish a filesystem on the cryptfile, in this example we use ext2.

  mkfs -t ext2 /dev/loop1

The loop can be closed now.

  losetup -d /dev/loop1

salvaged from Wayback Machine at 2025-12-05, , original timestamp 2005 -11 -25

Reactions

How to interact with this page

Webmentions

To interact via Webmentions, send an activity that references this URL from a platform that supports Webmentions, such as Lemmy, WordPress with Webmention plugins, or any IndieWeb-compatible site.

ActivityPub