Simple encryption/decryption

Einar Ryeng einarr at pvv.org
Mon Dec 9 14:52:52 CET 2013


On Fri, Dec 06, 2013 at 07:54:53PM +0100, Pär Carlsson wrote:
> 
> I have a very simple thing I want to do and I have not found out how.
> 
> I want to send/receive receive files to a FTP-server. The files has to be
> encrypted when it's sent to FTP. Vice versa I will receive files which I
> have to decrypt.
> 
> In the best of worlds I thougth this was very simple using gnupg. Something
> like this perhaps but not....

I may have misunderstood your post, but it seems like you're asking how to do
the most basic public key encryption/decryption operations in gpg. If so, you
probably want to read some of the documentation to become familiar with the
concepts.

However, here are what I think you're asking for:

> gnupg --encrypt myFile.txt --myPrivateKey --output myEncryptedFile

(assuming you want to encrypt something to someone else, and their key ID is
12341234, which it isn't)

gpg -e -a -r 12341234 somefile.txt

This will produce a file named somefile.txt.asc which is encrypted and
base-64-encoded to be friendly towards any FTP protocol settings.

> and
> 
> gnupg --decrypt anEncryptedFile --theirPublicKey --output
> myDecryptedFile.txt

To decrypt a file that is encrypted to you, type:

gpg somefile.txt.asc

or, if the encryption was done without -a

gpg somefile.txt.gpg

Both of these will decrypt the file and produce a file named somefile.txt,
provided that you have the private key they are encrypted to.

(The GnuPG executable is usually named just gpg on linux, I'm not sure what the
command is called if you're on another operating system)


Cheers,

-- 
Einar Ryeng




More information about the Gnupg-users mailing list