how to delete a GnuPG Secret key using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
graziano
Forum Newbie
Posts: 9
Joined: Sat Dec 14, 2002 7:16 am

how to delete a GnuPG Secret key using php

Post by graziano »

Hello,

I written a simple php script (see below) to delete GnupG secret keys , however I receive this error ;


gpg: cannot open /dev/tty


If I add --no-tty I receive this error ,
gpg: Sorry, no terminal at all requested - can't get input


Any idea ?

Thank you

Code: Select all

<?
function getDELETEPRIVATE()
&#123;
    ob_start();
$command = "/usr/bin/gpg --no-secmem-warning --home /home/test/.gnupg --yes --delete-secret-key 'B209E218'";
    
        passthru($command);
        
         echo"<pre>";
        $lookup = ob_get_contents();
    ob_end_clean();
    return $lookup;
&#125;


$delete = getDELETEPRIVATE();
echo  "=========================================</BR>";
echo  "<pre>$delete</pre>";
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I don't know gpg but doesn't it ask for any password before you can delete something? If it tries it has no chance since there is no terminal ;)
Post Reply