473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Regex Assembly security


Hi,

I'm now nearing the completion of my first c# development. I have two applications. The first is
a simple database app that uses an Access database to store Regex strings along with a
description and various flags. This application has an export facility that compiles the Regexs
to an assembly and produces a flat file containing the descriptions and flag settings.

The second application, uses the Regex assembly and flat file to allow grouped Regex's to be ran
against the contents of files.

Everything is working correctly in the applications, however I would like to secure the Regex
assembly to prevent the underlying Regex's being easily stolen / used by a third party.

Currently, the Regex strings can be easily viewed using ILDASM. Also, how can I secure the
assembly from being used by a thirdparty?

I found this article: http://www.codeguru.com/Csharp/Cshar...cle.php/c8329/
but that assumes that I have the access to the Classes in the assembly to be able to use the
StrongNameIdentityPermissionAttribute.

The code to create the Assembly in the first Application is as follows:

AssemblyName assembly = new AssemblyName();
assembly.Name = "Scanlib";
assembly.Version = new Version ("1.0.0.0");
assembly.CultureInfo = new CultureInfo ("en-GB");
assembly.HashAlgorithm = AssemblyHashAlgorithm.SHA1;
assembly.CodeBase = String.Concat ("file:///", Directory.GetCurrentDirectory());
assembly.VersionCompatibility = AssemblyVersionCompatibility.SameProcess;
assembly.Flags = AssemblyNameFlags.PublicKey;
assembly.KeyPair = new StrongNameKeyPair (File.Open ("PublicPrivateKeyFile.snk",
FileMode.Open,FileAccess.Read));

Regex.CompileToAssembly( myRegexs.ToArray() , assembly );
The second Application, loads in the Assembly and then uses Reflection to store the Regexs
types for later use.

myassembly = Assembly.LoadFrom ("MyRegexAssembly.dll");
string strlibName = "MyRegex.Regex" + uniqueKey;
mytype = myassembly.GetType ( strlibName );


--
----------------------------------------------
Posted with NewsLeecher v3.0 Final
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------
Nov 17 '05 #1
0 1181

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Thomas Christmann | last post by:
Hi! I have a rather special question here. I'd like to write a wrapper for a .NET assembly, and register that on my server so that the people on my server call my assembly instead of the...
3
by: Jon Maz | last post by:
Hi All, Am getting frustrated trying to port the following (pretty simple) function to CSharp. The problem is that I'm lousy at Regular Expressions.... //from...
3
by: Daylor | last post by:
hi. im loading assembly from my computer and createInstance from it. till now it worked ok. now, im changing the path from : c:\myfolder\myassembly.dll to
2
by: John Grandy | last post by:
Is it advisable to compile a Regex for a massively scalable ASP.NET web-application ? How exactly does this work ? Do you create a separate class library and expose the Regex.Replace() as a...
8
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's...
3
by: jlea | last post by:
I'm receiving the error message shown below when I try to load an aspx file (C# web application) on our server. The web application works fine if I remove the reference to the dll so I know the...
2
by: Martin Hart | last post by:
I have a connection string that I would like to extract a part from, but my knowledge does not extend far enough to resolve my problem. I can have strings like: "Integrated Security=SSPI;Persist...
1
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
14
by: ohmmega | last post by:
hy, i've got a simple question (for somebody who already knows the answer) about regex: i've a string like bla@bla@bla or bla@@bla i like to check the @'s, but couldn't figure it out how to set...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.