Query the default key via command line?

Immanuel Scholz immanuel.scholz at tu-dresden.de
Mon Sep 3 18:28:16 CEST 2007



Werner Koch schrieb:
> On Fri, 31 Aug 2007 11:32, immanuel.scholz at tu-dresden.de said:
> 
>> This triggers any password agent, doesn't it?
> 
> For encryption you don't need the secret key and ghus there won't be a
> passphrase prompt.

What are the command line options to encrypt to the default key?

~$ echo "" | gpg --batch -e
gpg: no valid addressees
gpg: [stdin]: encryption failed: no such user id
~$


>> Really ugly, though... (and of course, the greps and cuts have to be
>> done within the program to be usable under windows ;)
> 
> It is not that hard if you already have spawn and pipe functions ready.
> gpgconf-comp.c has some code you could reuse.

grep and cutting the USER_HINT status-fd output isn't the ugly part. It
is more the "signing with an invalid password-fd and then hope the gpg
spit out the key-id as a hint" - part. It feels naughty ;-)


>> ~$ cat .gnupg/gpg.conf | grep ^default
>> default-key 91723535
> 
> Ah right, my current gpg2 has this feature, whereas gpg 1.4.7 is missing
> it.  BTW, the supported options can be listed using
> 
>   gpg --gpgconf-list

Doesn't work either.

~$ gpg2 --gpgconf-list
gpgconf-gpg.conf:16:"/home/imi/.gnupg/gpg.conf
verbose:0:
quiet:0:
keyserver:0:
reader-port:0:
~$ gpg2 --version
gpg (GnuPG) 2.0.3
Copyright (C) 2007 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ELG
Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH
Hash: MD5, SHA1, RIPEMD160, TIGER192, SHA256, SHA384, SHA512
Compression: Uncompressed, ZIP, ZLIB, BZIP2
~$


At least I get the location of the config file somewhat platform
independent...

Ciao, Imi.

-- 
DF0E A04F 7063 69C5 A76B  7557 0A77 608F 9172 3535



More information about the Gnupg-devel mailing list