How do I wrap my builder with a stub?
<p>I'm currently learning about crypters and this is what I've learned so far.</p>

<p>A crypter consists of a builder and a stub.</p>

<p>The builders role is to encrypt a file and the stub wraps the file
and makes it run in a buffer aka in the memory of the machine it is being decrypted on.
(Please do correct if I am wrong)</p>

<p>I have created my File Encrypter (The builder) and to be honest I have no idea how to create a stub.. I've been looking around the entire day but all I can find are these really old Console applications not explaining anything really..</p>

<p><strong>So my question is..</strong>
How do I wrap my current file encrypter with a stub.. or how do I create a stub. Not to sure how to form that question since I am new to stubs.</p>

<p>Here is my file encrypter.</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using System.Windows;
using Microsoft.Win32;
using System.Security.Cryptography;
using System.IO;

namespace FileEncrypter
{
    /// &lt;summary&gt;
    /// Interaction logic for MainWindow.xaml
    /// &lt;/summary&gt;
    public partial class MainWindow : Window
    {
        string key;
        public MainWindow()
        {
            InitializeComponent();
            key = generateKey();
        }

        public string generateKey()
        {
            DESCryptoServiceProvider desCrypto = (DESCryptoServiceProvider)DESCryptoServiceProvider.Create();
            return ASCIIEncoding.ASCII.GetString(desCrypto.Key);
        }

        private void EncryptBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.ShowDialog();

                inputencryptFileTextBox.Text = ofd.FileName;

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.ShowDialog();

                outputencryptFileTextBox.Text = sfd.FileName;

                encrypt(inputencryptFileTextBox.Text, outputencryptFileTextBox.Text, key);
                MessageBox.Show("File has been encrypted.", "File");

            }
            catch(Exception encEx)
            {
                MessageBox.Show(encEx.ToString());
            }

        }

        private void encrypt(string input, string output, string strhash)
        {
            FileStream inFs, outFs;
            CryptoStream cs;
            TripleDESCryptoServiceProvider TDC = new TripleDESCryptoServiceProvider();
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();

            byte[] byteHash, byteTexto;

            inFs = new FileStream(input, FileMode.Open, FileAccess.Read);
            outFs = new FileStream(output, FileMode.OpenOrCreate, FileAccess.Write);

            byteHash = md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(strhash));
            byteTexto = File.ReadAllBytes(input);

            md5.Clear();

            TDC.Key = byteHash;
            TDC.Mode = CipherMode.ECB;

            cs = new CryptoStream(outFs, TDC.CreateEncryptor(), CryptoStreamMode.Write);

            int byteRead;
            long length, position = 0;
            length = inFs.Length;

            while (position &lt; length)
            {
                byteRead = inFs.Read(byteTexto, 0, byteTexto.Length);
                position += byteRead;

                cs.Write(byteTexto, 0, byteRead);

            }

            inFs.Close();
            outFs.Close();

        }

        private void DecryptBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.ShowDialog();

                inputdecryptFileTextBox.Text = ofd.FileName;

                SaveFileDialog sfd = new SaveFileDialog();
                sfd.ShowDialog();

                outputdecryptFileTextBox.Text = sfd.FileName;

                decrypt(inputdecryptFileTextBox.Text, outputdecryptFileTextBox.Text, key);
                MessageBox.Show("File has been decrypted.", "File");
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }



        private void decrypt(string input, string output, string strhash)
        {
            FileStream inFs, outFs;
            CryptoStream cs;
            TripleDESCryptoServiceProvider TDC = new TripleDESCryptoServiceProvider();
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();

            byte[] byteHash, byteTexto;

            inFs = new FileStream(input, FileMode.Open, FileAccess.Read);
            outFs = new FileStream(output, FileMode.OpenOrCreate, FileAccess.Write);

            byteHash = md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(strhash));
            byteTexto = File.ReadAllBytes(input);

            md5.Clear();

            TDC.Key = byteHash;
            TDC.Mode = CipherMode.ECB;

            cs = new CryptoStream(outFs, TDC.CreateDecryptor(), CryptoStreamMode.Write);

            int byteRead;
            long length, position = 0;
            length = inFs.Length;

            while (position &lt; length)
            {
                byteRead = inFs.Read(byteTexto, 0, byteTexto.Length);
                position += byteRead;

                cs.Write(byteTexto, 0, byteRead);

            }

            inFs.Close();
            outFs.Close();

        }
    }
}
</code></pre>