• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 416
  • Last Modified:

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                  *  
  • 2
1 Solution

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.

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now