473,795 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Slowass license provider

Nak
Hi there,

I just made my own license provider (at last!) that uses signed XML
license files. When the license provider gets the license it does the
following,

*At runtime

1) Gets the signed XML license file from the calling assemblys resources
2) Gets the public RSA key from the calling assemblys resources
3) Attempts the validate the signature

*At design time

1) Gets the signed XML license file from same path the binary is
executing from (i.e. Obj\Debug or Obj\Release)
2) Gets the public RSA key from same path the binary is executing from
(i.e. Obj\Debug or Obj\Release)
3) Attempts the validate the signature

This works fine, and it seems to be quite a reliable method of control
licensing with 1 exception. It's damn slow!

Check this out, I timed the creation and disposal of 2 types of control,
1 licensed via my method and 1 not licensed at all. I timed how many could
be created in 1 minute in both circumstances and these were my results,

* I created 3,456,717 un-licensed controls in 1 minute

* I created 438 licensed controls in 1 minute

On closer inspection it turns out that the GetLicense method starts at
about 578ms then jumps around 94ms and 250ms each time. So obviously this
greatly reduces the speed of creating large numbers of controls. I would
ideally like to speed this up and I believe that there is a way to cache the
license file and possibly the public key too.

So that leaves me asking if anyone has any idea how I can create my own
LicenseContext class and get it passed to my license provider so that I can
use the SetSavedLicense Key and the GetSavedLicense Key methods (unless of
course there is another way around this). I have found an example from the
Windows Forms web site that creates a licensed component class, but I'm not
quite sure if this is what I need or not as this would intil creating lots
of derived classes from the licensed one.

Anyways, thanks for your time and I look forward to any suggestions!

Nick.
Nov 21 '05 #1
5 1621
Hi Nick,

Here is the link about create customlicenseco ntext, you may take a look.
http://www.windowsforms.net/Samples/...mId=123&tabind
ex=4

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.

Nov 21 '05 #2
Nak
Hi Peter,

<quote>...
"I have found an example from the Windows Forms web site that creates a
licensed component class, but I'm not
quite sure if this is what I need or not as this would intil creating lots
of derived classes from the licensed one."

I know it was a bit of a long question so never mind. I think I have
just found out something quite interesting. *ALL* Licensed objects via a
license provider are "slowass" at being created in comparrison to unlicensed
controls, which would explain any bottle necks in my application. My PC is
making around 749,862 standard LicFileLicenseP rovider licensed controls in 1
minute too.

I have thought of 1 idea to help speed up the process but it doesnt seem
to make any difference, I have created a custom attribute that allows you to
specify the public key to verify the XML file with, it seems that retrieving
data from an assemblys resources actually takes very little time. So at
the moment I am looking for another bottle neck and all I can think it is;
is that the license key for that type is *not* being cached, if it were it
would take very little to no time at all to create the 2nd object.

I *think* this is all the licene context does, *but* the example on
Windows Forms does *not* use a license provider and I must as I am wanting
to license any class via my own license provider so that I can in-turn sell
this product as a licensing solution. Surely other XML based licensing
systems arent this slow so it must be something I'm missing! :-(

Nick.
""Peter Huang"" <v-******@online.m icrosoft.com> wrote in message
news:hB******** ******@cpmsftng xa10.phx.gbl...
Hi Nick,

Here is the link about create customlicenseco ntext, you may take a look.
http://www.windowsforms.net/Samples/...mId=123&tabind
ex=4

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.

Nov 21 '05 #3
Nak
Hi again,

Even more scary results, I have managed to implement a custom
LicenseContext by altering the license managers context when my application
loads, now it caches the resource file in the form of a string in a
hashtable and the public key is passed via a custom attribute but it is
*still* as slow as a sloath swimming in molasses! So this leads me to
believe that it is the XML signature verification that is slow, this is my
routine,

-----------------------------------

Private Function verifyViaString (ByVal iType As Type, ByVal iLicense() As
Byte, ByVal iPublicKey As String) As Boolean
Try

'Firstly we load the XML license from a byte array into a memory
stream

Dim pMSmInput As New MemoryStream(iL icense)

'Then we load it into the XML document object

Dim pXDtXMLDoc As New XmlDocument()
Call pXDtXMLDoc.Load (pMSmInput)

'Then we create a new signature object

Dim pSXlSigned As New SignedXml(pXDtX MLDoc)
Dim pXNeSig As XmlNode =
pXDtXMLDoc.GetE lementsByTagNam e("Signature" ,
SignedXml.XmlDs igNamespaceUrl) (0)
Call pSXlSigned.Load Xml(CType(pXNeS ig, XmlElement))

'Then we set the public key to verify with

Dim pStrKey As String = iPublicKey

'The following check is used as an internal precauting within my
application

If (Not (pStrKey Is Nothing)) Then

'Then we create the CSP object to verify the signature with

Dim pRSACrypto As RSACryptoServic eProvider = New
RSACryptoServic eProvider()
Call pRSACrypto.From XmlString(pStrK ey)

'Lastly we verify the signature

If (pSXlSigned.Che ckSignature(pRS ACrypto)) Then
Return (True)
End If
End If
Finally
End Try
End Function

-----------------------------------

My understanding is that this is as fast as this method could possibly
be, but surely slowing it down as much as it is is not a viable solution.
Has anyone any ideas on how I can speed this little method up maybe? Or an
alternative method?

Nick.

"Nak" <a@a.com> wrote in message
news:e5******** ******@tk2msftn gp13.phx.gbl...
Hi Peter,

<quote>...
"I have found an example from the Windows Forms web site that creates a
licensed component class, but I'm not
quite sure if this is what I need or not as this would intil creating lots
of derived classes from the licensed one."

I know it was a bit of a long question so never mind. I think I have
just found out something quite interesting. *ALL* Licensed objects via a
license provider are "slowass" at being created in comparrison to
unlicensed controls, which would explain any bottle necks in my
application. My PC is making around 749,862 standard
LicFileLicenseP rovider licensed controls in 1 minute too.

I have thought of 1 idea to help speed up the process but it doesnt
seem to make any difference, I have created a custom attribute that allows
you to specify the public key to verify the XML file with, it seems that
retrieving data from an assemblys resources actually takes very little
time. So at the moment I am looking for another bottle neck and all I
can think it is; is that the license key for that type is *not* being
cached, if it were it would take very little to no time at all to create
the 2nd object.

I *think* this is all the licene context does, *but* the example on
Windows Forms does *not* use a license provider and I must as I am wanting
to license any class via my own license provider so that I can in-turn
sell this product as a licensing solution. Surely other XML based
licensing systems arent this slow so it must be something I'm missing! :-(

Nick.
""Peter Huang"" <v-******@online.m icrosoft.com> wrote in message
news:hB******** ******@cpmsftng xa10.phx.gbl...
Hi Nick,

Here is the link about create customlicenseco ntext, you may take a look.
http://www.windowsforms.net/Samples/...mId=123&tabind
ex=4

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.


Nov 21 '05 #4
Nak
AAaaah, and dumb I surely am!

I was caching the license keys in the context but still verifying them, and
in theory if a license key has already been verified in order to be cached
there is no point in verifying it again, so I just create a new license with
that key and return it straight away! Bobs your aunty or whatever and now
over 1 million licensed controls per minute! ;-)

Nick.

"Nak" <a@a.com> wrote in message
news:Od******** ******@TK2MSFTN GP15.phx.gbl...
Hi again,

Even more scary results, I have managed to implement a custom
LicenseContext by altering the license managers context when my
application loads, now it caches the resource file in the form of a string
in a hashtable and the public key is passed via a custom attribute but it
is *still* as slow as a sloath swimming in molasses! So this leads me to
believe that it is the XML signature verification that is slow, this is my
routine,

-----------------------------------

Private Function verifyViaString (ByVal iType As Type, ByVal iLicense() As
Byte, ByVal iPublicKey As String) As Boolean
Try

'Firstly we load the XML license from a byte array into a memory
stream

Dim pMSmInput As New MemoryStream(iL icense)

'Then we load it into the XML document object

Dim pXDtXMLDoc As New XmlDocument()
Call pXDtXMLDoc.Load (pMSmInput)

'Then we create a new signature object

Dim pSXlSigned As New SignedXml(pXDtX MLDoc)
Dim pXNeSig As XmlNode =
pXDtXMLDoc.GetE lementsByTagNam e("Signature" ,
SignedXml.XmlDs igNamespaceUrl) (0)
Call pSXlSigned.Load Xml(CType(pXNeS ig, XmlElement))

'Then we set the public key to verify with

Dim pStrKey As String = iPublicKey

'The following check is used as an internal precauting within my
application

If (Not (pStrKey Is Nothing)) Then

'Then we create the CSP object to verify the signature with

Dim pRSACrypto As RSACryptoServic eProvider = New
RSACryptoServic eProvider()
Call pRSACrypto.From XmlString(pStrK ey)

'Lastly we verify the signature

If (pSXlSigned.Che ckSignature(pRS ACrypto)) Then
Return (True)
End If
End If
Finally
End Try
End Function

-----------------------------------

My understanding is that this is as fast as this method could possibly
be, but surely slowing it down as much as it is is not a viable solution.
Has anyone any ideas on how I can speed this little method up maybe? Or an
alternative method?

Nick.

"Nak" <a@a.com> wrote in message
news:e5******** ******@tk2msftn gp13.phx.gbl...
Hi Peter,

<quote>...
"I have found an example from the Windows Forms web site that creates
a licensed component class, but I'm not
quite sure if this is what I need or not as this would intil creating
lots of derived classes from the licensed one."

I know it was a bit of a long question so never mind. I think I have
just found out something quite interesting. *ALL* Licensed objects via a
license provider are "slowass" at being created in comparrison to
unlicensed controls, which would explain any bottle necks in my
application. My PC is making around 749,862 standard
LicFileLicenseP rovider licensed controls in 1 minute too.

I have thought of 1 idea to help speed up the process but it doesnt
seem to make any difference, I have created a custom attribute that
allows you to specify the public key to verify the XML file with, it
seems that retrieving data from an assemblys resources actually takes
very little time. So at the moment I am looking for another bottle neck
and all I can think it is; is that the license key for that type is *not*
being cached, if it were it would take very little to no time at all to
create the 2nd object.

I *think* this is all the licene context does, *but* the example on
Windows Forms does *not* use a license provider and I must as I am
wanting to license any class via my own license provider so that I can
in-turn sell this product as a licensing solution. Surely other XML
based licensing systems arent this slow so it must be something I'm
missing! :-(

Nick.
""Peter Huang"" <v-******@online.m icrosoft.com> wrote in message
news:hB******** ******@cpmsftng xa10.phx.gbl...
Hi Nick,

Here is the link about create customlicenseco ntext, you may take a look.
http://www.windowsforms.net/Samples/...mId=123&tabind
ex=4

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.



Nov 21 '05 #5
Hi Nick,

It is cool that you have resolved the problem.
Cheers!

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.

Nov 21 '05 #6

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

Similar topics

11
2770
by: gooze | last post by:
Hi I know, this might be the wrong place for such a question, but maybe you can redirect me to the right place to post. I wrote a small software under the GNU General Public License and put it on freshmeat.net for download. Now, someone likes this software and wants it to integrate into his own software as a module. This software is for sale. Is there a meaningfull solution about this issue? I just would like to give a "common" answer...
8
2882
by: madcap | last post by:
Hi, Our company was looking for contract programmer to develop an internet/intranet application. We were approached by a freelancer who have quite a lot experience and his resume was impressive. But he did mention that if we download php & mysql and use the application developed within our company, we should be fine and there will not be any legal issues. While some of the folks see this as a low cost solution, others are concerned...
34
2645
by: Michael Foord | last post by:
I'd like to formalise slightly the license I release my projects under. At the moment it's 'free to use, modify, distribute and relicense'. This is basically fine as I don't want t oprevent people using my work in commercial settings - but I would like to retain the right to be identified as the author. I'd also like to prevent people selling derivative works where my stuff forms the substantial part of the poduct. I'd prefer to use an...
9
2184
by: Daniel Keep | last post by:
I'm currently working on a Python program, and was wondering if it's possible to license the program, some associated tools, and a few other libraries I've written under the Python license. I had a look at the new PSF Python license on the list of OSI-approved licenses, but it makes numerous direct mentions of Python and the PSF. Is there any acceptable way to simply say that a particular source file is under the PSF license (like you...
1
2470
by: Mark Ramey | last post by:
I have an assembly that I want to license to developers. I don't want to license the runtimes that they deliver to their customers. There are no real design-time controls, only some classes that they use by referencing the assembly. If I implement the LicenseManager stuff the LicenseContextMode of any object is always 'Runtime' which makes sense. How can I tell if the assembly is being used for development and not in the resulting...
0
829
by: Nak | last post by:
Hi there, Is it possible to get a reference to the current license provider? I'm presuming that only 1 instance is made of each license provider type by the LicenseManager but I would like to know if it is possible to get this object? I'm hoping that you say "No", but knowing my luck one of you knows how to get it.
51
3280
by: mojosam | last post by:
I've been watching the flame war about licenses with some interest. There are many motivations for those who participate in this sector, so disagreements over licenses reflect those agendas. I don't have an agenda, at least not right now. I do plan on writing a few programs. These will be tools I need for firmware testing. They will be relatively simple things like tools for breaking down data by its structure for easy viewing,...
4
2128
by: Martitza | last post by:
Hi. I work for a small company (actually in process of forming) interested in embedding or extending python as part of our commercial non-open-source product. We have legal counsel, but are interested in the spirit as well as the letter of the law. Not much seems to have been written about the python license since version 2, so pointers to more recent discussions or contacts are appreciated. If this is not the right place to ask these...
14
4510
by: Frank Rizzo | last post by:
I've been given a project to work with which involves connecting to MySQL from .NET 2.0 app. I've googled looked and there is a metric ton of different MySQL ADO.NET providers from different people. Is there a consensus on which one is the most stable, more or less supported and has good support for the standard MySQL features (e.g. stored procs)? Regards.
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7543
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.