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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:43:17+00:00 2026-05-27T23:43:17+00:00

In fact, private methods are implemented in C# that can still be searched with

  • 0

In fact, private methods are implemented in C# that can still be searched with Reflection.

What I am going to do is to write public string Encrypt(string data) and private string Decrypt(string cipher) methods to perform encryption and decryption.

Unfortunately, if someone knows .NET framework, he can use Reflection to find Decrypt methods and it decrypt everything that is encrypted.

It seems that is not that secure. So I want to make Decrypt method to truly private method.

But how to do that?


Updated 09 Jan 2012 10:52PM Sydney Time

bdares provides the technical explanation of this question

Eric Lippert provides the political explanation of this question

Thanks both experts!

  • 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-27T23:43:18+00:00Added an answer on May 27, 2026 at 11:43 pm

    You can’t. If the attacker has access to your code, compiled or source, he can trace your program and find where it’s being encrypted or decrypted.

    You can add a layer of security by storing the key in a separate location, but generally if the attacker is executing code on your server, you’re already screwed.

    (You’re only worried about this if the attacker is executing code on your server, because otherwise it doesn’t matter whether or not the method is private. Also, he can’t use reflection to find method names unless he’s executing code on your server. In short: you’re worrying about the wrong thing here.)

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

Sidebar

Related Questions

It's a known fact that Windows applications usually have 2Gb of private address space
Will the fact that java class files can be decompiled and need of third
I have a private class, User that implements an interface, IQMUser, with public static
I assume that public or private static targets must have reduced memory usage, due
Fact: I'm not that good with jQuery. Problem: I have a form containing dynamically
The fact that Delicious has two sets of API authentications one with username and
Can a fact table have no keys at all? or if it can, is
I noticed that the fact tables used in a cube were actually views. Infact
Other than the fact that PNG is a more common image format, is there
...besides the fact that I am a total amateur? My table is set up

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.