Skip to content Skip to sidebar Skip to footer

How To Encrypt A File With Python But Can Be Decrypted Using The Shell?

I need to encrypt a file, send it to another person, who then can only decrypt it using shell. I usually encrypt the file with the openssl command: openssl enc -aes-256-cbc -salt -

Solution 1:

Do you need to use openssl?

I use command line GnuPG and there is very nice Python library: python-gnupg . It is a wrapper over command line gpg so they work simply the same.

Instead of key file (I think it contains password) you can use asymmetric cryptography. Create private/public pairs of keys for each part and then encrypt message using recipient public key and sigg it using sender private key. Recipient will check signature of sender using sender public key and recipient will decrypt message using her private key. Private keys can be protected by password but if you are sure your environments are safe you can use empty passwords.

Post a Comment for "How To Encrypt A File With Python But Can Be Decrypted Using The Shell?"