PHP/GnuPG Decryption -- Syntax error?
Posted
by NeedBeerStat
on Stack Overflow
See other posts from Stack Overflow
or by NeedBeerStat
Published on 2010-05-21T00:28:41Z
Indexed on
2010/05/21
0:30 UTC
Read the original article
Hit count: 395
I'm using php to invoke gpg, but I'm getting a pipe error. I thought that if I read in the password from a file, I could then pipe it to the command itself? But, I keep getting: Syntax error: "|" unexpected
Here's the code:
(Note: The files are being iterated over in a foreach loop...)
foreach($files as $k => $v) {
$encrypted = $v;
$filename = explode('.',$v);
$decrypted = $filename[0].'.txt';
shell_exec("echo $passphrase | gpg --no-tty --passphrase-fd 0 -o $decrypted -d $encrypted");
}
© Stack Overflow or respective owner