Re: Can AddKey not use stdin for the new key?

Michael Kjörling <[email protected]> Thu, 24 Aug 2023 17:27:56 +0000
Newsgroups dev.linux.lists.cryptsetup
Message-ID <[email protected]>
On 24 Aug 2023 05:51 -0400, from [email protected] (Chris X Edwards):
> I create an encrypted secret that I only have to unlock once:
> 
>     dd if=/dev/urandom bs=512 count=1 | gpg --symmetric --output drivekey.gpg

If you are willing to unlock once, you can also use a small LUKS
container to hold a file system holding passphrase or key files for
other LUKS containers. Or you can derive further keys from contents or
metadata of another LUKS container; I've seen suggestions for how to
do this scattered about the Web.


> Now I'd like to add that to a LUKS keyslot so that the following
> works.
> 
>     gpg --decrypt drivekey.gpg | cryptsetup luksOpen --key-file=- /dev/sdb backup

Assuming bash, you might want to try:

    cryptsetup luksOpen --key-file=<(gpg --decrypt drivekey.gpg) /dev/sdb backup

and corresponding variations of your other commands as well.

-- 
Michael Kjörling                     🔗 https://michael.kjorling.se
“Remember when, on the Internet, nobody cared that you were a dog?”