0

for a little security reasons I must encrypt (in php) (and decrypt later) some pdf in my server.

How can I do this? I can do it in php with gnupg?

I've try to search in internet some example but I haven't found anything

Can You help me?

Duccio
  • 9
  • 3
  • you can passed protect a pdf. (no idea how secure this is). if you encrypt and decrypt on the server that also has he encryption key, your not protecting much. –  Jun 18 '14 at 21:41

2 Answers2

0

You can use ssh2 library with the gnupg form the command line. I think it is very powerful solution, but You have to be careful with ssh2 library:)

What OS do You prefer?

ajtamwojtek
  • 763
  • 6
  • 19
0

You can use the GnuPG extension, but for a PDF file, it'd probably be easiest to just fork out to gpg(1) with exec.

Something like this might work, assuming you have the key in your GPG keychain already:

exec(escapeshellcmd("gpg -e -r " . 
                     escapeshellarg($key_id) . " " .
                     escapeshellarg($filename)));
Jenner La Fave
  • 1,327
  • 1
  • 9
  • 11