![]() Print("Error decrypting data with AES: ", e)Īes_ciphertext = self.aes_encryption.encrypt(text)Įncrypted_key = self.rsa_encryption.encrypt(self.aes_encryption.key)ĭef decrypt_text(self, aes_ciphertext, encrypted_key):ĭecrypted_key = self.rsa_crypt(encrypted_key) Print("Error encrypting data with AES: ", e) Print("Error decrypting data with RSA: ", e) Plaintext = self.private_key.decrypt(ciphertext, padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), label=None)) Print("Error encrypting data with RSA: ", e) Self.public_key = self.private_key.public_key()Ĭiphertext = self.public_key.encrypt(data, padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), label=None)) ![]() Self.private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048) Here is the code for my library: from import hashesįrom import rsa, padding Additionally I would like to know if my library is cryptographically secure and if I can make any improvements to my code in order to make it more efficient. I am wondering if I should implement a keystore and/or a better key management system and if that would be applicable or useful for my purposes (I plan to implement this in a chat flask web-app). I've created a python library that uses both RSA and AES encryption to allow for hybrid encryption of text or images.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |