C#: DLL as Embbeded Resource

Posted on 2009-12-18
Last Modified: 2013-12-17
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                  *  
Question by:Mister_Spock
    LVL 4

    Accepted 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.
    LVL 5

    Expert Comment

    You can embed encrypted xml in your project and decrypt it in the run time.
    Hope this will help you
    LVL 4

    Expert Comment


    Please consider the timing of both questions.

    Thanks :)
    LVL 3

    Author Closing Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video discusses moving either the default database or any database to a new volume.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now