Milan Broz | e3dcc5a | 2008-04-24 22:11:03 +0100 | [diff] [blame] | 1 | dm-crypt |
| 2 | ========= |
| 3 | |
| 4 | Device-Mapper's "crypt" target provides transparent encryption of block devices |
| 5 | using the kernel crypto API. |
| 6 | |
| 7 | Parameters: <cipher> <key> <iv_offset> <device path> <offset> |
| 8 | |
| 9 | <cipher> |
| 10 | Encryption cipher and an optional IV generation mode. |
Milan Broz | d1f9642 | 2011-01-13 19:59:54 +0000 | [diff] [blame] | 11 | (In format cipher[:keycount]-chainmode-ivopts:ivmode). |
Milan Broz | e3dcc5a | 2008-04-24 22:11:03 +0100 | [diff] [blame] | 12 | Examples: |
| 13 | des |
| 14 | aes-cbc-essiv:sha256 |
| 15 | twofish-ecb |
| 16 | |
| 17 | /proc/crypto contains supported crypto modes |
| 18 | |
| 19 | <key> |
| 20 | Key used for encryption. It is encoded as a hexadecimal number. |
| 21 | You can only use key sizes that are valid for the selected cipher. |
| 22 | |
Milan Broz | d1f9642 | 2011-01-13 19:59:54 +0000 | [diff] [blame] | 23 | <keycount> |
| 24 | Multi-key compatibility mode. You can define <keycount> keys and |
| 25 | then sectors are encrypted according to their offsets (sector 0 uses key0; |
| 26 | sector 1 uses key1 etc.). <keycount> must be a power of two. |
| 27 | |
Milan Broz | e3dcc5a | 2008-04-24 22:11:03 +0100 | [diff] [blame] | 28 | <iv_offset> |
| 29 | The IV offset is a sector count that is added to the sector number |
| 30 | before creating the IV. |
| 31 | |
| 32 | <device path> |
| 33 | This is the device that is going to be used as backend and contains the |
| 34 | encrypted data. You can specify it as a path like /dev/xxx or a device |
| 35 | number <major>:<minor>. |
| 36 | |
| 37 | <offset> |
| 38 | Starting sector within the device where the encrypted data begins. |
| 39 | |
| 40 | Example scripts |
| 41 | =============== |
| 42 | LUKS (Linux Unified Key Setup) is now the preferred way to set up disk |
| 43 | encryption with dm-crypt using the 'cryptsetup' utility, see |
Andrea Gelmini | adc0485 | 2011-01-13 23:01:53 +0100 | [diff] [blame] | 44 | http://code.google.com/p/cryptsetup/ |
Milan Broz | e3dcc5a | 2008-04-24 22:11:03 +0100 | [diff] [blame] | 45 | |
| 46 | [[ |
| 47 | #!/bin/sh |
| 48 | # Create a crypt device using dmsetup |
| 49 | dmsetup create crypt1 --table "0 `blockdev --getsize $1` crypt aes-cbc-essiv:sha256 babebabebabebabebabebabebabebabe 0 $1 0" |
| 50 | ]] |
| 51 | |
| 52 | [[ |
| 53 | #!/bin/sh |
| 54 | # Create a crypt device using cryptsetup and LUKS header with default cipher |
| 55 | cryptsetup luksFormat $1 |
| 56 | cryptsetup luksOpen $1 crypt1 |
| 57 | ]] |