Write to a file in a dll

  • Thread starter Thread starter WStoreyII
  • Start date Start date
W

WStoreyII

Is There anyway to write to a file in a dll.

Like lets say i packaged an xml file called customers as a resource in a dll
is there any way that i could write to and or append the changes to it so
that it will be secure inside the dll for security purposes?

WStoryeII
 
Self modifying code is not a trivial thing at any pace, but I would expect
that it comes a bit more difficult in the managed code arena.

Why not juts look into the new managed technologies of serialized objects
and cryptography. I wrote a bit of code that writes a class out to a file
that is encrypted with DES using a binary formatter and it only took me
about 2 hours using example code I found on the internet.

Of course I would then recommend that you obfuscate the code to hide your
keys and protect your entire assembly used to access your file, but that is
really the trivial part of it.
 
WStoreyII,
I'm not sure how having the XML in a DLL is secure. Its easy enough to read
an embedded resource from an assembly...

I would think having the XML encrypted, using the
System.Security.Cryptography.CryptoStream class would be significantly more
secure.

The only way I know of to write to a file in a dll, is to use one of the
compilers and recompile your assembly, or use al.exe to embed a resource.
Unfortunately you will need to be certain that the assembly was not loaded
(effectively has no code). I don't remember if al.exe is part of the .NET
SDK or the runtime.

Hope this helps
Jay
 
Back
Top