title: Encrypt/Decrypt string between Java and PHP
body: <p>I'm using AES encryption to encrypt and decrypt string between php on the server side and Android app (as client).</p>
  
  <p>The encrypted string in PHP is: </p>
  
  <pre><code>HaxRKnMxT24kCJWUXaVvqDHahzurJQK+sYA4lIHql/U=
  </code></pre>
  
  <p>and in Java it's:</p>
  
  <pre><code>HaxRKnMxT24kCJWUXaVvqD/KMEkJTPTXEcCsHIYGX9TGtCNOHQcJyUURPk8qlgf3
  </code></pre>
  
  <p>I'm making use of phpseclib in the PHP script to do the encryption.</p>
  
  <p>What am I missing here?</p>
  
  <p>The relevant Java code here</p>
  
  <pre><code>SecretKeySpec skeySpec = new SecretKeySpec(pad16(pass), "AES");
  Cipher c = Cipher.getInstance("AES");
  c.init(Cipher.ENCRYPT_MODE, skeySpec);
  byte[] out = c.doFinal( input )
  </code></pre>
  
  <p>And the PHP code here:</p>
  
  <pre><code>$aes = new Crypt_AES();
  $aes-&gt;setKey('password');
  $encrypted_encoded_text =  base64_encode($aes-&gt;encrypt($plaintext));
  </code></pre>