This article describes the Secure Communication Block (SCB) data area that is used to exchange information between your program and the KeyChk DLL.


Since the SCB resides within your program, the layout must be defined (declared) in your program so information can be passed to and from the KeyChk DLL. The size of your SCB definition MUST be 512 bytes.


Here is the field-by-field layout of the SCB:

Field

Type

Offset (decimal)

Size (bytes)

Description

Error Code

Unsigned Word

0

2

This is the Main KeyChk Error Code field. It should be set to 6240 (hex) before calling KeyChk. It will be returned as Zero if your Key was found and not Expired.

Error Status 1

Unsigned Word

2

2

This field is only used if the Error Code field is returned non-Zero. It contains additional information about the Error.

Error Status 2

Unsigned Word

4

2

This field is only used if the Error Code field is returned non-Zero. It contains additional information about the Error.

Function Code

Unsigned Byte

6

1

This field tells KeyChk what you want it to do. It should be set prior to calling KeyChk. Each function is described in detail later in this chapter.

SCB‑ID

String (ASCIIZ)

7

5

This is a "Signature" field used by KeyChk to verify that this block of memory is the SCB. Set it to “Kc.6” before calling KeyChk.

For backward compatibility, if this field is set to “..?Z”, KeyChk will assume that your program is still using an 80-byte SCB as defined in EverKey v2. This allows old programs to use the newest version of the KeyChk DLL with NO changes.

Product‑ID

String

(UTF-8 Unicode)

12

9

Before calling KeyChk, set this field to the Product‑ID of the Key that you want to find and check. This is shown on the Build Keys panel of the KeyBuild program. This field is case sensitive.

Reserved

Unsigned Byte

21

1

Reserved for future use.

Feature-Flags

Unsigned Word

22

2

These are 16 single-bit flags that are stored securely in the memory of the Key. If the bit is set to 1, the flag is On.

The least significant bit represents Feature-Flag #1 and the most significant bit represents Feature-Flag #16.

These flags can be set by KeyBuild when the Key is built.

Later, once the Key is in the Customer's possession, the Renew program may be used to turn On additional Feature-Flags. Also, Renew can turn Off any of the Feature-Flags.

Product Serial Number

Unsigned DWord

24

4

Before calling KeyChk, set this field to the Product Serial Number of the Key that you want to find and check.

Normally, you will set this field to Zero so the Key check will succeed as long as KeyChk finds a Key with your specific Product‑ID and Product PIN.

If you also want to verify that the Key present has a specific Product Serial Number, then set this field to the specific Serial Number that you want to verify.

Product PIN

Unsigned DWord

28

4

Before calling KeyChk, set this field to the Product PIN of the Key that you want to find and check. This is shown on the Build Keys panel of the KeyBuild program. Please note that you CANNOT use the User-Data PIN here.

Field

Type

Offset (decimal)

Size (bytes)

Description

Uses Limit

or

Uses Update

Signed Word

32

2

The current Uses Limit of the Key will always be returned in this field. This is the number of uses left until the Key expires. This value is originally set from the Uses Limit option of the KeyBuild program. If the Key does not have an Uses Limit, this field will be returned as -1 (negative one) which means “Unlimited”.

When using KeyChk Function 2 or 3, this field can be set to a negative number equal to the number of “uses” that you wish to subtract from the Key's current Uses Limit. For example, to take one “use” away, set this field to "-1" (negative one) and then call KeyChk Function 2.

Time Limit

Unsigned Word

34

2

Number of days left until the Key expires. This value is originally set from the Time Limit option of the KeyBuild program. If the Key does not have a Time Limit, this field will be returned from KeyChk as FFFF (hex) which means “Unlimited”.

Please note that if the Key has an Expire-Date, this value will be Zero (0) if there are less than 24 hours until the Key expires. Once the Key does expire, the Error Code will be set to 0x6143.

ED_ASCII

String (ASCIIZ)

36

9

Note: This field is kept here for backward compatibility with programs that still use the Version 2 SCB layout.

It's recommended that all new programs use the Expire-Date field, located at offset 272. That field uses Unicode characters and formats the date using the Local Region Settings.

This field is the Expiration date of the Key in ASCIIZ format. This date string will always be 8 ASCII characters with a format of MM/DD/YY.

This date is originally set from the Time Limit option of the KeyBuild program.

If the Key does not have a Time Limit, this field will be set to "No Limit".

User-Data

Unsigned Byte

45

16

You can use this area to securely store anything you like in the Key. For example, some Customers store a Password in the Key so it is not embedded in their program.

This data is originally set from the User-Data option of the KeyBuild program.

In EverKey Version 2, the last two bytes (16 bits) were called the User-Data Flags.

Reserved

Unsigned Byte

61

6

Reserved for future use.

Lasered‑ID

Unsigned Byte

67

8

Permanent Serial Number of the Key. This field cannot be reprogrammed and is guaranteed unique for each EverKey Key.

The 1st Byte of this field indicates the Key Type:

E1 (hex): Rockey4 Key.

E2 (hex): Rockey4ND Key.

Renew Used‑Count

Unsigned Byte

75

1

This is how many times the Key has been successfully updated by the Renew program.

Reserved

Unsigned Byte

76

4

Reserved for future use.

Field

Type

Offset (decimal)

Size (bytes)

Description

Registered Name

String

(UTF-16 Unicode)

80

64

Name of the registered Owner of your Product Key.

This field is set from the Registration Information Name option of KeyBuild and cannot be changed by KeyChk or Renew.

Registered Company

String

(UTF-16 Unicode)

144

64

Company Name of the registered Owner of your Product Key.

This field is set from the Registration Information Company option of KeyBuild and cannot be changed by KeyChk or Renew.

Registered Other

Info

String

(UTF-16 Unicode)

208

64

Use this field for any Other information about the registered Owner of your Product Key. For example, Phone Number or Email Address.

This field is set from the Registration Information Other option of KeyBuild and cannot be changed by KeyChk or Renew.

Expire-Date

String

(UTF-16 Unicode)

272

32

Expiration date of the Key. This date is originally set from the Time Limit option of the KeyBuild program.

The format of the Expire-Date field will always use the Local Region Settings.

If the Key does not have a Time Limit, this field will be set to "No Limit".

Expire-Time

String

(UTF-16 Unicode)

304

32

Expiration time of the Key on it's last day of operation. This time is originally set to the time that the Key was built by the KeyBuild program.

The format of the Expire-Time field will always use the Local Region Settings.

If the Key does not have a Time Limit, this field will be set to "No Limit".

Reserved

Unsigned Byte

336

176

Reserved for future use.