title: Encrypted password is different for android and javascript in using CryptoJs library
body: <p>I am trying to encrypt the password using AES algorithm in android.The backend is done using the CryptojS library and it can not be changed.I need to send the encrypted password to the backend.I have tried with the below code:</p>
  <pre><code>  fun encryptNew(key: String, value: String): String? {
      try {
          val secretKey: SecretKey = SecretKeySpec(
              Base64.decode(
                  key.toByteArray(),
                  Base64.NO_WRAP
              ), &quot;AES&quot;
          )
          val iv: AlgorithmParameterSpec = IvParameterSpec(
              Base64.decode(
                  key.toByteArray(),
                  Base64.NO_WRAP
              )
          )
          val cipher =
              Cipher.getInstance(&quot;AES/CBC/PKCS5Padding&quot;)
  
  
          cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv)
          return String(
              Base64.encode(
                  cipher.doFinal(value.toByteArray(charset(&quot;UTF-8&quot;))),
                  Base64.NO_WRAP
              )
          )
      } catch (e: java.lang.Exception) {
          Log.d(&quot;1111&quot;,&quot;2222&quot;)
          e.printStackTrace()
      }
      return null
  }
  </code></pre>
  <p>But it returns null and showing exception as java.security.invalidkeyexception: unsupported key size: 20 bytes.
  The code for backend is</p>
  <pre><code>      const encrypt = CryptoJS.AES.encrypt(str, secret);
        return encrypt.toString();
  </code></pre>
  <p>Can anyone help me on this?
  Note:secret key is to be 32 byte
  value is the password which is needed to be encypted</p>