title: Decrypt AES buffer received from PHP service
body: <p>I'm having trouble decrypting AES encrypted data. I receive base64 encoded, encrypted buffer from remote service. The data is encrypted using AES 128-cbc using OpenSSL library in PHP. I'm trying to decrypt it this way:</p>
  
  <pre class="lang-cs prettyprint-override"><code>var encryptedKey = Encoding.ASCII.GetString(key);
  var rsaKey = Convert.FromBase64String(encryptedKey);
  var ms = new MemoryStream();
  var aes = RijndaelManaged.Create();
  aes.Padding = PaddingMode.None;
  aes.Mode = CipherMode.CBC;
  aes.KeySize = 128;
  aes.BlockSize = 128;
  aes.Key = pwd;
  aes.IV = pwd;
  var stream = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write);
  stream.Write(rsaKey, 0, rsaKey.Length);
  var ss6 = Encoding.ASCII.GetString(ms.ToArray());
  </code></pre>
  
  <p>But I get absolutely invalid result.</p>
  
  <p>Here's the code in PHP used to encrypt the data:</p>
  
  <pre class="lang-php prettyprint-override"><code>($this-&gt;source, 'aes-128-cbc', $this-&gt;key, true, $this-&gt;key)
  </code></pre>
  
  <p>Anyone has any idea what could be wrong? The key and IV are set correctly.</p>
  
  <p>Thanks</p>
  
  <p>P.S.
  I've tried all available CipherModes :) also key size is 16 bytes.</p>