dm-crypt.txt 1.7 KB

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