• 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"?>
<HNeedles>
  <CurrentPassword>Cry$tal</CurrentPassword>
  <FirstPreviousPassword>Sn0wFall!</FirstPreviousPassword>
  <SecondPreviousPassword>1stFr0st</SecondPreviousPassword>
</HNeedles>
 BSJB        v2.0.50727     l     #~  |  l  #Strings    è  x   #US `     #GUID   p  X  #Blob         W          ú3                  *  
                
...
0
Mister_Spock
Asked:
Mister_Spock
  • 2
1 Solution
 
xoperatorCommented:
Hey,

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:

http://www.codeproject.com/KB/files/encryption.aspx

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

http://davidhayden.com/blog/dave/archive/2005/11/22/2580.aspx
0
 
xoperatorCommented:
Hey,

Please consider the timing of both questions.

Thanks :)
0
 
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.
0

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