Q: How to get the generated IV from encryption to decryption method I didn't want to seed the IV with the user given password. The question is if I've created the method of encrypting with a generated IV, is there anyway I could save the generated IV, to get it into the decryption method, without saving it into a database.
private void EncryptFile(string inputFile,string outputFile, string pass_input){

        try
       {
            MessageBox.Show("FLAG 1");
            UTF8Encoding UE = new UTF8Encoding();
            //Represents a UTF-8 encoding of unicode characters

            string password = pass_input;
            // passed password through user input

            byte[] key = UE.GetBytes(password);
            //password parsed into bytes

            string cryptFile = outputFile;
            FileStream FScrypt = new FileStream(cryptFile, FileMode.Create);
            //FScrypt is created where it creates a file to save output

            RijndaelManaged RMcrypto = new RijndaelManaged();
            //RMcrypto is created where new instance of RijndaelManaged Class is initialized

            RMcrypto.GenerateIV();
            CryptoStream cs = new CryptoStream(FScrypt, RMcrypto.CreateEncryptor(key,RMcrypto.IV), CryptoStreamMode.Write);
            //CreateEncryptor from RMcrypto creates a symmetric Rijndael Encryptor object with specified key

            FileStream fsIn = new FileStream(inputFile, FileMode.Open);
            //fsIn Opens the input file
            MessageBox.Show("FLAG 2");
            int data;

            while ((data = fsIn.ReadByte()) != -1)
                //will read input file opened by fsIn
                cs.WriteByte((byte)data);
            MessageBox.Show("FLAG 3");

            fsIn.Close();
            cs.Close();
            FScrypt.Close();
       catch(Exception ex)
       {
          MessageBox.Show("Failed");
       }
}

private void DecryptFile(string inputFile, string outputFile, string pass_input)
    {
        try
        {
            string password = pass_input; // Taking password input and storing in local string. 

            UTF8Encoding UE = new UTF8Encoding()  //UnicodeEncoding Object UTF8
            byte[] key = UE.GetBytes(password); // converting password to bytes

            FileStream fsCrypt = new FileStream(inputFile, FileMode.Open); // Opens the file

            RijndaelManaged RMCrypto = new RijndaelManaged(); //new RijndaelMaaged object

            CryptoStream cs = new CryptoStream(fsCrypt, RMCrypto.CreateDecryptor(key, **"RMCrypto.IV"**), CryptoStreamMode.Read);

            FileStream fsOut = new FileStream(outputFile, FileMode.Create);

            int data;

            while ((data = cs.ReadByte()) != -1)
               fsOut.WriteByte((byte)data);

            fsOut.Close();
            cs.Close();
            fsCrypt.Close();
        }
        catch (Exception ex)
        {
            MessageBox.Show("Failed");
        }
    }


A: One well used/accepted method is to prepend the IV to the encrypted data, the IV does not need to be secret.
