title: SecretKeyFactory generateSecret error when passing PBEKeySpec
body: <p>I'm currently trying to encrypt and decrypt java String. For this purpose I wrote the 2 methods below :</p>
  
  <pre><code>public static String AESencryptString(String clearStr) throws Exception {
      String cipherStr = null;
  
      //génération de la clé de cryptage AES
      SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
      PBEKeySpec spec = new PBEKeySpec(KEY.toCharArray());
      Log.d("test", ""+ spec);
      SecretKey tmp = factory.generateSecret(spec);
      SecretKey key = new SecretKeySpec(tmp.getEncoded(), "AES");
  
      //cryptage du mot de passe
      Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
      cipher.init(Cipher.ENCRYPT_MODE, key);
      byte[] cipherByteArray = cipher.doFinal(clearStr.getBytes("UTF-8"));
  
      //convertion du mot de passe en String pour l'enregistrement en base
      cipherStr = new String(Base64.encode(cipherByteArray, 0));
  
      return cipherStr;
  }
  
  public static String AESdecryptString(String cipherStr) throws Exception {
      String clearStr = null;
  
      //génération de la clé de cryptage AES
      SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
      KeySpec spec = new PBEKeySpec(KEY.toCharArray());
      SecretKey tmp = factory.generateSecret(spec);
      SecretKey key = new SecretKeySpec(tmp.getEncoded(), "AES");
  
      //décryptage du mot de passe
      Cipher decipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
      decipher.init(Cipher.DECRYPT_MODE, key);
      byte[] clearByteArray = decipher.doFinal(cipherStr.getBytes());
  
      //convertion du mot de passe en String pour l'enregistrement en base
      clearStr = new String(Base64.encode(clearByteArray, 0));
  
      return clearStr;
  }
  </code></pre>
  
  <p>The thrown error is "InvalidKeySpec" during the execution of factory.generateSecret -> I know that this error is due to the lack of SALT but, if I can create a PBEKeySpec with just a password, it should have a way to use it, can you help to find it ?</p>
  
  <p>I tried with the SALT, just for testing and... It doesn't work either but the error is not the same. In this case the error is thrown on "cipher.init" and I can't figure out what is this error because the debugger tells me ""</p>
  
  <p>Please help me because I'll going crazy !</p>