title: Python - Decrypt from php openssl_encrypt
body: <p>Question,
  I was wondering if someone could point me in the right direction on this as i have been scratching my head.
  Is it possible to build a decryption function in python to decrypt something that was encrypted using php with the below method of 128-CTR?</p>
  <p>The php side was encoded using the following</p>
  <pre><code>$enc_method = 'AES-128-CTR';
  $enc_iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($enc_method));
  $crypted_token = openssl_encrypt($token, $enc_method, $enc_key, 0, $enc_iv) . &quot;::&quot; . bin2hex($enc_iv);
  </code></pre>
  <p>Where the token is the data getting encrypted.</p>
  <p>I'd post a bunch of my trial code, but there's been too much and i'm not a super huge expert in encryption (The php side was built a while ago on an older version). I'm thinking i may just end up rebuilding it to the newer standards in python if i can make it somehow backwards compatible. Was just wondering if anyone had any links to otpics on this i may have overlooked, or some good book suggestions on the subject i can read more into to get better at it.
  Thanks in advance.</p>