title: android encryption
body: <p>I want to encrypt/decrypt some passwords in the SQLite database of my application. To do that I have searched on the internet and I have found the AES algorithm.
  I have this code:</p>
  
  <pre><code>public String encript(String dataToEncrypt)
          throws NoSuchAlgorithmException, NoSuchPaddingException,
          InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
      // I'm using AES encription
  
      if(!dataToEncrypt.equals("")){
          String key = "FMVWf8d_sm#fz";
  
          Cipher c = Cipher.getInstance("AES");
          SecretKeySpec k;
          try {
              k = new SecretKeySpec(key.getBytes(), "AES");
              c.init(Cipher.ENCRYPT_MODE, k);
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          }
  
  
          return new String(c.doFinal(Base64.decode(dataToEncrypt)));
      }
      return "";
  }
  
  public String decript(String encryptedData)
          throws NoSuchAlgorithmException, NoSuchPaddingException,
          InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
  
      if(!encryptedData.equals("")){
          String key = "FMVWf8d_sm#fz";
  
          Cipher c = Cipher.getInstance("AES");
          SecretKeySpec k = new SecretKeySpec(Base64.decode(key), "AES");
          c.init(Cipher.DECRYPT_MODE, k);
          return new String(c.doFinal(Base64.decode(encryptedData)));
      }
      return "";
  }
  </code></pre>
  
  <p>After running this I get this error on encrypt method:</p>
  
  <blockquote>
    <p>01-27 14:50:51.698: ERROR/ACTIVITY(782):
    java.security.InvalidKeyException: Key length not 128/192/256 bits.</p>
  </blockquote>
  
  <p>I have seen some other cases here on stackoverflow but I want to give the key to the AES not to generate it...</p>
  
  <p>Can somebody help me with this? If there is other encryption method to use but without using another jars or external classes and to let me give the key.</p>
  
  <p>Thank you very much!  </p>