Cryptodome - convert openssl command to python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Cryptodome - convert openssl command to python (/thread-17014.html) |
Cryptodome - convert openssl command to python - twebber - Mar-24-2019 I have received an encrypted data file (mydata.encrypted) and a key (plain text for now) and the following command to decrypt it: openssl enc -d -aes-256-cbc -a -in mydata.encrypted -out mydata.decrypted -kfile my_symmetric_key The people who encrypted these data did so with openssl but I dont know what the encrypt command looks like. I do know that the above command does decrypt the data successfully though. I want to use Python to decrypt this file. I am thinking of using cryptodome but am open to suggestions. Here's what i know from the above openssl decrypt command. - its uses AES cbc 256 mode for the decryption ( -d ) - it uses base64 to encode the data "AFTER" (-a) the cryptographic operation - it does not specify the initialization vector (IV). I am struggling with how to code for this using python. What I suspect is my problem is that i dont know how to properly calculate the IV. Looking at the openssl documentation they say to see "key derivation" to find out how they handle IV when its not specified. I cant track down this key derivation information. Any help will be appreciated! RE: Cryptodome - convert openssl command to python - twebber - Mar-25-2019 I've sent an email to the openssl users mailing list. If i find out from them the answer, i'll post the reply here. |