title: Decrypting Rijndael in Android
body: <p>I basically need to decrypt a password I retrieve from a server encrypted with Rijndael, I have never worked with encrypting/decrypting before and I am completely lost. I found somewhere in this web that Java has some methods implemented without need of external libraries to do so but I didn't get it. The only thing I need is the decrypt since I won't be writing back into the server anyways.</p>
  
  <p>Any idea on how to do it or where I could find documentation about it?</p>
  
  <p>I don't know if this code, taken from an answer <a href="https://stackoverflow.com/questions/587357/rijndael-support-in-java">here</a> is what I am looking for, I don't understand much of it, as I said, I've never worked with this kind of stuff before:</p>
  
  <pre><code>byte[] sessionKey = null; //Where you get this from is beyond the scope of this post
  byte[] iv = null ; //Ditto
  byte[] plaintext = null; //Whatever you want to encrypt/decrypt
  Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
  //You can use ENCRYPT_MODE or DECRYPT_MODE
  cipher.calling init(Cipher.ENCRYPT_MODE, new SecretKeySpec(sessionKey, "AES"), new IvParameterSpec(iv));
  byte[] ciphertext = cipher.doFinal(plaintext);
  </code></pre>
  
  <p>Thanks in advance.</p>