Digital River - SoftwarePassport
Digital Rights Management
The Silicon Realms Toolworks
SoftwarePassportTM
Forum
 
NOTE:   These forums are for user to user discussions only. If you need "official" technical support from our support staff and/or our developers, please contact us by e-mail at support@siliconrealms.com
 
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Online Activation PHP Script, How to get the outdated 32bit Keymaker.php Script Working on 64 bit
richardhc
post 2012.03.25 14:05 (Sunday)
Post #1






Posts: 31
Joined: 2009.01.20
From: New Caledonia




Has anyone found a solution for updating the outdated 32bit Keymaker.php script still being sold by Silicon Realms so it will work on modern 64bit Linux servers?
When read by a 64bit php interpreter the script gives invalid keys. (IMG:style_emoticons/default/sad.gif)
The shift to 64 bit PHP began in 2008 (the same year keymaker.php was last updated) and is now used on almost all hosting servers because of it's speed and efficiency.
This issue has been known since 2008 - see this posting:
http://stackoverflow.com/questions/397738/...-gotchas-in-php

If you know of anyone who has updated keymaker.php to 64bit or would be willing to do so, please post the information here.
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.03.26 05:28 (Monday)
Post #2


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




Denis opened a case for that last Friday (maybe in response to an earlier message from you?). Our PHP guy has it, and we'll get it fixed ASAP.
Go to the top of the page
 
+Quote Post
richardhc
post 2012.03.27 14:35 (Tuesday)
Post #3






Posts: 31
Joined: 2009.01.20
From: New Caledonia




I have gotten a reply from Gene, your PHP guy, who said he would not be fixing it until there is an official php release of a Windows 64bit Binary. By posting on this forum I am hoping to find out if any of the existing users of this script have solved the problem already.

If Gene intends to wait for an official Windows 64bit Binary there is little hope for any progress and the php script is history (along with the perl version).

The official php development site is unlikely to release an Official PHP Windows 64bit binary. Almost all web hosts today are using 64bit Linux operating systems and running the official php 64bit interpreter.

A trial Windows 64bit system was released in 2009 and it was unstable and slower than the 32 bit interpreter so it was removed. In addition, many important plug-in libraries for PHP are no longer supporting 64bit Windows systems. PHP is very stable and runs over 50% faster on Linux systems than on Windows systems.

The solution to getting the online activation script working ASAP is to set up a Virtual Linux system on a 64bit computer, download the official Linux 64bit interpreter and debug the 32bit code. There is no other option and is not likely to be one.

Gene said: ""We could grab any old 64 bit binary, fix the key generar using it, and it would still not work for you because your hosting service got their 64 bit PHP interpreter from someone else or they built it themselves using a different set of options or parameters.
We figure that by holding out for an official build, we improve the chances that a 64 bit fix will work on a wider variety of installations."

I checked with my web host - which has more than 1,7 million websites - and they said they are definitely using the official php 64bit interpreter. Everybody is, except the rare web hosts that still provide some Windows systems for special needs (at double the cost of their Linux servers).


QUOTE (Chad Nelson @ 2012.03.26 22:28 (Monday)) *
Denis opened a case for that last Friday (maybe in response to an earlier message from you?). Our PHP guy has it, and we'll get it fixed ASAP.


This post has been edited by richardhc: 2012.03.27 15:04 (Tuesday)
Go to the top of the page
 
+Quote Post
richardhc
post 2012.03.27 16:24 (Tuesday)
Post #4






Posts: 31
Joined: 2009.01.20
From: New Caledonia




See http://w3techs.com/technologies/overview/operating_system/all
Their survey of millions of websites shows Unix (linux) servers with 63.6% of web hosts. Further research shows that Microsoft operating systems are strong on dedicated server hosting because more techies in larger companies are used to Windows servers and prefer to set up their dedicated online servers with Microsoft. PHP is not commonly run on these machines, they tend to use Net, C, or ASP.

I believe that the users of the php will be doing inexpensive shared, not dedicated, hosting and will be likely to be using php on a Linux shared host. So I think it would be a reasonable business decision to get keymaker.php operational again.

QUOTE (richardhc @ 2012.03.28 07:35 (Wednesday)) *
Almost all web hosts today are using 64bit Linux operating systems and running the official php 64bit interpreter.
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.03.28 05:28 (Wednesday)
Post #5


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




QUOTE (richardhc @ 2012.03.27 16:35 (Tuesday)) *
[...] If Gene intends to wait for an official Windows 64bit Binary there is little hope for any progress and the php script is history

(IMG:style_emoticons/default/neutral.gif) I'll talk to him about it.

QUOTE
(along with the perl version). [...]

Is something wrong with the current Perl version too?
Go to the top of the page
 
+Quote Post
richardhc
post 2012.03.28 13:19 (Wednesday)
Post #6






Posts: 31
Joined: 2009.01.20
From: New Caledonia




Gene said, "We withdrew the perl key generator because it was written by a customer before we added short v3 keys and key strings. None of us knew perl so we couldn't add it ourselves and the customer that wrote it, wasn't interested in updating any further.
Also realize that if the perl system is also built with 64 bit executables, that the perl key generator may not work either."

I did not test it as I was using short v3 keys.

QUOTE
Is something wrong with the current Perl version too?

Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.03.30 06:17 (Friday)
Post #7


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




Gene will update the PHP script for 64-bit PHP. Not sure how soon he'll get to it though.

Thanks for the info on the Perl generator, richardhc. I'd forgotten it, but now that you mention it, I do recall that.
Go to the top of the page
 
+Quote Post
richardhc
post 2012.03.30 13:47 (Friday)
Post #8






Posts: 31
Joined: 2009.01.20
From: New Caledonia




He hasn't gotten to it since 2008 so that's not very promising.

Meanwhile, to avoid other customers feeling like they've been had, you might wish to change the "Note" on the bottom of the page advertising the Key Generator - the one that says, "Note: This product is source code. Once the source code is downloaded, no refunds will be offered." to something like:

Note: This product is source code. Once the source code is downloaded, no refunds will be offered. The php code does not work on 64bit servers. The Key Generator code does not include a user key management system or database interface and comes without support for integrating it with your site or examples of use. It is intended for advanced programmers only.

QUOTE (Chad Nelson @ 2012.03.30 23:17 (Friday)) *
Gene will update the PHP script for 64-bit PHP. Not sure how soon he'll get to it though.

Thanks for the info on the Perl generator, richardhc. I'd forgotten it, but now that you mention it, I do recall that.

Go to the top of the page
 
+Quote Post
richardhc
post 2012.04.01 13:12 (Sunday)
Post #9






Posts: 31
Joined: 2009.01.20
From: New Caledonia




Hopefully some good news.

http://stackoverflow.com/questions/9861432...-work-in-64-bit

This post on Stackoverflow has some answers on fixing the keymaker.php script. Hopefully it will help Gene get it operational again but if there is anyone else out there with a good working knowledge of PHP that is interested in getting the script working again please have a look at this answer and see if it helps.
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.04.02 06:05 (Monday)
Post #10


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




QUOTE (richardhc @ 2012.03.30 15:47 (Friday)) *
He hasn't gotten to it since 2008 so that's not very promising.

If he doesn't get to it in a reasonable amount of time, I'll do it myself. I don't have any real experience with PHP, but I wrote the C version, and it looks similar enough to C and Python that I should be able to muddle though.

QUOTE
Meanwhile, to avoid other customers feeling like they've been had, you might wish to change the "Note" on the bottom of the page advertising the Key Generator [...]

(IMG:style_emoticons/default/sad.gif) It sounds like you had higher expectations for the key generator code than it could fulfill. It's a direct port of the C code, which was designed solely to create keys.

I'm definitely not a PHP expert, but I'll be happy to try to help with integrating it into your site. What kind of problems, other than the 64-bit one, are you having?
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.04.02 06:15 (Monday)
Post #11


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




QUOTE (richardhc @ 2012.04.01 15:12 (Sunday)) *
Hopefully some good news. [...] This post on Stackoverflow has some answers on fixing the keymaker.php script. [...]

Great! I'll add that info to the case.
Go to the top of the page
 
+Quote Post
richardhc
post 2012.04.04 00:52 (Wednesday)
Post #12






Posts: 31
Joined: 2009.01.20
From: New Caledonia




QUOTE
I'm definitely not a PHP expert, but I'll be happy to try to help with integrating it into your site. What kind of problems, other than the 64-bit one, are you having?


Thanks Chad, I appreciate that.

I decided the best way to use the keymaker script was to set up a protected user-support area for my buyers and have access to the keymaker script available from within that protected area.

I already use linklok to process my orders and have integrated it with Vibralogix's sitelok script so that when someone places an order for my software, linklok assigns that person to a sitelok protected usergroup for that software and sends the person's name, email address, and the transaction ID to the sitelok MySQL database. Linklok also sends the buyer an email with details of their purchase, download link, and their username and password for logging in to the sitelok member group. That's step one, a URL that is only accessible to the buyer.

When my Software Passport protected application first runs the registration window includes a link to the user-group URL. The user logs in with their email and the password sent to them by linklok.

Now comes the integration problem.

The user's php license activation page would

1. Have a "Click here to get your activation code" button - a php form that would get their name from the MySQL database when they login and get the hardware fingerprint passed from the link on the registration window. For security reasons I would have the key template and signature levels in the keymaker script.
2. The user clicks the button and the form sends the name and hardware fingerprint, to the keymaker script.
3. The user name and activation key are written to the screen so the user can copy and paste these into the registration window activating their software. The php script would also send the activation key to the MySQL database.

The problem is figuring out a way to prevent the person from getting more than ONE activation code.

Integration problem 1:

How do I prevent the user from making more keys?

Integration problem 2:

In the defines section of the keymaker script Gene has put an option to define the template and signature level in the script - a very excellent idea.

line 166 //define('ENCRYPTION_TEMPLATE', '');
line 167 //define('SIGNATURE_LEVEL', 0);

I thought, since these were defined options, that if I removed the // and put the template and signature level values there the script would then operate without needing to send these values from a more exposed php page.

But that does not work. I asked Gene and he said I have to re-write the relevant parts of his code to allow this. I'm not sure what parts to change or how, exactly, to change them. I'm also wondering why, since he has this as an optional define, the code was not written so it automatically checked for the definitions if it did not get the encryption template and signature levels when it is called.

There are other integration issues, for example in a useful licence management system the user should be able to:
1. see their activation key again,
2. unregister their key and get another one if they want to change their computer
3. register another computer (so if they paid for a second application they could then (and only then) use the keymaker script to get another key.

I would, however, be thankful if you could help me just figure out how to make it impossible for a buyer to get more than one activation key and how to rewrite the keymaker.php script so the template and signature levels can be read from the define and not expected in the call.

I was thinking along the lines of having the php script that calls keymaker first check the MySQL database and if there is already an activation code registered there the php script simply writes "This software has already been activated, the activation code was - and then it writes the code from the database.

If there is no activation code already recorded then it calls the keymaker script.

Do you have a better option? Would you know how such a script might be written?

This post has been edited by richardhc: 2012.04.04 01:09 (Wednesday)
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.04.04 05:53 (Wednesday)
Post #13


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




QUOTE (richardhc @ 2012.04.04 02:52 (Wednesday)) *
QUOTE
I'm definitely not a PHP expert, but I'll be happy to try to help with integrating it into your site. What kind of problems, other than the 64-bit one, are you having?

Thanks Chad, I appreciate that.

My pleasure.

QUOTE
I decided the best way to use the keymaker script was to set up a protected user-support area for my buyers and have access to the keymaker script available from within that protected area. [...] The problem is figuring out a way to prevent the person from getting more than ONE activation code.

Integration problem 1:

How do I prevent the user from making more keys?

It sounds, from the text below, like you've got the basic idea. I'll answer this further down.

QUOTE
Integration problem 2:

In the defines section of the keymaker script Gene has put an option to define the template and signature level in the script - a very excellent idea.

line 166 //define('ENCRYPTION_TEMPLATE', '');
line 167 //define('SIGNATURE_LEVEL', 0);

I thought, since these were defined options, that if I removed the // and put the template and signature level values there the script would then operate without needing to send these values from a more exposed php page.

But that does not work. [...]

:| It sounds like he started to design it that way but changed his mind.

QUOTE
There are other integration issues [...] I would, however, be thankful if you could help me just figure out how to make it impossible for a buyer to get more than one activation key

Again, I'll answer this part further down.

QUOTE
and how to rewrite the keymaker.php script so the template and signature levels can be read from the define and not expected in the call.

I'll look into that. Not sure how long it will take, but I'll be surprised if I can't get it done in the next couple weeks. I'll post something to this thread when I have it.

Finally, your first point:
QUOTE
I was thinking along the lines of having the php script that calls keymaker first check the MySQL database and if there is already an activation code registered there the php script simply writes "This software has already been activated, the activation code was - and then it writes the code from the database.

If there is no activation code already recorded then it calls the keymaker script.

Do you have a better option?

Nope. That's exactly how I'd do it.

QUOTE
Would you know how such a script might be written?

Not at present, but I can figure it out. (IMG:style_emoticons/default/smile.gif) Again, I'll post something here as soon as I've got it. Sorry for the delay, but I've got several things that have to be done first, and as I said earlier in this thread, I've never worked with PHP so it'll take me a little bit to get up to speed on it.

This post has been edited by Chad Nelson: 2012.04.04 05:55 (Wednesday)
Go to the top of the page
 
+Quote Post
richardhc
post 2012.04.05 14:53 (Thursday)
Post #14






Posts: 31
Joined: 2009.01.20
From: New Caledonia




Gene has got the keymaker.php working on the 64bit php interpreter - not completely, but it is working for the signature level I am using. (IMG:style_emoticons/default/biggrin.gif)

Now to work out how to get the key template safely hidden in the keymaker script and then set it up so a user gets only one key.

Progress!
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.04.06 05:24 (Friday)
Post #15


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




(IMG:style_emoticons/default/biggrin.gif)
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.04.06 08:34 (Friday)
Post #16


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




Finally got a chance to look at this, and it looks like using an encryption template and signature level encoded into the script is pretty simple. Adding this small function should do it:

*** NOTE: I have not tried this code, there may be bugs in it. ***

CODE
function CreateKeyX($regname, $hardware = '0', $extrainfo1 = 0, $extrainfo2 = 0,
                   $extrainfo3 = 0, $extrainfo4 = 0, $extrainfo5 = 0, $KeyString = '')
{
    return CreateKey(SIGNATURE_LEVEL, ENCRYPTION_TEMPLATE, $regname, $hardware, $extrainfo1,
        $extrainfo2, $extrainfo3, $extrainfo4, $extrainfo5, $KeyString);
}


Then just uncomment the SIGNATURE_LEVEL and ENCRYPTION_TEMPLATE defines near the top, and call CreateKeyX instead of CreateKey. The parameters are the same, other than removing the signature level and encryption template parameters at the beginning.

Will this do what you want?

I'll look into the only-one-key problem on Monday, barring unforeseen problems.
Go to the top of the page
 
+Quote Post
richardhc
post 2012.04.06 16:02 (Friday)
Post #17






Posts: 31
Joined: 2009.01.20
From: New Caledonia




[quote

CODE
function CreateKeyX($regname, $hardware = '0', $extrainfo1 = 0, $extrainfo2 = 0,
                   $extrainfo3 = 0, $extrainfo4 = 0, $extrainfo5 = 0, $KeyString = '')
{
    return CreateKey(SIGNATURE_LEVEL, ENCRYPTION_TEMPLATE, $regname, $hardware, $extrainfo1,
        $extrainfo2, $extrainfo3, $extrainfo4, $extrainfo5, $KeyString);
}


Then just uncomment the SIGNATURE_LEVEL and ENCRYPTION_TEMPLATE defines near the top, and call CreateKeyX instead of CreateKey. The parameters are the same, other than removing the signature level and encryption template parameters at the beginning.

[/quote]
I inserted your code below in line 2406 and uncommented the defines like this:
define('ENCRYPTION_TEMPLATE', '76thtfitfGH');
define('SIGNATURE_LEVEL', 22);

When I call the CreateKeyX with
echo( "<p>Activation Key: " .MyCreateKey($regname, $hardware)."</p>\n" );

the generated code is the correct number of groups and characters but the key is invalid.

Using the same script and same form to call it - only changing the actual call
echo( "<p>Activation Key: " .CreateKey(22, "76thtfitfGH", $regname, $hardware)."</p>\n" );
the generated code is valid.

The CreateKeyX returned code is the same number of characters and groups so the level is not the problem (I tried using level 23 and 21 in the define but the codes were completely different number groups - and wrong). I also am corresponding with Gene on this.
Go to the top of the page
 
+Quote Post
richardhc
post 2012.04.06 17:51 (Friday)
Post #18






Posts: 31
Joined: 2009.01.20
From: New Caledonia




Here is what I have so far on the page that will call the script. It has some problems but at least it is a start.

CODE
<?php //connect to the database these includes configure the $dbhost $dbuser $dbpass $dbname and open the connection to the database
include 'config.php';
include 'opendb.php';
?>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<form name="registration" action="<?=$PHP_SELF?>" method="POST">
<p>Please enter your name: <input type="text" name="regname" size="30"></p>
<p> Enter the Registration Code: <input type="text" name="hardware" size="30" /></p>
<p><input type="submit" name="Send" value="OK" id="OK"></p>
</form>


<?php
if( @$Send == "OK" )
{
/* OK-Button pressed - first check to see if a key is already stored in field C3 of MySQL database */

$check_query = mysql_query("select count(*) as total from $dbname where Custom3='" . $whatever_key_passed . "'") //How do I make sure this is using the field from the logged in user?
$check_array = mysql_fetch_array($check_query); //there is an error here but I dont know what it is
// If total is not zero it means the key is already in the database
if( $check_array['total']) {
// Key in database
echo( "<p>This software has already been activated. The activation key issued was: $Custom3 </p>\n" );
} else {
// Key is not in the database verify and activate
require_once("activationkey.php");
echo( "<p>Here is your private key:</p>\n" );
echo( "<p>Name: $regname </p>\n" );
echo( "<p>Activation Key: " .CreateKey(22, "e76", $regname, $hardware)."</p>\n" );
}
/* Send the returned key and hardwareID to database fields Custom3 and Custom4 so any future attempt to call the MakeKey script will not call the activation script */
mysql_select_db($dbname);
$query = "INSERT INTO sitelok (custom3,custom4) VALUES ('$returned_key','$hardware')";

mysql_query($query) or die('Error, insert query failed');

}
mysql_close($conn);
?>
Go to the top of the page
 
+Quote Post
richardhc
post 2012.04.07 12:43 (Saturday)
Post #19






Posts: 31
Joined: 2009.01.20
From: New Caledonia




The error reported on this line has been fixed - it was a missing ; on the line above it.

check_query = mysql_query("select count(*) as total from $dbname where Custom3='" . $whatever_key_passed . "'"); //How do I make sure this is using the field from the logged in user?
$check_array = mysql_fetch_array($check_query);
Go to the top of the page
 
+Quote Post
Chad Nelson
post 2012.04.09 03:14 (Monday)
Post #20


Developer Emeritus



Posts: 5,999
Joined: 2002.04.28
From: The Silicon Realms Toolworks




QUOTE (richardhc @ 2012.04.06 18:02 (Friday)) *
I inserted your code below in line 2406 and uncommented the defines like this:
define('ENCRYPTION_TEMPLATE', '76thtfitfGH');
define('SIGNATURE_LEVEL', 22);

When I call the CreateKeyX with
echo( "<p>Activation Key: " .MyCreateKey($regname, $hardware)."</p>\n" );

the generated code is the correct number of groups and characters but the key is invalid.

Using the same script and same form to call it - only changing the actual call
echo( "<p>Activation Key: " .CreateKey(22, "76thtfitfGH", $regname, $hardware)."</p>\n" );
the generated code is valid. [...]

I've just set up a PHP server on one of my own systems and tested that. I'm sorry to say that it works as intended, and Armadillo confirms that the generated keys are good for both the CreateKeyX call and the direct CreateKey call. I don't know what else to tell you. (IMG:style_emoticons/default/sad.gif)
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 2014.04.20 02:09