home *** CD-ROM | disk | FTP | other *** search
-
-
- rKey 1.4 (c) 1990, 1991 Serious Cybernetics
- Turbo Pascal(tm) Registration Key Unit
- by C. Scott Davis
-
-
- -------------------------------------------------------------------------------
-
-
- rKey is a small and simple version of a Turbo Pascal (tm) Registration Key Unit
- (similar to RkPlus). It is designed to provide the most basic handling of
- registration keys, with a minimum of memory usage. All of the key encryption,
- checking and key file routines are handled in rKey, requiring little effort on
- the part of the programmer. It can allow anything from simple registration
- messages to limiting program functions if the software is not registered.
-
-
- There are two versions of rKey included here. RKEY.TPU, which runs under Turbo
- Pascal (tm) 5.5 and RKEY6.TPU, which runs under Turbo Pascal (tm) 6.0. For
- enhanced registration key handling (such as multiple encryption strings,
- registration levels and limited use demo keys) you should obtain a copy of
- RkPlus. The latest version of rKey and RkPlus (as well as other Serious
- Cybernetics software) are always available for download and Fido file request
- from Phoenix StarFighter BBS (see phone number and Fido address below).
-
-
- All of the sample programs use RKEY.TPU. If you have Turbo Pascal (tm) 6.0,
- and need to use rKey6, simply change :
-
- Uses
- rKey;
-
- to
-
- Uses
- rKey6;
-
-
- The various sample programs demonstrate the 2 methods of handling keys :
-
- Method 1 : Distribute your program (for example, RKSAMPLE.EXE) and use
- a key file generation program (like RKGENFIL.EXE), which you
- do NOT distribute, to create a key file for each user who
- registers. You then send the user the key file.
-
- Method 2 : Distribute your program (for example, RKSAMPLE.EXE) and a
- branding program (like RKBRAND.EXE). You then use a key
- generation program (like RKGENKEY.EXE), which you do NOT
- distribute, to create a a key number for each user who
- registers. You then send the user the key number, which
- he/she enters into the brand program to create a key file.
-
-
- -------------------------------------------------------------------------------
-
-
- The following constants are defined in rKey :
-
- rKeyVersion = '1.4'; { contains the current version of rKey }
-
-
- The following variables are defined in rKey :
-
- OwnerCode : String[20];
- ProgramCode : String[16];
- KeyFileName : String[8];
- KeyFilePath : String[79];
- RegError : Boolean;
- RegStatus : Boolean;
- RegName : String[36];
- RegKey : String[12];
-
-
- The following procedures and functions are defined in rKey :
-
- Function MakeKey(Name : String) : String;
- Function ValidKey(Name : String; Key : String) : Boolean;
- Procedure GetRegInfo;
- Procedure Register(Name : String; Key : String);
-
-
- -------------------------------------------------------------------------------
-
-
- OwnerCode : String[20];
-
- This variable is NOT initialized by rKey and MUST be set at the start of your
- program. It is used (along with ProgramCode) to generate the registration
- keys. This variable should probably be the same for all software written by a
- single person/company. Since is it used to cause your keys to be different
- from those of other programmers who are also using rKey, the more cryptic this
- variable is, the more secure your keys will be.
-
-
- Examples :
-
- OwnerCode := 'TrendSoft, Inc.';
-
- {
- If the name of your company is 'TrendSoft, Inc.', this is probably NOT a good
- OwnerCode. It would be easy for someone who knows the name of the company
- to use the rKey unit to write a program that will generate keys for your
- software.
- }
-
- OwnerCode := 'Trend&&Soft/Inc@';
-
- {
- This is better. It still uses the name of the company, but it is somewhat
- masked by the insertion of other characters and would be harder for another
- programmer to guess.
- }
-
- OwnerCode := 'Read$Make@Into';
-
- {
- This is MUCH better. It uses totally unrelated words that would be extremely
- unlikely to be used by another programmer/company.
- }
-
- OwnerCode := 'EkQW3#m,-%\uSaXo^Ej7';
-
- {
- This is most likely the best, since it uses totally random symbols.
- }
-
- IMPORTANT : You should NOT use any of the actual examples used here or in
- the sample programs included with rKey. If you do, anyone else
- who uses the same example will have IDENTICAL keys!
-
-
- -------------------------------------------------------------------------------
-
-
- ProgramCode : String[16];
-
- This variable is NOT initialized by rKey and MUST be set at the start of your
- program. It is used (along with OwnerCode) to generate the registration keys.
- There are several approaches to the use of ProgramCode :
-
- (1) If ProgramCode is set to the same value for several programs
- written by a person/company, keys for one piece of software will
- work on another piece of software. Using this approach, you
- could have a single key for several programs.
-
- (2) If each program has a different ProgramCode and the ProgramCode is
- not changed when the program changes, keys for one version of the
- program will work for all versions of the same program.
-
- (3) If each program has a differenct ProgramCode and the ProgramCode is
- changed when the program is changed, a different key will be
- required for each version of the program.
-
-
- Examples :
-
- ProgramCode := 'RkStuff';
-
- {
- If you wrote a program called RkSample and a program called RkUtils and
- you defined the ProgramCode as 'RkStuff' in both programs, a key for one
- program would work for the other.
- }
-
- ProgramCode := 'RkSample';
-
- {
- If you wrote a program called RkSample and a program called RkUtils and
- you defined the ProgramCode as 'RkSample' in RkSample and used a different
- ProgramCode in RkUtils, a key for one would NOT work for the other.
- }
-
- ProgramCode := 'RkSample One';
-
- {
- If you wrote a program called RkSample and you defined the ProgramCode as
- 'RkSample One' in versions 1.1, 1.2 and 1.3 and then changed the
- ProgramCode to 'RkSample Two' for version 2.0, the same key would work for
- versions 1.1, 1.2 and 1.3 but would NOT work for version 2.0.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- KeyFileName : String[8];
-
- This variable is NOT initialized by rKey and MUST be set at the start of your
- program. It is the name of the keyfile that is read by GetRegInfo and written
- to by Register. This will probably be the name of the program file. The
- extension will be '.KEY'.
-
-
- Examples :
-
- KeyFileName := 'RKSAMPLE';
-
- {
- The key file will be 'RKSAMPLE.KEY'. Key files are always created and read
- from the same directory that the program is in. This is true even if the
- program is not in the current directory.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- KeyFilePath : String[79];
-
- This variable is initialized by rKey to ''. GetRegInfo and Register will set
- KeyFilePath to the full directory, filename and extension of the key file. If
- no key file was found, KeyFilePath will be set to ''.
-
-
- Examples :
-
- KeyFileName := 'RKSAMPLE';
- GetRegInfo;
- If KeyFilePath <> '' then
- WriteLn('Key file is ' + KeyFilePath);
-
- {
- The key file will be 'RKSAMPLE.KEY'. After GetRegInfo is called, KeyFilePath
- will contain the full pathname of the the key file, which is displayed (if it
- is not '').
- }
-
-
- -------------------------------------------------------------------------------
-
-
- RegError : Boolean;
-
- This variable is initialized by rKey to FALSE. It is set by GetRegInfo and
- Register to indicate an invalid key. If RegError is TRUE after a call to
- GetRegInfo, it means that the key contained in the key file is invalid. This
- probably means that the key file has been tampered with. If RegError is set
- to TRUE after a call to Register, it means that the key that was passed to
- Register was invalid or the program was unable to create the key file; and the
- key file was NOT written.
-
-
- Examples :
-
- KeyFileName := 'RKDEMO';
- GetRegInfo;
- If RegError then
- WriteLn('The key file has been altered!');
-
- {
- This will call GetRegInfo. If the key contained in 'RKDEMO.KEY' is invalid,
- the message 'The KEY file has been altered!' will be displayed.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- RegStatus : Boolean;
-
- This variable is initialized by rKey to FALSE. It is set by GetRegInfo and
- Register to indicate the software is registered. If RegStatus is TRUE then
- RegName and RegKey contain valid registration information. If RegStatus is
- FALSE (after a call to GetRegInfo), the software is unregistered.
-
-
- Examples :
-
- KeyFileName := 'RKDEMO';
- GetRegInfo;
- Write('RkDemo v1.5');
- If RegError then
- WriteLn('[invalid key]')
- Else If RegStatus then
- WriteLn('[registered]')
- Else
- WriteLn('[unregistered]');
-
- {
- This will call GetRegInfo. If the key contained in 'RKDEMO.KEY' is invalid,
- the message 'RkDemo v1.5 [invalid key]' will be displayed. If the program
- is registered, the message 'RkDemo v1.5 [registered]' will be displayed.
- Otherwise, the message 'RkDemo v1.5 [unregistered]' will be displayed.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- RegName : String[36];
-
- This variable is initialized by rKey to ''. It is set by GetRegInfo and
- Register if the software is registered. This variable only contains valid
- information if RegStatus is TRUE.
-
-
- Examples :
-
- KeyFileName := 'RKDEMO';
- GetRegInfo;
- Write('RkDemo v1.5');
- If RegError then
- WriteLn('[invalid key]')
- Else If RegStatus then
- WriteLn('[registered to ' + RegName + ']')
- Else
- WriteLn('[unregistered]');
-
- {
- This will call GetRegInfo. If the key contained in 'RKDEMO.KEY' is invalid,
- the message 'RkDemo v1.5 [invalid key]' will be displayed. If the program
- is registered, the message 'RkDemo v1.5 [registered to NAME]' will be displayed
- (with 'NAME' replaced by the name of the person that the software is
- registered to). Otherwise, the message 'RkDemo v1.5 [unregistered]' will be
- displayed.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- RegKey : String[12];
-
- This variable is initialized by rKey to '000000000000'. It is set by
- GetRegInfo and Register if the software is registered. This variable only
- contains valid information if RegStatus is TRUE. This contains the
- 12 digit hexadecimal registration key as a string.
-
-
- Examples :
-
- KeyFileName := 'RKMORE';
- GetRegInfo;
- If RegError or Not RegStatus then Begin
- WriteLn('This version of RkMore is not registered.');
- WriteLn('Please read the READ.ME file for more info.');
- End Else
- WriteLn('This version of RkMore is registered to ' + RegName + '.');
- WriteLn('Registration key is ' + RegKey + '.');
- End;
-
- {
- This will call GetRegInfo. If the key contained in 'RKMORE.KEY' is invalid
- or the program is not registered, a message will be displayed telling the
- user how to register the program. Otherwise, the name of the person that
- that the program is registered to and the registration key will be
- displayed.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- Function MakeKey(Name : String) : String;
-
- The function MakeKey will return a string containing the 12 digit hexadecimal
- registration key for the Name passed to it (using the pre-defined values of
- OwnerCode and ProgramCode). This function is usually used to create
- registration keys or key files, in a program that is not distributed to the
- user.
-
-
- Examples :
-
- OwnerCode := 'AZ771N91P03DJSS447';
- ProgramCode := 'RkProg';
- WriteLn('Registration Key Maker for RkProg');
- WriteLn;
- WriteLn('FOR INTERNAL USE ONLY!');
- WriteLn;
- Write('Enter name : ');
- ReadLn(n);
- k := MakeKey(n);
- WriteLn;
- WriteLn('Registration key is '+k);
-
- {
- This will display a warning message and then prompt for a name. MakeKey is
- then passed the name and then returns the key in the variable k, which is then
- displayed.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- Function ValidKey(Name : String; Key : String) : Boolean;
-
- ValidKey will return TRUE, if Key is valid for the name passed to it (using the
- pre-defined values of OwnerCode and ProgramCode). If ValidKey returns FALSE,
- the key is not valid.
-
-
- Examples :
-
- OwnerCode := 'dfk89ew32zg0imm02';
- ProgramCode := 'RkProg One';
- WriteLn('RkProg v1.4');
- WriteLn;
- Write('Enter your name : ');
- ReadLn(n);
- Write('Enter your registration key : ');
- ReadLn(k);
- If Not ValidKey(n,k) then Begin
- WriteLn('Invalid key!');
- Halt(1);
- End;
-
- {
- This program will prompt the user to enter a name and a registration key.
- If the registration key is not valid, the program will display 'Invalid key!'
- and Halt with an errorlevel of 1.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- Procedure GetRegInfo;
-
- GetRegInfo will read the key file (if it exists) and set the value of the
- following variables :
-
- RegError { set to TRUE if the key file contains an invalid key }
- RegStatus { set to TRUE if the software is registered }
- RegName { set to the name of the person the software is registered to }
- RegKey { set to the 12 digit hexadecimal registration key }
-
- GetRegInfo would generally be called near the beginning of a program (after
- OwnerCode, ProgramCode and KeyFileName are defined).
-
-
- Examples :
-
- OwnerCode := '&,<;(##@["+|~~**=#))';
- ProgramCode := 'RkTest';
- KeyFileName := 'RKTEST';
- GetRegInfo;
- If Not RegError then
- If RegStatus then
- WriteLn('Registered to ' + RegName);
-
- {
- GetRegInfo will read 'RKTEST.KEY'. If it contains an invalid key, RegError
- will be set. If it doesn't exist, RegStatus will be set to FALSE. Otherwise,
- The various registration variables will be set. The program then displays
- the name of the person that the program is registered to.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- Procedure Register(Name : String; Key : String);
-
- Register will update the key file (creating it, if it doesn't exist) and set
- the value of the following variables :
-
- RegError { set to TRUE if the Key parameter is invalid }
- { or the file can NOT be created }
- RegStatus { set to TRUE }
- RegName { set to the Name parameter }
- RegKey { set to the Key parameter }
-
- If the Key parameter is invalid, RegError will be set to TRUE, the key file
- will NOT be written and the values of the other registration variables will
- NOT be changed. Register would generally be called by an install or branding
- program of some type. It can also be used by a key creation program, which
- is not distributed (if you want to send key files to registered users, rather
- than a key that they would enter).
-
-
- Examples :
-
- OwnerCode := 'Keyboard*Sytem=Load';
- ProgramCode := 'RkProg';
- KeyFileName := 'RKPROG';
- WriteLn('RkProg Install Program');
- WriteLn;
- Write('Enter your name : ');
- ReadLn(n);
- Write('Enter your registration key : ');
- ReadLn(k);
- Register(n,k);
- If RegError then
- WriteLn('Invalid Key. Program not installed.');
-
- {
- This program will prompt the user for a name and a registration key. Register
- will then be passed the name and the key. If RegError is TRUE, the key was
- invalid and no key file was written (the program displays 'Invalid Key.
- Program not installed.'). Otherwise, RKPROG.KEY is written and the
- registration variables are set.
- }
-
-
- -------------------------------------------------------------------------------
-
-
- For more information on using rKey, see the sample Turbo Pascal (tm) programs
- that are distributed with rKey, or contact me at any of the locations listed
- below.
-
-
- -------------------------------------------------------------------------------
-
-
- rKey is shareware. You may copy and distribute RKEY14.ZIP freely. All I ask is
- that you include all of the original files, unmodified, and that you do not
- charge for the distribution of rKey itself. You may use rKey for development
- of programs for your own use, to give away or to sell.
-
-
- If you like rKey and use it to develop software, a registration fee of $10
- or more toward the continued development of this unit and others like it
- would be appreciated. See REGISTER.FRM for registration information.
-
-
- Everyone registering rKey with a registration fee of $10 or more, will be
- entitled to have one piece of software (written using rKey/RkPlus) listed,
- along with an address or phone number, in an application list that will be
- included with all future versions of rKey/RkPlus. Registrations of $20 or
- more, will register both rKey AND RkPlus (available as RKPLUS20.ZIP), allowing
- you to develop and distribute programs using either one, or both. Registrations
- in excess of $20 will allow multiple applications to be listed.
-
-
- There are no royalties for the distribution of programs that are written
- with rKey. A single registration fee entitles you to write and distribute
- any number of programs using rKey.
-
-
- If you have written an application using rKey/RkPlus, and wish to have it
- listed in the APPLIST.TXT file that is distributed with rKey/RkPlus, please
- send the following information via E/Mail, NetMail or US Mail :
-
- Name of Application
- Programmer's Name (optional)
- Copyright Notice
- Address or Phone Number
- System Requirements
- Cost of Program (optional)
- Any Additional Information (optional)
-
-
- Questions, comments, and suggestions are welcome.
-
- Send E/Mail to Scott Davis
- Phoenix StarFighter BBS [3/12/24/HST)
- Phone (404) 869-3410
- FidoNet Node 1:3616/20
-
- Send US Mail to Scott Davis
- Rt. 2 Box 95
- County Line Drive
- Lula, GA 30554
-
-
- -------------------------------------------------------------------------------
-
-
- I'd like to thank Danny Sosebee (Sysop of Phoenix StarFighter BBS) for
- allowing me to use his BBS as a way to receive suggestions and comments
- regarding rKey. Also, I'd like to thank Ed Ivey (Sysop of Ed's Place
- BBS - 404/532-1978 - FidoNet Node 1:3616/1) for his continued support
- and assistance in distributing my little software "projects".
-
-
- -------------------------------------------------------------------------------
-
-
- Turbo Pascal (tm) units available from Serious Cybernetics :
-
- StrLib 1.2 TP 5.5 String Functions Library Unit
- rKey 1.4 TP 5.5/6.0 Registration Key Unit
- RkPlus 2.0 TP 5.5/6.0 Registration Key Unit (enhanced)
-
-
- ------------------------------------------------------------------------------
-
- RkPlus (c) 1991 Serious Cybernetics
- rKey, StrLib (c) 1990, 1991 Serious Cybernetics
- Turbo Pascal (c) 1983, 1989 Borland International
-
-
-