The variables are strOrig (PlainText) and strKey (Passphrase) System.IO.MemoryStream ms = new System.IO.MemoryStream(); System.Security.Cryptography.RijndaelManaged rj = new System.Security.Cryptography.RijndaelManaged(); rj.Mode = System.Security.Cryptography.CipherMode.CBC; RandomNumberGenerator rng = RandomNumberGenerator.Create(); byte[] salt = new byte[8]; rng.GetBytes(salt); PasswordDeriveBytes pdb = new PasswordDeriveBytes(strKey, salt); rj.IV = pdb.GetBytes(16); rj.Key = pdb.GetBytes(32); // Debug so I can see the IV, Key, and Salt Generated string strIV = Encoding.UTF8.GetString(rj.IV); string _strKey = Encoding.UTF8.GetString(rj.Key); string strSalt = Encoding.UTF8.GetString(salt); ms.Write(Encoding.UTF8.GetBytes("Salted__"), 0, Encoding.UTF8.GetByteCount("Salted__")); ms.Write(salt, 0, salt.Length); ms.Write(rj.IV, 0, rj.IV.Length); byte[] bOrig = Encoding.UTF8.GetBytes(strOrig); System.Security.Cryptography.CryptoStream cs = new System.Security.Cryptography.CryptoStream(ms, rj.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write); cs.Write(bOrig, 0, bOrig.Length); cs.FlushFinalBlock(); string bResult = Convert.ToBase64String(ms.ToArray()); bResult = bResult.Remove(0, 10); ms.Flush(); return bResult;