diff options
Diffstat (limited to 'help/en/manager/keygen/keygen_php.htm')
-rw-r--r-- | help/en/manager/keygen/keygen_php.htm | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/help/en/manager/keygen/keygen_php.htm b/help/en/manager/keygen/keygen_php.htm new file mode 100644 index 0000000..9da8d36 --- /dev/null +++ b/help/en/manager/keygen/keygen_php.htm @@ -0,0 +1,94 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <link rel="Stylesheet" type="text/css" href= + "../../default.css" /> + <meta http-equiv="Content-Type" content= + "text/html; charset=utf-8" /> + + <title>UNIX-version</title> +</head> + +<body> + <h1>UNIX-version</h1> + + <h3>Description</h3> + + <p>The UNIX-version of the key generator is a PHP file that contains all necessary information for serial number generation. The file is located in <strong>Keygen\PHP</strong>. Below we describe the key points of using such a generator.</p> + + <h3>Configuring the generator</h3> + + <p>In the beginning of the PHP file, the setup code is located:</p> + <pre class="code">////////////////////////////////////////////////////////////////////////////////////////////// +// The following lines should be generated by VMProtect License Manager +$exported_algorithm = "RSA"; +$exported_bits = 2048; +$exported_private = "PJvj4kEpoQMIpYK+9wEt......xKeiSZgzdiln8Q=="; +$exported_modulus = "rOlny/3QgZb/VmGr3CmY......I6ESAUmtQ+RBqQ=="; +$exported_product_code = "oLQdGUn8kVk="; +////////////////////////////////////////////////////////////////////////////////////////////// +</pre> + + <p>This code is automatically generated by VMProtect (see <a href= + "../licenses.htm#export">Exporting product parameters</a>) and is unique for each particular product. It is crucial to copy it accurately, as otherwise the generator will work incorrectly.</p> + + <h3>Contents of a key</h3> + + <p>Then, the generator specifies the contents of a serial number + The contents are specified in an array, with all possible parameters of the key listed below. However, in real applications, some of them may be omitted:</p> + <pre class="code">$params = <strong>array</strong>( + user_name => "John Doe", // UTF-8! + email => "john@doe.com", + hwid => "vHGMdMRvGCPjWcCQ", // Exactly as returned by VMProtectGetCurrentHWID + expire_date => <strong>array</strong>(year => 2009, month => 10, day => 1), + maxbuild_date => <strong>array</strong>(year => 2009, month => 10, day => 1), + time_limit => 10, + user_data => <strong>base64_decode</strong>("CGCvRvMWcPHGdMjQ"), // string of bytes + ); +</pre> + + <h3>Successful key generation handler function</h3> + + <p>Below you can see a simplest function called upon successful generation of a serial number. The only parameter sent to it is a serial number string. The function must pass the serial number to the caller (an e-commerce agent), usually with the <strong>echo</strong> command. The string is preliminarily split to sub-strings 75 symbols each, for convenience. Also, this function could send the generated serial number by e-mail to the developer or add it to a database.</p> + <pre class="code">function <strong>OnSerialGenerated</strong>($serial) +{ + $serial = <strong>wordwrap</strong>($serial, 75, "\n", true); + <strong>echo</strong> $serial; +} +</pre> + + <h3>Key generator error handler function</h3> + + <p>The final part of the code that needs our attention is a function called when something goes wrong. This function receives a string with the error message, and when it finishes, the <strong>die()</strong> function is called. The handler function must do two things: instead of a key, return to an e-commerce agent a message saying the key will be sent manually. And send to the developer an exhaustive information about the error to fix it and generate the key manually.</p> + <pre class="code">function <strong>OnSerialGenerationFailed</strong>($details) +{ + <strong>echo</strong> "You will receive serial number in the next 24 hours"; // message to the customer +// mail("support@vendor.com", "Houston, we have a problem", $details); // message to vendor +} +</pre> + + <p>There are several possible causes of mistakes: incorrect parameters of the algorithms, incorrect parameters of the key, a too long user name or e-mail, or a too long serial number that doesn't fit to the number of bits specified in the algorithm. + That is why the <strong>OnSerialGenerationFailed</strong> function must send a detailed information about the issue to the developer, so he could generate a serial number and send it to the customer.</p> + + <h3>Other things to consider</h3> + + <p>Examples hold a simplified version of the key generator. It doesn't take into account <a href="index.htm">recommendations to develop web generators</a>. It does not check the IP address of the caller and does not analyze input parameters. Please pay attention to this when developing your own generator based on this one.</p> + + <p>A user name and an e-mail must be passed as UTF-8 strings. Make sure your e-commerce agent sends these data in the UTF-8 encoding, or transcode the information if this is not so. Wrong encoding won't lead to an incorrect serial number generated, but the registration name displayed for such a serial number can be different from the real user's name, so he or she may be surprised to see it in the "About" window of the application</p> + + <p>Asymmetric encryption is a complex mathematical process. If it is implemented using pure PHP without any third-party libraries, serial number generation can take dozens of seconds. The generator uses + <strong>gmp_powm</strong>, <strong>bi_powmod</strong>, + <strong>bcpowod</strong> functions whenever they are available. If serial number generation take too long on your hosting, we recommend to ask the hosting provider to enable these functions. For example, the <strong>gmp_powm</strong> function works ten of times faster than <strong>bcpowmod</strong>.</p><br /> + <br /> + <br /> + <br /> + <br /> + <hr noshade="noshade" size="1" /> + + <div align="center"> + © 2006-2015 Copyright VMProtect Software + </div> +</body> +</html> |