figenc

[RADIOACTIVE] rsa and symmetric key encryption scripts and executables
git clone git://git.figbert.com/figenc.git
Log | Files | Refs | README

commit 4508194ae48a3789e00d74a4ab77a55d0d311edb
parent 12b9a165d4736f8e885fa8309a572c774574f858
Author: therealFIGBERT <naomi@Naomis-MacBook-Air.local>
Date:   Thu, 27 Jun 2019 21:03:37 -0700

Removing weak encryption option and creating control file

Diffstat:
Mdecrypt.py | 11-----------
Mencrypt.py | 12------------
MfigEnc.py | 16++++++++++++----
Minitiate_key.py | 8--------
4 files changed, 12 insertions(+), 35 deletions(-)

diff --git a/decrypt.py b/decrypt.py @@ -5,17 +5,6 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding from cryptography.fernet import Fernet -def symmetric_dec(): - with open('symmetric_key.key', 'rb') as symmetric_key_file: - symmetric_key_data = symmetric_key_file.read() - symmetric_key = Fernet(symmetric_key_data) - file_to_decrypt = input("File to decrypt: ") - with open(file_to_decrypt, 'rb') as read_file: - encrypted_data = read_file.read() - original_message = symmetric_key.decrypt(encrypted_data) - with open(file_to_decrypt, 'wb') as write_file: - write_file.write(original_message) - def rsa_dec(): passcode = input("Private Key passcode: ") with open('private_key.pem', 'rb') as private_key_file: diff --git a/encrypt.py b/encrypt.py @@ -5,18 +5,6 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding from cryptography.fernet import Fernet -def symmetric_enc(): - with open('symmetric_key.key', 'rb') as symmetric_key_file: - symmetric_key_data = symmetric_key_file.read() - symmetric_key = Fernet(symmetric_key_data) - file_to_encrypt = input("File to encrypt: ") - with open(file_to_encrypt) as read_file: - file_data = read_file.read() - data = symmetric_key.encrypt(bytes(file_data, 'utf-8')) - with open(file_to_encrypt, 'wb') as write_file: - write_file.write(data) - print("Encryption successful. Proceed into cyberspace with confidence.\n") - def rsa_enc(): with open('public_key.pem', 'rb') as public_key_file: public_key = serialization.load_pem_public_key( diff --git a/figEnc.py b/figEnc.py @@ -1,6 +1,14 @@ from initiate_key import rsa_key -from initiate_key import symmetric_key -from encrypt import symmetric_enc from encrypt import rsa_enc from decrypt import rsa_dec -from decrypt import symmetric_dec -\ No newline at end of file + +exec_action = input("Are you encrypting or decrypting today (enc/dec)? ") +if exec_action == "enc": + key_gen = input("Are you generating fresh keys (y/n)? ") + if key_gen == "y": + rsa_key() + rsa_enc() + elif key_gen == "n": + rsa_enc() +elif exec_action == "dec": + rsa_dec() +\ No newline at end of file diff --git a/initiate_key.py b/initiate_key.py @@ -5,14 +5,6 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding from cryptography.fernet import Fernet -# symmetric_key() generates a single symmetric key -def symmetric_key(): - # Generating the symmetric key - symmetric_key = Fernet.generate_key() - # Saving the symmetric key to the file symmetric_key.key - with open('symmetric_key.key', 'wb') as symmetric_file: - symmetric_file.write(symmetric_key) - #rsa_key() generates a symmetric key as well as a public and private key def rsa_key(): # Generating the symmetric key for use encrypting the file