Forensicsencryptionluksdisk-encryptiondm-cryptcryptsetupveritysetupintegritysetup

cryptsetup

Cryptsetup provides an interface for configuring encryption on block devices using the Linux kernel device mapper target dm-crypt with integrated LUKS support. It includes tools for managing encrypted devices, integrity protection, and verity verification.

Description

Cryptsetup is a suite of tools for disk encryption support in Kali Linux, featuring integrated Linux Unified Key Setup (LUKS) for secure block device encryption such as /home or swap partitions. It uses the Linux kernel's dm-crypt device mapper target and is backwards compatible with cryptoloop but supports more secure formats. The package includes startup scripts for automatic configuration of encrypted devices at boot time via /etc/crypttab, cryptoroot support through initramfs-tools, and multiple passphrase or key input methods.

Key utilities include cryptsetup for LUKS management, integritysetup for dm-integrity devices, veritysetup for dm-verity verification, and wrappers like cryptdisks_start/stop and luksformat. Additional packages provide initramfs integration, experimental SSH token handling for remote unlocking, suspend mode support, and development libraries. It supports advanced features like reencryption, keyslot manipulation, and external token plugins.

Use cases include setting up full disk encryption, creating encrypted containers, verifying data integrity, and managing LUKS2 devices with modern PBKDF algorithms like argon2id.

How It Works

Cryptsetup operates through the Linux kernel's device mapper (dm-crypt) to create encrypted block devices. It formats devices with LUKS metadata headers containing keyslots encrypted with PBKDF (pbkdf2 for LUKS1, argon2id for LUKS2), master key, and configuration. Devices are opened as /dev/mapper mappings using passphrases or keyfiles. integritysetup adds dm-integrity tags (default crc32c) for data integrity, while veritysetup uses dm-verity with Merkle trees (sha256 hashes) for read-only data verification. External token plugins and SSH integration enable advanced key management.

Installation

bash
sudo apt install cryptsetup

Flags

-r|--readonlyMount readonly for cryptdisks_start
--align-payload=SECTORSAlign payload at sector boundaries for luksFormat
--allow-discardsAllow discards (TRIM) requests
-t <file system>Specify filesystem type for luksformat
--key-slot=NUMKeyslot to assign token to for cryptsetup-ssh
--ssh-keypath=STRINGPath to SSH key for cryptsetup-ssh
--buffer-sectors=SECTORSBuffer size for integritysetup
--data-block-size=bytesData block size for veritysetup

Examples

Show help for cryptdisks_start wrapper that parses /etc/crypttab
cryptdisks_start -h
Start crypto disk mapping from /etc/crypttab
cryptdisks_start [-r|--readonly] <name>
Show help for cryptdisks_stop wrapper
cryptdisks_stop -h
Show help for creating and formatting LUKS device
luksformat -h
Create and format encrypted LUKS device with optional filesystem
luksformat [-t <file system>] <device> [ mkfs options ]
Show complete cryptsetup usage and actions
cryptsetup --help
Open encrypted device as mapped name in /dev/mapper
cryptsetup open <device> [<name>]
Format a LUKS partition on device
cryptsetup luksFormat <device>
Updated 2026-04-16kali.org ↗