Você está na página 1de 24

IKG (Inno Key Generator)

Compliments of MJ Freelancing
http://www.mjfreelancing.com

Copyright (c) MJ Freelancing 2002-2003. All rights reserved.


IKG (Inno Key Generator) Table of Contents
Page I

Table of Contents
1 Introduction 1
1.1 License Information 1
1.2 What is IKG ? 3
1.3 How does it work ? 3
1.4 How secure ? 3

2 Getting Started 5
2.1 IKG Overview 5
2.2 Public Key vs Private Key 6
2.3 Running IKG for the first time 6
2.4 Subsequent usage of IKG 8
2.5 Configuring an Inno Key 8
2.6 Exporting an Inno Key 10
2.7 Validating an Inno Key 10

3 Implementing an Inno Key 13


3.1 Script Requirements 13

4 IKG in Detail 15
4.1 IKG - The Generator 15
4.1.1 The File Menu 15
New Inno Key 15
Load Inno Key 16
Save Inno Key 17
Save Data Bank 17
Change Bank Password 17
4.1.2 The Key Menu 18
New Public Key 18
New Private Key 18
Delete Selected Key 18
4.2 ISID - The Validation DLL 18
4.2.1 ValidateSerialNumber 18
4.2.2 GetMACAddress 19
4.2.3 GetHDDSerial 19
4.2.4 Using IKG with VB 19
4.3 IKGCG - Code Generator 20
4.3.1 GenerateSerialNumber 20
4.4 TestProj - The Test Harness 20
4.4.1 What is it for ? 20
4.4.2 Testing an unlock code 20

5 Index 22

1.0 Page I
15/07/2004
IKG (Inno Key Generator) Introduction License Information
1.1 Page 1

IKG (Inno Key Generator)


1 Introduction
IKG is provided as a royalty free third party product from MJ Freelancing (http://www.mjfreelancing.com) to compliment the
following products:

Product Author Web Site


Inno Setup Jordan Russell http://www.jrsoftware.com
My Inno Extensions Martijn Laan http://www.wintax.nl/isx

The author of IKG is Malcolm Smith of MJ Freelancing.

MJ Freelancing is a small business specialising in component development for the C++Builder(TM) environment. The main
product developed by MJ Freelancing is a comprehensive security suite called MJFSecurity. For information can be found at
http://www.mjfreelancing.com.

Refer to the following sections for more information:

License Information( see page 1)

What is IKG ?( see page 3)

How does it work ?( see page 3)

How secure ?( see page 3)

1.1 License Information


IKG - Inno Key Generator
License Statement and Limited Warranty

IMPORTANT - READ CAREFULLY

This license statement and limited warranty constitutes a legal agreement ("License Agreement") between you (either as an
individual or a single entity) and MJ Freelancing for the software product / component development tools ("Software")
identified above, including any software, media, and accompanying on-line or printed documentation.

BY INSTALLING, COPYING, OR OTHERWISE USING THE SOFTWARE, YOU AGREE TO BE BOUND BY ALL OF THE
TERMS AND CONDITIONS OF THE LICENSE AGREEMENT. If you are the original purchaser of the Software and you do
not agree with the terms and conditions of the License Agreement, promptly return the unused Software to the place from
which you obtained it for a full refund.

Upon your acceptance of the terms and conditions of the License Agreement, MJ Freelancing grants you the right to use the
Software in the manner provided below.

This Software may include source code, redistributable files, and/or other files provided by a third party vendor (Third Party
Software). Since use of Third Party Software might be subject to license restrictions imposed by the third party vendor, you
1.0 Page 1
15/07/2004
IKG (Inno Key Generator) Introduction License Information
1.1 Page 2
should refer to the on-line documentation (if any) provided with Third Party Software for any license restrictions imposed by
the third party vendor. In any event, any license restrictions imposed by a third party vendor are in addition to, not in lieu of,
the terms and conditions of the License Agreement. The supplied software is royalty free unless otherwise indicated in this
agreement.

LIMITED WARRANTY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MJ FREELANCING DISCLAIM
ALL OTHER WARRANTIES AND CONDITIONS, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE, AND THE PROVISION OF OR FAILURE TO PROVIDE
SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHERS,
WHICH VARY FROM STATE/ TERRITORY TO STATE/TERRITORY. LIMITATION OF LIABILITY TO THE MAXIMUM
EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MJ FREELANCING BE LIABLE FOR ANY SPECIAL,
INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE PRODUCT
OR THE PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF MJ FREELANCING HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

HIGH RISK ACTIVITIES

The Software is not fault-tolerant and is not designed, manufactured or intended for use or resale as on-line control
equipment in hazardous environments requiring fail- safe performance, such as in the operation of nuclear facilities, aircraft
navigation or communication systems, air traffic control, direct life support machines, or weapons systems, in which the
failure of the Software could lead directly to death, personal injury, or severe physical or environmental damage ("High Risk
Activities"). MJ Freelancing specifically disclaim any express or implied warranty of fitness for High Risk Activities.

GENERAL PROVISIONS

This License Agreement may only be modified in writing signed by you and an authorized officer of MJ Freelancing. All terms
of any purchase order or other ordering document shall be superseded by this License Agreement. If any provision of the
License Agreement is found void or unenforceable, the remainder will remain valid and enforceable according to its terms. If
any remedy provided is determined to have failed for its essential purpose, all limitations of liability and exclusions of
damages set forth in this License Agreement shall remain in effect.

This License Agreement shall be interpreted and governed by the laws of the State of New South Wales, Australia. This
License Agreement gives you specific legal rights; you may have others which vary from state to state and from country to
country. MJ Freelancing reserves all rights not specifically granted in this License Agreement.

COMPETITIVE PRODUCTS

The software provided, including source code and binary files, cannot be used in the production of a competitive product.
The intellectual property of this application rests solely with MJ Freelancing. Where third-party source code has been
provided the intellectual property of that source code, unless otherwise indicated, belongs to the third party. The design and
implementation rights of any third-party source code is owned by MJ Freelancing.

DEVELOPER LICENSE

This application is provided royalty free. You are permitted to use this application without fee. You may not distribute this
application under any circumstances. All referals to this application must be directed to MJ Freelancing at
http://www.mjfreelancing.com where the latest version is always available.

1.0 Page 2
15/07/2004
IKG (Inno Key Generator) Introduction How secure ?
1.4 Page 3

1.2 What is IKG ?


IKG is a Inno Key Generator.

If you need a slightly more secure method of protecting your application from unauthorized installation then IKG might be
suitable for you. IKG is not a total anti-piracy solution and it should not be substituted for more rigid protection options, such
as the MJFSecurity suite from MJ Freelancing (http://www.mjfreelancing.com).

Key features

Each IKG key created includes random information to make each key unique between developers and applications. An
unlock code is then derived from this information along with user-supplied information based on settings you configure for
the key (such as which options to use).
Several options available for the type of information required from your customers.
Several options available for the style and format of the unlock code generated.
Persistant storage of generated keys in a IKG Data Bank. This is basically a flat file containing all of the keys generated
(including the private key information). This file is encrypted with a password. The password is not recoverable if you lose
it; even by me.
Option to export a single key as an IKY file (the public key). This is distributed with your installation script. The file does not
include the private key information.
Option to import a single IKY file (possibly created by a colleague). A private key is required to import the file. This is
required for two reasons. First, the application needs the private key to be able to decrypt it. Secondly, it acts as a security
feature to ensure nobody can steal the information that would enable them to generate their own unlock codes.

1.3 How does it work ?


Using the [code] section available in My Inno Extensions you can write a script to display a dialog that allows the user to
enter registration information. This information is then verified before the installation is allowed to proceed.

As part of your installation you include a DLL and a public key (generated from IKG). The public key is encrypted using the
latest standard known as Rijndael. The encryption is performed using a private key. DO NOT SUPPLY THE PRIVATE KEY
TO ANYONE EXCEPT FOR THOSE YOU WANT TO INSTALL YOUR APPLICATION.

It is advisable to change the private key from time to time (this will not change the user registration details but they will need
the new private key to enable the DLL to decrypt the public key).

The public keys contains various pieces of information, some of which are not used by IKG. The length of the key does,
however, improve the security of the contents.

When your script calls the validation method in the DLL, the public key is decrypted and the user-supplied information is
verified. The unlock code is generated according to information private to the public key (internal random information unique
to each key) as well as the user information supplied. The DLL returns true or false to indicate success or failure respectively.

1.4 How secure ?


In two words, Not Very.

The Inno Key generated from IKG should only be used for deterrent protection during the installation of your application. MJ
Freelancing offers a commercial product for C++Builder(TM) called MJFSecurity that is designed for stronger protection of
applications. Only a small percentage of this security is provided with IKG.

Why is this not so secure ?


A hacker could easily create an alternate DLL that returns true for the validation test. It would not matter what information an
end-user inputs, the DLL will simply report the test as passed.

So why provide IKG ?


Because some users of Inno Setup / My Inno Extensions wanted a better solution than the built-in option of a stored
password.

1.0 Page 3
15/07/2004
IKG (Inno Key Generator) Introduction How secure ?
1.4 Page 4
IKG is an alternative for the password option and provides only slightly better protection from unauthorized installation of
your product.

Why not provide a better solution ?


To be honest, because it is FREE. MJFsecurity is the major income source for MJFreelancing. IKG cannot be allowed to
compete with it. If you use C++Builder(TM) and require true software protection then take a browse at
http://www.mjfreelancing.com for more information.

What encryption is used ?


The latest standard, known as Rijndael.

1.0 Page 4
15/07/2004
IKG (Inno Key Generator) Getting Started IKG Overview
2.1 Page 5

2 Getting Started
This section gives a detailed overview of how to use IKG from the very start. You will be shown what to do when you first run
IKG and will move on to configure an Inno Key, exporting a Inno Key and then testing the key within the test harness
supplied in the download.

IKG Overview( see page 5)

Public Key vs Private Key( see page 6)

Running IKG for the first time( see page 6)

Subsequent usage of IKG( see page 8)

Configuring an Inno Key( see page 8)

Exporting an Inno Key( see page 10)

Validating an Inno Key( see page 10)

2.1 IKG Overview


IKG is an easy-to-use Key Generator for Inno Setup (requires My Inno Extensions). A sample screen shot is shown below.

This screen shot shows the configuration for the sample public key provided with this download. This same public key was
used in the installation of IKG itself.

So what do you need to do with IKG to make it work for you ?

Create a public key. This key must be unique for each application you write an installation script for. If your minor version
updates are provided free to your users then use the same key for each update. If you release a completely new version
that you want users to acquire new installation codes then you must create a new public key OR define a new private key
for the same public key.
Record the private key used to encrypt the public key. Without this private key you will not be able to reload this key, nor
will your users be able to install your application ! It is up to you to store the private key and the generated public key for
future reference.
Implement a script similar to the sample provided with this download. You may need to modify it slightly depending on the
dialog pages you use in your installation script.
Make sure your script includes the ISID.DLL and the public key created by IKG. These files should have their Copy Mode
set to dontcopy.

1.0 Page 5
15/07/2004
IKG (Inno Key Generator) Getting Started Running IKG for the first
2.3 time Page 6

2.2 Public Key vs Private Key


What makes a public key different from a private key ?

In general, a IKG public key is information you make available for everyone (included with your installation). The information
by itself is, however, useless. To gain access to the information encrypted within this public key you need a private key. This
key is required for the decryption process.

The public key contains a timestamp that is required as validation when attempting to import a pulic key into IKG. This is a
extra (albiet weak) validation test to prevent other users of IKG trying to import a public key that would ultimately allow them
to generate as many unlock codes as they liked.

The above screen shot (as an example) shows the timestamp in the right-most column. If someone was to get hold of the
public key and tried to import it into IKG they will not be able to do it without the timestamp information. This timestamp is not
the same timestamp as the file itself. It is created internally by IKG when the key is produced.

2.3 Running IKG for the first time


When IKG is run for the very first time you will be presented with a screen similar to the one shown below.

1.0 Page 6
15/07/2004
IKG (Inno Key Generator) Getting Started Running IKG for the first
2.3 time Page 7

The only difference between your screen and the one above is the contents of the private key and timestamp information for
New Project1.

The key produced (labelled as New Project1) is created automatically because no current data bank (referred throughout
this help file as IKG Data Bank) was found in the same directory as the executable.

The IKG window is divided into three areas.

The top left hand corner contains information that must be (optionally) provided by your user except for the expiry date. The
checkboxes next to each item indicate if the information is required from the user. Each item has a direct impact on the
unlock code generated (including the expiry date). These items are detailed more below.

Registered Name - The name of the user registering the installation.


Organisation - The name of the organisation (company) registering the installation.
User Defined - A user defined field you can use for any purpose. A common use for this is a product code.
HDD Serial Number - The serial number of the user's hard drive. The ISID.DLL supplied contains a method that allows
you to obtain the serial number of the hard drive. You need to present that information to the user so they can tell you
what it is. Without it you cannot generate an unlock code. See the additional note below*.
MAC Address - The MAC Address of the user's network card. The ISID.DLL supplied contains a method that allows you
to obtain the MAC Address of the network card. You need to present that information to the user so they can tell you what
it is. Without it you cannot generate an unlock code. See the additional note below*.
Expiry Date - The date after which installation ceases to be valid. Use this option if you want to prevent the installation
from proceeding after this date. This date comparison is done in ISID.DLL and performs several validation checks to
prevent users from winding the clock back. The methods are not 100% fail safe but they will work in the majority of cases.
Several files (system and user) are checked against the current system date.

* Using the HDD Serial Number and MAC Address information may not always be a valuable test. Hard drives get replaced
or re-formatted and MAC Address information may not always be correct when there is more than one NIC card (or virtual
NIC's such as VMWare). ISID.DLL does its best to obtain the correct information.

For the purpose of moving through this help file, rename the project by clicking on the text New Project1 until you are in edit
mode. Edit the text and press Enter or click on another area of the listview.

1.0 Page 7
15/07/2004
IKG (Inno Key Generator) Getting Started Configuring an Inno Key
2.5 Page 8

Now we will exit IKG (we'll be back shortly) to see what happens when we re-open the application. Choose File | Exit from
the menu or press Ctrl-X. You will be prompted to save the current IKG Data Bank. Click Yes.

The next dialog will ask you for a password. This is the password used to encrypt the information in the IKG Data Bank
about to be created.

For this demonstration we will use the password 'demo' as shown.

Move onto Subsequent usage of IKG( see page 8) to see what happens when you re-open IKG.

2.4 Subsequent usage of IKG


Open IKG. Enter the password you have used to encrypt the IKG Data Bank. If an incorrect password is entered the
application will close.

The contents of the IKG Data Bank will be decrypted and displayed. All project items are initially sorted by project name but
you can change the sort order by clicking on any of the column headers.

2.5 Configuring an Inno Key


This topic is best explained with a sample, as shown below.

1.0 Page 8
15/07/2004
IKG (Inno Key Generator) Getting Started Configuring an Inno Key
2.5 Page 9

The top half of the window is used for configuring the Inno Key.

The above sample shows four options enabled; namely the registered name, organisation, user defined fields and the expiry
date. The textual information in the data fields is NOT stored in the IKG Data Bank. This application creates and stores Inno
Keys, not your user registration information. That data is best stored in a database. If there is enough interest and demand I
might build it into this product.

The expiry date information is stored in the Inno Key because it is used to determine if the installation should proceed. If a
valid unlock code has been provided by your user but the expiry date has been reached then the ISID.DLL will report the
unlock code as invalid.

The top right half of the window is used to configure the style of the unlock code. The above sample shows an unlock code
configured to have 18 characters (excluding mask characters), the mask format to use, the style of the unlock code
(explained below) and an option to exclude ambiguous characters such as 1, l, o, O, and 0. If this option is selected then
each of the ambiguous characters are replaced with a ? as shown above.

The Mask and Style options are explained in more detail below.

Option Explanation
Mask The mask format is optional. It is recommended not to use this field because it gives hackers an indication of how
many characters make up your code. The format specifiers are identical to those used by the VCL and are
therefore not documented in this help file. If the option is used the ISID.DLL will first attempt to validate the unlock
code without using this information. In the above example, a supplied code of 7q8?3RTfqJHfBJ9u5c will validate
just as equally as 7q8?-3RTfq-JHfBJ-9u5c.
Style The generated unlock code can be made up of various combinations of uppercase letters, lowercase letters and
numbers. The table below describes these in more detail.

The unlock code styles are given below. If the option to exclude ambiguous characters is enabled then some letters and
numbers (l, o, O, 0, 1) will be replaced with a ? character.

Style Description
LowerAlpha The unlock code will comprise of lowercase letters only.
LowerAlphaNumeric The unlock code will comprise of lowercase letters and numbers.
UpperAlpha The unlock code will comprise of uppercase letters only.
UpperAlphaNumeric The unlock code will comprise of uppercase letters and numbers.
AlphaAll The unlock code will comprise of upper and lowercase letters only.
AlphaNumeric The unlock code will comprise of upper and lowercase letters as well as numerical values.

1.0 Page 9
15/07/2004
IKG (Inno Key Generator) Getting Started Validating an Inno Key
2.7 Page 10
When you are happy with your Inno Key configuration choose File | Save Data Bank from the menu or press CTRL-ALT-S.
This will update the IKG Data Bank.

2.6 Exporting an Inno Key


You need to export an individual Inno Key from the IKG Data Bank to be able to use it in your installation script.

Right-click the Inno Key of interest and select the Save Inno Key menu option. Alternatively, press CTRL-S when the
required Inno Key is the active item in the list view.

The save dialog is given. This demo is saving the Inno Key with the name MyFirstProject.iky. The .iky extension will be
added if you leave it off. This key is used in your installation script.

Refer to Validating an Inno Key( see page 10) and Script Requirements( see page 13) for additional information.

2.7 Validating an Inno Key


This section of the help file will be using the MyFirstProject.iky Inno Key as exported in the previous section Exporting an
Inno Key( see page 10).

First open IKG and make the Inno Key of interest the currently selected item.

1.0 Page 10
15/07/2004
IKG (Inno Key Generator) Getting Started Validating an Inno Key
2.7 Page 11

To test the ISID.DLL (as used by the installation script) we can use the test harness supplied (TestProj.exe). To know what
to enter into the test harness you can use IKG to generate the unlock code. The name, organisation and user defined fields
have been completed.

Making sure the ISID.DLL file is in the same folder as the TestProj.exe application, enter the same information into the test
harness as shown below.

At this stage the test harness knows nothing about the Inno Key. Now use the button with the ellipsis (...) to locate and load
the Inno Key MyFirstProject.iky. Additionally, copy the registration code and private key information directly from IKG (use
the copy buttons to the right of the edit fields).

1.0 Page 11
15/07/2004
IKG (Inno Key Generator) Getting Started Validating an Inno Key
2.7 Page 12
If you were to click the 'Validate the Code' button you will get a message to indicate the code is invalid. This is because we
have not ticked the checkboxes next to the fields of interest (user name, organisation or user defined). The test harness
does not actually load the Inno Key. The information is passed to the ISID.DLL just like it will be done from your installation
script. Tick the three checkboxes and click the validation button.

Now it is time to use the Inno Key in your installation script. Refer to the Script Requirements( see page 13) section for more
information.

1.0 Page 12
15/07/2004
IKG (Inno Key Generator) Implementing an Inno Key Script
3.1 Requirements Page 13

3 Implementing an Inno Key


The implementation of an Inno Key requires some additional work in the [Code] section of your script (as provided by My
Inno Extensions). The section Script Requirements( see page 13) discusses this in greater detail.

3.1 Script Requirements


As mentioned in the Introduction( see page 1) you will need to use the third party tool My Inno Extensions to be able to
implement your Inno Key.

The exact way you use your Inno Key is personal. This section will show the minimum requirements for implementing an
Inno Key in the [Code] section of your installation script.

Declare the DLL function


function ValidateSerialNumber(InnoKeyFile, User, Orgn, ProdCode, HDD, MAC, PrivateKey,
Serial: String): Boolean;
external 'ValidateSerialNumber@files:ISID.dll stdcall';
The parameters for this function is detailed below.

Parameter Description
InnoKeyFile This is the fully path qualified filename of the Inno Key you exported from IKG.
User The user name of the person installing your application.
Orgn The organisation name (Company) installing your application.
ProdCode The user defined field (typically used as a product code).
HDD The serial number of the HDD on the installers computer.
MAC The MAC Address of the netwrok card on the installers computer.
PrivateKey The private key used to encrypt the Inno Key.

Where a parameter is not used pass a blank string.

Do not store the private key in the script of your installation. This can be easily extracted from the executable. You should
have your end user provide this information (you give it to them when they register the application).

If you are using the HDD serial number and MAC Address information you will need the end user to provide this information
to you since you need to input this into the key generator (IKG).

Validating an unlock code


The sample script (IKG.iss) provided in the download is the actual script used to build the installation of IKG. The script uses
an array to hold the information entered by the user. The InitializeSetup section of [Code] initializes the array as follows;
UserValues[0] := GetPreviousData('Name', UserValues[0]);
UserValues[1] := GetPreviousData('Company', UserValues[1]);
UserValues[2] := GetPreviousData('Unlock', UserValues[2]);
UserValues[3] := GetPreviousData('Private', UserValues[3]);
The sample script includes an Inno Key called sample1.iky (this was the very first key I exported and the name has never
changed). Your Inno Key, along with ISID.DLL, is included with your installation with a copy mode of dontcopy. The relevant
section of your [Files] section might look something like:
Source: C:\Business\MJ Freelancing\Projects\InnoKeyGen\Script Demo\sample1.iky; DestDir:
{tmp}; CopyMode: dontcopy
Source: ..\ISID\ISID.dll; DestDir: {sys}\ISID; CopyMode: dontcopy
At saome stage in your script you need to retrieve data from the user and validate it via the ISID.DLL. How you do this
depends largely on your own script (you can review IKG.iss to see how it was done for IKG) but the key thing is to
temporarily extract the Inno Key and then pass all of the information to the DLL.

To extract the Inno Key, do something like this:

1.0 Page 13
15/07/2004
IKG (Inno Key Generator) Implementing an Inno Key Script
3.1 Requirements Page 14
ExtractTemporaryFile('sample1.iky'); { the public key file }
Store the path and filename to your Inno Key in a string variable:
ExpPath := ExpandConstant('{tmp}\sample1.iky');
Pass all of the information to the DLL and act on the boolean result:
Result := ValidateSerialNumber( ExpPath, UserValues[0], UserValues[1], '', '', '',
UserValues[3], UserValues[2] );
In the above example UserValues[0], UserValues[1], UserValues[3] and UserValues[2] are the 'Name','Company', 'Private'
and 'Unlock' array items as explained above. The blank strings are fields not used to validate the unlock code provided by
the user. The ExpPath parameter is the fully qualified filename to the Inno Key.

This help file will not explain the sample script from beginning to end. You should refer to the help provided by My Inno
Extensions and the jrsoftware.innosetup.thirdparty newsgroup for further information.

If you want to see IKG.iss in action, just install IKG again - it is the same script.

1.0 Page 14
15/07/2004
IKG (Inno Key Generator) IKG in Detail IKG - The Generator The File Menu
4.1 Page 15

4 IKG in Detail
This section details the IKG application, the ISID DLL and the test harness (TestProj) supplied.

IKG - The Generator( see page 15)

ISID - The Validation DLL( see page 18)

TestProj - The Test Harness( see page 20)

4.1 IKG - The Generator


IKG = Inno Key Generator
This section details the various menus available within the application.

The File Menu( see page 15)

The Key Menu( see page 18)

4.1.1 The File Menu


The File menu provides a number of options for managing Inno Keys and the IKG Data Bank.

Each item is detailed in the following sections:

New Inno Key( see page 15)

Load Inno Key( see page 16)

Save Inno Key( see page 17)

Save Data Bank( see page 17)

Change Bank Password( see page 17)

New Inno Key

New Inno Key - Ctrl+N


This option is also available by right-clicking the list view.

This option creates a brand new Inno Key and gives a default project name of New Project# where # is the next available
number starting from 1.

1.0 Page 15
15/07/2004
IKG (Inno Key Generator) IKG in Detail IKG - The Generator The File Menu
4.1 Page 16

The above screen shot shows several new Inno Keys produced. The items are sorted (initially) by the Project description.
Click any column and the sort order will change. Click the same column twice and the order will toggle between ascending
and descending. The projects are sorted alphabetically hence New Project10 will come before New Project2.

Although you can only see a handful of information about the generated key there are over 900 byes of data making up the
key. The private key is not stored in the Inno Key, it is used to encrypt the individual keys. This private key must be provided
to your end user for the installation process. Without this private key ISID.DLL cannot verify the unlock code information.

The Date/Time information is only required if you need to import an Inno Key. To prevent someone from importing an Inno
Key into IKG the system uses a timestamp to verify the authentication of the import. This timestamp is NOT the time stamp
of the file itself. If you lose this information (and the Inno Key is not already in the IKG Data Bank) then you will never be
able to import the file into IKG. This is explained further in the section Load Inno Key( see page 16).

Load Inno Key

Load Inno Key - Ctrl+L


If a colleague creates a Inno Key on another IKG Data Bank and you want to import it into another then this is the menu
option to use. The information in this section attempts to load an existing key to show all possible steps in the process.

1.0 Page 16
15/07/2004
IKG (Inno Key Generator) IKG in Detail IKG - The Generator The File Menu
4.1 Page 17
We will try and import the same key as the one shown highlighted (ignore the text in the edit fields). Press CTRL+L or
right-click the listview and choose the sub menu Load Inno Key. From the open dialog we select the appropriate Inno Key (if
you followed other areas of this help file you may have created the above key, it is not supplied).

If the private key information is correct then you will be presented with another dialog where you will be required to enter the
timestamp for the Inno Key. As you can see in the above screen shot we need to enter 02/11/2002 16:25:12 as shown
below.

When you click the OK button the information is verified. If the timestamp information is incorrect the import will abort,
otherwise you will be prompted for a project name. If the Inno Key is not in the IKG Data Bank then the information will be
added otherwise you will be notified that the information already exists and the current item in the listview will be updated to
reflect the item that was found. The search is based on the private key rather than the project name - the private key is
unique for each Inno Key.

Save Inno Key

Save Inno Key - Ctrl+S


A Inno Key can be exported from the IKG Data Bank for two reasons.

1. You must export the key to be able to include it with your installation script. The end user (and ISID.DLL) will require the
private key.
2. You might need to forward the key to a colleague. They will require the private key and the timestamp information to be
able to import it.

Select the required Inno Key from the listview then choose Save Inno Key from the file menu or press CTRL-S or right-click
the listview to choose this option. A save dialog will be provided for you to choose a name to save the key to. The file will be
saved, encrypted using the private key.

Save Data Bank

Save Data Bank - Ctrl+Alt+S


When a change is made to the IKG Data Bank the statusbar indicates the information in memory has been modified. These
changes are not permanent until you save the information. This is done via this menu option.

If you exit IKG without updating the information you will be prompted to save the data first.

Change Bank Password

Change Bank Password - Ctrl+P


The information stored in the IKG Data Bank is encrypted with a password. You enter this password when you save your
first data bank. This is the same password you must enter each time you run
1.0 Page 17
15/07/2004
IKG (Inno Key Generator) IKG in Detail ISID - The Validation DLL ValidateSerialNumber
4.2 Page 18
IKG.

You can change this password at any time using this menu option or hotkey.

4.1.2 The Key Menu


The Key menu options available change (state) depending on whether or not a Inno Key item is selected in the listview. The
remainder of this document assumes an item is selected (creating and loading keys do not require an item to be selected).

New Public Key

New Public Key - Ctrl+B


If you want to change the public key for a Inno Key then use this option. This will cause the internal public key data to
change, including the timestamp information. If you save the IKG Data Bank the old Inno Key cannot be recovered.

New Private Key

New Private Key - Ctrl+V


This option assigns a new private key to the Inno Key. The key itself is unchanged. The private key is used to encrypt the
information contained within the key. If you modify a Inno Key this way then your users will have the same license
information (including unlock code) but they will require the new private key to be able to use it.

Delete Selected Key

Delete Selected Key - Ctrl+D


This option gives you the ability to delete a Inno Key from the IKG Data Bank. If you save the data bank then the Inno Key
cannotbe recovered unless you have previously exported the key and you know the private key and timestamp information.
Refer to Load Inno Key( see page 16) for information on how to import a previously exported Inno Key.

4.2 ISID - The Validation DLL


ISID = Inno Secure Install DLL
The ISID.DLL file provided performs the validation of a user supplied unlock code. It also has functions available to obtain
the HDD serial number and MAC Address of the user's computer. The exported functions are detailed in the following
sections.

ValidateSerialNumber( see page 18)

GetMACAddress( see page 19)

GetHDDSerial( see page 19)

4.2.1 ValidateSerialNumber
__declspec(dllexport) bool __stdcall ValidateSerialNumber(
char *InnoKeyFile, // Inno Key file generatedby IKG
char *User, // User name
char *Orgn, // Organisation
char *ProdCode, // User defined field (typically a product code)
char *HDD, // Hard drive serial number
char *MAC, // MAC Address of network card
char *PrivateKey, // Private key required to access the Inno Key
char *Serial); // The unlock code for this user
Parameters not required (according to the configuration of your Inno Key) should send an empty string.

Your Inno script will include this declaration:


function ValidateSerialNumber(InnoKeyFile, User, Orgn, ProdCode, HDD, MAC, PrivateKey,
Serial: String): Boolean;
external 'ValidateSerialNumber@files:ISID.dll stdcall';

1.0 Page 18
15/07/2004
IKG (Inno Key Generator) IKG in Detail ISID - The Validation DLL Using IKG with VB
4.2 Page 19
Refer to Implementing an Inno Key( see page 13) and Using IKG with VB( see page 19) for additional information.

4.2.2 GetMACAddress
__declspec(dllexport) int __stdcall GetMACAddress(char *output);
This method will return the MAC address for the network card on the destination PC. This method does its best to resolve
the primary card in the case where there is more than one or there are virtual cards, as are detected when VMWare is
installed.

If an empty string buffer is passed to GetMACAddress the method returns the size of the buffer required, otherwise the
output buffer will contain the MAC Address upon return.
procedure GetMACAddress(output: String): Integer;
external 'GetMACAddress@files:ISID.dll stdcall';

4.2.3 GetHDDSerial
__declspec(dllexport) int __stdcall GetHDDSerial(char Drive, char *output);
This method will return the hard drive serial number for the given drive on the destination PC.

The drive parameter is the drive letter (upper or lowercase).

If an empty string buffer is passed to GetHDDSerial the method returns the size of the buffer required, otherwise the output
buffer will contain the hard drive serial number upon return.
procedure GetHDDSerial(Drive: Char, output: String): Integer;
external 'GetHDDSerial@files:ISID.dll stdcall';

4.2.4 Using IKG with VB


I've been asked on several occassions how to use IKG with Visual Basic. I don't use this tool so have no ieda. Here is some
information provided by another user. Use at your own risk.

Creating a KeyGen
Option Explicit
Declare Function GenerateSerialNumber Lib "IKGCG.DLL" _
(ByVal InnoKeyFile As String, ByVal User As String, ByVal Orgn As String, _
ByVal ProdCode As String, ByVal HDD As String, ByVal MAC As String, _
ByVal PrivateKey As String, ByVal UnlockCode As String) As Boolean

Public Function GetCode(ByVal sName As String) As String


On Error GoTo errh
Dim UnlockCode As String * 17 'Change this number to the length of your keycode
GetCode = GenerateSerialNumber("Key.iky", sName, "", "", "", "", "PRIVATE KEY",
UnlockCode)
GetCode = UnlockCode
Exit Function
errh:
MsgBox Err.Description
End Function

Validating the DLL


Option Explicit
Private Declare Function ValidateSerialNumber Lib "ISID.DLL" _
(ByVal InnoKeyFile As String, ByVal User As String, ByVal Orgn As String, _
ByVal ProdCode As String, ByVal HDD As String, ByVal MAC As String, _
ByVal PrivateKey As String, ByVal Serial As String) As Boolean

Public Function ValidReg() As Boolean


ValidReg = ValidateSerialNumber([InnoKeyfile], [User], [Orgn], [ProdCode], [HDD],
[MAC], [PrivateKey], [Serial])
End Function

1.0 Page 19
15/07/2004
IKG (Inno Key Generator) IKG in Detail TestProj - The Test Harness Testing an unlock code
4.4 Page 20

4.3 IKGCG - Code Generator


IKGCG = Inno Key Generator Code Generator
The IKGCG.DLL file provided is used to generate a serial number for a previously configured IKG file. This DLL is used
in-house by automation systems that need to forward serial numbers to customers. Your applications are still as secure
because the end user does not have the private key required to decrypt the IKG file.

The exported functions are detailed in the following sections.

GenerateSerialNumber( see page 20)

The test project provided shows using the DLL via dynamic linking in C++.

4.3.1 GenerateSerialNumber
__declspec(dllexport) bool __stdcall GenerateSerialNumber(
char *InnoKeyFile, // Inno Key file generatedby IKG
char *User, // User name
char *Orgn, // Organisation
char *ProdCode, // User defined field (typically a product code)
char *HDD, // Hard drive serial number
char *MAC, // MAC Address of network card
char *PrivateKey, // Private key required to access the Inno Key
char *UnlockCode); // The unlock code for this user
Parameters not required (according to the configuration of your Inno Key) should send an empty string. The application
calling this DLL is responsible for the allocation and freeing of the memory that will hold the UnlockCode. The DLL will
calculate the unlock code and copy it into the UnlockCode parameter.

The method will return an empty string if the PrivateKey is incorrect for the InnoKeyFile provided.

4.4 TestProj - The Test Harness


This section outlines what the supplied application called TestProj.exe is used for.

What is it for ?( see page 20)

Testing an unlock code( see page 20)

4.4.1 What is it for ?


The test harness supplied, called TestProj.exe, was the original application I wrote to test the validation of input data for an
Inno Key. I supplied it so you could test unlock codes against a particular Inno Key without having to perform an actual
installation. Additionally, if you suspect a discrepency between the unlock code generated by IKG and what the DLL is
validating you can use the test harness as another test.

The application serves very little value but it is included nonetheless.

4.4.2 Testing an unlock code


The test harness knows nothing about the content of an Inno Key. The application is nothing more than a gateway between
data entry and validation performed by ISID.DLL.

1.0 Page 20
15/07/2004
IKG (Inno Key Generator) IKG in Detail TestProj - The Test Harness Testing an unlock code
4.4 Page 21

The above screen shot shows data entered for a Inno Key created elsewhere( see Exporting an Inno Key, page 10) in this
help file. In this particular example the entered data is correct but the DLL will report the code as being invalid. This is
because the Inno Key is configured to require the username, organisation and user defined fields. Because the checkboxes
are not checked the entered data is not passed to the DLL. If the checkboxes are checked and the test performed again then
the DLL will report the information as valid.

Remember, the test harness knows nothing about the Inno Key - it makes no attempt to load and interpret it (just like your
installation).

1.0 Page 21
15/07/2004
IKG (Inno Key Generator) Index
5 Page 22

Index
P
Public Key vs Private Key 6
C
Change Bank Password 17
Configuring an Inno Key 8
R
Running IKG for the first time 6

D
Delete Selected Key 18
S
Save Data Bank 17
Save Inno Key 17
E
Script Requirements 13
Exporting an Inno Key 10
Subsequent usage of IKG 8

G T
GenerateSerialNumber 20
Testing an unlock code 20
GetHDDSerial 19
TestProj - The Test Harness 20
GetMACAddress 19
The File Menu 15
Getting Started 5
The Key Menu 18

H U
How does it work ? 3
Using IKG with VB 19
How secure ? 3

V
I
ValidateSerialNumber 18
IKG - The Generator 15
Validating an Inno Key 10
IKG in Detail 15
IKG Overview 5
IKGCG - Code Generator 20
W
What is IKG ? 3
Implementing an Inno Key 13
What is it for ? 20
Introduction 1
ISID - The Validation DLL 18

L
License Information 1
Load Inno Key 16

N
New Inno Key 15
New Private Key 18
New Public Key 18

1.0 Page 22
15/07/2004

Você também pode gostar