Activation/licensing techniques?

Just starting out? Need help? Post your questions and find answers here.
Slyvnr
User
User
Posts: 58
Joined: Wed Jun 27, 2007 10:10 pm
Location: USA
Contact:

Re: Activation/licensing techniques?

Post by Slyvnr »

I am working on this same problem. I have finally found a low-cost solution that is out there and am just trying to integrate into my software.

Go to Kagi.com (store front for doing sales of your digital product)
Go to softworkz.com (Software Licensing and Activation Code Generator)

Softworkz.com is fully integrated into Kagi.com and Softworkz.com will be paid from Kagi.com for each activation. Therefore, you are never out of pocket for the activation. Kagi.com does the sale and collects the fee from the end user, sends a request for an activation key to softworkz.com. Softworkz.com sends email to end user with activation key. End user enters activation key into your product, your product calls a softworkz dll that verifies and activates. I have an purebasic include file for the softworkz.com dll for all the dll functions. I am however having one problem that I will be posting in another thread.

So far, everything works great.

Here is the include file for the softworkz dll (which is called DNA.dll)

Code: Select all

Global DNAdll.l

Enumeration
     #ERR_NO_ERROR=0
     #ERR_ACTIVATIONS_EXCEEDED = -3
     #ERR_DNA_DISABLE = -2
     #ERR_VALIDATION_WARNING = -1
     #ERR_NO_CONNECTION = 1
     #ERR_CONNECTION_LOST = 2
     #ERR_LOCKOUT = 3
     #ERR_INVALID_COMMAND = 4
     #ERR_INVALID_PRODUCT_KEY = 5
     #ERR_INVALID_ACTIVATION_CODE = 6
     #ERR_INVALID_PASSWORD = 7
     #ERR_ACTIVATION_EXPECTED = 8
     #ERR_REACTIVATION_EXPECTED = 9
     #ERR_BANNED_ACTIVATION_CODE = 10
     #ERR_NO_EMAIL_PROVIDED = 11
     #ERR_INVALID_BUILD_NO = 12
     #ERR_EVAL_CODE_ALREADY_SENT = 13
     #ERR_EVAL_CODE_UNAVAILABLE = 14
     #ERR_CDM_HAS_EXPIRED = 15
     #ERR_CODE_HAS_EXPIRED = 16
     #ERR_INVALID_NEW_PASSWORD = 17
     #ERR_CDM_WRITE_PROTECTED = 18
     #ERR_CANCELLED_BY_USER = 98
     #ERR_OPERATION_FAILED = 99
EndEnumeration

;procedure to Open DNA.dll
Procedure UseDNAdll()
     DNAdll=OpenLibrary(#PB_Any,"DNA.dll")
EndProcedure

;release DNA.dll resources
Procedure FreeDNAdll()
     CloseLibrary(DNAdll)
EndProcedure

; Procedures from DNA.dll 
Procedure DNA_Activate(product_key.s, activation_code.s, password.s, email.s)
     ProcedureReturn CallFunction(DNAdll,"DNA_Activate", @product_key, @activation_code, @password, @email)
EndProcedure
     
Procedure DNA_ActivateOffline(product_key.s, activation_code.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_ActivateOffline",@product_key, @activation_code)
EndProcedure

Procedure DNA_Reactivate(product_key.s, activation_code.s, password.s, new_password.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Reactivate", @product_key, @activation_code, @password, @new_password)
EndProcedure

Procedure DNA_Validate(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Validate", @product_key)
EndProcedure

Procedure DNA_Validate2(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Validate2", @product_key)
EndProcedure

Procedure DNA_Validate3(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Validate3", @product_key)
EndProcedure

Procedure DNA_Validate4(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Validate4", @product_key)
EndProcedure

Procedure DNA_Validate5(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Validate5", @product_key)
EndProcedure

Procedure DNA_ValidateCDM(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_ValidateCDM", @product_key)
EndProcedure

Procedure DNA_ValidateCDM2(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_ValidateCDM2", @product_key)
EndProcedure

Procedure DNA_ValidateCDM3(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_ValidateCDM3", @product_key)
EndProcedure

Procedure DNA_ValidateCDM4(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_ValidateCDM4", @product_key)
EndProcedure

Procedure DNA_ValidateCDM5(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_ValidateCDM5", @product_key)
EndProcedure

Procedure DNA_Deactivate(product_key.s, password.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Deactivate", @product_key, @password)
EndProcedure

Procedure DNA_SendPassword(product_key.s, activation_code.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_SendPassword", @product_key, @activation_code)
EndProcedure

Procedure DNA_Query(product_key.s, activation_code.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_Query", @product_key, @activation_code)
EndProcedure

Procedure DNA_InfoTag(product_key.s, activation_code.s, tag.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_InfoTag", @product_key, @activation_code, @tag)
EndProcedure

Procedure DNA_SetBuildNo(build_no.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_SetBuildNo", @build_no)
EndProcedure

Procedure DNA_SendEvalCode(product_key.s, email.s, machineID.i)
     ProcedureReturn CallFunction(DNAdll, "DNA_SendEvalCode", @product_key, @email, machineID)
EndProcedure

Procedure DNA_SetCDMPathName(pathname.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_SetCDMPathname", @pathname)
EndProcedure

Procedure DNA_SetINIPathName(pathname.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_SetINIPathName", @pathname)
EndProcedure

Procedure DNA_ProtectionOK(product_key.s, Request_EvalCode.i, machineID.i)
     ProcedureReturn CallFunction(DNAdll, "DNA_ProtectionOK", @product_key, @Request_EvalCode, machineID)
EndProcedure

Procedure DNA_SetProxy(server.s, port.s, username.s, password.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_SetProxy", @server, @port, @username, @password)
EndProcedure

Procedure DNA_SetLanguage(language.i)
     ProcedureReturn CallFunction(DNAdll, "DNA_SetLanguage", language)
EndProcedure

Procedure DNA_EvaluateNow(product_key.s)
     ProcedureReturn CallFunction(DNAdll, "DNA_EvaluateNow", @product_key)
EndProcedure

Procedure DNA_UseIE(Use_IE_Settings.i)
     ProcedureReturn CallFunction(DNAdll, "DNA_UseIESettings", Use_IE_Settings)
EndProcedure
I am still working on the error checking code. And the one procedure that is having a problem is not included in this. Otherwise, everything is functional. I have tested with Kagi.com store front and softworkz.com in test mode and it worked without problems.

What I am working on now is the portion that returns additional information from the softworkz.com database.

I will edit with a link to the problem procedure thread listed {edit} here is link http://www.purebasic.fr/english/viewtop ... 13&t=48552.

Slyvnr
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: Activation/licensing techniques?

Post by Bisonte »

Why you dont use Prototypes.... its so much easier to use...

like this

Code: Select all

Prototype pDNA_Activate(ProductKey.p-Ascii, ActivationCode.p-Ascii, Password.p-Ascii, Email.p-Ascii)
Prototype pDNA_ActivateOffline(ProductKey.p-Ascii, ActivationCode.p-Ascii)

Structure dna_struct
  Activate.pDNA_Activate
  ActivateOffline.pDNA_ActivateOffline
EndStructure

Procedure DNA_Init()
  
  Protected Lib, Result = #False
  
  Lib = OpenLibrary(#PB_Any,"DNA.dll")
  If Lib
    Global DNA.dna_struct
    
    With DNA
      \Activate         = GetFunction(Lib, "DNA_Activate")
      \ActivateOffline  = GetFunction(Lib, "DNA_ActivateOffline")
    EndWith
    
    CloseLibrary(Lib)
    Result = #True  
  EndIf
  
  ProcedureReturn Result
  
EndProcedure

If DNA_Init()
  Debug DNA\Activate("Productkey","ActivationCode","PW","my@email.com")
  Debug DNA\ActivateOffline("Productkey","ActivationCode")
EndIf
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Slyvnr
User
User
Posts: 58
Joined: Wed Jun 27, 2007 10:10 pm
Location: USA
Contact:

Re: Activation/licensing techniques?

Post by Slyvnr »

I really don't understand Prototyping so went with what I know.

Anyway, I got the bug worked out of the one command that was giving me problems so that now I can implement the error checking routines. I am looking at making drop-in code. Where anyone can add the code to their projects with a XIncludeFile command and set a few variables and go.

As I posted in the other thread Softworkz.com and Kagi.com are fully integrated. Kagi.com is the storefront/backend processing agent for sales. Softworkz.com is the license key and activation code generator system.

The process is pretty straight forward:
1) User finds my software and clicks the buy now
2) User is taken to my website store which is a iframe inset of the Kagi.com storefront for me
3) User adds the item to the cart and processes payment through Kagi
4) kagi.com sends an activation request to the softworkz.com servers
5) kagi.com sends out receipts and post sales emails
6) softworkz.com sends out License key and instructions
7) user starts program, clicks activate button and enters License Key
8) program makes a few DNA.dll function calls which contact softworkz.com servers and sets up a license file (.CDM) on the client computer
9) program runs
10) everytime program starts up program checks for valid license file on computer. If valid file exist program runs. If missing can offer activation/re-activation services. Lots of other features available

For my product I am looking at charging $6.99
Kagi.com will charge me fees of $1.31 which are taken at time of sale
Softworkz.com will charge me fees of $1.09 which Kagi.com will pay directly to softwokz.com
I will get a net of $4.59

There are no out-of-pocket upfront fees. These fees are a lot better than the $400-$6000 solutions that I had found in the past.

So far in testing mode everything is working like it is suppose to and working smoothly. Activation took < 5 seconds once the License Key was entered. So it is not something that would irk the end user. Also, Softworkz.com offers a "Anti-Fraud" option for $0.20 per activation. Basically, if anyone purchases the software and then does a "return"/"Chargeback" of the payment then Softworkz.com will de-activate the license. There is a "re-validation" date that is stored in the local license file on the clients computer that you can pull and check. If the date has past you can call a re-validate routine. If the computer is not connected to the internet at that time, it can prompt the end user to the fact they must re-validate within xx days. After xx days if not re-validated returns to trial/demo mode. Once they re-validate (not re-activate) it will return to normal mode. softworkz.com also offers "off-line" activation abilities. Anyway, I encourage everyone to check Kagi and Softworkz out. it might meet your needs.

Once I get the drop-in program written I will pass it along. I am doing it that way for me so might as well share it for all.

Take care,

Slyvnr
pthien
Enthusiast
Enthusiast
Posts: 148
Joined: Sun Jun 29, 2003 9:39 pm

Re: Activation/licensing techniques?

Post by pthien »

So what happens if a customer loses their registration information and needs it to be sent to them again? Can kagi.com or softworkz.com accomodate that? How about six months after purchase? How about 1.5 years?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Activation/licensing techniques?

Post by Trond »

pthien wrote:So what happens if a customer loses their registration information and needs it to be sent to them again? Can kagi.com or softworkz.com accomodate that? How about six months after purchase? How about 1.5 years?
Worse: what happens if the user needs to reinstall and softworkz.com is out of business?
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Activation/licensing techniques?

Post by jassing »

Trond wrote:
pthien wrote:So what happens if a customer loses their registration information and needs it to be sent to them again? Can kagi.com or softworkz.com accomodate that? How about six months after purchase? How about 1.5 years?
Worse: what happens if the user needs to reinstall and softworkz.com is out of business?
Yes, I have an app with a "call home" type of licensing. The company is no longer supporting the application, and (to me) looks like they've stopped being a company (ie: no new products, perhaps a single dev taking a full time job) but he swears "the phone home will always work" -- Makes me nervious; needless to say, I have a replacement that I am transitioning to.

I get nervous now w/ any type of "phone home" licensing system. I prefer a system that has a stored blacklist of serial or activation #'s -- so If I spot someone has "shared' their key, I just blacklist that key in any updates I do.
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Activation/licensing techniques?

Post by skywalk »

Seems a hefty price (~30%) to pay for a service you have no control over. :?:

I like the idea Trond mentioned of watermarking or fingerprinting the exe.
@Trond - Do you do this in a DataSection or modify the exe's resource area?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Slyvnr
User
User
Posts: 58
Joined: Wed Jun 27, 2007 10:10 pm
Location: USA
Contact:

Re: Activation/licensing techniques?

Post by Slyvnr »

**double posted **
Last edited by Slyvnr on Wed Dec 14, 2011 11:56 pm, edited 1 time in total.
Slyvnr
User
User
Posts: 58
Joined: Wed Jun 27, 2007 10:10 pm
Location: USA
Contact:

Re: Activation/licensing techniques?

Post by Slyvnr »

Trond wrote:
pthien wrote:So what happens if a customer loses their registration information and needs it to be sent to them again? Can kagi.com or softworkz.com accomodate that? How about six months after purchase? How about 1.5 years?
Worse: what happens if the user needs to reinstall and softworkz.com is out of business?
jassing wrote:I prefer a system that has a stored blacklist of serial or activation #'s -- so If I spot someone has "shared' their key, I just blacklist that key in any updates I do.
Kagi.com is strictly the storefront/backend processor so that you are not responsible for sales related problems, security (ie. credit card security). Credit Card PCI Compliance is a pain in the ass. I run a small business other than my software programming and computer consulting and the compliance even without an internet store front is just frickin' ridiculous. The hoops that have to be jumped through every year is just asinine.

Softworkz.com supports all kinds of scenarios. Yes, the server accommodates re-emailing registration/license keys provided the user setup a password and email account on registration. If not they can contact you through your website technical support link and you can access the data and "potentially" provide them with the information. I say "potentially" because you still have to identify the right license key for them. That being either the transaction code from KAGI, IP address, email if no password was set, info-tags if you collected information and the user provided it, purchase date (although if you had a lot of sales on any one day, it could be a problem finding it). The server also supports reactivation due to a variety of factors and allows you the control to make exceptions and even to ban fraudulent or "hacked" codes.

They go out of business and your end users need to reinstall/reactive, you send the end user a new .exe with your new Licensing/Activation solution implemented.

It's interesting so many people want to be in "TOTAL" control of their products. I want to be able to "sell" my product without having to worry about casual hackers. Professional Hackers there is nothing you can really do to prevent them and you really shouldn't be worrying about them. Better to cover the 80% of piracy that occurs by the casual hacker.

Personally, I don't want any control to be perfectly honest. I do not want liability for credit card information. I do not want liability for providing reactivation services (other than the code provided in my software to begin with). I do not want to be doing anything other than supporting bugs/problems with my product. Problems with licensing contact this company's support services. Hand off as much as I can.

30% of sales price is not too hefty compared to other services that want $400-$6000 up front + service fees of 15%-40%. No upfront fees and only 30% with a lot of hassles turned over to someone else is better than 10%-20%+ through PayPal and keeping all of the hassles. Small price to pay in the long run truthfully.

For a merchant account/credit card processing account you are going to pay 2-4% to the credit card company + another $30-$100 a month merchant account fees. So depending on sales you may be 10%-30% of sales or if you have low volume you could be looking at fees that are greater than your sales.

For a $6.99 product if your credit card fees ran $100 a month you would have to have 15 sales a month to cover your merchant fees. In the scenario provided by Kagi and Softworkz, if I sold 4 items in a month I make $18.36 versus losing money by having my own merchant account. This does not even take into account any fees for running a licensing and activation server and the hassles of supporting problems related to activations. Again, IMHO a small price to pay to get rid of a lot of liabilities.

Again, not saying this is for everyone, just a solution that I came across that fits my needs and may fit the needs of some other industrial programmer.

Anyway,

Slyvnr
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Activation/licensing techniques?

Post by skywalk »

Hi Slyvnr,
I was commenting on the licensing schemes as this is supposed to be a coding question?
Yes, the e-service provided has obvious value but should really be in 'off-topic' or 'general discussion' forum. :wink:
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Activation/licensing techniques?

Post by Trond »

They go out of business and your end users need to reinstall/reactive, you send the end user a new .exe with your new Licensing/Activation solution implemented.
Not if you are out of business, too.
skywalk wrote:I like the idea Trond mentioned of watermarking or fingerprinting the exe.
@Trond - Do you do this in a DataSection or modify the exe's resource area?
I haven't tried it, but it could work inside a datasection or outside, as long as there is a label so we can know the addresses. Resources aren't crossplatform, so I didn't really consider that.
Post Reply