GPG/PGP Free Data Encryption with Python

preview_player
Показать описание
In this video, we will encrypt and sign documents with PGP and Python as part of my series on encryption with Python.

Specifically, we are going to use GnuPG or GPG, which is essentially a free version of PGP and is part of the OpenPGP standard

First of all….PGP or Pretty Good Privacy.

PGP was developed in the early nineties by Phil Zimmerman. Phil offered up the source code for PGP which was used to develop the Open PGP ..a standard for

GPG encrypts data using asymmetric key pairs that are individually generated by users. GPG also supports symmetric encryption with AES and other algorithms …but we’ll leave that discussion for another day.

If you remember, In the world of asymmetric encryption , each user has a key pair …one public and one private key. There is a mathematical relationship between each key pair where you can encrypt with one and decrypt with the other.

How this typically works is that Bob securely sends Alice his public key. Alice encrypts a file with Bob’s public key and sends it to Bob, knowing that only Bob can decrypt because he has the private key that was associated with the public key he sent to Alice.

GPG has several command line options to manage your encryption but we are going to use a Python library instead called python-gnupg

To exchange encrypted files in GPG, each user will need to have GPG installed on their computer. Also, we will need to install the GnuPG libray in python to write the code.
Рекомендации по теме
Комментарии
Автор

This video is very comprehensive, and an excellent way to gain an understanding of PGP, and public key cryptography as a whole. I'm hoping this channel receives a lot of attention, because it's a joy to see this depth of coverage when it comes to a subject like this, and I feel everyone should be aware of the ins and outs. It helps enhance all of our security. By the way, thank you for replying to my suggestion!

WorldDstroyer
Автор

thanks for making this video! you just solved my problem in 5 minutes, been banging my head against the wall for days.

spit
Автор

Thanks this video inspired me to write a short program in python to encrypt digital assets. I opted to manually import the public key I tested with. Excellent demonstration of code that was easy to adapt and implement.

simonsentore
Автор

This should get me started using GnuPG. Nice introduction, great video!

loialbringer
Автор

Thank you so much for the video. If there is one video that sums up all the basics of GPG it would definitely be this!! 😄

kewei
Автор

Hi, I've installed latest version "gpg4win" and installed python package python-gnupg in my windows machine via jupyter notebook in anaconda. I am unable to locate ".gnupg" in my home directory and configure the same. Could you pls advise?

MrAvijit
Автор

Thank you for the video! It is a really nice introduction to working with PGP/GPG.
I tried to generate keys but could not seem to make it work, tried it without the input "key_lenght = 2048" and it worked after that. Any idea how come?

dimitriostsantaridis
Автор

Thanks for the nice explanation, is it possible to split the encryption based on size(for example if the file size is more than 1 GB split in 2 files) and then compress it zip.gpg?

nirmalr
Автор

What could be the possible vulnerabilitys/holes from incorrect configuration?

jaydenrohleder
Автор

Anyone had any success running this on a windows machine? I'm not sure what my gnupghome directory should be. I was able to get gpg to work via command line in wsl, but I can't seem to find the .gnupg dir in windows. Is there another download I need to perform to work outside wsl?

CherylTo-ru
Автор

So when we're importing bob's public key I keep getting an error code 2 and google seems to think this is due to the public key being unsigned. I'm on Windows which is probably making this harder. Any advice?

helo
Автор

When I am trying to encrypt the file I am getting AttributeError:'GPG' object has no attribute 'encrypt_file'. could please tell me I am getting this error I am doing same approach.

sudhakarkothapalli
Автор

Hi Jaden, Can we add some subkeys under primary key?

gamelover
Автор

Encryption part is not working I am getting attribute error encrypt_file is not found i am seeing please help me here

sudhakarkothapalli
Автор

I keep getting this error on windows when i run gpg = gnupg.GPG():

" _find_binary raise RuntimeError("GnuPG is not installed!")"

I am able to encrypt files using gpg.exe from cmd line. Anyone know what might be causing the error?

joestopansky
Автор

hi . your have same tutorial with pycharm

frpforums
Автор

This code isn't working for me in February 2023.

johnmontalbano
Автор

why I am getting
decrypted_data.valid is False
decrypted_data.trust is None

rahulshukla
Автор

You lost me when you used pip3. My pip/pip3 is a nightmare. I'd like to burn the whole system down. They don't work right or consistently.

CheapHomeTech