title: Java decryption throws an exception
body: <p>Here is my encryption method(value is an input parameter):</p>
  
  <pre><code> byte key_bytes[] = "12345678".getBytes();
   SecretKeySpec _keyspec = new SecretKeySpec(key_bytes, "DES");
   Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); // Yes, I know I shouldn't use DES
   cipher.init(Cipher.ENCRYPT_MODE, _keyspec);
  
   byte[] utf8 = value.getBytes("UTF8");
   byte[] enc = cipher.doFinal(utf8);   // Encrypt
  
   String encrypted = new String(new Base64().encode(enc));
  
   return URLEncoder.encode(encrypted, "UTF-8");
  </code></pre>
  
  <p>Here is my decryption method(value is an input parameter):</p>
  
  <pre><code>byte key_bytes[] = "12345678".getBytes();
  SecretKeySpec _keyspec = new SecretKeySpec(key_bytes, "DES");
  Cipher dcipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
  dcipher.init(Cipher.DECRYPT_MODE, _keyspec);
  
  byte[] dec = new Base64().decode(value);
  byte[] utf8 = dcipher.doFinal(dec);  // Decrypt, throws exception
  return new String(utf8, "UTF8");
  </code></pre>
  
  <p>And I get an Exception:</p>
  
  <pre><code>javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
  </code></pre>
  
  <p>I've read different topics, so I figured out, that this exception occurs, when there is no padding and there is another cipher mode. So, what's wrong?</p>