Using GPG to encrypt and decrypt a file

78,354
0
Published 2018-12-12
in this quick video you can see how to use GPG commands to encrypt and decypt a file.
- demo using GnuPG/GPG CLI
- GPG to encrypt and decrypt a (data) file
- Key lifecycle - Export and import keys (public and private keys)
------------------------------------------------------------------------
Install:
--------
apt-get install gnupg

List keys:
----------
gpg --list-secret-keys
gpg --list-keys

Generate keys:
-------------
gpg --full-generate-key
OR
gpg --gen-key

Export/Import keys:
-------------------
gpg --export -a Melvin > melvin_public.key
gpg --import melvin_public.key
gpg --export-secret-keys Melvin > melvin-private-key.key
gpg --import melvin-private-key.key

Encrypt & Decrypt
-----------------
gpg -e -r "Melvin" users.csv
gpg --always-trust -e -r "Melvin" users.csv

gpg -d users.csv.gpg
gpg --batch --passphrase demo users.csv.gpg

All Comments (21)
  • @machinarum
    Great video! It goes straight to my library. I will share the link if someone asks me about the subject.
  • @philchapman7980
    Thanks for the tutorial of GPG. By far it’s the best I have been able to find on the internet.
  • @ehabbustami7691
    Thanks for clear and organized explanation for the GnuPG CLI.
  • @googlewalle8904
    I work with Encryption Appliance solutions but never had the need to understand Exporting/Importing keys (due to separation of duties these days) and it really just helped me understand another important component where you can separate out the Private and Public keys and Encrypt files at another source. Excellent video Melvin and great job explaining it.
  • @fs8820
    Liked, subscribed, bookmarked. That was the BEST, clearest demo. Thank you!
  • Thank you for such a clear step-by-step explanation. This is great content
  • OMG man you nailed it, i wasted days but this 18 min video saves me
  • @saarang4637
    Fantastic video, to the point information. Thank you for helping me understand how to use gpg :)
  • @chrischiu2335
    Thanks Melvin. It is a great tutorial for the gpg tutorial.
  • @SelectFrom
    Thank you a lot for the clear explanation!
  • @nagarocky
    Great explanation. Simply superb. Thanks.
  • @majorblazer9055
    thanks so much and thanks for providing the examples, copy pasted to my cheat sheet :)
  • @borjonx
    Thank you from 1.5 years later! Exactly what I needed. Clear, concise & to the point. Thank you also for having your commands pre-typed; that saves time & we can pause as necessary.
  • @8080VB
    Thankyou so much Melvin 🎈⚡