gpg symmetric encryption using pipes
Posted
by Thomas
on Super User
See other posts from Super User
or by Thomas
Published on 2010-06-03T03:49:03Z
Indexed on
2010/06/03
3:54 UTC
Read the original article
Hit count: 390
I'm trying to generate keys to lock my drive (using DM-Crypt with LUKS) by pulling data from /dev/random
and then encrypting that using GPG.
In the guide I'm using, it suggests using the following command:
dd if=/dev/random count=1 | gpg --symmetric -a >./[drive]_key.gpg
If you do it without a pipe, and feed it a file, it will pop up an (n?)curses prompt for you to type in a password. However when I pipe in the data, it repeats the following message four times and sits there frozen:
pinentry-curses: no LC_CTYPE known assuming UTF-8
It also says can't connect to '/root/.gnupg/S.gpg-agent': File or directory doesn't exist
, however I am assuming that this doesn't have anything to do with it, since it shows up even when the input is from a file.
So I guess my question boils down to this: is there a way to force gpg to accept the passphrase from the command line, or in some other way get this to work, or will I have to write the data from /dev/random
to a temporary file, and then encrypt that file? (Which as far as I know should be alright due to the fact that I'm doing this on the LiveCD and haven't yet created the swap, so there should be no way for it to be written to disk.)
© Super User or respective owner