Formatting a static AES Key for decryption in Python
<p>I'm working to decrypt several files in python using a given AES key via the PyCrypto AES implementation. I've currently set it to a static list of hex bytes (as this was how it was provided to me). However, when I try to decrypt the files, I get a warning stating the key size must be 16, 24, or 32 bytes. My code for converting the list to a string is as follows:</p>

<pre><code>''.join(str(x) for x in key) 
</code></pre>

<p>I've verified that the key in list form has 16 bytes, but something I'm doing when converting it must be changing the size. What operations would be best for changing a key from something like </p>

<pre><code>[0x2a, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c]
</code></pre>

<p>to a usable string for decryption? </p>

<p>You didn't mention what AES implementation you're using, but the right answer is likely to look like</p>

<pre><code>k = bytes([0x01, 0x23, 0x34, 0x56])
</code></pre>

python encryption aes