Recursion issues

  • Thread starter Thread starter Nak
  • Start date Start date
N

Nak

Hi there,

I was wondering what the normal procedure for making a license provider
require licensing was?

I have just created a licensing class library and I want to make it
require a license to be used, but I cannot protect the license provider with
itself as you just get a massive recursion issue taking place. Can I
protect my own "protector"? :-\

Nick.
 
Ahem, well, cant you just instantiate a new one ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
What do you mean? My class needs to be licensed or any tom dick and harry
could use the class library to protect their applications. But I dont seem
to be able to protect anything within it! :-\

Nick.
 
I think I'll give a quick example, incase I'm missing something really
obvious here,

My licensing class library contains several classes for licensing
applications and controls, the main ones which the developer interacts with
are

myLicenseProvider
^ A license provider that does the main business

and

myLicenseAttribute
^ A custom attribute which is used to pass addition information to the
license provider upon initialization

Protecting anything becomes really easy with this, you basically do exactly
as you would with a LicFileLicenseProvider with the exception that you need
to include another attribute for each licensed class to set some extra
properties which are essential to getting a valid license.

For example,

<LicenseProvider(GetType(myLicenseProvider)), _
npLicenseAttribute(..parameters are passed here but are irrelivant...)> _
Public Class Class1

Private cLicLicence As npLicense

Public Sub New()
cLicLicence = CType(LicenseManager.Validate(GetType(Class1), Me),
npLicense)
End Sub

Protected Overrides Sub Finalize()
MyBase.Finalize()
If Not (cLicLicence Is Nothing) Then
cLicLicence.Dispose()
cLicLicence = Nothing
End If
End Sub
End Class

This is great and suits me down to the ground, *but* I want to use this same
method of licensing to protect "myLicenseProvider". Now in theory this is
impossible as the license provider would need to create a new license
provider to validate its license and the provider that it creates would have
to do likewise, hence forth an endless loop has occured.

The same goes for *any* other object used in myLicenseProvider that I have
created, I cannot license them as they will recurse themselves into a big
hole of muchness. The only thing that I can think of is to put code into
the class constructor of myLicenseProvider to call its internal routines and
validate its own license before it does anything else, but surely this is a
bit of a bodge isn't it? How would this normally be tackled, I'm trying not
to make things slack as I want to rely on this class library for all my
future projects.

Nick.
 
Perhaps, you could create a public property as an integer (0=non self >0
means self )called something like validatingSelf; this would be set to true
if the reference was to Me, each function would check this and execute if
this value was 0 or <2.

How about that ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
Hi OHM,

Thanks for the idea, I've managed to get something working, what I've
done is I've made a selfvalidation method inside of the licenseprovider
class, this is the first thing thats called when the licenseprovider is
called upon, if it returns false then a null referenced license is returned.
It seems to have the desired effect. I've kind of been thinking, surely I
only need to license this 1 class within the class library as this is the
only one that does the magic. I'm hoping anyway, that and panicing about
how easy it is for .NET reflector to disasembly my code to its orignal
source, which kind of destroys the good work Ive done in making a licensing
application if all you need to do is decompile 1 class library and remove a
couple of lines :-( Oh well, thanks for the idea :-) I hate recursion!

Nick.
 
Hi Nick,

If you wants to protecte your code from being disassembled, you may try to
use the obfuscation.
VS.NET IDE 2003 shipped with one community version of Obfuscation,
dotfuscator.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dotfuscator
/dotf6duz.asp

You may take a look and let me know if that helps you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Peter,

I dont have VS.NET 2003, I have VB.NET Standard 2002. I've tried a few
demos of commercial products but havent been massively impressed by the
results, especially considering the claims. One thing I wasnt aware of
until yesterday was that you can disable strong name checking on an
assembly! What is the point of using it if it can be disabled!! Half of me
thinks that the reason .NET code is so insecure is so that *anyone* can read
it, i.e. Microsoft!

Anyway, enough of my thoughts on that subject. I shall keep looking
around for an effective obfuscator, if you know of any *good* ones that
require very little interaction please let me know :-)

Nick.
 
Hi Nick,

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top