This is the FAQ (Frequently Asked Questions) for cryptsetup. It
covers Linux disk encryption with plain dm-crypt (one passphrase,
This is the FAQ (Frequently Asked Questions) for cryptsetup. It
covers Linux disk encryption with plain dm-crypt (one passphrase,
Current FAQ maintainer is Arno Wagner <arno@wagner.name>. Other
contributors are listed at the end. If you want to contribute, send
Current FAQ maintainer is Arno Wagner <arno@wagner.name>. Other
contributors are listed at the end. If you want to contribute, send
Instructions on how to subscribe to the mailing-list are at on the
project website. People are generally helpful and friendly on the
Instructions on how to subscribe to the mailing-list are at on the
project website. People are generally helpful and friendly on the
with just the word "help" in the subject or message body. Make sure
to send it from your list address.
with just the word "help" in the subject or message body. Make sure
to send it from your list address.
There is no converter, and it is not really needed. The way to do
this is to make a backup of the device in question, securely wipe
There is no converter, and it is not really needed. The way to do
this is to make a backup of the device in question, securely wipe
Just the same as with any block device. If you want, for example,
to use a 100MiB file as LUKS container, do something like this:
Just the same as with any block device. If you want, for example,
to use a 100MiB file as LUKS container, do something like this:
- head -c 100M /dev/zero > luksfile # create empty file
- losetup /dev/loop0 luksfile # map luksfile to /dev/loop0
- cryptsetup luksFormat /dev/loop0 # create LUKS on the loop device
+ head -c 100M /dev/zero > luksfile # create empty file
+ losetup /dev/loop0 luksfile # map luksfile to /dev/loop0
+ cryptsetup luksFormat /dev/loop0 # create LUKS on loop device
Afterwards just use /dev/loop0 as a you would use a LUKS partition.
To unmap the file when done, use "losetup -d /dev/loop0".
Afterwards just use /dev/loop0 as a you would use a LUKS partition.
To unmap the file when done, use "losetup -d /dev/loop0".
- * When I add a new key-slot to LUKS, it asks for a passphrase but
- then complains about there not being a key-slot with that
- passphrase?
+
+ * When I add a new key-slot to LUKS, it asks for a passphrase but
+ then complains about there not being a key-slot with that
+ passphrase?
That is as intended. You are asked a passphrase of an existing
key-slot first, before you can enter the passphrase for the new
That is as intended. You are asked a passphrase of an existing
key-slot first, before you can enter the passphrase for the new
Note that the file will still be hashed first, just like keyboard
input. Use the --key-file option, like this:
cryptsetup create --key-file keyfile e1 /dev/loop0
Note that the file will still be hashed first, just like keyboard
input. Use the --key-file option, like this:
cryptsetup create --key-file keyfile e1 /dev/loop0
What you really do here is to read a passphrase from file, just as
you would with manual entry of a passphrase for a key-slot. You can
What you really do here is to read a passphrase from file, just as
you would with manual entry of a passphrase for a key-slot. You can
The question you should ask yourself first, is why you would want
to do this. The only legitimate reason I can think of is if you
The question you should ask yourself first, is why you would want
to do this. The only legitimate reason I can think of is if you
A file-stored key or passphrase has the same security requirements
as one entered interactively, however you can use random bytes and
A file-stored key or passphrase has the same security requirements
as one entered interactively, however you can use random bytes and
- * If I map a journaled file system using dm-crypt/LUKS, does it
- still provide its usual transactional guarantees?
+
+ * If I map a journaled file system using dm-crypt/LUKS, does it still
+ provide its usual transactional guarantees?
As far as I know it does (but I may be wrong), but please note that
these "guarantees" are far weaker than they appear to be. For
As far as I know it does (but I may be wrong), but please note that
these "guarantees" are far weaker than they appear to be. For
better with kernel 2.6.36 and the reworking of filesystem flush
locking. Kernel 2.6.37 is expected to improve this even further.
better with kernel 2.6.36 and the reworking of filesystem flush
locking. Kernel 2.6.37 is expected to improve this even further.
- * Can I use LUKS or cryptsetup with a more secure (external) medium
- for key storage, e.g. TPM or a smartcard?
+
+ * Can I use LUKS or cryptsetup with a more secure (external) medium
+ for key storage, e.g. TPM or a smartcard?
Yes, see the answers on using a file-supplied key. You do have to
write the glue-logic yourself though. Basically you can have
Yes, see the answers on using a file-supplied key. You do have to
write the glue-logic yourself though. Basically you can have
Yes, you can, as neither dm-crypt nor LUKS stores partition size.
Whether you should is a different question. Personally I recommend
Yes, you can, as neither dm-crypt nor LUKS stores partition size.
Whether you should is a different question. Personally I recommend
- * My dm-crypt/LUKS mapping does not work! What general steps are
- there to investigate the problem?
+3. Common Problems
+
+
+ * My dm-crypt/LUKS mapping does not work! What general steps are
+ there to investigate the problem?
If you get a specific error message, investigate what it claims
first. If not, you may want to check the following things.
If you get a specific error message, investigate what it claims
first. If not, you may want to check the following things.
- Check that the hash-functions and ciphers you want to use are in
the kernel. The output of "cat /proc/crypto" needs to list them.
- Check that the hash-functions and ciphers you want to use are in
the kernel. The output of "cat /proc/crypto" needs to list them.
The default cipher, hash or mode may have changed (the mode changed
from 1.0.x to 1.1.x). See under "Issues With Specific Versions of
cryptsetup".
The default cipher, hash or mode may have changed (the mode changed
from 1.0.x to 1.1.x). See under "Issues With Specific Versions of
cryptsetup".
If you get errors about unknown parameters or the like that are not
present when cryptsetup is called from the shell, make sure you
If you get errors about unknown parameters or the like that are not
present when cryptsetup is called from the shell, make sure you
The iteration time for a key-slot (see Section 5 for an explanation
what iteration does) is calculated when setting a passphrase. By
The iteration time for a key-slot (see Section 5 for an explanation
what iteration does) is calculated when setting a passphrase. By
to 10, but it is now derived from the PBKDF2 benchmark as well and
set to iterations in 0.125 sec or 1000, whichever is larger.
to 10, but it is now derived from the PBKDF2 benchmark as well and
set to iterations in 0.125 sec or 1000, whichever is larger.
Some old versions of cryptsetup have a bug where the header does
not get completely wiped during LUKS format and an older ext2/swap
Some old versions of cryptsetup have a bug where the header does
not get completely wiped during LUKS format and an older ext2/swap
There seems to be some inteference between the hardening and and
the way cryptsetup benchmarks PBKDF2. The solution to this is
There seems to be some inteference between the hardening and and
the way cryptsetup benchmarks PBKDF2. The solution to this is
other uses, you can apparently specify USE="dynamic" as compile
flag, see http://bugs.gentoo.org/show_bug.cgi?id=283470
other uses, you can apparently specify USE="dynamic" as compile
flag, see http://bugs.gentoo.org/show_bug.cgi?id=283470
LUKS and dm-crypt can give the RAM quite a workout, especially when
combined with software RAID. In particular the combination RAID5 +
LUKS and dm-crypt can give the RAM quite a workout, especially when
combined with software RAID. In particular the combination RAID5 +
itself did not report any problems. If you find defect RAM, assume
all backups and copied data to be suspect, unless you did a verify.
itself did not report any problems. If you find defect RAM, assume
all backups and copied data to be suspect, unless you did a verify.
First you should know that overclocking often makes memory problems
worse. So if you overclock (which I strongly recommend against in a
First you should know that overclocking often makes memory problems
worse. So if you overclock (which I strongly recommend against in a
If you just create a filesystem on it, most of the old data will
still be there. If the old data is sensitive, you should overwrite
If you just create a filesystem on it, most of the old data will
still be there. If the old data is sensitive, you should overwrite
For LUKS, if you are in a desperate hurry, overwrite the first few
kilobytes of the LUKS partition. This erases the master key salt
For LUKS, if you are in a desperate hurry, overwrite the first few
kilobytes of the LUKS partition. This erases the master key salt
That depends on the medium it is stored on. For HDD and SSD, use
overwrite with zeros. For an SSD, you may want to overwrite the
That depends on the medium it is stored on. For HDD and SSD, use
overwrite with zeros. For an SSD, you may want to overwrite the
after overwrites. Also write-head alignment issues can lead to
data not actually being deleted at all during overwrites.
after overwrites. Also write-head alignment issues can lead to
data not actually being deleted at all during overwrites.
Overwriting the LUKS header in part or in full is the most common
reason why access to LUKS containers is lost permanently.
Overwriting the LUKS header in part or in full is the most common
reason why access to LUKS containers is lost permanently.
the running system. Ask on the mailing-list on how to do that and
make sure nobody switches off the machine.
the running system. Ask on the mailing-list on how to do that and
make sure nobody switches off the machine.
A salt is a random key-grade value added to the passphrase before
it is processed. It is not kept secret. The reason for using salts
A salt is a random key-grade value added to the passphrase before
it is processed. It is not kept secret. The reason for using salts
This needs a bit of theory. The quality of your passphrase is
directly related to its entropy (information theoretic, not
This needs a bit of theory. The quality of your passphrase is
directly related to its entropy (information theoretic, not
either!) If you add 2 or 3 typos or switch some words around, then
this is good passphrase material.
either!) If you add 2 or 3 typos or switch some words around, then
this is good passphrase material.
Iteration count is the number of PBKDF2 iterations a passphrase is
put through before it is used to unlock a key-slot. Iterations are
Iteration count is the number of PBKDF2 iterations a passphrase is
put through before it is used to unlock a key-slot. Iterations are
Unfortunately, yes. However the only aspect affected is the
protection for low-entropy passphrase or master-key. All other
Unfortunately, yes. However the only aspect affected is the
protection for low-entropy passphrase or master-key. All other
passphrases on fast CPUs. Technology can do only so much to
compensate for problems in front of the keyboard.
passphrases on fast CPUs. Technology can do only so much to
compensate for problems in front of the keyboard.
The problem is that cbc-plain has a fingerprint vulnerability, where
a specially crafted file placed into the crypto-container can be
The problem is that cbc-plain has a fingerprint vulnerability, where
a specially crafted file placed into the crypto-container can be
encryption key as key. This makes the IV unpredictable without
knowing the encryption key and the watermarking attack fails.
encryption key as key. This makes the IV unpredictable without
knowing the encryption key and the watermarking attack fails.
volume sizes <= 2TiB, but not for those > 2TiB. Finally, "plain64"
does not cause any performance penalty compared to "plain".
volume sizes <= 2TiB, but not for those > 2TiB. Finally, "plain64"
does not cause any performance penalty compared to "plain".
XTS mode is potentially even more secure than cbc-essiv (but only if
cbc-essiv is insecure in your scenario). It is a NIST standard and
XTS mode is potentially even more secure than cbc-essiv (but only if
cbc-essiv is insecure in your scenario). It is a NIST standard and
Depends on how you do it. First, a backup is non-optional with
encrypted data just the same way it is with non-encrypted data.
Depends on how you do it. First, a backup is non-optional with
encrypted data just the same way it is with non-encrypted data.
- * What happens if I overwrite the start of a LUKS partition or
- damage the LUKS header or key-slots?
+
+ * What happens if I overwrite the start of a LUKS partition or damage
+ the LUKS header or key-slots?
There are two critical components for decryption: The salt values
in the header itself and the key-slots. If the salt values are
There are two critical components for decryption: The salt values
in the header itself and the key-slots. If the salt values are
unrecoverable in a cryptographically strong sense, changing about
4-6 bits in random locations of its 128kiB size is quite enough.
unrecoverable in a cryptographically strong sense, changing about
4-6 bits in random locations of its 128kiB size is quite enough.
I have not tried the different ways to do this, but very likely you
will have written a new boot-sector, which in turn overwrites the
LUKS header, including the salts. You may also damage the key-slots
in part or in full. See also last item.
I have not tried the different ways to do this, but very likely you
will have written a new boot-sector, which in turn overwrites the
LUKS header, including the salts. You may also damage the key-slots
in part or in full. See also last item.
There is none. dm-crypt takes a block device and gives encrypted
access to each of its blocks with a key derived from the passphrase
There is none. dm-crypt takes a block device and gives encrypted
access to each of its blocks with a key derived from the passphrase
A LUKS partition consists of a header, followed by 8 key-slot
descriptors, followed by 8 key slots, followed by the encrypted
A LUKS partition consists of a header, followed by 8 key-slot
descriptors, followed by 8 key slots, followed by the encrypted
The exact specification of the format is here:
http://code.google.com/p/cryptsetup/wiki/Specification
The exact specification of the format is here:
http://code.google.com/p/cryptsetup/wiki/Specification
While you could just copy the appropriate number of bytes from the
start of the LUKS partition, the best way is to use command option
While you could just copy the appropriate number of bytes from the
start of the LUKS partition, the best way is to use command option
You do a sector-image of the whole partition. This will contain the
LUKS header, the keys-slots and the data ares. It can be done
You do a sector-image of the whole partition. This will contain the
LUKS header, the keys-slots and the data ares. It can be done
a sector image of a partition. Note that compression is
ineffective for encrypted data, hence it does not sense to use it.
a sector image of a partition. Note that compression is
ineffective for encrypted data, hence it does not sense to use it.
Backup protects you against two things: Disk loss or corruption and
user error. By far the most questions on the dm-crypt mailing list
Backup protects you against two things: Disk loss or corruption and
user error. By far the most questions on the dm-crypt mailing list
Yes. One risk is that if you remove access rights for specific
key-slots by deleting their contents, the data can still be
Yes. One risk is that if you remove access rights for specific
key-slots by deleting their contents, the data can still be
Yes, you can use plain dm-crypt. It does not allow multiple
passphrases, but on the plus side, it has zero on disk description
Yes, you can use plain dm-crypt. It does not allow multiple
passphrases, but on the plus side, it has zero on disk description
- * When using the create command for plain dm-crypt with cryptsetup
- 1.1.x, the mapping is incompatible and my data is not accessible
- anymore!
+7. Issues with Specific Versions of cryptsetup
+
+
+ * When using the create command for plain dm-crypt with cryptsetup
+ 1.1.x, the mapping is incompatible and my data is not accessible
+ anymore!
With cryptsetup 1.1.x, the distro maintainer can define different
default encryption modes for LUKS and plain devices. You can check
With cryptsetup 1.1.x, the distro maintainer can define different
default encryption modes for LUKS and plain devices. You can check
SLED 10 is missing an essential kernel patch for dm-crypt, which
is broken in its kernel as a result. There may be a very old
SLED 10 is missing an essential kernel patch for dm-crypt, which
is broken in its kernel as a result. There may be a very old