Cyber Security

End-To-End Encrypted Communication using Python

By Fernet Encryption Algorithm

Image for post
Image for post
Photo by Jason Leung on Unsplash

Platforms I used:

Python Packages to be downloaded:

pip install urllib

Now, here’s the code that sends the message:

Run it:

Image for post
Image for post
Screenshot by the author

Here’s the code that receives the message:

In lines 10 and 15, notice ‘YourName’. Replace it with your PC’s name.

Run it:

Image for post
Image for post
Screenshot by the author

Give these codes to your friend and you both can communicate securely.

What if you give a wrong key? — It doesn’t show the message.

Image for post
Image for post
Don’t ask me what these complicated exceptions are. XD

What the ‘Man in the Middle’ sees — The csv file:

Hehe, no one understands these unless they’re decrypted. One can’t decrypt these unless he gets the key. So, keep your key confidential.

Written by

University Student | NCC Cadet | Hobby Writer | Curious Experimenter | 🇮🇳

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store