title: Android encryption "pad block corrupted" exception
body: <p>In this code, this line is causing an exception:</p>
  
  <p><code>clearText = c.doFinal(Base64.decode(encryptedText, Base64.DEFAULT));</code></p>
  
  <p><code>javax.crypto.BadPaddingException: pad block corrupted</code></p>
  
  <p>I got the code from:
  <a href="http://www.techrepublic.com/blog/software-engineer/attention-android-developers-keep-user-data-safe/" rel="noreferrer">http://www.techrepublic.com/blog/software-engineer/attention-android-developers-keep-user-data-safe/</a></p>
  
  <p>Any ideas?</p>
  
  <pre><code>    private String decrypt (String encryptedText) {
          byte[] clearText = null;
          try {
              SecretKeySpec ks = new SecretKeySpec(getKey(), "AES");
              Cipher c = Cipher.getInstance("AES");
              c.init(Cipher.DECRYPT_MODE, ks);
              clearText = c.doFinal(Base64.decode(encryptedText, Base64.DEFAULT));
              return new String(clearText, "UTF-8");
          } catch (Exception e) {
              return null;
          }
      }
  </code></pre>
  
  <p>Details: I am encrypting it on the android as well</p>