Link to home
Start Free TrialLog in
Avatar of zonkerman
zonkermanFlag for United States of America

asked on

Is There A Way To Protect Strings Inside A C# Program Without An Obfuscator?

I have a C# program which needs to invoke a function with parameter data.  I don't wan't the parameter data to be viewable by someone using a disassembler. I would prefer to put the parameter inside the program itself.  Puting the data in an external encrypted file does little because someone with a disassembler only needs to view the programs internal routine that decrypts it and they have it.  

Is there some kind feature on C# where I can specify a text string to not be viewable? Or is there some compiler option to scramble the text so that it does not look like the original yet the program compiled code knows what the value should be?

This program has to run on a PC that is not network connected so putting the parameter data in a database won't work.  Passing in the values on the command line won't do much either because with a dissembler they just see which routine reads the command line and get the values from there.
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

tricky question, I feel the final answer will be no, but need more information about your requirement:
where are the calling and called methods? same application? same machine?
where is the string generated? what kind of information? is it some kind of random key?
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zonkerman


I ended up just spending more time making the program more difficult to see what I was doing. Luckily the comments appear to be stripped out when compiled so I had to put lots of comments in the source to tell me what the program had become because without them I myself could not easily see what was what. Blah what a chore.