title: Encrypting and Decrypting String using a Java equilavent of the C# CryptoStream
body: <p>I am looking at developing an application in Java for a mobile platform operating system. </p>
  
  <p>I have developed an application in C# WPF for the Windows Environment. I am using a cryptostream in order to encrypt and decrypt a string using the following code. the code shown below is the encryption only</p>
  
  <pre><code>public string encrypt(string encryptionString)
      {
          byte[] clearTextBytes = Encoding.UTF8.GetBytes(encryptionString);
  
          SymmetricAlgorithm rijn = SymmetricAlgorithm.Create();
  
          MemoryStream ms = new MemoryStream();
          byte[] rgbIV = Encoding.ASCII.GetBytes("ryojvlzmdalyglrj");
          byte[] key = Encoding.ASCII.GetBytes("hcxilkqbbhczfeultgbskdmaunivmfuo");
          CryptoStream cs = new CryptoStream(ms, rijn.CreateEncryptor(key, rgbIV), CryptoStreamMode.Write);
  
          cs.Write(clearTextBytes, 0, clearTextBytes.Length);
  
          cs.Close();
  
          return Convert.ToBase64String(ms.ToArray());
      }
  </code></pre>
  
  <p>The encrypted string is stored in an online database. What I need to be able to do is for the java application to be able to read the string from the database and decrypt the string using the same encryption keys from the C# application.</p>
  
  <p>Thanks for your help. </p>