olzmethod.blogg.se

Python encrypt and decrypt file with rsa public key
Python encrypt and decrypt file with rsa public key










python encrypt and decrypt file with rsa public key python encrypt and decrypt file with rsa public key

It is slow, and can be hard to use right. Public-key cryptography is usually used for small amounts of data only. 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,

python encrypt and decrypt file with rsa public key

# RSA encryption returns a tuple containing 1 string, so i fetch the string. # Encrypt with RSA and append the result to list. 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.












Python encrypt and decrypt file with rsa public key