Using GPG For Symmetric File Encryption

Many cloud storage providers boast strong encryption, but for most services they are still capable of accessing the content of files on their servers. Fortunately there’s a very simple way to encrypt files (or .zip archives) with GPG using symmetric encryption, and with a password instead of a keyfile. This feature can be used with just two simple commands.

To encrypt a given file: $ gpg -c example.txt The program will ask for a password twice, and the encrypted copy of the file, with the .gpg extension, is generated in the same directory.

Of course, anyone wanting to decrypt the file must use the same password, as there is no public key here. To decrypt the file, simply use: $ gpg example.gpg

Which Algorithm?

It’s also possible to define which algorithm to use for encrypting file, from the following: Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
Cypher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH...
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512...
Compression: Uncompressed, ZIP, ZLIB, BZIP2
For example: $ gpg -c --cipher-algo=BLOWFISH example.txt To encrypt with AES, substitute ‘BLOWFISH’ with ‘AES’: $ gpg -c --cipher-algo=AES example.txt