An open API service indexing awesome lists of open source software.

https://github.com/smaranjitghose/pyconfidentiality

Adding secrecy to your emails with RSA
https://github.com/smaranjitghose/pyconfidentiality

cryptography email-sender python rsa smtp

Last synced: 10 months ago
JSON representation

Adding secrecy to your emails with RSA

Awesome Lists containing this project

README

          

PyConfidentiality

![RSA](https://img.shields.io/badge/rsa-encrypted-brightgreen)
![Open Source](https://img.shields.io/badge/open-source-red)
[![License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/smaranjitghose/pycondidentiality/blob/master/LICENSE)

Adding secrecy to your emails with RSA!

Installation

```python
pip install pyconfidentiality
```

Usage

## 1. Generate the Public and Private Keys

```python
from pyconfidentiality import generate_keypair

bit_length = int(input("Enter bit length: "))

public_key, private_key = generate_keypair(2**bit_length)
```

## 2. Generate Cipher Text

```python
from pyconfidentiality import encrypt_message
plain_text = input("Enter a message: ")
cipher_text, cipher_obj = encrypt_message(plain_text, public_key)
print("Encrypted message: {}".format(cipher_text))
```

## 3. Send the message

- Note we are intially using GMAIL for this
- Make sure your Google Account has [Allow Less Secure App Access](https://myaccount.google.com/lesssecureapps) enabled
- It is always recommeded to store the credentials of your GMAIL account using environment variables in your system

```python
from pyconfidentiality import send_message
your_email = os.environ.get('EMAIL_ID')
your_password = os.environ.get('EMAIL_PASSWORD')
receiver_email = input("Enter Reciever Email")
subject = input("Enter subject of the Email")

send_message(your_email,your_password,reciever_email,subject,cipher_text)
```

## 4. Get back our plain text

```python
from pyconfidentiality import decrypt_message
print("Decrypted message: {}".format(decrypt(cipher_obj, private_key)))
```

Project Maintainers


   


Smaranjit Ghose

   
Anush Bhatia

Code of Conduct


License