title: Problems encoding/decoding using AES-128-CBC
body: <p>So basically I have these snippets of code and would like them to produce the same output:</p>
  
  <pre><code>require 'openssl'
  aes = OpenSSL::Cipher::Cipher.new("AES-128-CBC")
  aes.key = "aaaaaaaaaaaaaaaa"
  aes.iv = "aaaaaaaaaaaaaaaa"
  aes.encrypt
  encrypted = aes.update("1234567890123456") &lt;&lt; aes.final
  puts encrypted.unpack('H*').join
  </code></pre>
  
  <p>This prints:</p>
  
  <pre><code>8d3bbffade308f8e4e80cb77ecb8df19ee933f75438cec1315c4a491bd1b83f4
  </code></pre>
  
  <p>And this Java code:</p>
  
  <pre><code>Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  String key = "aaaaaaaaaaaaaaaa";
  String textToEncryptpt = "1234567890123456";
  
  SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
  IvParameterSpec ivspec = new IvParameterSpec(key.getBytes());
  cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
  byte[] encrypted = cipher.doFinal(textToEncryptpt.getBytes());
  System.out.println(Crypto.bytesToHex(encrypted));
  </code></pre>
  
  <p>Prints:</p>
  
  <pre><code>2d3760f53b8b3dee722aed83224f418f9dd70e089ecfe9dc689147cfe0927ddb
  </code></pre>
  
  <p>Annoying thing is that it was working a couple of days ago... so I am not sure what happened. What's wrong with this code? Do you see anything unusual?</p>