Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6033245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:27:20+00:00 2026-05-23T05:27:20+00:00

SO, in Visual C#.NET I would like it to somehow be able to taken

  • 0

SO, in Visual C#.NET I would like it to somehow be able to taken in a program (through an open file dialog), then somehow take the bytes of that program and encrypt the bytes, to be executed later.

How would I do that? How would I encrypt, then later decrypt, a program using Visual C#.NET?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:27:21+00:00Added an answer on May 23, 2026 at 5:27 am

    This answer shows you how to execute a byte array. One caution, this may cause problems with virus scanners because it is common in malware.

    If you don’t want to execute from memory, I whipped up an example of how you could encrypt store then decrypt and run an executable.

     public class FileEncryptRunner
     {
        Byte[] key = ASCIIEncoding.ASCII.GetBytes("thisisakeyzzzzzz");
        Byte[] IV = ASCIIEncoding.ASCII.GetBytes("thisisadeltazzzz");
    
        public void SaveEncryptedFile(string sourceFileName)
        {
           using (FileStream fStream = new FileStream(sourceFileName, FileMode.Open, FileAccess.Read, FileShare.Read),
                  outFStream = new FileStream(Environment.SpecialFolder.MyDocuments+"test.crp", FileMode.Create))
           {
              Rijndael RijndaelAlg = Rijndael.Create();
              using (CryptoStream cStream = new CryptoStream(outFStream, RijndaelAlg.CreateEncryptor(key, IV), CryptoStreamMode.Write))
              {
                  StreamWriter sWriter = new StreamWriter(cStream);
                  fStream.CopyTo(cStream);
              }
           }
        }
    
        public void ExecuteEncrypted()
        {
           using (FileStream fStream = new FileStream(Environment.SpecialFolder.MyDocuments + "test.crp", FileMode.Open, FileAccess.Read, FileShare.Read),
                  outFStream = new FileStream(Environment.SpecialFolder.MyDocuments + "crpTemp.exe", FileMode.Create))
           {
              Rijndael RijndaelAlg = Rijndael.Create();
              using (CryptoStream cStream = new CryptoStream(fStream, RijndaelAlg.CreateDecryptor(key, IV), CryptoStreamMode.Read))
              {   //Here you have a choice. If you want it to only ever exist decrypted in memory then you have to use the method in
                  // the linked answer.
                  //If you want to run it from a file than it's easy and you save the file and run it, this is simple.                                               
                  cStream.CopyTo(outFStream);
              }
           }
           Process.Start(Environment.SpecialFolder.MyDocuments + "crpTemp.exe");
        }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to edit the ASP.NET MVC templates for Visual Studio so that
As I've only ever used Visual Studio for .NET development, I would like to
I'm a ASP.NET MVC Visual Studio, SQL Server web developer. I would like to
I would like to see some statistic and visual states of my git repository.
I have a class library written in .Net that I would like to make
I would like to create some test web applications with Visual Studio 2010 Express
I would like to use Visio to mockup a few ASP.NET interfaces that I
I'm working on Visual Studio in an x86. I would like to build my
I'm using ASP.NET MVC and would like to get Model information for use within
I would like to debug a .NET application that fails immediately on startup (and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.