Piotr Bratkowski <pioterbrat at o2.pl>

Werner Koch wk at gnupg.org
Thu Nov 26 15:35:49 CET 2009


On Thu, 26 Nov 2009 12:27:04 +0100, Piotr Bratkowski <pioterbrat at o2.pl> wrote:

> I need to invoke trust command but from linux shell. I was thinking that 
> this will do:
> gpg --edit host_name trust 3

You do not want to set the trust for a host_name; this is not a unique
identifier for a key.  Figure out the fingerprint and specify this
one.  Canned command as above usually don't work becuase there are so
manhy things to care about.

> It's in C so making it to write to stdin of gpg would be a lot of fuss, 
> as a command line I can simply use system function.

In general you should not use system(3) in a program; even if it
sounds to be simple.  Getting the quoting right is not easy.  Passing
suff via stin to another process is pretty easy: popen(3) does this.
However, popen has the same problems as system has.

> So my question is is it possible?? If yes how??

Use gpgme and the edit callback.  An example on how to do is is
gpgme/tests/gpg/t-edit.c .


Shalom-Salam,

   Werner




More information about the Gnupg-users mailing list