It is slow, and can be hard to use right. Public-key cryptography is usually used for small amounts of data only.
![decrypting rsa python 3.6 decrypting rsa python 3.6](https://media.geeksforgeeks.org/wp-content/uploads/20220124143153/1.jpeg)
![decrypting rsa python 3.6 decrypting rsa python 3.6](https://devrescue.com/wp-content/uploads/2021/06/art10.png)
I heard about Mcrypt and OpenSSL, but I don't know if they can encrypt files. So my question is : are there any better methods for using Private/ Public key encryption ON FILES ? Open('encrypted_file.ext', 'wb').write(encrypted) # when i explode the string back for decryption. # I hope the \r\r\r sequence won't appear in the encrypted result, # RSA encryption returns a tuple containing 1 string, so i fetch the string. # Encrypt with RSA and append the result to list.
![decrypting rsa python 3.6 decrypting rsa python 3.6](https://www.sdrplay.com/wp-content/uploads/2021/06/python1-1024x431.jpg)
This is the code so far: from Crypto.PublicKey import RSAįile_to_encrypt = open('my_file.ext', 'rb').read() I know it's somewhat wrong, first of all because RSA is very slow and second because P圜rypto RSA can only encrypt 128 characters, so you have to explode the file in 128 characters chunks. I'm implementing file encryption with RSA, using P圜rypto.