0

I have a file which was encrypted using Linux command line tool openssl. eg: openssl smime -encrypt -binary -aes-256-cbc -in 400000005f16bec1298bbc0c0079371de75e -out 400000005f16bec1298bbc0c0079371de75e_enc -outform DER /usr/local/etc/key.pem

How to decrypt this file in Python? Any help or suggestion will be appreciated. Thank you.

Edit-1: I have /usr/local/etc/key.pem is available with me, it has private key and certificate details and I must use this pem file to decrypt/encrypt the files in Python

Edit-2: Used the C functionality which I have to encrypt/decrypt the file. Invoking the C binary from Python code worked for me.

Suresh
  • 277
  • 1
  • 4
  • 22
  • One way is to invoke openssl inside python. – Philippe Jul 27 '20 at 16:30
  • In python, I can able to get the files decrypted using os.popen(). But I am looking for programmatic way to decrypt them using Python libraries. – Suresh Jul 28 '20 at 14:07
  • https://stackoverflow.com/questions/16761458/how-to-decrypt-openssl-aes-encrypted-files-in-python – Philippe Jul 28 '20 at 15:11
  • Thank you Philippe, I looked into the post you have shared, here they are not reading/generating the password/key from "pem file". In my case I have the pem file and I should fetch a key from it and then continue to decrypt the file – Suresh Jul 29 '20 at 05:24

0 Answers0