Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: users

gpg trust from command line

 

 

GnuPG users RSS feed   Index | Next | Previous | View Threaded


pioterbrat at o2

Nov 26, 2009, 3:27 AM

Post #1 of 4 (950 views)
Permalink
gpg trust from command line

Hello,

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

to set my trust marginal for host_name, but it didn't, it took me to the
gpg command line.

I need this becouse I'm currently writing program that is using gpg.
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.

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

Regards,
Piotr Bratkowski

_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


rahul.raviz at gmail

Nov 26, 2009, 5:02 AM

Post #2 of 4 (880 views)
Permalink
Re: gpg trust from command line [In reply to]

Hi,

I have done the trusting part automated on my linux box like the following.
Give a try anyways and let me know whether it was helpful or not. I did many
google search and could not find any method described for this. The
following method worked gr8 for me and is the one which I created myself
;-).

For trusting it as 3, use 4 and for 5, use 6 and so on...


1. gpg --import key.pk - Import your key
2. echo $(gpg --list-keys --with-fingerprint --with-colons | tail -2 |
head -1 | tr -s ":" ":"| cut -d ":" -f2):4: > /tmp/somefile1 - take the
finger print and copy to a temp file.
3. gpg --import-ownertrust < /tmp/somefile1 - import the finger print to
the trust data base. Done!!!!

You can check the trusting part by typing the below command

1. gpg --export-ownertrust


On Thu, Nov 26, 2009 at 4:57 PM, Piotr Bratkowski <pioterbrat [at] o2> wrote:

> Hello,
>
> I need to invoke trust command but from linux shell. I was thinking that
> this will do:
> gpg --edit host_name trust 3
>
> to set my trust marginal for host_name, but it didn't, it took me to the
> gpg command line.
>
> I need this becouse I'm currently writing program that is using gpg. 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.
>
> So my question is is it possible?? If yes how??
>
> Regards,
> Piotr Bratkowski
>
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users [at] gnupg
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
>



--
Thanks,
Regards,
Rahul R
Mob: 09008030921


rahul.raviz at gmail

Nov 26, 2009, 5:23 AM

Post #3 of 4 (887 views)
Permalink
Re: gpg trust from command line [In reply to]

:-) :-) I am really happy to hear that it worked great for you also.... :-)

On Thu, Nov 26, 2009 at 6:46 PM, Piotr Bratkowski <pioterbrat [at] o2> wrote:

> Hello,
>
> Thanks, you have just rescued me :). It is working really great.
>
> Regards,
> Piotr Bratkowski
>
>
>
> Rahul R pisze:
>
>> Hi,
>>
>> I have done the trusting part automated on my linux box like the
>> following. Give a try anyways and let me know whether it was helpful or not.
>> I did many google search and could not find any method described for this.
>> The following method worked gr8 for me and is the one which I created myself
>> ;-).
>>
>> For trusting it as 3, use 4 and for 5, use 6 and so on...
>>
>> 1. gpg --import key.pk <http://key.pk> - Import your key
>> 2. echo $(gpg --list-keys --with-fingerprint --with-colons | tail
>>
>> -2 | head -1 | tr -s ":" ":"| cut -d ":" -f2):4: >
>> /tmp/somefile1 - take the finger print and copy to a temp file.
>> 3. gpg --import-ownertrust < /tmp/somefile1 - import the finger
>>
>> print to the trust data base. Done!!!!
>>
>> You can check the trusting part by typing the below command
>>
>> 1. gpg --export-ownertrust
>>
>>
>>
>> On Thu, Nov 26, 2009 at 4:57 PM, Piotr Bratkowski <pioterbrat [at] o2<mailto:
>> pioterbrat [at] o2>> wrote:
>>
>> Hello,
>>
>> I need to invoke trust command but from linux shell. I was
>> thinking that this will do:
>> gpg --edit host_name trust 3
>>
>> to set my trust marginal for host_name, but it didn't, it took me
>> to the gpg command line.
>>
>> I need this becouse I'm currently writing program that is using
>> gpg. 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.
>>
>> So my question is is it possible?? If yes how??
>>
>> Regards,
>> Piotr Bratkowski
>>
>> _______________________________________________
>> Gnupg-users mailing list
>> Gnupg-users [at] gnupg <mailto:Gnupg-users [at] gnupg>
>>
>> http://lists.gnupg.org/mailman/listinfo/gnupg-users
>>
>>
>>
>>
>> --
>> Thanks,
>> Regards,
>> Rahul R
>> Mob: 09008030921
>>
>
>


--
Thanks,
Regards,
Rahul R
Mob: 09008030921


wk at gnupg

Nov 26, 2009, 6:35 AM

Post #4 of 4 (886 views)
Permalink
Re: Piotr Bratkowski <pioterbrat@o2.pl> [In reply to]

On Thu, 26 Nov 2009 12:27:04 +0100, Piotr Bratkowski <pioterbrat [at] o2> 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


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users

GnuPG users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.