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
- Host: GitHub
- URL: https://github.com/smaranjitghose/pyconfidentiality
- Owner: smaranjitghose
- License: mit
- Created: 2020-07-12T23:02:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-01T22:11:24.000Z (almost 6 years ago)
- Last Synced: 2025-01-26T04:12:38.502Z (over 1 year ago)
- Topics: cryptography, email-sender, python, rsa, smtp
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PyConfidentiality


[](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

