Reply to topic
Gnu PGP and PHP
bobclingan
Forum Regular

Joined: 16 Sep 2004
Posts: 271
Location: Abingdon, MD
Reply with quote
I'm trying to modify a script I found to work but my PHP knowledge gets fuzzier everyday since I don't use it as much any more, could anyone give some tips on why I'm getting a 'No input file specified error'? Or perhaps suggest another approach? The goal is to take text from a form, encrypt it with a specific pgp key and email it.

Code:
<?
   $message = "this is the text to encrypt with gpg";
   $sendto = 'Dummy Key <another@fake.email>';

   system("mkfifo pipein");
   system("mkfifo pipeout");
   system("gpg --encrypt -a -r '$sendto' > pipeout < pipein &");
   $fo = fopen("pipeout", "r");
   $fi = fopen("pipein", "w");
   fwrite($fi, $message, strlen($message));
   fclose($fi);
   while (!feof($fo)) {
     $buf .= fread($fo, 1024);
   }
   echo $buf;
   unlink("pipein");
   unlink("pipeout");
?>


I'm also not sure if the OS supports bi-directional pipes. (I'm running this code on a SmarterLinux account).

Thanks.
pmeserve
HostMySite Tech

Joined: 19 Mar 2004
Posts: 178
Reply with quote
I know this is a really old post, but I thought I'd take a look anyway. I'm kind of confused with this. I don't know much of anything about encryption, so maybe that's part of it, but you seem to be opening gpg before you actually place any content in your files? That seems really weird

I'd recommend checking a tutorial like this:
http://webmonkey.wired.com/webmonkey/00/20/index3a_page5.html?tw=programming

or maybe using a 3rd-party function like this:
http://business-php.com/opensource/gpg_encrypt/
Gnu PGP and PHP
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic