C#: DLL as Embbeded Resource

I have two files, one is an EXE the other is a DLL (Class Library). I have embedded an XML file with sensitive data and the DLL is added as a reference to the EXE file. If the DLL is opened with Notepad, most of the information is encoded but the nodes containing the sensitive text are readable. Is there a way to encode the XML file or make the DLL so it cannot be opened by an end user?

DLL file:
Þ!  Þ    ~  o*  
:óþÿÿ+  *    Ý &  (  
*ë   <?xml version="1.0" encoding="utf-8"?>
 BSJB        v2.0.50727     l     #~  |  l  #Strings    è  x   #US `     #GUID   p  X  #Blob         W          ú3                  *  
Who is Participating?
xoperatorConnect With a Mentor Commented:

If you are dealing with a sensitive data I'd better make sure is encrypted BEFORE you embed it in the DLL.
You can use any encryption you want, take the XML, encrypt it and embed it.
When you will open the file from the DLL simply decrypt it first and use it.

You can use the encryption method advice on the following link:


Please tell me if you need anything else.
You can embed encrypted xml in your project and decrypt it in the run time.
Hope this will help you


Please consider the timing of both questions.

Thanks :)
Mister_SpockAuthor Commented:
Thanks for the example code. I am a DIY person so I am re-writing (mostly word for word) so I can understand what it is the code is doing. I hate it when someone uses "copy \ paste". What did they learn other than how to get someone else to do the work for them?
Merry Christmas and thank you again.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.