<div dir="ltr">I just posted a message which i have copied below to a python forum.  It might be better asked here.  The coles notes version of my question is this:<div><br><div><div><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">I have received an encrypted data file (mydata.encrypted) and a key (plain text for now) and the following command to decrypt it:</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">openssl enc -d -aes-256-cbc -a -in mydata.encrypted -out mydata.decrypted -kfile my_symmetric_key</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"></div><div><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">Question is this.  How is the initialization vector calculated?  This command works fine.  My issues is that i dont know how the initialization vetor is calculated.  I suspect if its left out there is some default way of doing it.  Can you tell me how its done? Thanks!</span></div><div><br></div><div>************************* ORIGINAL QUESTION to python community ******************</div><div><br></div><div><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">I have received an encrypted data file (mydata.encrypted) and a key (plain text for now) and the following command to decrypt it:</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">openssl enc -d -aes-256-cbc -a -in mydata.encrypted -out mydata.decrypted -kfile my_symmetric_key</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">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.</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">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.</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">- its uses AES cbc 256 mode for the decryption ( -d )</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">- it uses base64 to encode the data "AFTER" (-a) the cryptographic operation</span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">- it does not specify the initialization vector (IV). </span><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><br style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px"><span style="color:rgb(51,51,51);font-family:Tahoma,Verdana,Arial,sans-serif;font-size:14px">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!</span> </div><div>******************************* <br></div></div></div></div>