[dm-crypt] --key-file size...

Arno Wagner arno at wagner.name
Thu Jan 24 16:42:51 CET 2013


You are using plain dm-crypt (you really should use LUKS).
The man-page says this for key-files for plain mode:

 "From a key file: It will be truncated to the key size of the used
  cipher or the size given by -s and directly used as binary key. If
  the key file is shorter than the key, cryptsetup will quit with an 
  error."

So nothing wrong.

Arno


On Thu, Jan 24, 2013 at 01:34:42PM +0000, Andrea wrote:
> Hi all,
>    and thanks a lot for your work.
>    I'm a happy user of cryptsetup.
>    I need to store hospital data, and I would like to use a big key
>    file.
>    Well, I checked for compile limits (Ubuntu 12.10)
>    $ cryptsetup --help|grep -i maximum
>      Maximum keyfile size: 8192kB, Maximum interactive passphrase length 512 (characters)
> 
>    Anyway, if I check with the simple script under, it seems cryptsetup ignore
>    everything where $size > 32.
> 
>    What I am doing wrong?
> 
> Thanks a lot for your time,
> A.
> 
> ------------
> 
> #!/bin/bash
> 
> fdloopback="/tmp/loopback.dd"
> fdkey="/tmp/key_master"
> fdkeytmp="/tmp/key"
> cryptname="keytest"
> 
> dd if=/dev/zero of=$fdloopback bs=1G count=0 seek=1
> nettle-lfib-stream | dd of=$fdkey bs=1K count=8192 iflag=fullblock
> 
> losetup /dev/loop0 $fdloopback
>   cryptsetup create $cryptname /dev/loop0 --key-file $fdkey
>     mkfs.ext4 -q /dev/mapper/$cryptname -F
>     sync
>   cryptsetup remove $cryptname
> losetup -d /dev/loop0
> 
> for size in $(seq 2 2 8192)
> do
>   dd if=$fdkey of=$fdkeytmp bs=1 count=$size
>   losetup /dev/loop0 $fdloopback
>     cryptsetup create $cryptname /dev/loop0 --key-file $fdkeytmp
>       fsck /dev/mapper/$cryptname && echo "------> Good, " $size || echo "------> Bad, " $size
>       sync
>     cryptsetup remove $cryptname
>   losetup -d /dev/loop0
>   echo "Enter to go on";read trash
> done
> _______________________________________________
> dm-crypt mailing list
> dm-crypt at saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt

-- 
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: arno at wagner.name
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
One of the painful things about our time is that those who feel certainty
are stupid, and those with any imagination and understanding are filled
with doubt and indecision. -- Bertrand Russell


More information about the dm-crypt mailing list