In short, my question is: How do I get GnuPG to use the private / public key when encrypting / decrypting files?
Some explanation / long story
I have an application that needs to encrypt files before sending them to S3.
Users can download their files using their browsers from my site, in which case I must first decrypt the files before serving them.
Client side ( delphi 2010 ): I will probably prefer OpenPGPBlackbox
On the server side (PHP 5), I need to figure out how to encrypt / decrypt files using non-interactive commands.
I installed GnuPG on my server, tried this code:
clear_file='/full/path/my-file.zip' encrypted_file='/full/path/my-file.zip.pgp' # Encrypt file /usr/bin/gpg2 --encrypt "$clear_file" # Decrypt file /usr/bin/gpg2 --decrypt "$encrypted_file"
But it seems that I can not indicate on the command line which keys to use.
Each user will have their own public / private key, so I will need to specify which key to use to encrypt / decrypt the file in question.
My question is: How do I get GnuPG to use the private / public key when encrypting / decrypting files?
source share