Reply to gpg --decrypt

Your name:

Reply:


Posted by Alan Little on 05/07/06 14:22

I'm trying to operate gpg through proc_open. I can encrypt this way, just
fine, but when I try to decrypt I get:

gpg: cannot open `/dev/tty': Device not configured

Here's what I'm using; the same basic code works fine for encrypting:

<?php
$cmd =
'/usr/bin/gpg '.
'--decrypt '.
'--homedir /usr/home/userid/.gnupg';

$message =
'-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.2.2 (FreeBSD)

[Yada, yada]
-----END PGP MESSAGE-----';

$pass =
'[passphrase]';

$descriptors = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('file', '/usr/home/userid/error.gpg', 'a')
);

$process = proc_open($cmd, $descriptors, $pipes);
list($stdin, $stdout, $stderr) = $pipes;

fputs($stdin, $message);

while (!feof($stdout)) {
$line = fgets($stdout);
echo $line;
}

fputs($stdin, $pass);
fclose($stdin);

while (!feof($stdout)) {
$line = fgets($stdout);
echo $line;
}
?>

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация