0

I'm new to PGP encryption. I have a few files that I would like to encrypt before storing them on a cloud storage.

I learned that I could encrypt a file using one the following two methods:

Method 01: gpg -c filename

Method 02: using a public-key

For example (for personal use): gpg --encrypt --recipient 'my_name' filename

I just wanted to know whether the both methods produce the same results or not. Thank you.

  • 1
    the method 1 or gpg -c method encrypts symetric(to decrypt you need a "password" that is the same you used to encrypt the file) and the method 2 uses async encryption (public key to encrypt/ private key to decrypt) – WooJoo Jan 16 '17 at 11:25
  • Thank you for taking the time to answer the question. I think I would rather use symmetric cryptosystem as it seems to be a tiny bit more efficient than asymmetric cryptosystem. It will serve my purpose just fine even though I found a way to encrypt multiple directories/files at once using the second method. – Din Jan 16 '17 at 20:29
2

They don't produce the same result. However, OpenPGP (PGP/GnuPG's asymmetric encryption protocol) still uses symmetric encryption algorithms to encrypt the actual data.

You may want to read about what GnuPG actually does. A good start for this specific topic might be When should I use symmetric encryption instead of RSA? whose author seems to have the same misconception as you. Below is a quote of the most relevant and succinct answer passage:

[…] you never use the raw algorithm. You use a protocol, in this case OpenPGP, which defines the algorithms to use and where each byte goes. In OpenPGP, when the recipient has a public/private key pair and you want to encrypt your message "with the public key" (i.e. you want the message to be unreadable except by whoever knows the corresponding private key), then you invoke your OpenPGP-compatible software which will then follow the OpenPGP rules -- and these rules are that symmetric encryption is always used: the software generates a random symmetric key K, encrypts the message itself with a symmetric algorithm using K as key, then encrypts K (not the message) with the recipient's […] public key. You don't have to choose, and you don't get to choose: this is the way OpenPGP works.

(source)

  • Thank you very much for your guidance. That was very helpful. – Din Jan 19 '17 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.