Initial commit

This commit is contained in:
Alukym
2023-05-12 20:16:10 +08:00
commit a8433f06ee
1167 changed files with 1036549 additions and 0 deletions

View File

@ -0,0 +1,54 @@
<!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>Activation system</title>
</head>
<body>
<h1>Activation system</h1>
<h3>What is it?</h3>
<p>Activation is a two-stage process of registering an application. On the first step (usually, directly after the purchase) a user receives an activation code that usually looks like XXXX-YYYY-ZZZZ. On the second stage, the customer enters the code to the application, the application connects to the server of the developer via the Internet, the server checks the activation code and returns a serial number to the application tied to the given activation code and usually locked to user's hardware.</p>
<p>Such approach allows the developer to control license usage by customers, prevent licenses from leaking and offers additional possibilities, for example, making demo licenses or offering reliable trial periods.</p><strong>Why do I need it?</strong>
<p>The activation system gives a software developer a lot of possibilities, for instance:</p>
<ul>
<li><strong>Short serial numbers</strong> - long serial numbers are great, except they are long. User may make a typo while entering them, e-mail client break those keys or replace some symbols. At the same time, long serial numbers can hold a sufficient volume of additional information. Activation codes can resolve all issues of long serial numbers while taking the most benefit from their advantages.</li>
<li><strong>Installation control</strong> - all activations are available to the developer online in real-time. Each activation can be monitored, analyzed, blocked. The developer can provide support to users and so on.</li>
<li><strong>Trial periods</strong> - you can create time-limited serial numbers by using product "modes".</li>
<li><strong>Subscriptions</strong> - subscriptions are similar to trial periods, but are offered for a fee. You can sell the right to use the program for a specified time to a user, just like antiviruses do. Simply sell activation codes for each service year.</li>
</ul>
<p>You can find more detailed information about the activation system in the corresponding <a href=
"http://vmpsoft.com/products/web-license-manager/" target=
"_blank">section</a> of our website.</p>
<h3>What do I need?</h3>
<p>VMProtect Ultimate features several <a href=
"activation/api.htm">functions</a> for relatively easy implementation of both online and offline activation. You will also need
<a href="activation/weblm.htm">Web License Manager</a> installed on your server. Finally, you should <a href="activation/vmprotect.htm">configure</a>
the protection project in VMProtect, to make the activation module know the URL of the WebLM server.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,174 @@
<!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>Activation API</title>
<style type="text/css">
/*<![CDATA[*/
th {text-align:left;}
table {border-collapse:collapse; margin-top: 4px;}
td,th {border: 1px solid #B0B0B0; padding-left:10;padding-right:10;}
/*]]>*/
</style>
</head>
<body>
<h1>Activation API</h1>
<p>Activation API contains only 4 functions. Two for online activation and other two for offline activation when the computer has no access to the Internet. Activation API is intended to work in cooperation with Web License Manager, so a developer still should invoke licensing system API to use serial numbers obtained from WebLM.</p><strong id=
"VMProtectActivateLicense">VMProtectActivateLicense</strong>
<p>The function passes the activation code to the server and returns a serial number for this specific computer. Otherwise, an <a href="#codes">error code</a> is returned.</p>
<pre class="code">int VMProtectActivateLicense(const char *code, char *serial, int size);
</pre>
<p>The <strong>code</strong> parameter holds the activation code obtained from Web License Manager during the license purchase process.
The <strong>serial</strong> parameter specifies a memory block of the given
<strong>size</strong>, where the serial number generated by WebLM is put to.</p><strong id=
"VMProtectDeactivateLicense">VMProtectDeactivateLicense</strong>
<p>This function passes a serial number to the server for deactivation.
Possible return codes are listed <a href=
"#codes">below</a>.</p>
<pre class="code">int VMProtectDeactivateLicense(const char *serial);
</pre>
<p>The <strong>serial</strong> parameters contains the serial number (not the activation code) obtained from WebLM earlier during activation.</p><strong id=
"VMProtectGetOfflineActivationString">VMProtectGetOfflineActivationString</strong><br />
<strong id=
"VMProtectGetOfflineDeactivationString">VMProtectGetOfflineDeactivationString</strong>
<p>These two functions work similar to the previous two, except they do not try to connect to the WebLM server. Instead, they return a text block that a user should copy to a computer connected to the Internet, open the WebLM offline activation form and paste the text there.</p>
<pre class="code">int VMProtectGetOfflineActivationString(const char *code, char *buf, int size);
int VMProtectGetOfflineDeactivationString(const char *serial, char *buf, int size);
</pre>
<p>The <strong>code</strong> and <strong>serial</strong> parameters are similar to those of the online version of these functions. The
<strong>buf</strong> parameter should point to a buffer of 1000 bytes or more where the text block for the offline activation form will be copied to. Possible error codes are listed <a href=
"#codes">below</a>.</p>
<h3 id="codes">Possible error codes</h3>
<table border="1" cellspacing="0" cellpadding="2">
<tr>
<th>Code</th>
<th>Value</th>
<th>Description</th>
</tr>
<tr>
<td>ACTIVATION_OK</td>
<td>0</td>
<td>Activation is successful. The serial number is put to the
<strong>serial</strong> variable.</td>
</tr>
<tr>
<td>ACTIVATION_SMALL_BUFFER</td>
<td>1</td>
<td>The buffer is too small to hold the serial number. The minimum buffer size is calculated as: bits / 8 * 3 / 2 + N,
where bits is the length of the RSA key in bits, and N is a "security constant" - additional bytes for possible line breaks and other special symbols. We recommend using at least 10.</td>
</tr>
<tr>
<td>ACTIVATION_NO_CONNECTION</td>
<td>2</td>
<td>The activation module couldn't connect to Web License
Manager.</td>
</tr>
<tr>
<td>ACTIVATION_BAD_REPLY</td>
<td>3</td>
<td>The activation server returned an unexpected result. This means some configuration issues on the server, wrong server URL or a hack attempt.</td>
</tr>
<tr>
<td>ACTIVATION_BANNED</td>
<td>4</td>
<td>This activation code is banned on the server by the software vendor via the WebLM interface (for example, if the key has leaked or pirated). Not to be confused with ACTIVATION_ALREADY_USED.</td>
</tr>
<tr>
<td>ACTIVATION_CORRUPTED</td>
<td>5</td>
<td>Something has gone completely wrong. The error is produced by the activation module self-check system and usually means a hacking attempt. If you've got this error, all further operations with serial numbers and activation are not safe.</td>
</tr>
<tr>
<td>ACTIVATION_BAD_CODE</td>
<td>6</td>
<td>The specified code is not found in the database of the activation server. Perhaps, a user made a mistake while entering the code, so we can ask him or her to check if everything all right.</td>
</tr>
<tr>
<td>ACTIVATION_ALREADY_USED</td>
<td>7</td>
<td>The activation counter for this code is depleted and all further activations are impossible. This doesn't mean the code is bad or banned. The code is good, but it just can't be activated any more. The user should contact the software vendor and purchase additional licenses or uninstall the software on other computer to increase the value of the activation counter on the server.</td>
</tr>
<tr>
<td>ACTIVATION_SERIAL_UNKNOWN</td>
<td>8</td>
<td>Activation error. The given serial number is not found in the database on the server. Therefore, deactivation is impossible.</td>
</tr>
<tr>
<td>ACTIVATION_EXPIRED</td>
<td>9</td>
<td>Activation error. Means the activation period of the code has expired.</td>
</tr>
<tr>
<td>ACTIVATION_NOT_AVAILABLE</td>
<td>10</td>
<td>This error means activation/deactivation is unavailable.</td>
</tr>
</table>
<h3>Tips and tricks</h3>
<p>Activation API is pretty simple, so you shouldn't experience difficulties with it. Do not forget to offer a way to activate the program offline for users who have problems with the Internet. Also, don't forget, the Activation API does not save the serial number it receives and does not pass it to the licensing module - this should be done by the developer. You don't have to call Activation API on every launch of the application. You just need to call it once, get a serial number from WebLM, save it where appropriate and then use this saved copy.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!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>Configuring activation in VMProtect</title>
<style type="text/css">
</style>
</head>
<body>
<h1>Configuring activation in VMProtect</h1>
<p>For the <a href="api.htm">Activation API</a> to work, the WebLM URL is required, so you should specify it in the project settings in VMProtect. To do this, open VMProtect and switch to the options section:</p><br /><img src="../../images/activation_setup.png" alt="Configuring the activation server" />
<p>Enter the address to the "Activation Server" field. The address should look as: <em>http://yourserver/weblm
path</em>. This is the first place to check if you face problems with online activation.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,43 @@
<!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>Activation in Web License Manager</title>
<style type="text/css">
</style>
</head>
<body>
<h1>Activation in Web License Manager</h1>
<p>You can find the detailed Web License Manager description on <a href=
"http://vmpsoft.com/products/web-license-manager/" target=
"_blank">our website</a>, and here we merely provide minimum steps required to create an activation code for use with the Activation API.</p>
<p>First, enter Web License Manager (you can use the demo on our website) and create a product. Then export the product as a VMProtect project to be able to configure licensing and activation. After the project is set up, all check are added to the code of your app and the executable is protected, click the "Add New Code" link on the left panel in WebLM:</p>
<p><img src="../../images/weblm_1.png" /></p>
<p>Select the product you need from the upper drop-down list and fill in the rest of form with the data you want to put into the serial number. Click the "Save" button. You should see the activation code you can use to debug Activation API.</p>
<p><img src="../../images/weblm_2.png" /></p>
<p>You can study rich capabilities of Web License Manager (such as integration to e-commerce providers and automatic activation code generation) in
the <a href=
"http://vmpsoft.com/products/web-license-manager/" target=
"_blank">online user manual</a>.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!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>Licensing system features</title>
<style type="text/css">
</style>
</head>
<body>
<h1>Licensing system features</h1>
<h3>Secure serial numbers</h3>
<p>The license system uses an asymmetric algorithm to encrypt serial numbers. The number is encrypted with a private key that only the developer has. The protected product uses the corresponding public key to decrypt the serial number and checks it. Due to the length of keys the system uses (1024 bit or higher for RSA) it is virtually impossible to compute the private key and make a key generator for the application.</p>
<h3 id="lock">Locking the code to a serial number</h3>
<p>VMProtect allows execution of a part of the program code on a virtual machine. The set of commands of the virtual machine changes on every build of the protected program. The licensing system allows to encrypt a part of virtual machine commands with the key stored in a serial number. Therefore, even if a hacker modifies a conditional jump in the program, the code still will not work without the correct serial number. And since code decryption is managed by the virtual machine, the decryption algorithm is hard to analyze even if the serial number is available.
</p>
<h3>Limiting the period of free upgrades</h3>
<p>The licensing system can write a date into the key so that all application versions after that date will not work with this key. This mechanism allows you to limit the period of free upgrades. For example, upon purchase the current date plus one year is written to the key, so a user will be able to download new versions from the website within one year. The key will work in these versions only. When the one-year period ends, a user has a choice: either use the last working version of the program or purchase an update for one more year.</p>
<h3>Key expiration date</h3>
<p>The licensing system allows you to write a date into the key, after which that key stops working. This is a convenient option for products that require systematic updates. For example, upon purchase the current date plus one year is put to the key, and the program works for the given user for one year. Unlike the period of free upgrades, the user has no choice here - he has to purchase a new license if he wants to continue using the program.</p>
<h3>Limiting the program operation time</h3>
<p>The licensing system allows you to limit the maximum operation time of a copy of the program. This proves to be useful in many demo applications. For example, a user wants to test a full-featured copy of the program. In this case you can send to him or her a serial number that limits the maximum session time of the program with say ten minutes. After that, the program stops functioning. This option is also convenient for various server applications, where a user can't easily restart the program.</p>
<h3>Hardware locking</h3>
<p>The licensing system allows the developer to receive a hardware identifier of user's PC based on information about CPU, network card and OS. The licensing system can produce a serial number that will be only valid on that hardware only. This option allows you to limit usage of the application to several computers.</p>
<h3>Black list</h3>
<p>If a serial number is compromised, the licensing system allows adding such a number into the black list. The blocked serial number will not work in all further versions of the application.</p>
<h3>Data storage</h3>
<p>The licensing system stores in a serial number and provides to the program the following data: a user name, an e-mail and up to 255 bytes of arbitrary information (the so called custom user data). You can use this capability to show additional information in the "About" window of the program, to implement additional security checks if the entered serial number, to store constants available in the registered version of the product only and so on.</p>
<h3>Time-limited demo versions</h3>
<p>With the <a href="activation.htm">activation</a> system, a software developer can automatically build time-limited serial numbers locked to user's hardware. This allows you to setup a secure trial period (demo) for an application, because VMProtect does not try to hide trial marks on user's computer, and instead generates a working, but time-limited serial number. Activation is carried out over the Internet, but the activation API also provides the offline activation mode.</p><br />
<hr noshade="noshade" size="1" />
<h3>What can't the system do and why</h3>
<h3>100% secure hardware lock</h3>
<p>Besides the licensing system allows locking a serial number to a hardware identifier, you should understand that most of hardware data is received using operating system means, so a hacker can intercept them and modify this information. The licensing system uses certain ways to minimize this risk, but if you need 100% secure hardware lock, we recommend to use a solution based on USB keys also supported by VMProtect.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!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>How the licensing system works</title>
<style type="text/css">
</style>
</head>
<body>
<h1>How the licensing system works</h1>
<h3>Application protection</h3>
<p>To protect an application, VMProtect embeds the special code into it. This code checks serial numbers using information specified in the "Licensing" subsection of the "Project" section. A public key is embedded to the application and is used then to decrypt serial numbers. Also, the protection date and some additional information the licensing requires to work is put into the application.</p>
<h3>Creating serial numbers</h3>
<p>Serial numbers can be created in the <a href=
"licenses.htm">"Licensing"</a> section of the "Project" section or using third-party applications
- <a href="keygen/index.htm">key generators</a>. A serial number is a set of data about a customer encrypted using the asymmetric algorithm. The serial number then is passed to the customer, he or she enters it to the program, and the licensing system checks it.</p>
<h3>Checking a serial number in the program</h3>
<p>The licensing system has
<a href="usage/api.htm">several functions</a> a program can use to work with serial numbers. The program sends a serial number to the licensing system and queries information about it. The licensing system returns the state of a serial number (valid/invalid and why) and also can provide detailed information about the serial numbers including a user name, an e-mail, the expiration date of this serial number and so on. The protected program analyzes serial number information and decides whether or not to continue operation and to limit the functionality.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

35
help/en/manager/index.htm Normal file
View File

@ -0,0 +1,35 @@
<!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>Licensing system</title>
</head>
<body>
<h1>Licensing system</h1>
<p>The licensing system creates and checks for validity serial numbers. It supports limiting the protected software by date and time, locking it to specific hardware, encrypting the code with a serial number, limiting the period of free updates and many more. The system is based on asymmetric cryptographic algorithms to minimize chances that an unauthorized serial number generator will be built. To protect the licensing system itself, VMProtect uses virtualization therefore minimizing chances that the application will be cracked or patched on the code level.</p>
<ul>
<li><a href="features.htm">Licensing system features</a></li>
<li><a href="howitworks.htm">How the licensing system works</a></li>
<li><a href="licenses.htm">Managing licenses: creating, changing, blocking and so on</a></li>
<li><a href="usage/index.htm">Example of how to integrate the system to your application</a></li>
<li><a href="keygen/index.htm">Automatic serial number generation</a></li>
</ul>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,47 @@
<!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>Serial number encryption algorithms</title>
</head>
<body>
<h1>Serial number encryption algorithms</h1>
<p>The security of a key in the licensing system is based on asymmetric cryptography algorithms. The current version implements the RSA algorithm with the key length from 1024 to 16384 bits. Future versions are planned to implement other algorithms based on ECC as well as symmetric+asymmetric combined cryptography.</p>
<p>The algorithm used is unique for each product. Keys made with one algorithm cannot be used with another one, this means changing algorithms after at least one license is created is not allowed. The protection module in the protected program "knows" which algorithm the serial number is encrypted with and will not accept keys made with other algorithms or with the same algorithm but different parameters (say, different key length).</p>
<h3>RSA Algorithm</h3>
<p>A serial number is encrypted with the RSA algorithm as follows:</p>
<ul>
<li><strong>Adding random data to the beginning of the serial number</strong> - the method is based on RFC2313, but the implementation is slightly different. The following bytes are added to the beginning of the key: 00 02 NN...NN 00, where NN..NN
are from 8 to 16 random non-zero bytes. The number of bytes is random, but the system takes into account the length of the key and its maximum capacity.</li>
<li><strong>Adding random data to the end of the serial number</strong>
- the total number of bytes in a serial number must be equal to the number of bits in keys of the algorithm divided by 8.
The serial number is appended with the corresponding number of bytes holding random data. As a result, the following serial number format is produced: 00 02 NN..NN 00 DD..DD MM..MM, where NN is a set of random non-zero bytes, DD is the original serial number, MM is a set of random bytes (including zeros). The summary length of the sequence should be equal to the number of bits in keys of the algorithm divided by 8</li>
<li><strong>Encryption</strong> goes using a typical procedure implemented in many libraries to process big numbers. The PHP generator contains all the required information.</li>
<li><strong>Packing</strong> - the set of bytes obtained after encryption is encoded to base-64 &mdash; this is a serial number that goes to a customer.</li>
</ul><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,70 @@
<!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>Serial number generators</title>
</head>
<body>
<h1>Serial number generators</h1><strong>What are they for?</strong>
<p>Apart from VMProtect, other software can generate serial numbers too. This is necessary to automate sending serial numbers. A customer purchases the product, an e-commerce agent sends an HTTP query to the website of the vendor, the generator runs on the server and produces a serial number based on customer's data. The serial number is sent to the customer and to the vendor. The vendor then adds the serial to VMProtect manually using the import license dialog.</p><strong>How it works</strong>
<p>The licensing system of VMProtect is based on asymmetric algorithms, that is why a secret product key is required to generate a serial number. You can export this key in the project properties window and pass it to the generator in any suitable way.</p>
<p>The generator is called by the e-commerce agent using an HTTP query. A PHP generator can be called directly, a DLL-based generator - indirectly, but the principle is the same:</p>
<ul>
<li>Receive user data from the e-commerce agent</li>
<li>Add all required information specified by the vendor</li>
<li>Generate a serial number</li>
<li>Encrypt it with one of algorithms</li>
<li>Send the result to the e-commerce agent</li>
</ul><strong>Are there any existing generators?</strong>
<p>The licensing system comes with three ready to use serial number generators <a href="keygen_dll.htm">as DLL</a>,
<a href="keygen_net.htm">for the .Net platform</a> and <a href=
"keygen_php.htm">on PHP</a>.</p><strong>Can I make my own generator?</strong>
<p>Yes, you can. The format of the serial number is <a href=
"serial_format.htm">here</a>, serial number encryption algorithms are described <a href=
"algorithms.htm">here</a>.</p><strong>Is it safe?</strong>
<p>Generally, yes, this is safe. However, you should follow these recommendations:</p>
<ul>
<li><strong>Use HTTPS</strong> - if your e-commerce provider can send HTTPS queries, and your web hosting provider can answer such requests - you should prefer this variant over the typical HTTP, because in this case all data are transmitted in the encrypted form and the generated serial number cannot be intercepted.</li>
<li><strong>"Hide" your generator</strong> - make sure no one can open the generator occasionally. The
www.site.com/keygen.php address is a bad idea. While
www.site.com/abc123.php is much better. Make sure you do not put any external links to the key generator, it isn't listed in website directories, and don't put it into any service file like robot.txt. The less is known about the location of the generator, the better. Optionally, you can even place the generator on another website.</li>
<li><strong>Make sure it is the e-commerce agent who calls the generator</strong> -
the program processing queries from the agent should check the IP address of the caller. E-commerce providers usually publish the IP-range the use to query serial number generators. Find that list at your agent and add a check to the program. If IP address sending a query lies beyond the specified IP range, do not produce comprehensible error messages. Either do not return anything or produce a simple 404.
Do not give any clues to why the query has failed.</li>
<li><strong>Check input parameters</strong> - product settings in the e-commerce agent's control panel usually allow you to specify a query string the agent should make to receive a license. For instance, you want to receive user name, e-mail address, date of purchase and the order id. So make sure all these parameters are passed and all of them have the correct format. Do not produce any response to erroneous queries. Send a message to your own e-mail whenever an erroneous query to the generator is made. This should help to investigate the issue.</li>
<li><strong>Add a "password"</strong> specify an additional parameter in the query sent by the e-commerce agent, a password. It should have an non-obvious name and value. Check this parameter from the receiving side. If the value is wrong, or the parameter is not specified - do not generate a serial number.</li>
</ul><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,199 @@
<!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>Windows-version</title>
</head>
<body>
<h1>Windows-version</h1>
<h3>Description</h3>
<p>Windows key generators are DLL-files for x86 and x64 platforms, a C language header file and an MSVC-compatible lib-file. Therefore, the library can be both linked statically and loaded dynamically.</p>
<p>All files of the generator are located in the
<strong>Keygen\DLL</strong> folder. A test application generating serial numbers is also there.</p>
<h3>Generator API</h3>
<p>The generator exports just two functions: the first one generates a serial number, while the second one frees up memory allocated by the first one. Let's start with the first and the main one:</p>
<pre class="code"><strong>VMProtectErrors</strong> __stdcall <strong>VMProtectGenerateSerialNumber</strong>(
<strong>VMProtectProductInfo *</strong> pProductInfo,
<strong>VMProtectSerialNumberInfo *</strong> pSerialInfo,
<strong>char **</strong> pSerialNumber
);
</pre>
<p>The first parameter is a pointer to the
<strong>VMProtectProductInfo</strong> structure, which contents are uploaded to VMProtect (see <a href=
"../licenses.htm#export">Exporting product parameters</a>).
The structure contains product private key, the algorithm used and the identifier of the product. More details on filling this structure follow below.</p>
<p>The second parameter is a pointer to the
<strong>VMProtectSerialNumberInfo</strong> structure, which contents are moved to the generated serial number. The structure holds all fields of a serial number and a bit mask that defines which fields should be written to the serial number.</p>
<pre class="code">struct <strong>VMProtectSerialNumberInfo</strong>
{
<strong>INT</strong> flags;
<strong>wchar_t *</strong> pUserName;
<strong>wchar_t *</strong> pEMail;
<strong>DWORD</strong> dwExpDate;
<strong>DWORD</strong> dwMaxBuildDate;
<strong>BYTE</strong> nRunningTimeLimit;
<strong>char *</strong> pHardwareID;
<strong>size_t</strong> nUserDataLength;
<strong>BYTE *</strong> pUserData;
};
</pre>
<p>The <strong>flags</strong> field contains bit flags from the
<strong>VMProtectSerialNumberFlags</strong> set described before the structure:</p>
<ul>
<li><strong>HAS_USER_NAME</strong> - put the user name from the
<strong>pUserName</strong> variable into the serial number.</li>
<li><strong>HAS_EMAIL</strong> - put the e-mail from the
<strong>pEMail</strong> variable into the serial number.</li>
<li><strong>HAS_EXP_DATE</strong> - the serial number will expire after the date specified in the
<strong>dwExpDate</strong> variable.</li>
<li><strong>HAS_MAX_BUILD_DATE</strong> - the serial number will only work with version of the product built up to the date specified in the <strong>dwMaxBuildDate</strong> variable.</li>
<li><strong>HAS_TIME_LIMIT</strong> - the program stops working after the time specified in the
<strong>nRunningTimeLimit</strong> variable expires (the time is specified in minutes and shouldn't exceed 255).</li>
<li><strong>HAS_HARDWARE_ID</strong> - the program works only on hardware with the id specified in the <strong>pHardwareID</strong> variable.</li>
<li><strong>HAS_USER_DATA</strong> - put custom user data of
<strong>nUserDataLength</strong> length at the address of <strong>pUserData</strong> to the serial number.</li>
</ul>
<p>The third parameter is a pointer to a pointer. The address of the generated serial number is written there. After generating the serial number, it should be copied, and the address must be passed to the second API function of the generator that will free memory taken by the serial number.</p>
<pre class="code"><strong>void</strong> __stdcall <strong>VMProtectFreeSerialNumberMemory</strong>(<strong>char *</strong> pSerialNumber);
</pre>
<p>The <strong>VMProtectGenerateSerialNumber</strong> function
returns a <strong>VMProtectErrors</strong> value that either contains 0 if the serial number is successfully generated, or an error code.
Possible error codes are:</p>
<ul>
<li><strong>ALL_RIGHT</strong> - no errors, the serial number is generated.</li>
<li><strong>UNSUPPORTED_ALGORITHM</strong> - an incorrect key encryption algorithm is passed in the first parameter of the function.</li>
<li><strong>UNSUPPORTED_NUMBER_OF_BITS</strong> - an incorrect number of bits is passed in the first parameter of the function.</li>
<li><strong>USER_NAME_IS_TOO_LONG</strong> - the length of the UTF-8 encoded user name exceeded 255 byte.</li>
<li><strong>EMAIL_IS_TOO_LONG</strong> - the length of the UTF-8 encoded user e-mail exceeded 255 byte.</li>
<li><strong>USER_DATA_IS_TOO_LONG</strong> - the length of the user data exceeded 255 byte.</li>
<li><strong>HWID_HAS_BAD_SIZE</strong> - the hardware identifier has incorrect size.</li>
<li><strong>PRODUCT_CODE_HAS_BAD_SIZE</strong> - the identifier of the product passed in the first parameter of the function has incorrect size.</li>
<li><strong>SERIAL_NUMBER_TOO_LONG</strong> - the serial number is too long and can't fit the number of bits specified in the algorithm.</li>
<li><strong>BAD_PRODUCT_INFO</strong> - the first parameter of the function is incorrect or NULL.</li>
<li><strong>BAD_SERIAL_NUMBER_INFO</strong> - the second parameter of the function is incorrect or NULL.</li>
<li><strong>BAD_SERIAL_NUMBER_CONTAINER</strong> - the third parameter of the function doesn't point to memory to write the serial number address to.</li>
<li><strong>NOT_EMPTY_SERIAL_NUMBER_CONTAINER</strong> - the third parameter of the function doesn't point to an empty memory cell, the cell must be NULL.</li>
<li><strong>BAD_PRIVATE_EXPONENT</strong> - the first parameter of the function contains an incorrect value of the private exponent.</li>
<li><strong>BAD_MODULUS</strong> - the first parameter of the function contains an incorrect value of modulus.</li>
</ul>
<p>Errors can be of two categories: those caused by incorrect parameters or incorrect value of the first parameter, and all the rest. First category errors are rare and they indicate incorrect configuration of the structure. You should upload the product information again and check if the structure is filled correctly. An example of a proper filling of the structure can be found below.</p>
<p>Second category errors are caused by an attempt to put more data to the key than it can hold with its size. In this case we recommend to send a message to the e-commerce provider containing a text like "The key will be sent in 24 hours" instead of the actual serial number, and send all the required information to your own e-mail. In this case, the key is generated manually in VMProtect, some data are truncated to fit all crucial information to the maximum key size.</p>
<h3>Example of usage</h3>
<p>Below is a code example that calls the above functions and generates a serial number. Notice the block of code in the very beginning. The example will not work until you replace it with the one exported from VMProtect for your product:</p>
<pre class="code">//////////////////////////////////////////////////////////////////////////
// !!! this block should be generated by VMProtect !!! ///
//////////////////////////////////////////////////////////////////////////
<strong>VMProtectAlgorithms</strong> g_Algorithm = ALGORITHM_RSA;
<strong>size_t</strong> g_nBits = 0;
<strong>byte</strong> g_vModulus[1];
<strong>byte</strong> g_vPrivate[1];
<strong>byte</strong> g_vProductCode[1];
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
<strong>int</strong> _tmain(<strong>int</strong> argc, <strong>_TCHAR*</strong> argv[])
{
<strong>VMProtectProductInfo</strong> pi;
pi.algorithm = g_Algorithm;
pi.nBits = g_nBits;
pi.nModulusSize = sizeof(g_vModulus);
pi.pModulus = g_vModulus;
pi.nPrivateSize = sizeof(g_vPrivate);
pi.pPrivate = g_vPrivate;
pi.nProductCodeSize = sizeof(g_vProductCode);
pi.pProductCode = g_vProductCode;
<strong>VMProtectSerialNumberInfo</strong> si = {0};
si.flags = HAS_USER_NAME | HAS_EMAIL;
si.pUserName = L"John Doe";
si.pEMail = L"john@doe.com";
<strong>char *</strong> pBuf = NULL;
<strong>VMProtectErrors</strong> res = <strong>VMProtectGenerateSerialNumber</strong>(&amp;pi, &amp;si, &amp;pBuf);
<strong>if</strong> (res == ALL_RIGHT)
{
<strong>printf</strong>("Serial number:\n%s\n", pBuf);
<strong>VMProtectFreeSerialNumberMemory</strong>(pBuf);
}
else
{
<strong>printf</strong>("Error: %d\n", res);
}
<strong>return</strong> 0;
}
</pre>
<p>This is an example project for Microsoft Visual Studio from <strong>Keygen\DLL\Example</strong>. Below are the most interesting parts of the code with our comments.</p>
<p>First lines of the <strong>main</strong> function fill the <strong>VMProtectProductInfo</strong> structure with data, exported from VMProtect. This code is typical and it shouldn't be changed to avoid errors. Then we create the
<strong>VMProtectSerialNumberInfo</strong> structure and insert a bit combination of user name and e-mail to the flag field.
In the next line, we put the user name and the password to the appropriate fields in the structure. Note, values are accepted in the UNICODE encoding. The key generator will transform them to UTF-8.</p>
<p>Then, we initialize a pointer variable where the address of the generated key will be stored, and call
<strong>VMProtectGenerateSerialNumber</strong>, then analyze the return code. If there are no errors, the generated key goes out to console, and a call to free serial number memory function is made.</p><strong>The rest fields of the
VMprotectSerialNumberInfo structure</strong>
<p>Some fields of the structure may needs some additional explanations. For example, <strong>dwExpDate</strong> and
<strong>dwMaxBuildDate</strong> fields contain dates in the specific format: <strong>0xYYYYMMDD</strong>, that is, the year is stored in the high wordб while the month and the day are in the respectively high and low bytes of the low word.
To produce such a number, the following macros is used: <strong>MAKEDATE(y,
m, d)</strong>. You can call it like this: <strong>MAKEDATE(2010,
05, 12)</strong>.</p>
<p>The <strong>pHardwareID</strong> field should contain a pointer to a string the
<strong>VMProtectGetCurrentHWID</strong> method from the licensing SDK has returned.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,78 @@
<!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>.Net-version</title>
<style type="text/css">
/*<![CDATA[*/
p.c1 {color:red;}
/*]]>*/
</style>
</head>
<body>
<h1>.Net-version</h1>
<h3>Description</h3>
<p>The .Net-version of the key generator is a build containing all that is required to generate serial numbers. Source codes are in <strong>Keygen\Net</strong> as two projects: KeyGen (the key generator itself) and Usage (an example of use of the key generator).</p>
<p class="c1">The key generator is supplied in source codes for quick building under a given version of the .Net
Framework, however we strongly do not recommend to apply any changes to the code. In future versions of VMProtect some new possibilities may be added to the generator, and that may lead to repeated modification of the code. Also, this may lead to errors that are very difficult to locate.
If you found errors in the original code of the generator or would like to suggest improvements, please contact the support team.</p>
<h3>Using the generator</h3>
<p>Take the code from the <strong>Usage</strong> project as a base,
then add to your project a link to the VMProtect.KeyGen.dll build. After that you will be able to generate serial numbers in your application. To function properly, the generator must "know" which product you generate serial numbers for.
To achieve this, in VMProtect open the "Project | Export key pair" dialog and select the "Parameters for KeyGen.Net" option. The text area below will contain text information you should copy and paste to your application as a string constant.</p>
<p>Here is an example code to call the generator:</p>
<pre>
try
{
string data = @""; // put the exported data here
Generator g = new Generator(data);
g.UserName = "John Doe";
g.EMail = "john@doe.com";
g.ExpirationDate = DateTime.Now.AddMonths(1);
g.MaxBuildDate = DateTime.Now.AddYears(1);
g.RunningTimeLimit = 15;
g.HardwareID = "AQIDBAgHBgU=";
g.UserData = new byte[] { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
string serial = g.Generate();
Console.WriteLine("Serial number:\n{0}\n", serial);
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex);
}
</pre>
<p>The string you copied from VMProtect should be placed to the <strong>data</strong> variable passed as a parameter to the serial number class constructor. In case of any problems occur while parsing the product data, the constructor throws an exception containing a description of the problem. If the constructor successfully finishes its work, the generator is ready to produce serial numbers.</p>
<p>A serial number can contain various information specified using the generator properties. The above example displays how to fill all and every field of a serial number. Certain fields have limitations. For example, the <strong>User Name</strong> and
<strong>E-Mail</strong> cannot accept strings exceeding 255 symbols in the UTF-8 encoding. If incorrect data are supplied, properties throw exceptions containing a description of the problem.</p>
<p>When the generator setup is done, the
<strong>Generate()</strong> method is invoked. This method generates a serial number. At this step, all data of the serial number are combined, the checksum is calculated and the data are encrypted. If the volume of data exceeds the allowed length, the method throws an exception.</p>
<p>If you need to generate multiple serial numbers, you can use the generator class several times in a row, without the need to create it from scratch. To clear any given property of the generator, simply assign a <strong>null</strong> value to it.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -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 =&gt; "John Doe", // UTF-8!
email =&gt; "john@doe.com",
hwid =&gt; "vHGMdMRvGCPjWcCQ", // Exactly as returned by VMProtectGetCurrentHWID
expire_date =&gt; <strong>array</strong>(year =&gt; 2009, month =&gt; 10, day =&gt; 1),
maxbuild_date =&gt; <strong>array</strong>(year =&gt; 2009, month =&gt; 10, day =&gt; 1),
time_limit =&gt; 10,
user_data =&gt; <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>

View File

@ -0,0 +1,206 @@
<!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>Serial number format</title>
<style type="text/css">
/*<![CDATA[*/
th {text-align:left;}
table {border-collapse:collapse; margin-top: 4px;}
td,th {border: 1px solid #B0B0B0; padding-left:10;padding-right:10;}
/*]]>*/
</style>
</head>
<body>
<h1>Serial number format</h1>
<h3>Serial number structure</h3>
<p>The serial number consists of blocks. Each block starts from an identifier byte that indicates contents of the block and possibly its length. The last block always has the 255 identifier that contains a checksum of the serial number except the last block.</p>
<p>Depending on the type of the block, it can have constant or variable length. In the latter case, the length is specified in the byte following the block identifier. The exact format of each block is described below.</p>
<h3>Block format</h3>
<table border="1" cellspacing="0" cellpadding="2">
<tr>
<th>ID</th>
<th>Name</th>
<th>Size (byte)</th>
<th>Description</th>
<th>Example</th>
</tr>
<tr>
<td>0x01</td>
<td>Version</td>
<td>1</td>
<td>The block contains a version of the serial number, 1-byte sized.
The version must be 1.</td>
<td>01 01</td>
</tr>
<tr>
<td>0x02</td>
<td>User name</td>
<td>1 + N</td>
<td>The block contains a UTF-8 encoded user name. Before the user name, there is 1 byte holding the length of the name. Therefore, the total length of a user name must not exceed 255 bytes. No trailing 0 is required.</td>
<td>02 04 4A 5F 48 4E</td>
</tr>
<tr>
<td>0x03</td>
<td>E-Mail</td>
<td>1 + N</td>
<td>The block contains a UTF-8 encoded e-mail of the user.
Before the e-mail there is 1 byte holding the length. Therefore, the total length of an e-mail must not exceed 255 bytes. No trailing 0 is required.</td>
<td>03 07 61 40 62 2E 63 6F 6D</td>
</tr>
<tr>
<td>0x04</td>
<td>Hardware identifier</td>
<td>1 + N</td>
<td>The block contains hardware identifier as returned by the <strong>VMProtectGetCurrentHWID()</strong> function. The function returns a base-64 string. A decoded version of the string is put to the serial number. The length of the data block must be a multiple of 4. There is a length byte before the data block. The maximum block length is 32 bytes.</td>
<td>04 08 E1 E2 E3 E4 A1 A2 A3 A4</td>
</tr>
<tr>
<td>0x05</td>
<td>License expiration date</td>
<td>4</td>
<td>The block contains serial number expiration date
Date format is described below.</td>
<td>05 01 0A 07 DA</td>
</tr>
<tr>
<td>0x06</td>
<td>Maximum operation time</td>
<td>1</td>
<td>the block contains 1 byte holding the time in minutes the program can operate. Therefore, the maximum time can be 255 minutes.</td>
<td>06 05</td>
</tr>
<tr>
<td>0x07</td>
<td>Product code</td>
<td>8</td>
<td>The block contains a product code - 8 bytes created by VMProtect and exported with product parameters.
These data are exported in the base-64 encoding and must be decoded to a byte array before putting to a serial number.
The size of the array must be exactly 8 bytes.
<strong>This block is obligatory! Without it, the protected program will not work correctly.</strong></td>
<td>07 01 02 03 04 05 06 07 08</td>
</tr>
<tr>
<td>0x08</td>
<td>User data</td>
<td>1 + N</td>
<td>The block contains up to 255 bytes of custom user data.
The license system doesn't analyze these data and will return them when the
<strong>VMProtectGetSerialNumberData()</strong> function is called. Before the data block, there is a byte holding the size of the user data.</td>
<td>08 05 01 02 03 04 05</td>
</tr>
<tr>
<td>0x09</td>
<td>Maximum build date</td>
<td>4</td>
<td>The block contains the maximum build date of the application. The format is described below.</td>
<td>09 01 0A 07 DA</td>
</tr>
<tr>
<td>0xFF</td>
<td>Checksum</td>
<td>4</td>
<td>The block contains the serial number checksum. The block is located before the last one, and the checksum is calculated for all previous blocks. The checksum calculation mechanism is described below.</td>
<td>FF 01 02 03 04</td>
</tr>
</table>
<h3>Date storage format</h3>
<p>Dates are stored in a serial number as a double word -
0xYYYYMMDD. The high order word contains the year, and the lower order word holds the day and the month.
Bytes follow the Little Endian representation - from lower to higher. If there is a pointer to the first byte of the record, the date can be read or written with the following code:</p>
<pre class="code"><strong>byte *</strong>pDate = 0xNNNNNN; // date address
<strong>*</strong>(<strong>DWORD *</strong>)pDate = (2010 &lt;&lt; 16) | (10 &lt;&lt; 8) | 1; // October 1, 2010
<strong>DWORD</strong> dwExp = *(<strong>DWORD *</strong>)pDate;
</pre>
<h3>Checksum calculation</h3>
<p>The checksum of the serial number is calculated using the SHA-1 hashing algorithm. The result is five 32-bit words. The first word is used as a checksum for the serial number. <strong>Please note:</strong> the word is Little Endian (from lower to higher). The string representation of SHA-1 hash the Big Endian is used - numbers go from the higher byte to the lower one, so if the SHA-1 hash is generated by a string function (like in PHP), the first four bytes of the hash must be reversed.</p>
<h3>Additional information</h3>
<p>Block with numbers other than those specified above are ignored by the licensing system. New blocks may be added in newer versions. <strong>We do not recommend creating your own blocks using non-occupied identifiers!</strong> Firstly, this could render the key non-functional with newer version of the licensing system. Secondly, the protected program cannot read the values of theses blocks anyway. To store additional information in a key, use the <strong>User
Data</strong> field instead. It was meant exactly for this purpose.</p>
<p>A serial number doesn't have SALT, a random information intended to provide variability of keys based on the same input data. This task is imposed to the encryption algorithm. If you need differences on the serial number level, for example, when selling a series of keys to an organization, you can add individual indices to the user name field ("Company" LLC,
key 1 of 10) or insert this information to the <strong>User
Data</strong> field in any appropriate format.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,72 @@
<!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>Managing licenses</title>
</head>
<body>
<h1>Managing licenses</h1>
<h3>Initialization</h3>
<p>By default, licensing functions are off. To enable them, you should create a pair of keys in the "Licenses" subsection of the "Project" section. If the project links to the license manager database (in older versions of VMProtect the license manager was a standalone program), VMProtect will suggest you to import the corresponding licenses to the project. When initialization finishes, the Lock to Serial Number option will be available, and you will be able to create and process serial numbers.</p>
<h3>Interface</h3>
<p>The "Interface" section displays a full list of licenses in the left panel and parameters of the selected element in the main panel.</p>
<p><img src="../images/licenses1.png" /></p>
<p>The right panel displays detailed information about the selected license. It also allows blocking a serial number, copying it to the clipboard or seeing hardware id information (by clicking it).</p>
<h3 id="AddLicense">Creating a license</h3>
<p>To add a new license, click the corresponding button on the toolbar.
AThe Add License dialog appears:</p>
<p><img src="../images/project_add_license.png" /></p>
<p>The upper part of the dialog allows to specify main parameters of the new license. The lower section configures which parameters will be finally put into a serial number and allows adding additional data: for example, a hardware identifier or custom user data.
When you finish filling the data, click OK, and VMProtect creates a new license.</p>
<h3>Removing and blocking licenses</h3>
<p>To delete a license, right-click it in the list of licenses and choose "Delete" in the context menu. Or simply select the license and press Del. To block a license, turn the "Blocked" parameter in the main panel to "Yes".</p><p>There is a difference between deleting a license and clocking it. Removed serial numbers are not blocked by the licensing system. They simply do not exist any more in the database. If a license was created by mistake and the serial number never was sent to anyone, you can delete such a license. However, if the serial number was compromised, you should not just delete the license, you should block it instead. In this case the information about this serial number is passed to the licensing system, and it will not further accept this serial number.</p>
<h3>Importing serial numbers</h3>
<p>Serial numbers can be created not only in VMProtect, but also in third-party programs - key generators. Key generators allow you to automatically provide e-commerce agents with serial numbers whenever a license is purchased. To add such serial numbers to the database, you can import them. To import serial numbers, press
Ctrl+I or select the "Import" command in the "Project" menu.</p>
<p><img src="../images/menu_project_import.png" /></p>
<p>The first step to import a serial number is the import dialog:</p>
<p><img src="../images/import_key.png" /></p>
<p>If the entered license already presents in the database, the edit license window will be opened. Otherwise, the new license dialog appears where you can adjust the license information and confirm license creation by clicking the OK button. The license is added to the database.</p><a name="export" id="export"></a>
<h3>Exporting license parameters</h3>
<p>External key generators require secret key of the product to work properly. You can obtain this information in the most suitable form by using the "Export key pair" command from the "Project" menu. The following export dialog appears:</p>
<p><img src="../images/export_keys.png" /></p>
<p>The "Export format" field allows you to select one of the supported formats, while the "Results of export" field contains the key data in the most appropriate format for the selected type of a key generator. To copy the contents to the clipboard, click the "Copy" button.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,259 @@
<!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>Licensing API functions</title>
<style type="text/css">
/*<![CDATA[*/
th {text-align:left;}
table {border-collapse:collapse; margin-top: 4px;}
td,th {border: 1px solid #B0B0B0; padding-left:10;padding-right:10;}
/*]]>*/
</style>
</head>
<body>
<h1>Licensing API functions</h1>
<p>The licensing system API is an integral part of VMProtect API and its SDK. API allows you to specify a serial number and retrieve all information about it: whether it suits the program or not, is the serial number expired, the name this product is registered to and so on. Also, the API provides a hardware identifier of the computer the program runs on.</p><strong id=
"VMProtectSetSerialNumber">VMProtectSetSerialNumber</strong>
<p>This function loads a serial number to the licensing system. Call syntax:</p>
<pre class="code">int VMProtectSetSerialNumber(const char *SerialNumber);
</pre>
<p>The input <strong>SerialNumber</strong> parameter must contain a pointer to a null-terminated string ('\0') containing a base-64 encoded serial number. The function returns a bit mask of serial number status flags, the same as the one <strong>VMProtectGetSerialNumberState()</strong> returns. You can read more about flags below. The serial number is "good" if the function returned 0.</p><br />
<strong id=
"VMProtectGetSerialNumberState">VMProtectGetSerialNumberState</strong>
<p>This function returns status flags for the serial number specified by a call to
<strong>VMProtectSetSerialNumber()</strong>.</p>
<pre class="code">int VMProtectGetSerialNumberState();
</pre>
<p>If at least one flag is set, there is a problem with the serial number. The program shouldn't work if at least one bit is set. The detailed description of flags and their values is listed in the table below:</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr>
<th>Flag</th>
<th>Value</th>
<th>Description</th>
</tr>
<tr>
<td>SERIAL_STATE_FLAG_CORRUPTED</td>
<td>0x00000001</td>
<td>The licensing system is corrupted. Possible reasons are: incorrect setup of the protection project, cracking attempt.</td>
</tr>
<tr>
<td>SERIAL_STATE_FLAG_INVALID</td>
<td>0x00000002</td>
<td>The serial number is incorrect. The flag is set if the licensing system cannot decrypt the serial number.</td>
</tr>
<tr>
<td>SERIAL_STATE_FLAG_BLACKLISTED</td>
<td>0x00000004</td>
<td>The serial number matches the product, but is black listed in VMProtect.</td>
</tr>
<tr>
<td>SERIAL_STATE_FLAG_DATE_EXPIRED</td>
<td>0x00000008</td>
<td>The serial number is expired. You can obtain the detailed information about the expiration date by calling
<strong>VMProtectGetSerialNumberData()</strong></td>
</tr>
<tr>
<td>SERIAL_STATE_FLAG_RUNNING_TIME_OVER</td>
<td>0x00000010</td>
<td>Operating time of the program is depleted. You can obtain the detailed information about the operating time of the program by calling
<strong>VMProtectGetSerialNumberData()</strong></td>
</tr>
<tr>
<td>SERIAL_STATE_FLAG_BAD_HWID</td>
<td>0x00000020</td>
<td>Hardware identifier does not match the hardware identifier prescribed in the key.</td>
</tr>
<tr>
<td>SERIAL_STATE_FLAG_MAX_BUILD_EXPIRED</td>
<td>0x00000040</td>
<td>The serial number does not match the current version of the protected program. You can obtain the maximum build date of the program this serial number matches by calling
<strong>VMProtectGetSerialNumberData()</strong>.</td>
</tr>
</table><br /><br />
<strong id=
"VMProtectGetSerialNumberData">VMProtectGetSerialNumberData</strong>
<p>This function obtains information about contents of the serial number acquired with a call to
<strong>VMProtectSetSerialNumber()</strong>. Call syntax:</p>
<pre class="code">bool VMProtectGetSerialNumberData(VMProtectSerialNumberData *Data, int Size);
</pre>
<p>The first parameter is a pointer to the
<strong>VMProtectSerialNumberData</strong> structure, where all necessary information will be written to. The second parameter is the size of the structure passed in the first parameter. It is required to control the structure's format. The function returns FALSE if the licensing system is corrupted (see the SERIAL_STATE_FLAG_CORRUPTED flag), if a zero address of the structure is provided or if the passed size of the structure is incorrect. In all other cases, the function returns TRUE and records all information about the serial number to the provided address. Below are the elements of the structure:</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr>
<th>Element</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>nState</td>
<td>int</td>
<td>A bit flag mask indicating the status of a key. Similar to the one returned by
<strong>VMProtectGetSerialNumberState()</strong>.</td>
</tr>
<tr>
<td>wUserName</td>
<td>wchar_t[256]</td>
<td>The name of a customer in UNICODE, null-terminated.</td>
</tr>
<tr>
<td>wEMail</td>
<td>wchar_t[256]</td>
<td>The e-Mail of a customer in UNICODE, null-terminated.</td>
</tr>
<tr>
<td>dtExpire</td>
<td>VMProtectDate</td>
<td>The key expiration date. The format of the
VMProtectDate structure is described below.</td>
</tr>
<tr>
<td>dtMaxBuild</td>
<td>VMProtectDate</td>
<td>The maximum product build date the given key can work with. The format of the VMProtectDate structure is described below.</td>
</tr>
<tr>
<td>bRunningTime</td>
<td>int</td>
<td>The amount of minutes the program will work (maximum duration of a session). The value in minutes counts from the moment the program starts.</td>
</tr>
<tr>
<td>nUserDataLength</td>
<td>unsigned char</td>
<td>The length of user data in the
<strong>bUserData</strong> field.</td>
</tr>
<tr>
<td>bUserData</td>
<td>unsigned char[255]</td>
<td>User data put into the key. The actual number of bytes is specified in
<strong>nUserDataLength</strong>.</td>
</tr>
</table><br />
<p>The <strong>VMProtectDate</strong> structure is a compact representation of date. Its fields are listed in the table below:</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr>
<th>Element</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>wYear</td>
<td>unsigned short</td>
<td>Year.</td>
</tr>
<tr>
<td>bMonth</td>
<td>unsigned char</td>
<td>Month, starts from 1.</td>
</tr>
<tr>
<td>bDay</td>
<td>unsigned char</td>
<td>Day, starts from 1.</td>
</tr>
</table><br />
<br />
<strong id=
"VMProtectGetCurrentHWID">VMProtectGetCurrentHWID</strong>
<p>This function obtains a hardware identifier of the PC the program is working on. Call syntax:</p>
<pre class="code">int VMProtectGetCurrentHWID(char * HWID, int Size);
</pre>
<p>The first parameter is a pointer to a memory area where the identifier is written to. The second parameter is the size of this area. The function returns the number of bytes written inclusive of the trailing zero byte ('\0'). If NULL is provided in the first parameter, the function returns the number of bytes required to store the hardware identifier. Here is the correct way to use the function:</p>
<pre class="code"><strong>int</strong> nSize = <strong>VMProtectGetCurrentHWID</strong>(NULL, 0); // get the required buffer size
<strong>char *</strong>pBuf = <strong>new char</strong>[nSize]; // allocate memory for the buffer
<strong>VMProtectGetCurrentHWID</strong>(pBuf, nSize); // obtain the identifier
// use the identifier
<strong>delete</strong> [] pBuf; // release memory
</pre><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,74 @@
<!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>Integrating to application</title>
<style type="text/css">
</style>
</head>
<body>
<h1>Integrating to application</h1>
<p>In the several steps described below we will create a test application that queries the licensing system: provides serial numbers to it, receives the status of a serial number and its contents. On the first stage, we use the license system in the test mode; one the second stage we use it as it would be used in actual practice.</p><strong>Work modes of the licensing system</strong>
<p>Building protection always goes through two main steps: development and release. As for licensing, at first you create an application, integrate protection into it, then add checks and functional limitations. And only after thorough testing you can make the product available to users and begin the second stage. Testing of a protected application is a complex process, because you need to make sure all checks and conditional jumps operate correctly. Making "real" serial numbers for all possible test cases is inconvenient. That is why the licensing system offers the "developer mode" (AKA "test mode") as well. In this work mode, no protection is applied to the app, and reaction of the system to supplied serial numbers is adjusted in the configuration file. When the application is free from bugs and it correctly works with the licensing system, VMProtect replaces the "test" licensing module with the real one that do perform real serial number checking. This is done when the application is protected, so you can't avoid this step by mistake.</p><strong id="TestMode">Stage 1:
Test mode</strong>
<p>In the test mode, all reactions of the licensing system (statuses and data it returns) to supplied serial numbers is described in the configuration file. The file is called VMPLicense.ini and should be located in the working folder of the application. In 10 steps provided below we will go from creating the simplest application to full-featured use of the licensing system in the test mode with hardware locking and limiting the period of free upgrades.</p>
<ul>
<li><a href="step11_app.htm">Step 1.1: Creating a protected application</a></li>
<li><a href="step12_code.htm">Step 1.2: Adding the license checking code</a></li>
<li><a href="step13_flags.htm">Step 1.3: Retrieving serial number status flags</a></li>
<li><a href="step14_name.htm">Step 1.4: Retrieving the name and the e-mail of a user</a></li>
<li><a href="step15_exp.htm">Step 1.5: Checking the expiration date of the serial number</a></li>
<li><a href="step16_time.htm">Step 1.6: Limiting the operation time of the program</a></li>
<li><a href="step17_maxbuild.htm">Step 1.7: Limiting the free upgrades period</a></li>
<li><a href="step18_blacklist.htm">Step 1.8: Serial numbers in the black list</a></li>
<li><a href="step19_hwid.htm">Step 1.9: Hardware lock</a></li>
<li><a href="step1A_userdata.htm">Step 1.10: User data</a></li>
</ul><strong id="RealMode">Stage 2: Real mode</strong>
<p>In the real mode VMProtect licensing system puts a special licensing module to the protected application. This module carries out the same functions as the test one in the SDK, but works with contents of a serial number instead of the configuration ini-file. The next five steps illustrate the process of protecting a simple application with a full-featured protection based on VMProtect and the licensing system.</p>
<ul>
<li><a href="step21_src.htm">Step 2.1: Creating a new protected application</a></li>
<li><a href="step22_vmp.htm">Step 2.2: Creating a VMProtect protection project</a></li>
<li><a href="step23_product.htm">Step 2.3: First start of the protected product</a></li>
<li><a href="step24_test.htm">Step 2.4: Testing the results</a></li>
<li><a href="step25_codelock.htm">Step 2.5: Locking the code to a serial number</a></li>
</ul><strong>Additional information</strong>
<p>Values of all bit flags, structure formats and function call parameters can be found in the <a href="api.htm">Licensing system API
</a> section of this help file. Use this section as a reference, while Steps provided above help to easily implement a typical ready-to-use protection.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!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>Step 1.1: Creating a protected application</title>
</head>
<body>
<h1>Step 1.1: Creating a protected application</h1>
<p>The first step is to create an application. This would be a simple app without any user interface and with no serious capabilities. Our goal is to pass a serial number to the licensing system and receive its answer..</p>
<pre class="code">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
bool is_registered(const char *serial)
{
return serial &amp;&amp; serial[0] == 'X';
}
int main(int argc, char **argv)
{
char *serial = "Xserialnumber"; // we set the serial number directly in the code, for simplicity
if (!is_registered(serial))
{
printf("please register!\n");
return 0;
}
printf("We are registered.\n");
return 0;
}
</pre>
<p>The program uses a very simple way to check the serial number. The <strong>is_registered()</strong> function compares the first symbol of the serial number with 'X' and thinks the number is correct if this they match. For an incorrect serial number, a registration message is displayed, while if a user enter the correct key, "We are registered." is shown instead</p>
<p>The <a href="step12_code.htm">next step</a> is to add the code to check the serial number using the licensing system of
VMProtect.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,79 @@
<!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>Step 1.2: Adding the license checking code</title>
</head>
<body>
<h1>Step 1.2: Adding the license checking code</h1><strong>Include VMProtect SDK</strong>
<p>If you haven't do this before, it is time to include VMProtect SDK to your project. The SDK is three files: the header file (VMProtectSDK.h), the library file (VMProtectSDK32.lib) and the dll-file with implementation (VMProtectSDK32.dll). There are individual implementations of the library and the dll-file for 64-bit systems.</p>
<p>Put the dll-file, the header file and the library file to the working folder of our application, where the source files are, and include the header file to the main file:</p>
<pre class="code">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include "VMProtectSDK.h"
</pre>
<p>Build the project and make sure it compiles and runs as before. The licensing system is inactive yet.</p><strong>Sending a serial number to the licensing system</strong>
<p>Now, right below the line with the serial number, we add a call to the SDK function of the licensing system:</p>
<pre class="code">char *serial = "Xserialnumber"; // we set the serial number directly in the code, for simplicity
int res = VMProtectSetSerialNumber(serial);
printf("res = 0x%08X\n", res);
</pre>
<p>If after you did this the program stops with an error saying the required dll-file is missing, make sure you put the corresponding DLL-file to the working folder of our application. In case of a successful execution, you should see the following message:</p>
<pre class="code">res = 0x00000002
</pre>
<p>2 corresponds to the SERIAL_STATE_FLAG_INVALID flag
<a href="api.htm">described in the API</a>. This means the licensing system thinks our key is incorrect, which is pretty true, as we didn't "explain" to the system which keys are correct, and which ones are not.</p><strong>Specifying the "correct" serial number</strong>
<p>In the test mode, the licensing system analyzes the
VMProtectLicense.ini file and reacts to function calls in accordance with the specified settings. We will thoroughly review the file on later steps, and now we simply create such a file and add the following text there:</p>
<pre class="code">[TestLicense]
AcceptedSerialNumber=Xserialnumber
</pre>
<p>Now, run our program again. If you still receive the "2" error code, make sure the ini-file is located in the working folder of the app. This time we should receive "0". That's the sign that the licensing system accepted and approved the serial number. Now we can remove the
<strong>is_registered()</strong> function from the code - the licensing system is now in charge for checking serial numbers:</p>
<pre class="code">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include "VMProtectSDK.h"
int main(int argc, char **argv)
{
char *serial = "Xserialnumber"; // we set the serial number directly in the code, for simplicity
int res = VMProtectSetSerialNumber(serial);
printf("res = 0x%08X\n", res);
if (res)
{
printf("please register!\n");
return 0;
}
printf("We are registered.\n");
return 0;
}
</pre><br />
<a href="step13_flags.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,75 @@
<!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>Step 1.3: Retrieving serial number status flags</title>
</head>
<body>
<h1>Step 1.3: Retrieving serial number status flags</h1><strong>A handy function to print flags</strong>
<p>First of all, we need a handy function to transform numeric values of flags to comprehensible statuses of a serial number. Here is the code of this function:</p>
<pre class="code">#define PRINT_HELPER(state, flag) if (state &amp; flag) printf("%s ", #flag)
void print_state(INT state)
{
if (state == 0)
{
printf("state = 0\n");
return;
}
printf("state = ");
PRINT_HELPER(state, SERIAL_STATE_FLAG_CORRUPTED);
PRINT_HELPER(state, SERIAL_STATE_FLAG_INVALID);
PRINT_HELPER(state, SERIAL_STATE_FLAG_BLACKLISTED);
PRINT_HELPER(state, SERIAL_STATE_FLAG_DATE_EXPIRED);
PRINT_HELPER(state, SERIAL_STATE_FLAG_RUNNING_TIME_OVER);
PRINT_HELPER(state, SERIAL_STATE_FLAG_BAD_HWID);
PRINT_HELPER(state, SERIAL_STATE_FLAG_MAX_BUILD_EXPIRED);
printf("\n");
}
</pre>
<p>Despite the size, function is really simple - checks all bit flags one by one and print all that are present in the status variable. Replace
<strong>printf</strong> in the code after checking the serial number to the call to
<strong>print_state</strong>, and make changes to the serial number we pass to the licensing system:</p>
<pre class="code">char *serial = "Xserialnumber1"; // we set the serial number directly in the code, for simplicity
int res = VMProtectSetSerialNumber(serial);
print_state(res);
</pre>
<p>Now, if we run this program, the following message will be printed to the console:</p>
<pre class="code">state = SERIAL_STATE_FLAG_INVALID
please register!
</pre>
<p>Now, we put the old key back by removing "1" and run the program again:</p>
<pre class="code">state = 0
We are registered.
</pre>
<p>Now, as we can see status flags of a serial number, let's move to retrieving flags and data from a serial number.</p><strong>Retrieving serial number status</strong>
<p>You can get the status of a serial number in three ways: by calling
<strong>VMProtectSetSerialNumber()</strong>, by calling
<strong>VMProtectGetSerialNumberState()</strong> or by calling
<strong>VMProtectGetSerialNumberData()</strong> - status flags are put into one of fields of the structure. Each method is intended to use in specific time. The first check of the serial number is performed during installation. At this moment you should decline incorrect numbers, expired numbers, numbers in the black list and so on. Some limitations, for example, the maximum operation time of the program or serial number expiration date should also be checked in run-time. And the <strong>VMProtectGetSerialNumberState()</strong> method is the fastest and the most convenient way here. And if you need to receive complete information about the serial number, you can use the more powerful
<strong>VMProtectGetSerialNumberData()</strong> function.</p><br />
<a href="step14_name.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,48 @@
<!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>Step 1.4: Retrieving the name and the e-mail of a user</title>
</head>
<body>
<h1>Step 1.4: Retrieving the name and the e-mail of a user</h1>
<p>Let's start with simple things. We want to get the name and the e-mail of a user from a serial number to show them in the About window (or anywhere else). To do this, we have to add two more lines to our ini-file:</p>
<pre class="code">[TestLicense]
AcceptedSerialNumber=Xserialnumber
UserName=John Doe
EMail=john@doe.com
</pre>
<p>And in the program, if the registration is successful, we obtain these data and output them to the screen:</p>
<pre class="code">VMProtectSerialNumberData sd = {0};
VMProtectGetSerialNumberData(&amp;sd, sizeof(sd));
printf("name = %ls,\ne-mail = %ls\n", sd.wUserName, sd.wEMail);
</pre>
<p>The structure contains UNICODE data, so <strong>printf()</strong> uses %ls specifiers instead of %s.
The program should print the following text on the screen:</p>
<pre class="code">state = 0
We are registered.
name = John Doe,
e-mail = john@doe.com
</pre><br />
<a href="step15_exp.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,55 @@
<!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>Step 1.5: Checking the expiration date of the serial number</title>
</head>
<body>
<h1>Step 1.5: Checking the expiration date of the serial number</h1>
<p>Now put a new line to the ini-file in the following format: ExpDate=YYYYMMDD. For example:</p>
<pre class="code">ExpDate=20000101
</pre>
<p>The date specified in this line must be already passed, that is, the maximum date is yesterday. When we run the program, we should see the following:</p>
<pre class="code">state = SERIAL_STATE_FLAG_DATE_EXPIRED
please register!
</pre>
<p>Now let's get some more information before the "please register" message is shown and the program exists:</p>
<pre class="code">if (res)
{
VMProtectSerialNumberData sd = {0};
VMProtectGetSerialNumberData(&amp;sd, sizeof(sd));
printf("exp. date: y = %d, m = %d, d = %d\n", sd.dtExpire.wYear, sd.dtExpire.bMonth, sd.dtExpire.bDay);
printf("please register!\n");
return 0;
}
</pre>
<p>The second run of the app now provides more details to us:</p>
<pre class="code">state = SERIAL_STATE_FLAG_DATE_EXPIRED
exp. date: y = 2000, m = 1, d = 1
please register!
</pre>
<p>Ok, now remove the ExpDate=... line from the ini-file, so it will not influence everything else we are to do.</p><br />
<a href="step16_time.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,62 @@
<!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>Step 1.6: Limiting the operation time of the program</title>
</head>
<body>
<h1>Step 1.6: Limiting the operation time of the program</h1>
<p>You can limit the program operates since the moment it is started. This can be useful for demonstration purposes: you provide a real serial number to a user, but the program works no longer than 5 minutes. The licensing system doesn't force such a program to shut down, but merely sets the status flag. So, let's set a maximum working time of one minute, by adding the following line to the ini-file:</p>
<pre class="code">TimeLimit=1
</pre>
<p>And modify the program as follows:</p>
<pre class="code">int main(int argc, char **argv)
{
char *serial = "Xserialnumber"; // we set the serial number directly in the code, for simplicity
int res = VMProtectSetSerialNumber(serial);
print_state(res);
if (res) return 0;
VMProtectSerialNumberData sd = {0};
VMProtectGetSerialNumberData(&amp;sd, sizeof(sd));
printf("I will run for %d minute(s)\n", sd.bRunningTime);
print_state(VMProtectGetSerialNumberState());
Sleep(60 * 1000 * sd.bRunningTime);
printf("After %d minute(s):\n", sd.bRunningTime);
print_state(VMProtectGetSerialNumberState());
return 0;
}
</pre>
<p>The program prints the status of the serial number upon start up, then calculates the maximum operating time and waits it to expire. Then the serial number status is printed again. With the maximum operation time set to one minute we should receive the following result:</p>
<pre class="code">state = 0
I will run for 1 minute(s)
state = 0
After 1 minute(s):
state = SERIAL_STATE_FLAG_RUNNING_TIME_OVER
</pre>
<p>The protected program should analyze the status of a serial number periodically and shut down if the flag is set. The licensing system does not do this automatically, because the program may need to free memory, save data to a file and so on. Also, you may want the program to not stop after the operation time has expired, but instead switch to a more restricted mode. The licensing system leaves this up to the developer.</p><br />
<a href="step17_maxbuild.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!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>Step 1.7: Limiting the free upgrades period</title>
</head>
<body>
<h1>Step 1.7: Limiting the free upgrades period</h1><strong>How it works</strong>
<p>When VMProtect protects an application it records the date. The licensing system treats this date as a build date of the application. And you can put into a serial number the maximum build date this serial number can work with. Therefore, if you put the current date plus one year to the serial number, it will work with all versions of your programs you will be releasing in a year. A version you release one year and a day after will not work with this serial number, and a user will have a choice: use older version of your program or purchase a new key to work with the latest version of the program for one more year.</p><strong>Let's try it</strong>
<p>Put the line formatted as MaxBuildDate=YYYYMMDD into the ini-file:</p>
<pre class="code">MaxBuildDate=20000101
</pre>
<p>In the test mode, the licensing system treats today as the build date, so it is important that the date specified in this line already passed. That is, the maximum date is yesterday. Modify the code of the <strong>main()</strong> function so that it looked like this:</p>
<pre class="code">int main(int argc, char **argv)
{
char *serial = "Xserialnumber"; // we set the serial number directly in the code, for simplicity
int res = VMProtectSetSerialNumber(serial);
print_state(res);
if (res)
{
VMProtectSerialNumberData sd = {0};
VMProtectGetSerialNumberData(&amp;sd, sizeof(sd));
printf("max. build date: y = %d, m = %d, d = %d\n", sd.dtMaxBuild.wYear, sd.dtMaxBuild.bMonth, sd.dtMaxBuild.bDay);
printf("please register!\n");
return 0;
}
printf("I'm registered\n");
return 0;
}
</pre>
<p>Then, upon program run you should see the following:</p>
<pre class="code">state = SERIAL_STATE_FLAG_MAX_BUILD_EXPIRED
max. build date: y = 2000, m = 1, d = 1
please register!
</pre>
<p>By replacing the date in the ini-file to today or tomorrow, we end up with the "working" program:</p>
<pre class="code">state = 0
I'm registered
</pre>
<p>Remove the MaxBuildDate=... line from the ini-file so that it would not influence our further steps.</p><br />
<a href="step18_blacklist.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,55 @@
<!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>Step 1.8: Serial numbers in the black list</title>
</head>
<body>
<h1>Step 1.8: Serial numbers in the black list</h1>
<p>A serial number marked in VMProtect as "blocked" should not be accepted by the licensing system. When you will rebuild your application next time, VMProtect will add the hash of blacklisted serial numbers to the protected application. As a result, the licensing system of the application will decline these serial numbers in the future.</p>
<p>Firstly, lets minimize the contents of the <strong>main()</strong> function:</p>
<pre class="code">int main(int argc, char **argv)
{
char *serial = "Xserialnumber"; // we set the serial number directly in the code, for simplicity
int res = VMProtectSetSerialNumber(serial);
print_state(res);
return 0;
}
</pre>
<p>Now, run the program and make sure the licensing system do accept our serial number:</p>
<pre class="code">state = 0
</pre>
<p>Now, add this serial number to the black list of the licensing system. Add the following line to the ini-file:</p>
<pre class="code">BlackListedSerialNumber=Xserialnumber
</pre>
<p>And run the program again:</p>
<pre class="code">state = SERIAL_STATE_FLAG_BLACKLISTED
</pre>
<p>Should we inform a user that the serial number he or she enters is blacklisted? It is up to you. You can simply tell the serial number is incorrect or inform the user that the key is compromised. The licensing system simply informs the program about the fact of using the blacklisted serial number.</p><br />
<a href="step19_hwid.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,98 @@
<!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>Step 1.9: Hardware lock</title>
<style type="text/css">
/*<![CDATA[*/
div.c2 {text-align: center}
p.c1 {color:red;}
/*]]>*/
</style>
</head>
<body>
<h1>Step 1.9: Hardware lock</h1><strong>Receiving a hardware identifier</strong>
<p>Before we lock to hardware, we must receive a hardware identifier. The identifier is put into a serial number, and when the number is passed to the licensing system, it checks if identifiers match. So, first we need to receive the identifier of our hardware. Let's reduce the
<strong>main()</strong> function to the bare minimum:</p>
<pre class="code">int main(int argc, char **argv)
{
int nSize = VMProtectGetCurrentHWID(NULL, 0);
char *buf = new char[nSize];
VMProtectGetCurrentHWID(buf, nSize);
printf("HWID: %s\n", buf);
delete [] buf;
return 0;
}
</pre>
<p>By running the program, we receive a default test hardware identifier:</p>
<pre class="code">HWID: myhwid
</pre>
<p>To change the identifier, add the following line to the ini-file:</p>
<pre class="code">MyHWID=test
</pre>
<p>If we run the program afterwards, we can see the system thinks "test" is a hardware identifier of our PC:</p>
<pre class="code">HWID: test
</pre>
<p class="c1"><strong>Important!</strong> The program will display the real hardware identifier only after it is processed with VMProtect.</p><br />
<strong>Hardware-locked serial number</strong>
<p>To lock our test serial number to hardware, we should add one more line to the ini-file. This time we define the identifier that is "put into" the serial number:</p>
<pre class="code">KeyHWID=test
</pre>
<p>Then we complicate <strong>main()</strong> back a bit. Now it will pass a serial number and analyze the result it gets:</p>
<pre>
int main(int argc, char **argv)
{
int nSize = VMProtectGetCurrentHWID(NULL, 0);
char *buf = new char[nSize];
VMProtectGetCurrentHWID(buf, nSize);
printf("HWID: %s\n", buf);
delete [] buf;
char *serial = "Xserialnumber";
int res = VMProtectSetSerialNumber(serial);
print_state(res);
return 0;
}
</pre>
<p>After running the code we will see the following result:</p>
<pre class="code">HWID: test
state = 0
</pre>
<p>The licensing system has compared the current hardware identifier with the one written in the serial number. Identifiers are equal, so the
<strong>VMProtectSetSerialNumber()</strong> function returned 0 - the serial number matches.</p>
<p>Now let's try to "run" our program on another hardware. We simply change the value of the MyHWID parameter in the ini-file from "test" to "new test". Run the program again:</p>
<pre class="code">HWID: new test
state = SERIAL_STATE_FLAG_BAD_HWID
</pre>
<p>This time the licensing system returned the
SERIAL_STATE_FLAG_BAD_HWID flag, which means the real hardware identifier and the one stored in the serial number are not matching. The current identifier we see on the screen is "new test", while the serial number holds "test". If we change the KeyHWID parameter in the ini-file to "new test" we can make our serial number work on this "hardware" too.</p><br />
<a href="step1A_userdata.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,65 @@
<!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>Step 1.10: User data</title>
</head>
<body>
<h1>Step 1.10: User data</h1>
<p>A serial number can hold up to 255 bytes of arbitrary data that the licensing system passes to the program as they are. The data can hold any additional information about the sale, data required for operation of the full version or something else. Let's modify our
<strong>main()</strong> function so that it would read data from a serial number and display them on the screen:</p>
<pre class="code">int main(int argc, char **argv)
{
char *serial = "Xserialnumber";
int res = VMProtectSetSerialNumber(serial);
print_state(res);
if (res) return 0;
VMProtectSerialNumberData sd = {0};
VMProtectGetSerialNumberData(&amp;sd, sizeof(sd));
printf("Serial number has %d byte(s) of data\n", sd.nUserDataLength);
for (int i = 0; i &lt; sd.nUserDataLength; i++)
printf("%02X ", sd.bUserData[i]);
printf("\n");
return 0;
}
</pre>
<p>We also reduce the Ini-file to this:</p>
<pre class="code">[TestLicense]
AcceptedSerialNumber=Xserialnumber
</pre>
<p>Now, we run the program and make sure our serial number works well, but doesn't contain any data:</p>
<pre class="code">state = 0
Serial number has 0 byte(s) of data
</pre>
<p>To add new user data into the serial number, we need to create the UserData variable in the ini-file and assign data to it in the HEX format. Symbols must go in pairs, that is the length of a line must be a multiple of 2. Like this:</p>
<pre class="code">UserData=010203A0B0C0D0E0
</pre>
<p>In this case, if we runthe program we will receive the following result:</p>
<pre class="code">state = 0
Serial number has 8 byte(s) of data
01 02 03 A0 B0 C0 D0 E0
</pre><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,98 @@
<!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>Step 2.1: Creating a new protected application</title>
</head>
<body>
<h1>Step 2.1: Creating a new protected application</h1>
<p>At the first stage we made several simple apps to test the API of the licensing system. Now, on the second stage we'll create just one application. It will also be a console app with the <strong>foo()</strong> function working only in the registered version. Here is the code of our test application:</p>
<pre class="code">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include "VMProtectSDK.h"
#define PRINT_HELPER(state, flag) if (state &amp; flag) printf("%s ", #flag)
void print_state(INT state)
{
if (state == 0)
{
printf("state = 0\n");
return;
}
printf("state = ");
PRINT_HELPER(state, SERIAL_STATE_FLAG_CORRUPTED);
PRINT_HELPER(state, SERIAL_STATE_FLAG_INVALID);
PRINT_HELPER(state, SERIAL_STATE_FLAG_BLACKLISTED);
PRINT_HELPER(state, SERIAL_STATE_FLAG_DATE_EXPIRED);
PRINT_HELPER(state, SERIAL_STATE_FLAG_RUNNING_TIME_OVER);
PRINT_HELPER(state, SERIAL_STATE_FLAG_BAD_HWID);
PRINT_HELPER(state, SERIAL_STATE_FLAG_MAX_BUILD_EXPIRED);
printf("\n");
}
char *read_serial(const char *fname)
{
FILE *f;
if (0 != fopen_s(&amp;f, fname, "rb")) return NULL;
fseek(f, 0, SEEK_END);
int s = ftell(f);
fseek(f, 0, SEEK_SET);
char *buf = new char[s + 1];
fread(buf, s, 1, f);
buf[s] = 0;
fclose(f);
return buf;
}
// The foo() method is very short, but we need it to be an individual function
// so we asked the compiler to not compile it inline
__declspec(noinline) void foo()
{
printf("I'm foo!\n");
}
int main(int argc, char **argv)
{
char *serial = read_serial("serial.txt");
int res = VMProtectSetSerialNumber(serial);
delete [] serial;
if (res)
{
printf("serial number is bad\n");
print_state(res);
return 0;
}
printf("serial number is correct, calling foo()\n");
foo();
printf("done\n");
return 0;
}
</pre>
<p>Compile the program without the debug information, but in the linker settings we enable creating of the MAP-file - we will need it to work with VMProtect. After we run the program, we should see the following text:</p>
<pre class="code">serial number is bad
state = SERIAL_STATE_FLAG_INVALID
</pre>
<p>Currently, the licensing system still works in the test mode, because the file wasn't processed by VMProtect and doesn't contain a licensing module in it. On the <a href=
"step22_vmp.htm">next step</a> we will create a VMProtect project and will try to protect our application.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!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>Step 2.2: Creating a VMProtect protection project</title>
<style type="text/css">
</style>
</head>
<body>
<h1>Step 2.2: Creating a VMProtect protection project</h1>
<p>Now, as our test app is ready, compiled and has an assigned MAP-file in the same folder, we can run VMProtect
Ultimate and open the executable file. We need to add two functions to the project: _main (this is how Visual Studio renamed our main()) and foo(). Both functions can be seen in the list of functions in the "Functions" section in VMProtect.</p>
<!-- <p class="c1"><br /><img src="../../images/real_project_functions.png" alt="Дерево проекта" /></p> -->
<p>Then, we need to initialize the licensing system.
Open the "Licenses" section and create a pair of keys with the length of 2048 bit.</p><br />
<a href="step23_product.htm">Next step</a>
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!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>Step 2.3: First start of the protected product</title>
<style type="text/css">
</style>
</head>
<body>
<h1>Step 2.3: First start of the protected product</h1>
<p>The licensing system is initialized, so let's try to compile the VMProtect project and run the protected file. After running it from the command line we will receive the following message:</p>
<pre class="code">C:\test&gt;dummy_app.vmp.exe
serial number is bad
state = SERIAL_STATE_FLAG_INVALID
</pre>
<p>If you run depends.exe and can see that our protected executable file doesn't use the VMProtectSDK.dll any more. This means the licensing module is already built into the program. You can also review the list of used DLL from VMProtect, in the "Details | Imports" section.</p>
<p><img src="../../images/depends.png" /></p>
<p>Our protected program reads a serial number from the serial.txt file. Since there is no such file yet, the licensing module receives an empty serial number that is interpreted as incorrect.
Now we switch to the "Licenses" section and generate a serial number.
This procedure is described <a href=
"../licenses.htm">here</a> in all details, and now we merely create a simple serial number without any limitations.</p>
<p><img src="../../images/project_add_license.png" /></p>
<p>Then, we copy the serial number (select the "Serial number" field in the license properties and precc Ctrl+C), create a file named serial.txt in the same folder as the protected application, and paste the copied number there. Now, if we run our application we will see this:</p>
<pre class="code">C:\test&gt;dummy_app.vmp.exe
serial number is correct, calling foo()
I'm foo
done
</pre>
<p>The licensing system checked the serial number and found it correct. On the <a href="step24_test.htm">next step</a> we will try to apply some limitations will watch the results.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,65 @@
<!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>Step 2.4: Testing the results</title>
</head>
<body>
<h1>Step 2.4: Testing the results</h1><strong>Serial number expiration date</strong>
<p>Let's create another serial number with a certain expiration date. For example, 2005. This date has already passed and therefore our serial number must be incorrect. Switch to the "Licenses" section and click the "Add license" button on the toolbar. In the "Add license" dialog window enable the "Expiration date" option and specify September 30, 2005.
Create the serial number, copy it and paste to serial.txt, then run the program:</p>
<pre class="code">C:\test&gt;dummy_app.vmp.exe
serial number is bad
state = SERIAL_STATE_FLAG_DATE_EXPIRED
</pre>
<p>the licensing module returned the "serial number is expired" flag. Now, put the working serial number back to the serial.txt file and make sure the licensing module accepts it perfectly.</p>
<pre class="code">C:\test&gt;dummy_app.vmp.exe
serial number is correct, calling foo()
I'm foo
done
</pre><strong>Adding a serial number to the black list</strong>
<p>Let's imagine our "good" serial number has leaked to the Internet and is compromised now. We need to block it so that it will not work in future versions of the program. To do this, select the serial number in the list and set the "Blocked" property in the main panel to "Yes". For now, the serial number is not yet blocked, but when you protect the file again, the application will not accept this number any more. Let's make sure this is really so. If we run our program now, it should accept the blocked serial number without any problems, because this is the old version that knows nothing about the blocked number:</p>
<pre class="code">C:\test&gt;dummy_app.vmp.exe
serial number is correct, calling foo()
I'm foo
done
</pre>
<p>Now we make a copy of our program and name it as
"dummy_app1.vmp.exe", then open VMProtect and protect the application again. Then run this new version:</p>
<pre class="code">C:\test&gt;dummy_app.vmp.exe
serial number is bad
state = SERIAL_STATE_FLAG_BLACKLISTED
</pre>
<p>And the old version again, for comparison:</p>
<pre class="code">C:\test&gt;dummy_app1.vmp.exe
serial number is correct, calling foo()
I'm foo
done
</pre>
<p>The older version doesn't know about the blocked serial number and works as before.</p><br />
<br /><p>On the <a href=
"step25_codelock.htm">next step</a> we will try to lock the code to a serial number. But before we proceed, unblock the serial number and reapply protection in VMProtect to the application to make it accept this serial number again. Or simply create a new license.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!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>Step 2.5: Locking the code to a serial number</title>
<style type="text/css">
/*<![CDATA[*/
p.c2 {color:red;}
span.c1 {background-color:yellow;}
/*]]>*/
</style>
</head>
<body>
<h1>Step 2.5: Locking the code to a serial number</h1>
<p>One of the most common ways to crack programs is to locate the place where the serial number is checked and the nearby conditional jump that follows it. If the serial number is correct, the execution of the program goes one way, if not - the other way. A hacker locates this jump and replaces it with a jump to the "correct" way. Let's "crack" our test program using this technique. Directly in the source code, of course. Let's "switch off" our conditional jump:</p>
<pre class="code">char *serial = read_serial("serial.txt");
int res = VMProtectSetSerialNumber(serial);
delete [] serial;
if (<span class="c1">false &amp;&amp;</span> res)
{
</pre>
<p>Now, our program accepts any serial number and works normally. Of course, if the file is protected with VMProtect, even an experienced hacker would spend months to locate and modify the conditional jump as we did it. And taking into account the program check the serial number multiple times and under different conditions, even such a simple check is quite secure. But let's go further.</p><strong>locking the code to a serial number</strong>
<p class="c2"><strong>Important!</strong> The demo-version of VMProtect has a limitation on the number of processed function: only one function is processed. So if you use the demo-version, you should only include the foo() function to the project, otherwise the demo-version of VMProtect can choose the main() function and locking to a serial number will not work.</p>
<p>The licensing system of VMProtect allows you to lock the code of one or more functions to a serial number so, that they will not work without the correct serial number provided. the body of the function is virtualized, then encrypted and can only be decrypted with the correct serial number. This means, even if a hacker finds and fixes the conditional jump in the serial number check, functions locked to the serial number still will not work. Let's try this. In the "Functions" section choose the <strong>foo()</strong> function and at the right panel change the "Lock to Serial Number" option to "Yes".</p>
<p><img src="../../images/lock_to_serial.png" /></p>
<p>Then, protect the application. Since, we already "hacked" it, put an arbitrary text into the serial.txt file and run the application. The following text appears in the console:</p>
<pre class="code">C:\test&gt;dummy_app.vmp.exe
serial number is correct, calling foo()
</pre>
<p>This means, the hacker "fixed" the conditional jump, and the program runs on the "correct" way. But when the
<strong>foo()</strong> is invoked, the program displays a message:</p>
<p><img src="../../images/codelock_error.png" /></p>
<p>Since we locked the <strong>foo()</strong> function to the serial number, and the hacker does not have it, an attempt to decrypt the code of the function resulted in malfunction and inability to continue execution of the program. When "OK" is pressed, the program shuts down and the "done" message is never displayed in the console.
</p><strong>What should be locked to a serial number?</strong>
<p>It makes sense to lock to a serial number a function that should only run in the registered version of the program. Since locking requires virtualization, you should take into account some loss of performance. For instance, if a text editor does not allow saving result in a demo-version, you can lock the save document function to a serial number. If during its operation this function calls other functions, it is not necessary to lock them too, as they won't be of any use without the main function.</p>
<p>You should also remember that invoking the locked function without the serial number leads to program shut down, without a chance to save result of the work. that is why you should thoroughly test the application to make sure it doesn't calls such functions in the trial mode. In the above example, the text editor must disable the "Save" command in the demo mode and do not react on Ctrl+S shortcut as well. Of course, it also shouldn't ask to save the document on exit too. If you don't pay attention to this, a user may be disappointed with your "buggy" demo-version.</p><strong>Locking to a serial number and invalid serial numbers</strong>
<p>When the <strong>VMProtectSetSerialNumber()</strong> function is invoked, the licensing module checks the serial number passed to this function. Encrypted fragments of the code are only executed if the serial number was absolutely correct at the moment of check - not blacklisted, with the correct hardware identifier, not expired and so on. In this case all encrypted procedures are executed until the application is closed, or <strong>VMProtectSetSerialNumber()</strong> is invoked again.</p>
<p>Some limitations can "trigger" during execution of the program: for example, the operating time of the program may expire or the serial number expiration date comes. In this case the licensing module still encrypts and executes functions locked to the serial number. This is so, because it is hard for the protected application to detect the moment those limitations trigger and change the behaviour accordingly (block corresponding menu items and so on). If the licensing module suddenly stops execution of the code fragments that are locked to the serial number, this will very likely lead to malfunction of the application. That is why the decision is made when a serial number is set, and the corresponding execution mode is selected.</p><br />
<br />
<br />
<br />
<br />
<hr noshade="noshade" size="1" />
<div align="center">
© 2006-2015 Copyright VMProtect Software
</div>
</body>
</html>