private static byte[] EncryptObject_Private(object input, string passPhrase, out string cipher)
        {
            RandomGenerator randGen = new RandomGenerator();

            string strSalt = randGen.RandomString(8);
            byte[] saltValueBytes = Encoding.ASCII.GetBytes(strSalt);

            // Convert our plaintext into a byte array. 
            // Let us assume that plaintext contains UTF8-encoded characters. 
            byte[] plainTextBytes = Serializer.SerializeToByteArray(input);

            // First, we must create a password, from which the key will be derived. 
            // This password will be generated from the specified passphrase and 
            // salt value. The password will be created using the specified hash 
            // algorithm. Password creation can be done in several iterations. 
            Rfc2898DeriveBytes pw = new Rfc2898DeriveBytes(passPhrase, saltValueBytes, 2);

            // Use the password to generate pseudo-random bytes for the encryption 
            // key. Specify the size of the key in bytes (instead of bits). 
            byte[] keyBytes = pw.GetBytes(256 / 8);

            // Create uninitialized Rijndael encryption object. 
            RijndaelManaged symmetricKey = new RijndaelManaged();

            RandomGenerator randGen2 = new RandomGenerator();

            string strIv = randGen2.RandomString(16);
            // Convert strings into byte arrays. 
            // Let us assume that strings only contain ASCII codes. 
            // If strings include Unicode characters, use Unicode, UTF7, or UTF8 
            // encoding. 
            byte[] initVectorBytes = Encoding.ASCII.GetBytes(strIv);

            // It is reasonable to set encryption mode to Cipher Block Chaining 
            // (CBC). Use default options for other symmetric key parameters. 
            symmetricKey.Mode = CipherMode.CBC;

            // Generate encryptor from the existing key bytes and initialization 
            // vector. Key size will be defined based on the number of the key 
            // bytes. 
            ICryptoTransform encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes);

            // Define memory stream which will be used to hold encrypted data. 
            MemoryStream memoryStream = new MemoryStream();

            // Define cryptographic stream (always use Write mode for encryption). 
            CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write);
            // Start encrypting. 
            cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);

            // Finish encrypting. 
            cryptoStream.FlushFinalBlock();

            // Convert our encrypted data from a memory stream into a byte array. 
            byte[] cipherTextBytes = memoryStream.ToArray();

            // Close both streams. 
            memoryStream.Close();
            cryptoStream.Close();

            //// Convert encrypted data into a base64-encoded string. 
            //string cipherText = Convert.ToBase64String(cipherTextBytes);

            //// reconvert cipherText to bytes
            //byte[] cipherBytes = Convert.FromBase64String(cipherText);

            cipher = strIv + strSalt;

            return cipherTextBytes;
        }