Click here to Skip to main content
15,906,296 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends:

Can we encrypt a method in C# like T-sql?

For example in T-sql we can encrypt a view or stored procedure by inserting the code <<With Encryption>>. Do we have the same code in c# for encrypting a method?

Yours
Posted
Comments
Sergey Alexandrovich Kryukov 4-Jul-12 14:51pm    
1) What is is supposed to mean? 2) Why?
Encrypting normally means protecting some information. So, you should explain what exactly you want to protect (the algorithm from being learned, or to limit a possibility to reverse-engineer the code, or limit the possibility to call the method from some other application -- what exactly).
--SA
Mmohmmad 5-Jul-12 4:38am    
Dear Kryukov :

Thanks for your reply. I want to secure the algorithm from being learned.

I do not want somebody to extract my procedure.

[no name] 5-Jul-12 1:50am    
Use Dotfuscator in VS
This will encrypt the dll or exe.
Mmohmmad 5-Jul-12 4:35am    
Dear 2irfanshaikh:

thanks for your answer. could you please explain more how can i find it or give me a refrences?

yours

1 solution

Hi,

I think thats not possible but it depends what you want to achieve.
If declaring your Method as Private isn't enough you should obfuscate your code (string/byte/...encryption).
Another crazy idea what I'm thinking about now is to write your method in a file and de/encrypt it when you want to use it, but I think it's not the best solution.

With best Regards
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900