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 8879035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:51:32+00:00 2026-06-14T19:51:32+00:00

I need to pass secure information to an executable in my application. In other

  • 0

I need to pass secure information to an executable in my application. In other words I have the line:

Process.Start("someExecutable.exe","MyUsername, myPassword");

I want to prevent people from seeing those parameters. (The username and password are specified by the user at run time so I do not have to worry about those parameters).

Now a problem that I have now is: If someone replaces someExecutable.exe with their own program they will be able to see the credentials!

For future reference I refere to someExecutable.exe (program I am sending the credientials as arguments as ) A and I will refere to the executable created by this program as B

I will like to prevent that problem here are some solutions I have think of:

  1. Compute the hash of A and check it before executing it.

    static bool? VerifyThatExeIsReliable(string pathOfExe)
    {
        if (System.IO.File.Exists(pathOfExe) == false)
            return null;            
    
        var bytes = System.IO.File.ReadAllBytes(pathOfExe);
    
        using (SHA1Managed a = new SHA1Managed())
        {
            var hash = a.ComputeHash(bytes);
    
            StringBuilder formatted = new StringBuilder(2 * hash.Length);
            foreach (byte b in hash)                
                formatted.AppendFormat("{0:X2}", b);                
    
            var code = formatted.ToString();
    
            if (code == "4835658749AF89A65C5F4835658749AF89A65C5F")
                return true;
        }            
    
        return false;
    }
    

    the problem with this approach is that the hash 4835658749AF89A65C5F4835658749AF89A65C5F will be stored in the executable A and if someone opens this program with a hex editor he is going to be able to find the hash and modify it. In other words they will calculate the sha1 hash of the program they write and place that hash instead of 4835658749AF89A65C5F4835658749AF89A65C5F

  2. Use a the file Watcher class to detect when the file has been modified. If my program is not running I will not be able to detect this

  3. make sure that the user is not able to see the command line arguments passed to that executable: See command line arguments being passed to a program

  • 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-06-14T19:51:33+00:00Added an answer on June 14, 2026 at 7:51 pm

    To solve the problems with option #1, Use asymmetric encryption on the hash, that way your program (and the user) will only be able to decrypt the hash, not encrypt a different one. Of course if they can edit compiled C# code then you can’t stop them from altering it to not decrypt the hash, but that requires a lot more time and expertise.

    To solve problem #2, store a hash of executable A in your program, and verify that executable A matches the hash before starting it.

    As for #3, as far as I am aware there is no way to resolve the problem. However, if you are able to modify the target program you could send the username and password via an encrypted network socket, for example.

    Note also that it is possible to reverse engineer .NET applications, and that you should possibly consider running some kind of obfuscation tool on your executable if security is important to you. Ultimately its not about making the program 100% tamper-proof, because that is impossible. Its about making it not worth the bother to anyone who would have a reason to do so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these typedefs the problem is I need pass a secure socket as
I have a .NET program and a Borland Win32 program that need to pass
I want to pass information to athenticate a user to an XBAP application running
secure way to pass large string values between pages, i have used PHP in
I need a way to pass a variable between two page in a secure
I need to pass an extra parameter :mobilejs => true from jQuery to a
I need to pass argument to JNLP dynamically for which I tried using a
I need to pass Cursor object to another activity, what is the best way
I need to pass a variable which is captured from client side via jquery
I need to pass a parameter from an EditText and when I click the

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.