How to invoke gpg command in C-program

yuriping at sohu.com yuriping at sohu.com
Tue Jul 5 13:38:53 CEST 2016


Hi ALL:    I'm using gpg 1.4.10 to perform sign-verify processing.    In general, two gpg commands will be used as following:    0. gpg --detach-sign file    1. gpg --verify file.sig file    I notice that in the executing process of command 0, a passphrase will be required to be typed manually;    and the return value in shell($?) of command 1 have the meanings : 0-verify successfully, 1-verify failed, 2-file opening failed;    Now I want to invoke these 2 commands in C-program in order that the process can be excuted automatically, but I do not know how to implement.    -- How can I input the passphrase for command 0 automatically? One way I know is to use gpg-agent, is it all right? And does gpg-agent 2.1.9 match with gpg 1.4.10?    -- How can I get the return value of command 1? I have tried using "popen", it does not worked and seemed that the output of gpg does not be redirected to the pipe.    Expect any suggestion.    Best Regards!



------------------------------------------
搜狐邮箱积分商城积分大派兑,来晚就没了~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20160705/a31b82fb/attachment.html>


More information about the Gnupg-users mailing list