From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tansi.org (ns.km10532-04.keymachine.de [87.118.102.195]) by mail.saout.de (Postfix) with ESMTP for ; Tue, 14 Sep 2010 19:20:20 +0200 (CEST) Received: from gatewagner.dyndns.org (84-74-164-239.dclient.hispeed.ch [84.74.164.239]) by tansi.org (Postfix) with ESMTPA id 2B8B9212804A for ; Tue, 14 Sep 2010 19:20:20 +0200 (CEST) Date: Tue, 14 Sep 2010 19:20:19 +0200 From: Arno Wagner Message-ID: <20100914172019.GA32723@tansi.org> References: <20100914152633.GB30165@tansi.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dm-crypt] key-size argument not working with luksAddKey List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de On Tue, Sep 14, 2010 at 12:59:57PM -0400, Josh Litherland wrote: > > That is done differently. May I direct your attention to the > > item "How do I read a LUKS slot key from file?" in the FAQ? > > Understood. The point of my original query is that the procedure outlined > in that FAQ _will not work_ if the key-file you provide has trailing bytes > after the actual key part, as it does in my 2000key test file and as it will > _always_ do if you're using a raw block device as your key file. Oh, it works. It just does not take partial files as input, only full ones. This is not surprising as cutting out part of a file is a task for a diffewrent tool by the UNIX philosophy, see my second anzwer about reading the passphrase from STDIN and cutting with 'head'. > A workaround that works is to dd off the key into a separate file and use > that new file as the argument for luksAddKey (and then be careful to shred > -u the file afterward!). My patch adds the ability to handle this task > internally within cryptsetup, without having to duplicate and subsequently > destroy the extra copy of the key, and in a way that is consistent with the > user interface of other luks operations. Copying the file is a bad idea for security reasons. As cryptsetup accepts '-' as filename (except on adding or changing a passphrase), it is not needed. Also note that in more complex set-ups you might be able transfer the cutout of the passphrase bit-sequence by a named pipe. I can see what you are tryong to do, but I think your patch falls into the Microsoft pitfall of having complex tools that do a lot of tasts but none particularly well ;-) I recomend having a look through the Gnu Textutils. They are 8-bit clean (work on binary data) and there is amazing stuff in there. Another pitfall for us few that can actually code is to write things that already exist and work well. Believe me, I do understand the urge. Arno -- Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: arno@wagner.name GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans If it's in the news, don't worry about it. The very definition of "news" is "something that hardly ever happens." -- Bruce Schneier