title: java.security.InvalidKeyException: Illegal key size or default parameters in android
body: <p>I got the following error and I got a little stuck:
  Exception in thread "main" </p>
  
  <pre><code>java.security.InvalidKeyException: Illegal key size or default parameters
  at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1011)
                  at javax.crypto.Cipher.implInit(Cipher.java:786)
                  at javax.crypto.Cipher.chooseProvider(Cipher.java:849)
                  at javax.crypto.Cipher.init(Cipher.java:1213)
                  at javax.crypto.Cipher.init(Cipher.java:1153)
                  at net.nakou.indie.wtext.engineClass.Session.cryptString(Session.java:52)
  </code></pre>
  
  <p>I'm stuck because all the answers I've found talk about the Java <strong>Cryptography Extension (JCE)</strong> which be normally included into the android SDK. So I think my problem is not this one.</p>
  
  <p>I must have forgotten something, but I can't find what. Maybe my code is wrong (it's my first approach of cryptography in Java, I'm not an expert, and the following code is mostly some copy-pastes of tutorials).</p>
  
  <p>I use this code to crypt and decrypt a String :</p>
  
  <pre><code>public String cryptString(String s) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException, BadPaddingException, IllegalBlockSizeException {
      byte[] KeyData = this.cryptKey.getBytes();
      SecretKeySpec KS = new SecretKeySpec(KeyData, "Blowfish");
      Cipher cipher = Cipher.getInstance("Blowfish");
      cipher.init(Cipher.ENCRYPT_MODE, KS);
      String ret = new String(cipher.doFinal(s.getBytes("UTF-8")));
      return ret;
  }
  
  public String decryptString(byte[] s) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
      byte[] KeyData = this.cryptKey.getBytes();
      SecretKeySpec KS = new SecretKeySpec(KeyData, "Blowfish");
      Cipher cipher = Cipher.getInstance("Blowfish");
      cipher.init(Cipher.DECRYPT_MODE, KS);
      String ret = new String(cipher.doFinal(s));
      return ret;
  }
  </code></pre>
  
  <p>And the following key :</p>
  
  <pre><code>private String cryptKey = "qkjll5@2md3gs5Q@FDFqf";
  </code></pre>
  
  <p>Thank you guys.</p>