                                R k p 3 E n c

           RkPlus (tm) 3.x/compatible Encode Unit for RkPlus (tm) 3.2

                              by C. Scott Davis

                    Copyright (c) 1993 Serious Cybernetics


          

                      T A B L E   O F   C O N T E N T S

      ===================================================================

          D e s c r i p t i o n                                Sec

          What Is Rkp3Enc? ................................... 1.0
          Using Rkp3Enc ...................................... 2.0
          Rkp3Enc Procedures ................................. 3.0
          SetOwnerCode ....................................... 3.1
          SetProgCode ........................................ 3.2
          SetVerCode ......................................... 3.3
          Additional Information On Rkp3Enc .................. 4.0
          Copyright Notices .................................. 5.0


1.0 - What is Rkp3Enc?

Rkp3Enc is a Turbo Pascal (tm) unit that allows RkPlus(tm) 3.2 to generate and 
use version 3.x/compatible keys.  It contains definitions for SetOwnerCode, 
SetProgCode, and SetVerCode, as well as new encoding functions for RkPlus(tm) 
3.x.

If version 2.x/compatible keys are required, Rkp2Enc should be used instead; or 
for additional security, user-written encoding functions may be defined (see 
RKPLUS.DOC for more information).


2.0 - Using Rkp3Enc

To use Rkp3Enc, the programmer must place it AFTER RkPlus in the Uses 
definition (as shown below).

  Uses
    RkPlus, Rkp3Enc;

In addition, SetOwnerCode, SetProgCode and SetVerCode must be called, before 
any RkPlus(tm) calls are made (otherwise the RkPlus(tm) function RkpError will 
return InvalidParameter).  No other procedure or function calls are needed, as 
Rkp2Enc is automatically activated when it is Used.

If Rkp3Enc is corrupt or has been tampered with, the RkPlus(tm) function 
RkpError will return BadTPU.  If the RkPlus(tm) 3.2 version of Rkp3Enc is used 
with any version other than 3.2, the RkPlus(tm) function RkpError will return 
VersionMismatch.


3.0 - Rkp3Enc Procedures

The following Procedures are defined in Rkp3Enc:

SetOwnerCode
SetProgCode
SetVerCode


3.1 - SetOwnerCode

Procedure SetOwnerCode(Var v; b : Byte);

This procedure must be called before any of the RkPlus(tm) procedures or 
functions. The variable v may be of any type, and b specifies the length of v 
(up to 255 bytes).  The variable passed as v is used (along with the variables 
passed to SetProgCode and SetVerCode) 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 RkPlus(tm), the more cryptic this 
variable is, the more secure your keys will be.

Examples :

Var
  s : String[30];


s := 'Read$Make@Into';
SetOwnerCode(s[1],Length(s));
  
Note that when the variable passed to SetOwnerCode is a string, the first 
character of the string should be passed (rather than the string itself) and 
the length should be the length of the string (Length) and not the size 
(SizeOf).  This is to avoid having the length byte and the "garbage" bytes at 
the end of a Pascal string used in the key encryption.

Var
  a : Array[1 to 5] of LongInt;


a[1] := $3C1F29EC;
a[2] := $A446B902;
a[3] := $6C568DA0;
a[4] := $0B197E23;
a[5] := $F8F501C7;
SetOwnerCode(a,SizeOf(a));

IMPORTANT : You should NOT use any of the actual examples used here or in the 
sample programmes included with RkPlus(tm).  If you do, anyone else who uses 
the same example will have IDENTICAL keys!


3.2 - SetProgCode

Procedure SetProgCode(Var v; b : Byte);

This procedure must be called before any of the RkPlus(tm) procedures or 
functions. The variable v may be of any type, and b specifies the length of v 
(up to 255 bytes).  The variable passed as v is used (along with the variables 
passed to SetOwnerCode and SetVerCode) to generate the registration keys.  
Unlike the variable passed to SetOwnerCode, this variable doesn't need to be 
particularly cryptic.

Examples :

Var
  s : String[15];


s := 'RkStuff';
SetProgCode(s[1],Length(s));

If you wrote a programme called RkSample and a programme called RkUtils and you 
passed 'RkStuff' to SetProgCode in both programmes, a key for one programme 
would work for the other (assuming that SetOwnerCode and SetVerCode were also 
passed the same values in both programmes).

Var
  t : String[10];


t := 'RkSample';
SetProgCode(t[1],Length(t));

If you wrote a programme called RkSample and a programme called RkUtils and you 
passed 'RkSample' to SetProgCode in RkSample and passed a different value to 
SetProgCode in RkUtils, a key for one would NOT work for the other.


3.3 - SetVerCode

Procedure SetVerCode(Var v; b : Byte);

This procedure must be called before any of the RkPlus(tm) procedures or 
functions. The variable v may be of any type, and b specifies the length of v 
(up to 255 bytes).  The variable passed as v is used (along with the variables 
passed to SetOwnerCode and SetProgCode) to generate the registration keys.  
Unlike the variable passed to SetOwnerCode, this variable doesn't need to be 
cryptic at all.

Examples :

Var
  c : Char;


c := '2';
SetProgCode(c,SizeOf(c));

If you wrote a programme and passed '2' to SetVerCode in versions 2.0, 2.1 and 
2.2 of the programme; and passed '3' to SetVerCode in version 3.0, the same key 
would work for versions 2.x (assuming that SetOwnerCode and SetVerCode were 
passed the same values in all versions), but version 3.0 would require a 
different key.

Var
  r : Record
        v : Byte;
        u : Byte;
      End;


r.v := 1;
r.u := 0;
SetProgCode(r,SizeOf(r));

If you wrote a programme and passed r to SetProgCode with r.v set to the major 
version and r.u set to the minor update, a key for one version would NOT work 
for another.


4.0 - Additional Information On Rkp3Enc

For more information on using Rkp3Enc, see the sample Turbo Pascal (tm) 
programmes (RKPDEMO3) that are distributed with RkPlus(tm), or contact me at 
any of the locations listed in RKPLUS.DOC.


5.0 - Copyright Notices

RkPlus(tm) (c) 1991-93 Serious Cybernetics
Rkp2Enc (c) 1990-93 Serious Cybernetics 
Rkp3Enc (c) 1993 Serious Cybernetics
Turbo Pascal (c) 1983-89 Borland International
Borland Pascal (c) 1983-93 Borland International
Stony Brook Pascal+ (c) 1987-93 Stony Brook Software

