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: 360

Filed under:
|
|
|

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

Related posts about php

Related posts about gnupg

  • GnuPG PHP gnupg Folder & Files Permission

    as seen on Super User - Search for 'Super User'
    Situation: we plan on using PHP's GnuPG extension to encrypt/decrypt files. Currently we've setup some test cases, using keys generated with GPG. The generated files reside in: /Users/username/.gnupg/ I am able to get keyinfo for the key I want to use to encrypt/decrypt, but when I attempt to… >>> More

  • gnupg make failure

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I got errors as below when tried to make gnupg 2.0.19 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compress.o: In function `init_uncompress': /home/steve/Desktop/gnupg-2.0.19/g10/compress.c:147: undefined reference to `inflateInit_' compress.o: In function `do_uncompress': /home/steve/Desktop/gnupg-2… >>> More

  • GnuPG + Webservice + ASP.NET

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Hi! I'm exhausted. I have installed GnuPG and exported secret key, and two public keys (my own and one of my client) from another instance of GnuPG. I try to configure 'my encrypting/decrypting' method on the local machine. When I run encrypting method from a little console application it works… >>> More

  • PHP/GnuPG Decryption -- Syntax error?

    as seen on Stack Overflow - Search for 'Stack Overflow'
    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… >>> More

  • GnuPG Command Line - Verifying KeePass Signature

    as seen on Super User - Search for 'Super User'
    I'm trying to verify the PGP Signature of the latest version of KeePass 2.14's setup file against this signature, but this is the output I receive: C:\Program Files (x86)\GNU\GnuPG>gpg.exe --verify C:\Users\User\Desktop\KeePass-2.14-Setup.exe gpg: no valid OpenPGP data found. gpg: the signature… >>> More