You are on page 1of 289

BATTLE-PROVEN

SOFTWARE
PROTECTION
AND
LICENSE SECURITY
SDK
User Manual
B AT T L E - P R O V E N S O F T W A R E P R O T E C T I O N & L I C E N S E S E C U R I T Y
SINCE 1992

CrypKey SDK User Manual

R E L E A S E D AT E : J A N U A R Y 2 0 0 3

DOCUMENT VERSION: 6.003

2003 CrypKey (Canada) Inc.


Calgary, Alberta, Canada
Phone 1-403-398-8011 Fax 1-403-264-8838
Sales email sales@crypkey.com
Support email support@crypkey.com
http://crypkey.com
CrypKey License Agreement

Grant Of Rights
In consideration of payment, CrypKey (Canada) Inc. (CrypKey) grants to the purchasing
company (the Customer) the non-exclusive right to possess, use, and make and distribute
unlimited copies of the machine-executable code version of the CrypKey Software Licensing
System, including all revisions, modifications, and updates thereto furnished to the customer,
together with the written User Manuals in relation thereto (collectively the Software).

Intended Purpose
The Software is intended to be linked with and incorporated into the product, including, but limited
to, the foundation module and installation routines forming a part thereof. No right to distribute the
Software on a stand-alone basis is intended by this License Agreement. Any other use of the
Software requires written consent from CrypKey. The customer may not reverse engineer, modify,
nor create derivative works based on the Software without written consent from CrypKey, except
as permitted by acceptable law.

Ownership
All patents, copyrights, and other proprietary rights in the Software are, and shall remain, the
exclusive property of CrypKey or its suppliers. The Customer may not assign nor transfer the
rights granted in the License Agreement to any person, except the Customers subsidiaries and
affiliates, without written consent from CrypKey.

Limited Warranty
CrypKey warrants to the Customer that the Software will operate essentially as described in
CrypKey brochures and documentation. CrypKey warrants that the media on which the Software
is recorded shall be free from defects in materials and workmanship under normal use and service
for 60 days from the date of the Customers invoice. If failure of the media is a result of accident,
abuse, or misapplication of the Software, CrypKey shall not be responsible for its replacement.
Applicable law may imply warranties that cannot be excluded or can be excluded only to a limited
extent. This Agreement shall be reached and construed subject to such laws.
No Other Warranties
THE LIMITED WARRANTY SET FORTH HEREIN IS IN LIEU OF, AND CRYPKEY
DISCLAIMS, ANY AND ALL OTHER WARRANTIES (EXPRESS OR IMPLIED) WITH
RESPECT TO THE SOFTWARE, INCLUDING ANY AND IMPLIED WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Remedies
Except in connection with a claim for infringement of copyright, patent, or other
intellectual property right, the Customers sole and exclusive remedy for a breach of
warranty shall be: (a) the return of the initial fee paid for the rights granted herein or (b)
the correction or replacement of defective software or media. Corrected or replaced
Software or media will be warranted to the same extent as the original Software or media
for the remainder of the original warranty period or 30 days from the date of receipt by the
customer, whichever is longer.

Limitation Of Liability
IN NO EVENT SHALL CRYPKEY BE LIABLE TO THE CUSTOMER FOR INDIRECT,
INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGE. IN NO EVENT SHALL
CRYPKEY CANADAS AGGREGATE LIABILITY TO THE CUSTOMER EXCEED THE
AMOUNTS PAID TO CRYPKEY BY THE CUSTOMER FOR THE SOFTWARE.

Copyright 2003, CrypKey (Canada) Inc. All rights reserved

The software described in this manual is furnished under a License Agreement and may
only be used in accordance with the terms of this agreement.

All trademarks are the property of their respective owners.

Microsoft, Windows, Visual Basic, Access, Windows NT, Windows 95, and Windows 98
are trademarks of Microsoft Corporation. Watcom is a trademark of Watcom International
Corporation. PowerBuilder is a registered trademark of Powersoft Corporation. Novell is a
registered trademark of Novell, Inc
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Table of Contents

Section Page
1 Introduction 1
1.1 About CrypKey (Canada) Inc. 2
1.2 About CrypKey SDK 2
1.3 How to Use This Book 3
1.3.1 Summary of Contents 4
1.3.2 Strategies for Using This Manual 5
1.3.3 Special Icons 7
1.4 System Requirements 7
1.5 Technical Support 8
1.6 About Your CrypKey License 9
1.6.1 Registering with CrypKey (Canada) Inc. to Get Your Developer Keys 10
1.6.2 Using the Temporary License for Development 11
1.6.3 Obtaining Authorization for Your Site Key Generator 11
1.7 CrypKey Licensing Implementation 15
1.8 New Features in Version 6.0 17
1.8.1 CloneBuster TM Technology 18
1.8.2 EasyLicense 19
1.8.3 Dynamic Encryption 19
1.8.4 Enhanced Anti-Hacking 19
1.9 Updating to CrypKey SDK v6.0 20

2 Installation 23
2.1 Getting Started 23
2.1.1 Installing CrypKey SDK from CD 24
2.1.2 Downloading and Installing CrypKey SDK 34
2.1.3 Packing List and Readme Files 40

I C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

2.2 CrypKey License Service Installation 43


2.3 Windows 9x/ME Network Installation 43
2.4 MS-DOS Network Driver Installation 44
2.4.1 Example 45
2.5 Novell NetWare Installation 45
2.6 Libraries and Distribution Files 46
2.6.1 16-Bit Libraries 46
2.6.2 WIN32 Libraries 46
2.6.3 32-bit Thunk Library Installation 48
2.7 Connectivity to Microsoft Access 49

3 Demonstration Programs 51
3.1 Authorizing a Windows Program 51
3.2 Authorizing an MS-DOS Program 57

4 Site Key Generator 59


4.1 Levels and Options 59
4.1.1 Levels 60
4.1.2 Options 60
4.2 Additional Features of the Site Key Generator 61
4.2.1 License Duration Settings 61
4.2.2 EasyLicense 62
4.2.3 CloneBuster TM Technology 63
4.2.4 Transaction Summary 64
4.3 Using the Site Key Generator 65
4.3.1 Generating Site Keys 65
4.3.2 Configuring Your Products 69
4.3.3 Incrementing Existing Licenses 76
4.4 Distributor Authorizing License 78
4.4.1 Authorizing Distributors 78

5 Programming Your Application 87


5.1 Basic Programming Steps 87
5.2 GUI Programming Tasks 90
5.2.1 Authorizing the Program 91
5.2.2 Registering the Authorization Transfer on the Target Computer 91
5.2.3 Transferring the Authorization Out of the Source Computer 92

I I C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.2.4 Transferring the Authorization into the Target Computer 92


5.3 Compiling and Linking 92
5.3.1 CrypKey Header File 92
5.3.2 Linking 93
5.4 COM Object 96
5.4.1 COM Object Identifiers 97
5.4.2 Installing a COM Object 97
5.4.3 Referencing a COM Object Explicitly 98
5.4.4 Referencing a COM Object by Name 99
5.4.5 Pre-defining DLL functions 99
5.4.6 Using a COM object in C++ 100
5.4.7 COM Object Constants 102
5.4.8 Internal COM Status Messages 103
5.4.9 Referencing the Floating License Snapshot Record 104
5.5 External Linking using Binary Files 106
5.5.1 External Linking Security 107
5.5.2 Transferred Information 107
5.5.3 External Text Link 109
5.6 Creating a Windows NT License Service Installation 109
5.6.1 Error Codes 110
5.6.2 Run Mode 111
5.6.3 Installation Strategies 111
5.6.4 Uninstalling the Driver 112
5.6.5 Testing 113
5.6.6 Supported Versions of Windows NT 113

6 Protecting Your Software with StealthPLUS TM 115


6.1 Visual C++ Custom Step Example: 117
6.2 StealthPLUSTM File Auto-Distribution 117
6.3 Using the Interface (STELTHUI) 119
6.4 Using the Command Line Version (STELTHCM) 123

7 Counter-Hacker Strategies 125


7.1 Anti-tampering Measures 125
7.1.1 Error Codes 127

I I I C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

8 Network Licensing 129


8.1 Implementing Floating Licenses 129
8.1.1 Providing Multi-User Functionality 130
8.1.2 Installing a Network License Server 130
8.1.3 Specifying a Floating License Type 130
8.2 CrypKey Network Drivers 131
8.2.1 Supported Platforms 131
8.2.2 Installation Procedures 132

9 Moving Protected Programs 135


9.1 Direct License Transfers 135
9.1.1 Example 136
9.2 Floppy Disk License Transfers 136

10 Frequently Asked Questions 139


10.1 General 139
10.1.1 Software Protection 139
10.1.2 CrypKey Advantages 140
10.1.3 Telephone Authorization 142
10.1.4 Client Annoyance 142
10.1.5 24-hour Telephone Support 143
10.1.6 Computer Signatures 143
10.1.7 License Transfer to Floppy Disk 143
10.2 Technical 144
10.2.1 Disk Compression Programs 144
10.2.2 Watcom Support 144
10.2.3 Library Impacts 144
10.2.4 Hard Disk Failure 144
10.2.5 Product Update Releases 145
10.2.6 Multiple Program Names 145
10.2.7 Floating Licenses 145
10.2.8 Computer Clock Manipulation 146
10.2.9 CD-ROM Distribution 146
10.2.10 Internet Distribution 147
10.2.11 File Set Protection 147
10.2.12 Foreign System Compatibility 147
10.2.13 Removable Hard Drives 147
10.2.14 Anti-Virus Software 148

C RY P K E Y S D K I V
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

10.2.15 Installer Software 148


10.2.16 US Exports 148
10.2.17 Software Certification 148
10.2.18 Windows 98 148

11 Troubleshooting 149
11.1 CrypKey Error Messages 149
11.1.1 General Errors 149
11.1.2 Function Errors 150
11.2 General Error 102 150
11.2.1 CrypKey License Service Problems 151
11.2.2 CrypKey Technical Support 154
11.3 Windows NT Diagnostics 155
11.4 NetWare-related Issues 155
11.4.1 Sample Error 1 156
11.4.2 Sample Error 2 156
11.4.3 Sample Error 3 156
11.5 Norton Utilities Speed Disk 157

12 Function Reference 159


12.1 Function Summary 159
12.2 General Error Values 162
12.3 Function Descriptions 166
12.3.1 AcquireLicense() 166
12.3.2 CKChallenge() 169
12.3.3 CKChallenge32() 171
12.3.4 CKTimeString() 173
12.3.5 CrypkeyVersion() 174
12.3.6 DirectTransfer() 175
12.3.7 EndCrypkey() 178
12.3.8 ExplainErr() 179
12.3.9 ExplainErr2() 180
12.3.10 FloatingLicenseGetRecord 182
12.3.11 FloatingLicenseSnapshot 183
12.3.12 Get1RestInfo() 185
12.3.13 GetAuthorization() 187
12.3.14 GetAuthorization2() 195
12.3.15 GetDrivePermanentSerialData() 196

V C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.16 GetLastError() 196


12.3.17 GetLastErrorCode() 196
12.3.18 GetLevel() 197
12.3.19 GetNetHandle() 198
12.3.20 GetNumCopies() 199
12.3.21 GetNumMultiUsers() 199
12.3.22 GetOption() 200
12.3.23 GetRestrictionInfo() 201
12.3.24 GetSiteCode() 204
12.3.25 GetSiteCode2() 205
12.3.26 InitCrypkey() 206
12.3.27 KillLicense() 213
12.3.28 ReadyToTry() 215
12.3.29 ReadyToTryDays() 222
12.3.30 ReadyToTryRuns() 223
12.3.31 RegisterTransfer() 225
12.3.32 SaveSiteKey() 227
12.3.33 SetNetHandle() 229
12.3.34 TransferIn() 230
12.3.35 TransferOut() 235

13 Appendix I Sample File 240


13.1 Example.c 241

14 Appendix II Quick Reference 251


14.1 CrypKey Functions 251
14.2 CrypKey Return Codes 254
14.3 CrypKey 6.X OS File Distribution Matrix 255

15 Glossary 259

16 Index 263

C RY P K E Y S D K V I
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

List of Tables and Figures

TABLE Page
Table 1: Files required for distribution with 32-bit Applications 47

Table 2: Effects of Duration Settings for Slave Site Key Generator 79

Table 3: Libraries 93

Table 4: Library Linkages 95

Table 5: COM Object Identifiers 97

Table 6: Internal COM Status Messages 103

Table 7: COM C++ and C#.NET Prototypes for FLS Record Data Items 104

Table 8: Transferred Information Descriptions 107

Table 9: Software Protection Technology Problems and Solutions 140

Table 10: Function Summary 160

Table 11: General Errors and Solutions 163

Table 12: DirectTransfer() Values 176

Table 13: Functioncode Values 180

Table 14: Functioncode Values 181

Table 15: Floating License Snapshot Return Values 184

Table 16: Floating License Snapshot Record Structure 185

Table 17: Get1RestInfo() Values 186

Table 18: GetAuthorization() Values 188

Table 19: GetNumCopies() Values 199

Table 20: GetOption() Values 201

Table 21: Authopt Values 202

V I I C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Table 22: Num_used Values 202

Table 23: GetSiteCode() Values 205

Table 24: InitCrypkey() Values 209

Table 25: KillLicense() Values 214

Table 26: ReadyToTry() Values 217

Table 27: RegisterTransfer() Values 226

Table 28: SaveSiteKey() Values 228

Table 29: TransferIn() Values 232

Table 30: TransferOut() Values 237

C RY P K E Y S D K V I I I
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

FIGURE Page
Figure 1: Site Key Generator Startup 12

Figure 2: License Window Not Authorized 13

Figure 3: License Window Site Key Inserted 14

Figure 4: License Window Authorized 15

Figure 5: CrypKey SDK Program Group 24

Figure 6: Opening CrypKey CD Installation Window 25

Figure 7: CD Installation Screen 1 26

Figure 8: CD Installation Screen 2 27

Figure 9: CD Installation Screen 3 28

Figure 10: CD Installation Screen 4 29

Figure 11: CD Installation Screen 5 30

Figure 12: CD Installation Screen 6 31

Figure 13: CD Installation Screen 7 32

Figure 14: CD Installation Screen 8 33

Figure 15: Download Installation Screen 1 34

Figure 16: Download Installation Screen 2 35

Figure 17: Download Installation Screen 3 36

Figure 18: Download Installation Screen 4 37

Figure 19: Download Installation Screen 5 38

Figure 20: Download Installation Screen 6 39

Figure 21: Download Installation Screen 7 40

Figure 22: Program Group 51

I X C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 23: Sample Programs Group 52

Figure 24: Opening WEXAMPLE.EXE (TESTAPP) Window 53

Figure 25: TESTAPP Window with Site Code 54

Figure 26: Site Key Generator Window with Validated Site Code 55

Figure 27: Generated Site Key 56

Figure 28: TESTAPPS Window with Authorized Site Key 57

Figure 29: CrypKey SDK v6.0 Program Group Popup Window 58

Figure 30: Site Key Generator License Generation Summary Window 64

Figure 31: CrypKey Site Key Generator 6.0 Window 65

Figure 32: Site Key Generator Starting Authorization 66

Figure 33: Hard Drive Serial Number Information Window 67

Figure 34: HDSN License Details Window 68

Figure 35: Configure Window 70

Figure 36: Site Key Generator with New Application Popup Window 71

Figure 37: Configuration Window with New Application 72

Figure 38: Site Key Generator Options Tab Page 73

Figure 39: Site Key Generator Options Combo Box 74

Figure 40: Site Key Generator Levels Tab Page 75

Figure 41: Site Key Generator Levels Combo Box 76

Figure 42: CrypKey Site Key Generator 6.0 77

Figure 43: Distributor's Unauthorized SKG License Window with Site Code 81

Figure 44: Master Site Key Generator with Distributors Site Code 82

Figure 45: Master Site Key Generator with Slave Site Key and Selected Options 83

Figure 46: Site Key Generator License Authorization 84

Figure 47: Slave SKG License Window Authorized 85

C RY P K E Y S D K X
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 48: StealthPLUSTM Opening Window 119

Figure 49: StealthPLUSTM Validated Window 120

Figure 50: StealthPLUSTM Configuration Window 121

Figure 51: StealthPLUSTM Compression Begun 122

Figure 52: Network Disconnect Message Window 151

Figure 53: NT File System Troubleshooting Flowchart 152

Figure 54: Novell File System Troubleshooting Flowchart 153

Figure 55: .ckn Diagnostic File 155

Figure 56: Options and Levels 194

Figure 57: CrypKey Program Flowchart 257

Figure 58: Example Win9X/ME CrypKey Configuration 257

X I C RY P K E Y S D K
U S E R M A N U A L
Introduction
WelcometoCrypKeySDKandtheCrypKeyworldof Section

1
softwareprotection.

rypKeyisarevolutionarySoftwareLicensingApplicationProgram

C Interface(SLAPI)thatprovidestheserioussoftwaredevelopment
companywithinvisiblesecurityandcompleteflexibilityoverthelicensing
ofitsproducts.TheCrypKeysystemisdesignedtoreplaceanyexternal
hardware(dongle)orfloppydiskbasedkeysystemincopyprotection
effectiveness.

WiththeCrypKeySoftwareDevelopersKit(SDK),you(thesoftwaredeveloper)
can:
protectasoftwareproductfromunauthorizeduseonaturnkeybasis
grantcustomersdifferentlevelsofprivileges
grantcustomersusageprivilegeslimitedbytimeornumberofuses

Youcanprovidealloftheseservicesviatelephone,fax,oremail.

CrypKeySDK:

usesnohardwarekeyordiskkey

includesasoftwarelibrarythateasilyintegrateswiththedevelopers
existingprograms

canbeusedtotrackandcontrolprotectedsoftwaresoldbythirdparty
distributors

defeatsharddiskdrive(HD)cloningofyoursoftware

1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

1.1 About CrypKey (Canada) Inc.


TheuniqueCrypKeycopyprotectionandlicensecontrolsoftwarecameinto
beingin1992withthegoalofdevelopingabetterwayforalargeengineering
companytoprotectitsownsoftware.CrypKeyworkedsowell,thatitsoon
becameitsowncommercialproductandquicklyoutsoldtheproductitwas
createdtoprotect!

TheCrypKeyproductandservicebusinesswasspunoffbycurrent
managementintoCrypKey(Canada)Inc.inMarch2002.TheCrypKeyteamhas
developednew,ultrasecure,industryfirstCloneBusterTMtechnologyforits
version6.0.

CrypKeyhasdeliveredbattleprovensoftwarecopyandlicenseprotectionfor
thousandsofcompaniesworldwidesince1992,including:Nokia,Ericson,IBM,
MicrosoftCaterpillar,Eaton,Dupont,Fujitsu,Minolta,HP,Honeywell,3M,
LockheedMartin,Mobil,Procter&Gamble,Siemens,Verizon,Sybase,
Bell&Howell,Kodak,AllenBradley,andABB.

1.2 About CrypKey SDK


CrypKeySDKincludesatrialperiodthatallowsyoutoevaluatethefull
functionalityofthesystem.Obtainyourlicenseonlywhenyouaresatisfiedwith
CrypKeySDKsperformance.

ThisusermanualcontainsexampleUserandMasterKeys(seebelow)foruse
duringyourtrialperiod.Thesetemporarykeysarenotintendedfordistribution
withyourproduct.IfyoudistributeyourproductwiththesetemporaryUser
andMasterKeys,recipientswhohaveCrypKeycanunlockyourproduct.Since
allSiteKeyGeneratorscancreatekeysforanyprogramthatusesthetemporary
keys,theonlykeysyoushoulddistributewithyourproductarethose
specificallycreatedfortheproduct.

Example Keys

UserKey:D050815CD1A2A79DB103

MasterKey(16bit):2A5D57C41B4C135BF09E17F7600B2D7079E8
F275C36A

MasterKey(32bit):

C RY P K E Y S D K 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

F2C938D2D34678D2E9217C18D78EA6A8E466CF49520F92CDD1B6916
\BD460D60E7C7B4CC7CC1750BD7188F90AC132B915E82FC8FA60A1
D299DA0F28EA3C66BD42DB\0BE62149DAAEE4DBA55C0E70CE1C13
BD343F8B7573ABC1E7DA0695955AB2BD377F50A9BE29A\04CF816B3
0CD171E1509AD65100C999E52A35F45A215212A970

CrypKeySDKofferstwotypesofdeveloperkeysthoserelatedtotheexample
fileandthoselockingCrypKeytoyourproduct.Thinkofkeysasalphanumeric
stringsoftext.YourequirethefollowingfourkeystorunCrypKeySDK:

UserKey:createdfromtheCrypKeypasswordyouspecify

MasterKey:createdfromthefilenameyougivetoCrypKeyandother
pertinentinformation

SiteCode(generatedfromyourcomputeronwhichCrypKeySDKis
installed):requiredinordertoobtainyoursitekey

SiteKey(fortheSiteKeyGenerator):enablesyoutoauthorizeyour
productusingyourSiteKeyGenerator

1.3 How to Use This Book


Thismanualisabouttwobusinessrelationships:
yourrelationship,asasoftwarevendor,withCrypKeyCanadaInc.:howyou
obtainandutilizetheCrypKeySoftwareDeveloperKittoprotectyour
softwareasyoudistributeittocustomers
yourrelationshipwithyourcustomersanddistributors:howyouprovide,
protect,andlicenseyourapplications

PleasenotethatCrypKeySDKisdesignedforsoftwaredistributors.Allmaterial
inthismanualassumescompetenceonyourpartintheuseofWindowsbased
programs.

Followingisasummaryofthemanualscontents,aswellasstrategiesforusing
it.

3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

1.3.1 Summary of Contents


Chapter1,Introduction,containsthefollowinginformation:
systemrequirements
technicalsupportavailableatCrypKeyCanadaInc.
gettingauthorizationtouseCrypKeytolicenseyourapplications
generalCrypKeylicensingprocess
newfeaturesinCrypKey6.0
proceduresforupdatingtoCrypKey6.0

Chapter2,Installation,focusesontheinstallationandsetupoftheCrypKey
softwareandassociateddrivers(WindowsNT/9x/ME/2000/XP,MSDOS),files,
andsoftware.

Chapter3,DemoPrograms,providestwoexamplesofCrypKeyoperationone
fortheWindowsenvironmentandtheotherfortheMSDOSenvironment.

Chapter4,SiteKeyGenerator,discussesthecoreoftheCrypKeyinterface,
namelytheSiteKeyGenerator,whichisusedforconfiguringtheprotection
featuresforyoursoftwareandissuinglicensestoyourcustomersand
distributors.

Chapter5,ProgrammingYourApplication,discussesthebasicstepsin
programmingCrypKeyprotectionfeaturesandlicenseinformationintoyour
application.ItdiscussestheCrypKeylibrariesandhowtolinktothem.Italso
includesinstructionsforusingtheCrypKeyCOMObjects,whicharetoolsthat
facilitateandsimplifytheuseoflibraries.

Chapter6,ProtectingYourSoftwarewithStealthPLUSTM,discussestheuseof
CrypKeysStealthPLUSTMproducttoprotectyourdistributedapplication
againsthackers.Supplementaryinformationonthisissueisprovidedin
Chapter7,CounterHackerStrategies.

Chapters8,NetworkLicensing,and9,MovingProtectedPrograms,dealwith
networklicensingandlicensetransfersbycustomers.

Chapter10,FrequentlyAskedQuestions,discussesgeneralandtechnical
questionsthatuserscommonlyraiseaboutCrypKeySDK.

C RY P K E Y S D K 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Chapter11,Troubleshooting,providesstrategiesforidentifyingproblemsand
dealingwiththemostcommonCrypKeyerrors,themostfrequenterrorbeing
Error102(producedbytheInitCrypKey()function).Thischapteralsodealswith
CrypKeyLicenseServiceerrors,WindowsNTdiagnostics,NetWareissues.As
well,itidentifiesthegeneralinformationthatyouneedtoprovidetoCrypKey
technicalsupportstaffifyouhaveaproblemrequiringtheirassistance.

Chapter12,FunctionReference,providesdetailedinformation,includingusage,
syntax,parameters,anderrors,concerningallprogrammingfunctionsusedin
CrypKey.Thischapterincludesasummaryoffunctiondescriptions.Foraquick
referenceoffunctionsyntax,seeAppendixII.

Chapter13,AppendixI,containsthecodeforasampleCrypKeyexecutable,
demonstratingtheuseofCrypKeylibraryfunctions.

Chapter14,AppendixII,containsquickreferenceinformationaboutfunctions
anderrors.

AttheendofthemanualareaGlossaryandIndex.

1.3.2 Strategies for Using This Manual


IfyouarenewtoCrypKey,weadviseyoutoreadcarefullytheIntroduction,
Installation,andDemoProgramschaptersandfollowtheinstructionstotryout
theCrypKeyfunctionalityonyourcomputer.Afterreviewingthesechapters
andexamples,youllbereadytoworkwiththemainproceduralchaptersofthe
manualChapter4,SiteKeyGenerator,andChapter5,ProgrammingYour
Application.

TheSiteKeyGenerator,ProgrammingYourApplication,andFunctionReference
chaptersareyourmainresourcesfordaytodayuseofCrypKeySDK.In
addition,AppendixIIisusefulforquickreferenceinformationaboutfunctions
anderrors.Specifically,Sec.14.2:CrypKeyReturnCodesdiscusseserrors
returnedbythetwoCrypKeyfunctionsthatmustbecalledforalloperations
InitCrypkey()(seeSec.12.3.26)andGetAuthorization()(seeSec.12.3.13).

IfyouareexperiencingaproblemwithCrypKey,wesuggestinitiallyreviewing
theFrequentlyAskedQuestionsandTroubleshootingchapters,aswellas
AppendixIIQuickReference.Iftheproblemidentificationandpossible
solutiondonotcometolightfromthesesections,lookformoredetailinthe
FunctionReferenceandProgrammingYourApplicationchapters.Ifitisnot

5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

readilyapparenthowtoresolvethesituation,thenpleasecontactCrypKey
technicalsupportseeSec.1.5:TechnicalSupport.

C RY P K E Y S D K 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

1.3.3 Special Icons


Thefollowingiconsareusedthroughoutthemanualtoconveythemeanings
shown:

DONT FORGET

GLAD COMPUTER

WATCH OUT

1.4 System Requirements


CrypKeyisdesignedforusebysoftwaredevelopers.Inthismanual,weassume
thatyouhaveagoodworkingknowledgeofyourprogrammingenvironment,
butwedontnecessarilyexpectyoutobeanexpertprogrammer.

CrypKeySDKrequiresthefollowingminimumPChardwarerequirements:

a486(orbetter)processorwith64MBofRAMand25MBoffreespace
onyourharddrive

aVGAcolormonitor

7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

amouse

Windows3.1,Windows95,Windows98,orWindowsNTplatforms(NT,
2000,XP)

CrypKeySDKsupportsthefollowingdevelopmentplatforms:

MicrosoftC++6.0,7.0,and8.0(directly,usingstaticlibraries)

MicrosoftVisualC++1.5,2.x,4.x,5.xand6.x,andC++.Net(directly,
usingstaticlibraries)

BorlandC++4.x(directly,usingstaticlibraries)

BorlandC/C++3.xormorerecent

anydevelopmentsystemcapableofreadingandwritingafilevia
externallinking(forMSDOS)orDLL(for16or32bitWindows).This
includes,butisnotlimitedto,MicrosoftVisualBasic,MicrosoftFoxPro,
MicrosoftAccess,CAClipper,BorlandDelphi,BorlandVisualdBASE,
BorlandParadox,andPowersoftPowerBuilder.

.NetVB.Net,C#.Net,C++.Net

1.5 Technical Support


CrypKeySDKincludes60daysoftechnicalsupport,startingfromyourdateof
purchase.Ourcustomerservicerepresentatives,whilealwayspleasedtotake
yourcall,askthatyoureviewthefollowingchecklistbeforerequestingtheir
assistance:

readthemanual(mostproblemscanbesolvedusingtheinformation
containedinthisdocument)

workthroughthedemonstrationsinChapter3,whichprovideabasic
understandingofCrypKeySDK

testthesampleprogramwithinthescenariosyouareinvestigating
(again,mostquestionscanbeansweredusingthismethod;ifproblems
persist,trythesamesituationwithexample.exe)

C RY P K E Y S D K 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Ifthesealternativesdonotsatisfyyourrequirements,pleasecontactusby
phoneoremail.Ourbusinesscontactinformationislistedbelow.

CrypKey(Canada)Inc.

WorldHeadquarters:
MailingAddress CrypKey(Canada)Inc.
TheDevenishHeritageBuilding
90817thAvenueSW
Suite208
Calgary,Alberta
T2T0A3Canada

WorldHQPhone: 14033988011
RegularBusinessLine: 14032586274
FaxLine: 14032648838
Supportemail support@crypkey.com
Internet http://crypkey.com

PacificRimOffice:
Email Greg.Wible@crypkey.com
Phone: 15629898976
eFax: 12089788503

1.6 About Your CrypKey License


Bydesign,theCrypKeysystemallowsCrypKeytosendyouthisdeveloperskit
nowandreceivepaymentlater,afteryouarecompletelyconfidentinCrypKeys
abilities.However,ifyouwanttoshipCrypKeywithyourproduct,youneedthe
followingdeveloperkeysandnumbers:
User Key:Thisisanencryptedformofthedeveloper/productspecific
passwordandisprovidedtoyoubyCrypKey.Usethiskeyforthe
InitCrypkey()function.
Master Key:Thisisanencryptedformofinformationspecifictothe
productbeingprotectedandisprovidedtoyoubyCrypKey.Usethis
keyfortheInitCrypkey()function.

9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Site Key:ThiskeyisrequiredtounlockanyCrypKeyprotected
software.SincetheSiteKeyGeneratorisprotected,youmustsendus
thesitecodesothatwecanauthorizeyourSiteKeyGenerator.
Company Number:Thisvalueisspecifictoyourcompanyandisused
fortheCKChallenge()function.
Password Number:Thisvalueisspecifictoyourpasswordandisused
fortheCKChallenge()function.

Althoughyoucandevelopyourapplicationwithoutthedeveloperkeysusing
thetemporarylicenseprovided,youeventuallyneedthekeysforfinaltesting
andshippingofyourproduct.Thesekeysareissuedonlyafterwereceiveyour
payment.Ifyouareworkingunderanaggressivedevelopmentschedule(who
isntthesedays?),weaskthatyoutimeyourpaymentaccordingly.

1.6.1 Registering with CrypKey (Canada) Inc.


to Get Your Developer Keys

Procedure
1. FinishtestingCrypKeySDKandyourproductusingtheexample
developerkeys.

2. ConfirmyouhavepaidforCrypKeySDK.IfyouselectedBillNet30or
TelegraphicTransfer,pleaseensureyourpaymenthasbeensent.We
canauthorizeyoutouseCrypKeySDKonyourproductonlyafterthe
paymenthascleared.

3. Sendusthefollowinginformationviaemail,fax,ortelephone:

a. yourCustomerServiceNumber(CSN),locatedontheinside
coverofthisusermanual

b. thefilenameofyourproduct(maximum8.3characters)

c. thepasswordforyourproduct(maximum12characters)

d. yoursitecodefromyourSiteKeyGenerator(seeSection1.6.3:
ObtainingAuthorizationforYourSiteKeyGenerator)

C RY P K E Y S D K 1 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

1.6.2 Using the Temporary License for


Development
Forthepurposesofdevelopmentandexperimentation,youcantemporarily
usethefollowingkeysinyoursourcecode:

User Key: D050815CD1A2A79DB103

Master Key:2A5D57C41B4C135BF09E17F7600B2D7079E8F275
C36A

Youdonotrequireatemporarysitekey.

Tousethesekeys,youmust(temporarily)eitherplaceafilecalledexample.exe
inthesamedirectoryasyourapplicationorrenameyourexecutableto
example.exe.Also,youmustuseCRYPKEYasyourpasswordwheneveryou
useyourSiteKeyGeneratorintestauthorizations.

Underthistemporaryarrangement,youarecheckingandmodifyingthelicense
forexample.exe.Thismeansyoucanuseexample.exetotestyourprograms
licenseoperations.

1.6.3 Obtaining Authorization for Your Site Key


Generator
InordertocreatesitekeysusingyourSiteKeyGenerator,youmustfirstprovide
uswiththesitecodefromyourSiteKeyGenerator(youcandeterminethesite
codebyclickingLicenseintheSiteKeyGeneratordialogbox:seebelow).We
authorizeyourSiteKeyGeneratoronceyoufinishtestingCrypKeywithyour
application.

Donotshipyourapplicationusingthekeysthatareprovidedtoyouwiththe
trialsoftware.Theexamplekeysarestrictlyforuseduringyourtrialperiod,as
anyonewiththeCrypKeyproductcancreatekeysforanyproductprotectedwith
theexamplekeys.

1 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Procedure
WhenyouhavefinishedtestingyourproductwithCrypKeyandarereadyto
acquireSiteKeyGeneratorauthorizationfromus,usethefollowingstepsto
determinethesitecodefromyourSiteKeyGenerator:

1. StartyourSiteKeyGeneratorbydoubleclickingitsiconintheCrypKey
SDKprogramgroup.

Figure 1: Site Key Generator Startup

C RY P K E Y S D K 1 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

2. ClickLicense intheSiteKeyGeneratordialogbox.Yoursitecode
appearsintheLicensedialogbox,asshownbelow.

Figure 2: License Window Not Authorized

3. Sendusyoursitecodeviaemail,fax,orphone,alongwiththeother
informationoutlinedinSection1.6.1:RegisteringwithCrypKey
(Canada)Inc.toGetYourDeveloperKeys.

1 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4. Onceyoureceiveyoursitekey,typeit(orcutandpasteitfromouremail
message)intotheSiteKeyfieldintheLicensedialogbox.

Figure 3: License Window Site Key Inserted

5. ClickValidate. ToensurethatyourSiteKeyGeneratorisauthorized,
returntotheLicensedialogbox:

C RY P K E Y S D K 1 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 4: License Window Authorized

1.7 CrypKey Licensing Implementation


ThefollowingstepsdescribehowCrypKeyisusedinthedevelopmentprocess:

1. You (the developer) purchase the CrypKey software


licensing system and program your application with the
library security functions.CrypKeycanbebestthoughtofasa
SoftwareLicensingAPI(SLAPI).YoumustembedtheprimaryCrypKey
functionsinthesourcecodeusingCrypKeySDK,whichhandlesthe
initialization,licenseverification,sitecodegeneration,andtermination
features.

Youmayalsochoosetoorganizethefeaturesofyourapplicationin
termsofspecificlevelsandoptions,whichareautomatically
facilitatedwithintheCrypKeysystem.Infact,werecommendyoudo

1 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

thisifitisappropriatefortheapplication,sincethisallowsyoutouse
thefullfeaturesetthatCrypKeyprovidesforlicensing.

CrypKeyCanadaInc.alsoprovidesaproductcalledCrypKeyInstant,
thatembedstheCrypKeylicensingprotectionsystemwithinyour
applicationexecutablewithoutrequiringanychangestothesource
code.Thisproductoffersanalternativemethodofcopyrightprotection
todevelopersanddistributors.

2. You experiment with CrypKey and test the application using the
temporary license provided. Ifyouarecompletelysatisfiedwith
CrypKey,faxustherequiredinformation.Wefaxyoukeysthatactivate
yourSiteKeyGeneratorlicenseforthespecificproduct(s)in
development.Theproductexecutablename,password,SiteKey
Generatorsitecode,andcustomerserviceidentificationnumberare
requiredinordertocreatethedeveloperkeysthatenableyoutolicense
theproduct(s)tocustomersusingtheSiteKeyGenerator.Thereisa30
daymoneybackguarantee,soyoumayfullytesttheCrypKeysystem,
withoutrisk,usingthetemporarylicenseprovided.AllCrypKeySDK
featuresareavailabletoyouduringthetrialperiod.

PleasenotethatCrypKeycannotbereturnedoncethedeveloperkeysfor
yourproduct(s)havebeenissued.

3. You distribute the application that you have developed to


potential clients.Iftheproductfunctionsinitiallyindemonstration
mode,theclientcanexperimentwiththeproducttodeterminewhat
functionsandoptionsarerequired.Youcanprovideprospective
customerswithafreecopyoftheapplicationthathasa30daylimited
license(thisisconfigurable).Thistemporarylicenseisfullyprotectedby
CrypKeyandtheapplicationceasestooperatewhenthistemporary
licenseexpires.Untilthen,theapplicationcanfunctionnormallyand
theclientcantestitoutonhisorhersystem.Notethatprogram
behavior,whenitisnotauthorized,iscompletelyunderyourcontrol,
however,ademonstrationmodeisrecommended.

4. When the customer is satisfied with the application, he


or she obtains a site code from the application and
transfers the code to you, typically by email, along with
the license permissions the customer wants to
purchase. The customer also provides payment to you.
Thesitecodeisbasedonaspecialinternalhardwaresignaturethatis

C RY P K E Y S D K 1 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

uniquetothepersonalcomputerthattheapplicationisinstalledon.
Thesitecodeappearsasanencryptedalphanumericnumber.CrypKey
allowslicenserestrictionstobespecifiedintermsofalimited(or
unlimited)numberofdaysorruns.Runsareimplementedinthe
applicationinwhatevermanneryoudesignate.Thenumberofprogram
copiesorconcurrentnetworkusersisalsospecifiedwithinthelicense.

5. You enter the customers site code into the Site Key Generator
and set the license configuration. Asitekey,whichprovides
specifiedaccesstotheapplication,isthengeneratedandgiventothe
customerwhenyoureceivepayment.Thespecificlevels,options,and
permissionsaregenerallyreferredtoasthelicenseintheCrypKey
system.Thisinformationisembeddedandencryptedwithinthesitekey
anditactivatesandconfiguresthecustomerslicensewhenitisentered
intotheapplicationbythecustomeranddecrypted.Anysitekeyyou
generateworksonlywiththeinstalledapplicationthatcreatedthesite
codeprovidedbythecustomer.TheSiteKeyGeneratorautomatically
verifiesthatthesitecodegivenisauthentic.

6. Your customer uses the site key provided by you to unlock the
application under the terms specified. Sitecodesandsitekeyscan
betransferredbyemail,telephone,orothermeansbecausetheyare
alphanumericstringsofmanageablelength.Theprocessofissuinga
sitekeyforacustomersspecificsitecodeisreferredtoas
authorizationintheCrypKeysystem.CrypKeyautomaticallytracks
restrictionsintermsofdaysorrunsandinvalidatesthelicensewhenthe
timeperiodexpiresorthenumberofrunsisused.TheCrypKey
functionsinsidetheapplicationverifythatthesitecode/sitekey
combinationisvalidbeforeaccessisprovidedtothecustomer.Also,the
licenseisuniquelyspecifictothepersonalcomputeronwhichthe
applicationruns.Ifthecustomercopiestheprogramanditslicensefiles
toanothercomputer,thelicensebecomesinvalidonthatmachineand
doesnotallowaccess.ThisoccursbecauseCrypKeyiscapableof
identifyingtheexactcomputerthelicensewasissuedforwithoutthe
useofanexternalhardware(dongle)orfloppydiskkey.

7. You achieve fame and fortune as customers everywhere


are pleased with the product and the clean, non-
intrusive licensing system you have provided.Steps4
through6canberepeatedifthecustomersneedschangeandthe
customerwantstobuylicensesfordifferentlevelsoroptionsforthe
application.

1 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

1.8 New Features in Version 6.0


CrypKey,asaconcept,hasprovenitselfahundredtimesoverinthesoftware
marketplace.OurnextstepwastoperfectCrypKeysperformance.Ourgoal
withthepresentreleaseistomakeCrypKeyperformwithaveryhighstandard
ofsecurityandrobustnessonalltheplatformsonwhichitruns.Withversion
6.0,wehavesucceededinthisgoal.

CrypKey6.0hasbenefitedfromtheexperienceofournowsizablecustomer
base.Wehaveconcentratedontrackingdownandfixingeveryknownproblem
onthemanyplatformsCrypKeysupports.Theresultisrobustsoftware.Before
thisrelease,99%ofallsupportproblemswerefixedjustbysendingthis
software.

Wealsohavearelatedproduct,CrypKeyInstant,that:
protectsDOS,DOS32bit,Win16,andWin32programswithnosource
codechanges
doesnetworkfloatinglicensingwithnosourcecodechanges
supportsinternationallanguagesandenablesyoutoswitchoradd
languagesatruntime
encryptsdata

MoreinformationaboutCrypKeyInstantisavailableonourwebsite,at
http://crypkey.com.

ThechangeswevemadeinCrypKey6.0include:
CloneBusterTMtechnologyforharddriveserialnumber(HDSN)
recognition

EasyLicense

dynamic,multikeyencryption

enhancedantihackingcapability(StealthPLUSTM)

Thesenewfeaturesaredescribedinmoredetailbelow.

C RY P K E Y S D K 1 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

1.8.1 CloneBusterTM Technology


Softwaredevelopersarediscoveringtheyarelosingbillionsofdollarsina
worldwidemassivelicensetheftoflargescale.Fueledbytherecentsurgeinuse
oflegal,lowcostharddrive(HD)cloning,orghosting,software,easily
obtained$49utilitieswithnameslikeGhostandXXCopyarerenderingonce
popularcopyprotectiontechniquesuseless,generatingfastlucrativereturns
forsoftwarepirates.

Manypopularcopyprotectiontechnologiesthatdependonplacingsometype
ofsimplesoftwarefootprintarenoweasilydefeatedbythesenewHDcloning
techniquesandarenolongeraneffectiveoption.Manyunproven,startup,
venturecapitalbacked,rightsmanagementplatformprovidersarenot
practicallyviable.Theyoffergrand,andoftenexpensive,protectionschemes
thatfailtorecognizeallthenumerousfirewall,integration,distributed
deployment,andsupportissuesgeneratedbytheirsocalledconnected
productvision.HardwaredonglesprovidelimitedprotectionagainstHD
cloning,butareexpensiveanddislikedbyendusers.CrypKey6.0,which
includesCloneBusterTMtechnology,effectivelysolvesthisproblem.

MostmodernIDEharddriveshaveburnedinserialnumbers(HDSN).Notto
beconfusedwiththeeasilychangedvolumeserialnumber,theHDSNisa
permanent,readonlyattributeofapersonalcomputerharddrive.TheHDSN
isverydifficulttoaccess,butCrypKeySDK6.0withCloneBusterTMtechnology
hasthisability(patentpending).LeveragingCrypKeystenyear,proven
protectionarchitecture,CloneBusterTMdetectsandlogstheHDSN,model
number,andfirmwareidentifierandusesthisinformationinitsproprietary
licensingalgorithms.AlthoughHDcloningprogramssucceedinbreakingother
simplecopyprotectionschemesinordertocopyanentireharddrive,they
cannotachievethisagainstCrypKeyarmedwithCloneBusterTM.

1.8.2 EasyLicense
Somecustomersneedthesimplestpossibleformofcopyprotectionwhena
particularapplicationrunsonlyonaparticularcomputer.Thesecustomersdo
notwanttodealwithanyassociatedissuesoftransfer,networklicense,trial
period,ornumberofcopies.Whetherthesoftwareisoffloadedandputback,
deletedandrestoredlater,ortheentireharddriveiserasedandrestored,the
applicationstillsrunonthecomputer.

EasyLicenseoffersthistypeofprotectioncoupledwithsimplicity.

1 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

1.8.3 Dynamic Encryption


WehaveincreasedthebitsizeofourSiteCodeandSiteKeyencryption.Never
satisfiedwithgoodenough,wehavealsocreatedadynamicmultiple
encryptionkeyscheme,sothatencryptionkeysareconstantlychangingonthe
fly.Thisistrulyacodebreaker'snightmare.Thisalsohaltsanyattemptsto
createaroguekeygenerator.

1.8.4 Enhanced Anti-Hacking


TM
StealthPLUS ,ourantihackinglayerincludedwithCrypKey,isacritical
componentasitstopsthehackerfromreverseengineeringandcircumventing
thecopyprotection.StealthPLUSTMalreadyencryptsyourbinaryfileandguards
againstprogrampatcheswhileitisinmemory.Wehaveenhanced
StealthPLUSTMsoitpartiallyunencryptsprogramswhileitrunsinmemoryand
reencryptthepartsthatarenotrunning.Theprogramteamsupinmemory
withaspecialsymbioticprocessthatunencryptspartsasneeded,dramatically
decreasingvulnerability.

1.9 Updating to CrypKey SDK v6.0


ToupdateCrypKey6.0fromapreviousversion:

1. ObtainanewMasterKeyforeach32bitapplicationyouwishtoprotect.

2. ObtainanewSiteKeyforyourversion6.0SiteKeyGenerator.

3. Ifyouhavea32bitapplication,addanewfile,CRP32001.NGN,tothe
directoryyourapplicationresidesin.Thisfileisfoundinthe\Libs\32bit
directorythatiscreatedwhenyouinstallCrypKey6.0.

Theversion6.0librariesworkonlywiththenew32bitSiteKeyGenerator
6.0andlater.YouroldSiteKeyGeneratorcannotauthorizethese.

4. PleasenotethenewThunklibrarynamesCRYP95F.DLLand
CRYP9516F.DLL.ThesenewlibrariesmustbepresentwhenWin9XandME
arerun.

ThenameCRP9516F.DLLreplacesallpastversionsofCRP9516?.DLL.The
nameCRYP95F.DLLreplacesallpastversionsofCRYP95?.DLL.However,

C RY P K E Y S D K 2 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

thenameoftheotherfileinthesamedirectory,CK16RMV.EXE,hasnot
changed.

5. ThelocationoftheThunkDLLshaschanged.Theymustbefoundinoneof
thefollowing:
thedirectory(searchedfirst)whereyourapplicationresides
thedirectory(searchedsecond)whereyourCrypKeylicenseresides

Iftheydonotresideinoneofthesedirectories,a
THUNK_LIB_NOT_FOUNDerrorresults.Windowsandsystemdirectories
willnotwork.

Note:ForVBandDelphiuserswhenyourunyourapplication
undertheIDE(notcompiledstandalone),theapplication
directoryistheIDEdirectory,notthedirectorywhereyour
applicationis.Wepreviouslytoldyoutocorrectthisproblemby
puttingtheThunklibrariesintheWinDirectory,butthiswillnot
worknow.LocatetheThunklibrariesinthedirectorywhereyou
tellCrypKeytoputitslicense.

Whendevelopingwiththe.NETorC++IDEsyoucannotdebug
callstoCrypKey.Ifyouneedtodebugyourprograms,bypass
yourCrypKeycallstemporarily.
6. Thisupdateincludesall6.0librariesandDLLs.Youneedonlythosethat
applytoyourapplication.

7. Dooneofthefollowing:
reconfigureSKW
copyyourskw.inifromapreviouslyconfiguredSKWandaddthe
followinglineattheendofyourfile:

EasyLicense=0

8. Anuninstallfeature,andotherimportantchanges,havebeenaddedtothe
NTDriver(seeSec.5.6.4).

2 1 C RY P K E Y S D K
U S E R M A N U A L
Installation
ThischapterprovidesdetailsonhowtoinstallCrypKey Section

2
SDKanditsassociatednetworkdriversonyoursystem.

A networkdriverdoesnothavetobeinstalledtouseaCrypKeyprotected
applicationinstandalonemodeortouseCrypKeySDKonyourmachine
(exceptinthecaseofWindowsNTplatformsseeSec.8:Network
Licensing:andSec.5.6:CreatingaWindowsNTLicenseServiceInstallation).
DriversareprovidedsoyoucanrunaCrypKeyprotectedapplicationfroma
serveronclientworkstationsoveranetwork.

2.1 Getting Started


YoucaninstallCrypKeySDKfromaCDprovidedbyCrypKey(Canada)Inc.or,
ifyouareaCrypKeysubscriber,bydownloadingtheinstallationfilesfromthe
CrypKeywebsite.AsyouwillseeinSections2.1.1and2.1.2,thesequencesof
windowsforthetwotypesofinstallationarequitesimilar.

WhetherrunfromaCDorfromdownloadedfiles,theinstallationprogram
createsthefollowingCrypKeygroupinyourStartmenu(Windows
95/98/ME/NT/XP/2000)orinProgramManager(Windows3.1):

Figure 5: CrypKey SDK Program Group

2 3 C RY P K E Y S D K
U S E R M A N U A L
2.1.1 Installing CrypKey SDK from CD

Procedure
1. EnsureWindowsisrunningonyourcomputer.

2. InserttheCrypKeyCDROMintoyourCDROMdrive.CrypKey
automaticallystartsup,displayingthefollowingwindow:

Figure 6: Opening CrypKey CD Installation Window

2 4 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

3. ClicktheInstallbutton.Thesystemdisplaysthefollowingwindow:

Figure 7: CD Installation Screen 1

2 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4. ChooseInstall CrypKey SDK. ThesystemdisplaystheInstallShield


Wizard,shownbelow.Inthiswindow,andtheothersinthesequence,
simplyclickNextorYes,whicheverispresented,afteryouhaveresponded
totheprompts,ifany,showninthewindows.

Figure 8: CD Installation Screen 2

C RY P K E Y S D K 2 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 9: CD Installation Screen 3

4. Intheabovewindow,typethepasswordprovidedbyCrypKey.Whenyou
havecorrectlyenteredtheentirepassword,theNextbuttonisenabled,as
shownabove.ClickNexttodisplaythefollowingwindow:

2 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 10: CD Installation Screen 4

C RY P K E Y S D K 2 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 11: CD Installation Screen 5

2 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 12: CD Installation Screen 6

C RY P K E Y S D K 3 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5. Intheabovewindow,specifywhereyouwantCrypKeySDKinstalledby
acceptingthedefaultdirectoryprovidedbytheinstallationprogramorby
typinginapathforittouse.Ifthedirectorydoesnotalreadyexist,the
installationprogramcreatesitforyou.

Figure 13: CD Installation Screen 7

3 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 14: CD Installation Screen 8

6. Intheabovewindow,theoptionsLaunch CrypKey Site Key Generator


andView Readme Filearepreselected.Clickeithercheckboxtodeselect
it.

WestronglyrecommendthatyoureadtheReadmefileimmediately,asit
maycontaindetailsthatwerenotavailableintimetobeincludedinthis
manual.

C RY P K E Y S D K 3 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

2.1.2 Downloading and Installing CrypKey SDK

Procedure
1. Whenyouhavecompletedthedownloadoftheinstallationfilestoyour
computer,doubleclickthefileCrypKeySDK60.

Thesystemdisplaysthefollowingwindow.Thisisthefirstofasequence
ofstandardinstallationwindows.Ineachone,simplyclickNextafter
youhaverespondedtotheprompts,ifany,inthatwindow.

Figure 15: Download Installation Screen 1

3 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 16: Download Installation Screen 2

C RY P K E Y S D K 3 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 17: Download Installation Screen 3

3 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 18: Download Installation Screen 4

C RY P K E Y S D K 3 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 19: Download Installation Screen 5

3 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 20: Download Installation Screen 6

2. Intheabovewindow,specifywhereyouwantCrypKeySDKinstalledby
acceptingthedefaultdirectoryprovidedbytheinstallationprogramor
bytypinginapathforittouse.Ifthedirectorydoesnotalreadyexist,
theinstallationprogramcreatesitforyou.

3. Oncethedriveanddirectoryarecorrect,clickOKtocontinuethe
installationprocess.

C RY P K E Y S D K 3 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 21: Download Installation Screen 7

4. Intheabovewindow,youareaskedifyouwanttoviewtheReadme
file.Youmayreadthefilenoworchoosetoviewitlater.

WestronglyrecommendthatyoureadtheReadme immediately,asit
maycontainlastminutedetailsthatwerenotavailableintimetobe
includedinthismanual.

2.1.3 Packing List and Readme Files


Thepackinglistisafile(namedpacklist.txt)inyourCrypKeydirectory.Itlistsall
filesintheCrypKeysystemandincludesashortdescriptionofeachone.You
canusethepackinglistasaquickreferenceforinformationonthefiles
includedinyourinstallation.Thisisespeciallyusefulifyouneedtofinda
libraryyouwanttouse.

3 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

ThereadmefileislocatedinyourCrypKeydirectory.Itcontainsimportantlast
minuteinformationthatwasnotavailableintimetobeincludedinthemanual.
YoushouldreaditafterinstallingCrypKeyonyoursystem.

Followingistheinformationinthereadmefile,atthetimeofpublication,
aboutthecontentsofeachinstalleddirectory.

1. Demos

Thisdirectorycontainsthecompiledexecutableversionsofthesample
codefoundintheSamplesdirectory.IfyouareusingNT,thisdirectorywill
besetuptohavetheCrypKeyNTDriverservingit.

2. External

ThisdirectorycontainssamplecodeforusingExternalLinkingwith
CrypKey.Youwouldusethisifyoucouldnotlinktooneofourlibrariesof
DLLsfromyourparticulardevelopmentenvironment.(Example:Turbo
Pascal).

3. Include

ThisdirectorycontainstheincludefilesyouwoulduseifusingCorC++.
Currently,thereisonlycrypkey.h.

4. Lib

ThiscontainsanumberofdifferentversionsoftheCrypKeylibrary.Tohelp
youfindthefilesyouneed,thisdirectoryisfurthersubdividedinto16and
32bit.Underboth16and32bit,therearelibrariesforMicrosoftand
Borlandcompilers,aswellasgeneric16bitDLLs.

5. Netdrive

ThisdirectorycontainsthedriverneededforallCrypKeyNTPlatform
usage,aswellasdriversforusingCrypKeywithnetworks.

Fiveservertypesaresupported:
NTPlatform(IncludesXP,Win200,NT)
Windows3.xor9.x

C RY P K E Y S D K 4 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Novell3.xandhigher
MSDOS
OS2

6. Samples

Thisdirectorycontainsvarioussamplecodefromdifferentplatforms.Some
samplesarecontributedbykindheartedCrypKeycustomers(andwealways
welcomemore).Thesesamplesareagoodstartingpointandcanalwaysbe
improvedupon.

7. SiteKeyGenerator

ThisdirectoryhousestheCrypKeySiteKeyGenerator.Forthoseupdating
frompreviousversions,wethinkyouwillliketheimprovements.

8. Stealth

ThisdirectorycontainstwoversionsofCrypKeyStealthPLUSTM:
STELTHUI.EXEuserinterfaceversion
STELTHCM.EXEcommandlineversion

9. CrypKeySDKCOMObject

ThisdirectorycontainstheCrypKeyCOMobject.Thisistheeasiestlibrary
tointegrateintoVBandVisualC.Thisdirectoryalsoincludesthe
documentationandVBandVCsampleprograms.

10. CrypKeySDKdotNET

ThisdirectorycontainstheCrypKey.NETassembly.Thisistheeasiest
librarytointegrateintothe.NETlanguages(VB.NET,C#.NET,andC+
+.NET).ThisdirectoryalsoincludesthedocumentationandC#.NETand
VB.NETsampleprograms.

11. Thisdirectorycontainsthismanual.Youmaywishtousesomepartsin
yoursoftwaredocumentation.

4 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

2.2 CrypKey License Service Installation


ThissectionpertainstoallprogramsrunningontheNTFileSystem(NTFS),
includingMSDOSandWin16,aswellasnativeWin32programs.TheCrypKey
LicenseServicemustbeinstalledonWindowsNT/2000/XPoperatingsystems.

TheCrypKeyLicenseServicemanageslicenses.InNTenvironments,itis
requiredforeitherstandaloneornetworkinstallations.

TorunaCrypKeyprotectedMSDOS,Win16,orWin32programfromalocal
driveonaWindowsNTplatform,youmustinstalltheCrypKeyLicenseService
onthatmachine.TheCrypKeyLicenseServiceisrequiredbecauseWindows
NTdoesnotallowprogramstodirectlyaccessthecomputerhardware,which
CrypKeymustdo.Fortheinstallationprocedures,seeSec.5.6:Creatinga
WindowsNTLicenseServiceInstallation.

IfyouarecurrentlyrunningCrypKeyonaWindowsNTpersonalcomputer,you
alreadyhavetheCrypKeyLicenseServiceinstalled.Ifyouwanttousethe
LicenseServicewiththeinstallationofyourapplication,youcanfinditin
C:\CrypKey.60\Stealth.

StealthPLUSTMcaninstalltheLicenseServiceautomaticallyforyou.Formore
details,seeChapter6:ProtectingYourSoftwarewithStealthPLUSTM.

WenolongersupportcustominstallationsforWindowsNTdrivers.

2.3 Windows 9x/ME Network Installation


Thefilewckserve.exeistheWindows3.1/9xCrypKeynetworkcommunications
driver.ItisaWindowsprogramthatcanberuninanyWindowsenvironment
toallowthecomputertoactasaserverforCrypKeyprotectedprograms.
Wckserve.exerunsinthebackgroundandistransparenttotheoperationofthe
computer.

Beforerunningwckserve.exe,anenvironmentvariablemustbesettotellit
wheretheCrypKeyprotectedprogramis.Thebestwaytodothisistoputa
commandintheautoexec.batfileasfollows:

SET CKSERVE=dir; [dir2;] [dir3;]

Here,dir,dir2,dir3,etc.,arepathstothedirectoriesthatholdCrypKey
protectedprograms.IfthereismorethanoneCrypKeyprotectedprogramon

C RY P K E Y S D K 4 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

thecomputer,apathmustbegivenforeachdirectory,endingwitha
semicolon.Whenthecomputerisrebooted,theSETcommandtakeseffectwith
theparametersspecified.

Alternatively,wckserve.exeacceptsthedirectorystringnormallyinthe
WCKSERVEenvironmentasacommandlinevariable:

WCKSERVE.EXE C:\MYAPP1;C:\MYAPP2

Here,MYAPP1andMYAPP2aredirectoriescontainingCrypKeyprotected
applications.

Toconfigurewckserve.exetoautomaticallystartandruninthebackground,
addwckservetotheStartupgroup.WhenWindowsisrestarted,thedriverruns.

Note:theservermustgivereadandwritepermissiontoitsclientsforthe
directorywheretheCrypKeyprotectedsoftwareresides.Ifwritepermissionis
notgiven,allnetworkaccessrequestsaredenied.

2.4 MS-DOS Network Driver Installation


Ckserve.exeisaterminateandstayresident(TSR)driverprogramthatmustbe
runonanynetworkedMSDOScomputerthatmakesaCrypKeyprotected
programavailabletoothercomputers.ThisdriverisintendedforMSDOS
serversandcannotberunonaWindowsserver.Ckserve.exerunsinthe
backgroundandistransparenttotheoperationofthecomputer.

Beforerunningckserve.exe,anenvironmentvariablemustbesettotellitwhere
theCrypKeyprotectedprogramis.Thebestwaytodothisistodefinean
environmentvariableintheautoexec.batfileasfollows:

SET CKSERVE=C\:MYAPP1; C\:MYAPP2; ...

Here,MYAPP1,MYAPP2,etc.,aredirectoriescontainingCrypKeyprotected
applications.IfthereismorethanoneCrypKeyprotectedprogramonthe
computer,apathmustbegivenforeachdirectory,endingwithasemicolon.
Whenthecomputerisrebooted,theSETcommandtakeseffect.

Alternatively,ckserve.exeacceptsthedirectorystringnormallyintheCKSERVE
environmentasacommandlinevariable:

CKSERVE.EXE C:\MYAPP1;C:\MYAPP2; ...

4 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Here,MYAPP1, MYAPP1,etc.,aredirectoriescontainingCrypKeyprotected
applications.

Tostartckserve.exe,ensuretheprogramisloadedonthecomputer.Typethe
programnamefromtheMSDOScommandlinewithnooptions.This
commandshouldbeputintotheautoexec.batfile.Youcanputckserve.exein
anydirectory,aslongasyounamethefullpathwhenyoustartit.

ThisprogrammustberunfromMSDOS(version3.1orhigher).Itcannotbe
runwithWindowsonthesamecomputer.Contactusifyouneedthisability.

Theservermustgivereadandwritepermissiontoitsclientsforanydirectories
whereCrypKeyprotectedsoftwareresides.Ifwritepermissionisnotgiven,all
networkaccessrequestsaredenied.

2.4.1 Example
ConsideranexamplewherethereareCrypKeyprotectedprogramsinthe
followingdirectories:

C:\APPS\BINGO

E:\WINDOWS\WHIZBANG

D:\TEMP

Ifyouwantyouruserstobeabletooperatethefirsttwoprogramsfromother
computersthatarelinkedbyanetworkandyouhaveckserve.exeloadedinto
thedirectoryC:\util,putthefollowingcommandsintheautoexec.batfile:

SET CKSERVE=C:\APPS\BINGO;E:\WINDOWS\WHIZBANG;D:\TEMP

C:\UTIL\CKSERVE.EXE

Rebootthecomputertoputthesecommandsintoeffect.

C RY P K E Y S D K 4 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

2.5 Novell NetWare Installation


CrypKeyincludesoneNovellNetWareLoadableModule(NLM),whichmustbe
loadedintoaNetWareservermachinethatishostingCrypKeyprotected
programswithfloatinglicenses.

Ckserver.nlmisusedforallNetWareservers.Itmustbegivenread,write,
filescan,modify,anddeletepermissionsfortheservermachinethatitis
servicing.Ckserver.nlmcanserviceonlythelocalfileserverthatitisinstalled
on;thisincludestheSYSvolumeandallothervolumesontheserver.

Ckserver.nlmisselfconfiguringanddetectsanyCrypKeyprotectedprogram
ontheserveritrunson.Itdoesnotrequireanyinteractionorconfiguration
fromtheadministratoronceithasbeenloaded.

2.6 Libraries and Distribution Files


Followingarelistsof16and32bitlibrariesfromwhichyoumustdistributethe
appropriatefileswiththeproductthatyouprovidetoyourcustomer.For
convenience,both.LIBand.DLLfilesarelistedhere,although.LIBfilesarenot
distributedwithyourapplication.The.DLLfilesthatmustbedistributedare
indicatedbelow;othersarefordistributionasrequiredbyyourapplication.
TheselibrariesresideinyourCrypKey.60\Libdirectory.

Formoredetailsonlinkingyourapplicationtolibraries,seeSec.5.3.2:Linking.

Formoredetailsonlibrariestobedistributedforvariousplatforms,seeSec.
14.3:CrypKey6.XOSFileDistributionMatrix.

SeeSec.2.6.3foradiscussionoftheThunklibrarieswithinthe32bitlibraries.

2.6.1 16-Bit Libraries


Thefollowinglibrariesarefoundin~\CrypKey.60\Lib\16Bit.

LCRYPKY7.LIBMicrosoftC7.0andDOS

LCRYPKYM.LIBMicrosoftC7.0andWindows3.1

4 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

LCRYPKYD.DLLWindowsDynamicLinkLibrary(DLL)

LCRYPKYD.LIBMicrosoftC7.0ImportLibraryforDLL

2.6.2 WIN32 Libraries


Thefollowinglibrariesarefoundin~\CrypKey.60\Lib\32Bit.

Files required to be distributed

Table1:Filesrequiredfordistributionwith32bitApplications

CRYP95f.DLL Thesethreefilesmustbe
distributedwithyourprogram.
CRP9516f.DLL Theymustbeputinthesame
directoryasyour32bit
CRP32001.NGN application,orinthedirectory
thatholdsyourlicense.

Files required for various purposes

CRP32M60.LIBMicrosoftVC++6.0Win32library(multiplethreadStaticRT
Libraries)

CRP32D60.LIBMicrosoftVC++6.0Win32library(multiplethreadDynamic
RTLibraries)

CRP32S60.LIBMicrosoftVC++6.0Win32library(singlethreadRTLibraries)

CRP32M42.LIBMicrosoftVC++4.2Win32library(multiplethreadStaticRT
Libraries)

CRP32D42.LIBMicrosoftVC++4.2Win32library(multiplethreadDynamic
RTLibraries)

CRP32S42.LIBMicrosoftVC++4.2Win32library(singlethreadRTLibraries)

C RY P K E Y S D K 4 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

CRP32DLL.DLLWin32DLL(multiplethreadRTLibraries)

CRP32DLL.LIBMicrosoftVC++4.2importlibforCRP32DLL.DLL

CRP32BMT.LIBBorlandC++4.51Win32library(multiplethread)

CRP32BST.LIBBorlandC++4.51Win32library(singlethread)

Thefollowingfilesarefoundinotherdirectories:

in~\CrypKey.60\CrypKey SDK COM Object

CRYPKEYCOM.DLLCOMobjectforallcompilersthatcanuseCOM
objects.

in~\CrypKey.60\CrypKey SDK dotNET

CRYPKEYNET.DLL.NETassemblyforallcompilersthatcanuse.NET
assemblies.

2.6.3 32-bit Thunk Library Installation


A32bitCrypKeyprotectedapplicationmustincludespecialCrypKeythunk
librariesinitsinstallationroutinesothattheapplicationruns.Theselibraries
areplacedinthesamedirectorylocationastheprogram.For16bitCrypKey
protectedapplications,thesefilesarenotneeded.

CRYP9516f.dll,CRP95f.dll,andCK16RMV.exearethethreefilesthatmustbe
includedfor32bitapplicationsinWindows9x/ME(thefirsttwofilesarethunk
libraries.TheselibrariesarenotrequirediftheprogramisinstalledonWindows
NT,buttomakeyourinstallationprocessconsistent,youcanincludethem
anyway.

ThelocationoftheThunkDLLshaschanged.Theymustbefoundinoneofthe
following:
thedirectory(searchedfirst)whereyourapplicationresides
thedirectory(searchedsecond)whereyourCrypKeylicenseresides

4 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Iftheydonotresideinoneofthesedirectories,aTHUNK_LIB_NOT_FOUND
errorresults.Windowsandsystemdirectorieswillnotwork.

Note:ForVBandDelphiuserswhenyourunyourapplicationunderthe
IDE(notcompiledstandalone),theapplicationdirectorybecomestheIDE
directory,notthedirectorywhereyourapplicationis.Ifthethunklibraries
areinyourapplicationdirectory,theywillnotbefoundbyCrypKey.We
previouslytoldyoutocorrectthisproblembyputtingtheThunklibrariesin
theWinDirectory,butthisdoesnotworknow.YoushouldputtheThunk
librariesinthedirectorywhereyoutellCrypKeytoputitslicense.

ExtraCRCsecurityisaddedtotheThunklibraries,preventingfilesizesfrom
changing.

InpreviousCrypKeyreleases,whenmultipleversionsoftheprogramusedthe
ThunkDLLs,orwhenCrypKeyprotectedapplicationsran,theseDLLswere
sharedandsometimescrashed.Inthisversion,theDLLsarenotsharedand
consequentlytheDLLsdontcrash.Althoughthereisstillonlyonecopyofthe
DLLs,CrypKeyautomaticallycreatesandrunsacopyoftheDLLsforeach
program.

2.7 Connectivity to Microsoft Access


TherulesenablingCrypKeytoworkwithMicrosoftAccessarethesamefor
bothWindows97andWindows2000:
1. ThethreeDLLsCrp32dll.dll,Cryp95f.dll,Crp9516f.dllmustbeinthesame
directory.
2. Thisdirectorymustbeonthepathorexplicitlynamed.

Youcanachievethisinthreeways:
byputtingtheDLLsinawindowsorsystemdirectory

Note:itisalwaysbettertokeepyourfilesoutofcommondirectories.You
canavoidusingthesysorwindirectoriesbychoosingoneoftheother
methods
byaddingyourdirectorytothepathandrebooting
byalwaysputtingyourfilesinthesamedirectory,e.g.C:\Dan\Danstuff,and
changingthedeclaresinVBaccordingly.Forexamplefrom"Crp32dll.dll"to
"C:\Dan\Danstuff\Cryp32ddll.dll"

C RY P K E Y S D K 4 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Eachmethodhasmeritsanddrawbacks,soitisuptoyoutochoosetheoneto
use.

4 9 C RY P K E Y S D K
U S E R M A N U A L
Demonstration Programs
Demonstrationsareprovidedtoenableyoutotestand Section

3
evaluatetheCrypKeysysteminoperation.Thereare
twodemonstrationprogramsincludedwithCrypKey
SDK6.0WEXAMPLE.EXEandEXAMPLE.EXE.

EXAMPLE.EXEisaWin32basedCrypKeyprotectedprogramthat

W demonstratesallofthebasicfeaturesoftheCrypKeysystem.
EXAMPLE.EXEisanMSDOSbased,CrypKeyprotectedprogramwith
nographicaluserinterface(GUI).Thecompletesourcecodeforbothprograms
isincludedintheCrypKeySDKinstallation.

3.1 Authorizing a Windows Program


Afterinstallation,yourWindowsProgramManagercontainsanewprogram
groupwithseveralnewicons,asshown:

Figure 22: Program Group

OneoftheiconspointedtobytheSample Programs option,Win32


Example,launchestheWEXAMPLEprogram,whichdemonstratesthe
authorizationprocess.Itisausefultoolthatyoucanusetoverifyor
troubleshootCrypKeyfunctions.

5 1 C RY P K E Y S D K
U S E R M A N U A L
Asinthenormalauthorizationprocessforyourproducts,theSiteKey
GeneratorisanessentialelementoftheWEXAMPLEdemonstration.Formore
detailsonhowtousetheSiteKeyGenerator,seeSec.4:SiteKeyGenerator.

Procedure
1. UsingtheStartbutton,displaytheCrypKeyprogramgroupshownin
Figure22.

2. ClicktheSample Programs option.Yourcomputerdisplaysthefollowing


popupwindow:

Figure 23: Sample Programs Group

5 2 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

3. Intheabovewindow,doubleclicktheWin32 Exampleicontostartthe
WEXAMPLE.EXEprogram.

YourcomputerdisplaystheTESTAPPwindowasshown:

Figure 24: Opening WEXAMPLE.EXE (TESTAPP) Window

Note:thebuttonsintheTESTAPPwindowperformanumberof
CrypKeyfunctions.Youcanusethesebuttonstotroubleshootthe
operationalstatusofyourCrypKeyinstallation.

4. Clickthefollowingbuttonsinsequence:InitCrypKey(),GetAuthorization()
andGetSiteCode().Asyouclickthesebuttons,thefollowingmessages
appearinthewindowpanelontherightsideoftheTESTAPPwindow:

InitCrypkey() called
INIT OK

GetAuthorization() called
Oplevel = 0
AUTHORIZATION NOT PRESENT

GetSiteCode() called
SITE CODE OK
740A D598 71EC E8E3 35

5 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

TheTESTAPPwindowappearsasfollows:

Figure 25: TESTAPP Window with Site Code

Intheabovewindow,notethatthesitecode,showninthereturned
messagespanel,isalsodisplayedbelowtheSiteKeyfield.Forexplanations
ofhowtheSiteCodeandSiteKeyaregenerated,andtheirpurpose,seeSec.
4:SiteKeyGenerator.

5. SelecttheSiteCodelocatedbelowtheSite Keyfieldandpress[Ctrl]+[C]
tocopytheSiteCodetotheclipboard.

6. DoubleclicktheSite Key Generatoricontostarttheskw.exeprogram.

Youcanusethe[Alt]+[Tab]keystotogglebetweenthetwoprogram
windowsthatarenowactive(TESTAPPSandtheSiteKeyGenerator).

Note:ToplacethingsincontextIntheTESTAPPSwindow,youare
playingtheroleofyourcustomerbyopeninganapplicationthatyouas
thevendorhaveprotectedusingCrypKey.IntheSiteKeyGenerator
window,youareactingasyourselfbyreceivingthesitecodegenerated
bytheCrypKeyprogrambundledwithWEXAMPLE.EXEandentering
thecodeinordertogenerateaSiteKey.

C RY P K E Y S D K 5 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

7. IntheSiteKeyGeneratorwindow,press[Ctrl]+[V]topastethesitecode
(whichyoucopiedtotheclipboardinStep5)intotheSite codefieldand
thenclicktheCheckbuttontoverifythesitecode.Ifthecodeisvalid,the
windowshowsthefollowing:

Figure 26: Site Key Generator Window with Validated


Site Code

8. Intheabovewindow,enterthelevel,options,licensetype,andlicense
restrictionasdesired.TheseitemsareexplainedindetailinSection4:Site
KeyGenerator.

5 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

9. ClicktheGeneratebutton.Theprogramgeneratesasitekeybasedonthe
sitecodeandplacesitinthetextboxbesidetheGeneratebutton.

Figure 27: Generated Site Key

10. Selectthegeneratedsitekeyintheabovewindowandpress[Ctrl]+[C]to
copythesitekeytotheclipboard.

11. TogglingbacktotheTESTAPPSwindow,placethecursorintheSite Key


fieldandpress[Ctrl]+[V]topastethegeneratedsitekeyintotheSite
Keyfield.

Note:Again,toplacethingsincontextYouareplayingtheroleofyour
customerbyreceivingthesitecodefromthevendorandenteringthe
codeintoWEXAMPLE.UsingtheCrypKeyfunctionbuttonsinthe
TESTAPPSwindow,younowsimulateproductauthorization.

12. ClicktheSaveSiteKey()button.Thefollowingreturnmessageisaddedto
theprecedingmessagesintherightpaneloftheTESTAPPSwindow:

C RY P K E Y S D K 5 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

SaveSiteKey called
SITE KEY ACCEPTED

13. ClicktheGetAuthorization()button.Thefollowingreturnmessageis
addedtotheprecedingmessagesintherightpaneloftheTESTAPPS
window:

GetAuthorization() called
Oplevel = 0
AUTHORIZATION OK

TheTESTAPPSwindowappearsasfollows:

Figure 28: TESTAPPS Window with Authorized Site Key

Youhavejustgrantedthedemonstrationprogram,WEXAMPLE.EXE,the
privilegesyouassignedusingtheSiteKeyGenerator.Inanactual
implementation,theseprivilegesapplyonlytoaspecificcopyofyour
application.Youcansendthisauthorizationtoacustomerlocated
anywhereintheworldbyemailortelephone.

5 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

3.2 Authorizing an MS-DOS Program


Afterinstallation,yourWindowsProgramManagercontainsanewgroupwith
severalnewicons.Oneicon,Example,isanMSDOSprogramthatsimply
showsitscurrentstateofauthorization.Itrepresentsyoursoftware,atyour
customer'splaceofbusiness,forademonstration.Anothericon,SiteKey
Generator,istheactualprogramyouuseatyourplaceofbusinesstoauthorize
yourcustomer'sprograms.

Procedure
1. ClickWindowsStart > Programs > CrypKey SDK v6.0.

Thesystemdisplaysthefollowingprogramgrouppopupwindow:

Figure 29: CrypKey SDK v6.0 Program Group Popup


Window

2. Intheabovepopup,doubleclickontheExampleicontostartthe
example.exeprogram.

3. PresstheakeytoactivatetheAuthorizationoption.

4. Writethesitecodeonapieceofpaper.

5. DoubleclicktheSiteKeyGeneratoricontostarttheskw.exeprogram.Use
[Alt]+[Tab]totogglebetweenthetwoactiveprogramwindows.

6. TypethesitecodeintotheSiteCodefieldoftheSiteKeyGenerator.

7. EnterCRYPKEYintothepasswordfield.

C RY P K E Y S D K 5 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

8. Enterthelevel,options,licensetype,andlicenserestrictionasdesiredand
clicktheValidatebutton.Theseitemsareexplainedinmoredetailin
Section4:SiteKeyGenerator.

9. Writethesitekeyonapieceofpaperandpress[Alt]+[Tab]toreturnto
example.exe.

10. Typethesitekeyintoexample.exetoauthorizetheprogram.

Youhavejustgrantedexample.exetheprivilegesyouassigned.Inanactual
implementation,theseprivilegesapplyonlytoaspecificcopyofyour
application.Youcanfaxortelephonethisauthorizationtoacustomer
anywhereintheworld.

5 9 C RY P K E Y S D K
U S E R M A N U A L
Site Key Generator
CrypKeySDKsSiteKeyGeneratorenablesyouto Section

4
authorizeclientstouseyourproduct.

I ntegraltoCrypKeySDK,theSiteKeyGeneratorcreatesthekeysthatunlock
yourproduct.Youcanlimitthenumberofdaysorrunsoverwhichclients
canuseyourproductorimplementtheunlimitedusageoption.Youcan
alsospecifythenumberofprogramcopiesthatcanbemadeandthenumberof
concurrentnetworkusersthatareallowed.Inaddition,youcanreviewprevious
transactionsandsortthembydate,customerorproductname,andreview
archivedlogfiles.

4.1 Levels and Options


CrypKeySDKslevelsandoptionsallowyoutoauthorizedifferentfeaturesof
yourproduct.Forexample,ifyourproducthasmultiplecomponentsandyou
wantyourclientstopaypercomponent,toggleononlythosecomponentsyour
clientswantwhenyouissuethesitekey.

ThecombinedtotalnumberofbitsthatcanbeusedforCrypKeylevelsand
optionsis32.However,youcontrolwhatportionsofthistotalareassignedto
levelsandoptions.Forexample,youcouldimplement28options(eachoption
usesonebit)foryourproduct,keepinginmindthatonlyfourbitswould
remainforimplementinglevels.

Withinthisframework,yousetarangeoflevelsandoptionsforeachproduct
usingtheSiteKeyGeneratorConfiguretabpage(see4.3.2:ConfiguringYour
Products).Whenyourcustomerrequestsalicenseauthorizationforaproduct,
usetheSiteKeyGeneratorto:

selectalevel(onlyoneoftheavailablelevels)andoptionsspecifyingwhat
accessyouareprovidingtothecustomerforthatproduct

6 1 C RY P K E Y S D K
U S E R M A N U A L
issueasitekeytothecustomer,whichincorporatestheselectedleveland
options

Thecustomerentersthesitekeyintoyourprotectedapplicationonhisorher
computer.Thelevelsandoptionsinformationencodedintothesitekey
becomeapermanentpartofthecustomerslicense,whichdefinesthe
customersprivilegesfortheapplication.

4.1.1 Levels
Withlevels,youcanchooseonefeatureorstyleyouwantyourclientstohave.
Forexample,youcandivideyoursoftwareintobeginner,intermediate,and
expertlevels.

Alevelisanintegernumberthatcontrolsavarietyoffeaturesinyourproduct.
Forexample,youmaydevisethefollowingdefinitions:
Level0:noadditionalmodulescanbeused
Level1:thegraphicmodulecanbeused
Level2:thegraphicandprintingmodulescanbeused

Levelscanalsobeusedforversioncontrol.Forexample,youmaydecidethat
thefirstversion(v1)ofyoursoftwarerunsregardlessoflevel,whilev1.1requires
Level1andv1.3requiresLevel2.Levelstrategiesrelatingtoversionsare
numerous,butyoucanchooseonelevelatatime.ConfigurelevelsintotheSite
KeyGeneratorusingtheConfigurebutton.

4.1.2 Options
Withoptions,youcantoggleonoroffoneormoredifferentfeaturesofyour
product.

Anoptionisasinglebitusedlikeanon/offswitch.Forexample,ifyouwantto
offerclientsamodulethatallowsyourproducttoperformprintoutsforan
additionalfee,youcreateanoptionsimilartothis:
Option1(on):themodulecanberun
Option0(off):themodulecannotberun(amessageappearsnoting
thatthisoptionhasnotbeenpurchased)

6 2 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Upto32optionscanbeusedinCrypKeySDK.Tocreateasitekeyenables
options,usetheSiteKeyGeneratorsConfigurebutton.

4.2 Additional Features of the Site Key


Generator
InadditiontoLevelsandOptions,theSiteKeyGeneratoroffersflexible
restrictionsonlicenses,EasyLicensefortheusersconvenience,and
CloneBusterTMtechnologytopreventharddrivecloningorghosting.

4.2.1 License Duration Settings


Youcanconfigurealicenseusingoneofthreedifferentdurationtypes,allof
whichcanbetransferredviadirecttransferorfloppydisk:
Runs:allowclientstorunyourproductforaspecificnumberofruns
(maximum:32,768)
Days:allowsclientstorunyourproductforaspecificnumberofdays
(maximum:32,768)
Unlimited:allowsclientstorunyourproductwithoutrestrictions
Whenyouareauthorizingdistributors(seeSec.4.4:DistributorAuthorizing
License),theRUNS_ONLYandDAYS_ONLYoptionsareavailable.Whenyou
enableRUNS_ONLYandselecttherunslicense,theslaveSiteKeyGenerator
canonlycreaterunslicenses.Inaddition,thetotalnumberofrunsthe
generatorgrantsaproductisdecrementedfromitsownlicensecount.
Therefore,ifaslaveSiteKeyGeneratorisawardedarunslicensewith1,000runs
andtheRUNS_ONLYoptionisenabled,thegeneratorhas800runsleftifit
issues200runstoaproduct.ThesametheoryholdstruefortheDAYS_ONLY
optionanddayslicense.

Clock Manipulation Checks

Thereareprogramsareavailableonthemarketthataredesignedtotryto
deceivetimerestrictedsoftwareprotectionsystems.Theseprogramsautomate
theprocessofchangingacomputer'sclockinordertobypasstimerestricted
protection.Theseprogramschangethetimeregisteredbytheprotected
program.Forexample,iftheregisteredtimeneverextendsbeyondyour
program'strialperiod,ausercanintheoryrunyourprogramindefinitely.

6 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

CrypKeysafeguardsagainstclockmanipulationsbymonitoringyour
customers'computersfortheinconsistenciesgeneratedbysuchanattack.
CrypKeydetectswhentimeisfalselyreportedtoyourprogramandprevents
yourprogramfromrunning.TimereportedbyCrypKeyisthatoftheserver,
adjustedtothelocaltimezoneofthecomputer.

CrypKeymayalsodetectclockmanipulationifusersadjusttheircomputer
clockbymorethanseveralhours,evenforbenignpurposessuchastesting.If
yourprogramispreventedfromrunninginthesesituations,yourcustomercan
correctthesituationbyrebootingthecomputer.

4.2.2 EasyLicense
Somecustomersneedthesimplestpossibleformofcopyprotectionwhena
particularapplicationrunsonlyonaparticularcomputer.Thesecustomersdo
notwanttodealwithanyassociatedissuesoftransfer,networklicense,trial
period,ornumberofcopies.Whetherthesoftwareisoffloadedandputback,
deletedandrestoredlater,ortheentireharddriveiserasedandrestored,the
applicationstillrunsonthecomputer.EasyLicensemeetstheserequirements.

ThefeaturesofEasyLicenseinclude:

Clientscanbackuptheirlicensesandrestorethemlater.
Thelicensefilescanbemovedwithoutaffectingthelicenseitself.
Thelicensetransferabilityisdisabledtopreventabuse.
TheonlylicensetypeavailableforEasyLicenseisanunlimitedlicense.

EasyLicenseworksonanysystemthatsupportsCrypKeysHDSNtechnology.

EasyLicense Backup and Restore

ApartfromtheEasyLicensetypeoflicense,itisnotpossibletobackupor
restoreCrypKeylicenses.ThereasonforthisisthattheothertypesofCrypKey
licenses(thosewithtimeorrunrestrictions)aretransferablebytheuserandthe
availabilityofbackuprestorewouldallowtheusertoduplicatetheselicenses.
However,theEasyLicenseisnottransferableand,consequently,itcanbe
backedupandrestored.YoucanthinkofEasyLicenseasapermanent
authorizationofaprogramforaparticularharddrive.

C RY P K E Y S D K 6 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Procedures
ItissimpletobackupandrestoreavalidEasyLicense.

To back up EasyLicense:

Copythefollowingfilestoasafeplace(floppydiskoranothercomputer):

yourfilename.key

yourfilename.rst

To restore EasyLicense:

Installthesoftware,ifitisnotalreadypresent,andsimplycopytheabovetwo
filesbacktothedirectorywheretheycamefrom.Ifthesoftwareisonthesame
harddriveasitwaswhenthelicensewasbackedup,thelicenseisrestored.

4.2.3 CloneBusterTM Technology


CrypKey6.0,withthenewpatentpendingCloneBusterTMtechnology,
effectivelysolvestheproblemcreatedbytheupsurgeinsoftwareproductsthat
cloneharddrives.Manypopularcopyprotectiontechnologiesthatdependon
placingsometypeofsimplesoftwarefootprintarenoweasilydefeatedbythese
productsandarenolongeraneffectiveoption.Hardwaredonglesprovide
limitedprotectionagainstHDcloning,butareexpensiveandsomewhat
unpopular.

MostmodernIDEharddriveshaveburnedinserialnumbers(HDSN).The
HDSNisapermanentreadonlyattributeofapersonalcomputerharddrive,
ratherthantheeasilychangedvolumeserialnumber.TheHDSNisvery
difficulttoaccess,buttheCrypKeySDK6.0withCloneBusterTMtechnologyhas
thisability.UtilizingCloneBusterTM,CrypKeydetectsandlogstheHDSN,model
number,andfirmwareidentifierandusesthisinformationinitsproprietary
licensingalgorithms.ThisensuresthatyourCrypKeyprotectedapplications
arenotfraudulentlytransferredtounauthorizedcomputers.

6 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4.2.4 Transaction Summary


TheSiteKeyGeneratorincludesaSummarybuttonthatyoucanusetoview
licenseactivity.Whenyouclickthisbutton,thesystemdisplaysthefollowing
window:

Figure 30: Site Key Generator License Generation


Summary Window

C RY P K E Y S D K 6 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4.3 Using the Site Key Generator


TostarttheSiteKeyGenerator,youmustfirstobtainthelicensetouse.For
detailsonobtainingthelicense,seeSec.1.6.3:ObtainingAuthorizationforYour
SiteKeyGenerator.

OnceyouhaveobtainedyourSiteKeyGeneratorlicense,themainSiteKey
GeneratorwindowappearswhenyouselecttheSKW icon:

Figure 31: CrypKey Site Key Generator 6.0 Window


TheSiteKeyGeneratorfunctionhandlestheidentificationandgeneral
authorizationofyourclients,aswellasthedefinitionofyourproductsand
associatedlicenseterms,options,andlevels.

6 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4.3.1 Generating Site Keys


TheCrypKeySiteKeyGenerator6.0Windowenablesyoutoauthorizeyour
customerstouseyourproduct.WhenacustomerloadsyourCrypKey
protectedapplicationonhisorhercomputer,theapplicationgeneratesasite
code.Thecustomersendsyouthesitecode,whichyouuseintheSiteKey
Generatortoproduceasitekey.Yousendthissitekeytothecustomer,who
usesittounlockyourapplicationunderthetermsyouhavedefinedintheSite
KeyGenerator.

Procedure
1. Receivethecustomerssitecodegeneratedfromyourinstalledapplication.

2. StarttheSiteKeyGenerator,usingtheSKW icon.Thesystemdisplays
theCrypKeySiteKeyGenerator6.0Window.

3. Optionally,typeinthecustomername.

C RY P K E Y S D K 6 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4. IntheSite codefield,typeinthesitecodeprovidedbythecustomer,then
clicktheCheckbutton.Thewindowappearsasfollows:

Figure 32: Site Key Generator Starting Authorization

6 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5. ClicktheSerial number infobuttontodisplaythecustomersharddrive


serialnumber(HDSN),ifavailable:

Figure 33: Hard Drive Serial Number Information Window

C RY P K E Y S D K 7 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

TheHDSNexistsonmostcomputers.IfCrypKeyhasaproblemfindingor
readingtheHDSN,theserialnumberisshownasunavailableintheHDSN
Informationwindowabove.

Youcandoubleclickanyinformationentrylineintheabovewindow,to
displaytheLicenseDetailswindowshownbelow:

Figure 34: HDSN License Details Window

YoushouldrecordtheHDSNinformationforfuturereference.Forexample,
itishelpfulforverificationpurposesintheeventthatyourcustomerasks
youforreauthorizationfollowingacomputercrash.

6. Verifythelicensetermsgeneratedfromyourapplicationatyourcustomers
computer.Youcanchangethelicenseduration,expressedasunlimited,
days,orruns(fordetails,seethenextsection,ConfiguringYourProducts).

7. IntheLevelbox,clickthedropdownarrowtoassignoneofthelevels(if
any)thatwerepredefinedduringtheproductconfiguration.

7 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

8. IntheOptionsbox,clickthecheckboxesbesidetheproductoptionsthat
youwishtoactivateforthecustomer.

9. ClicktheGeneratebutton.

Thesystemgeneratesa26characteralphanumericvalueandplacesitin
theboxbesidetheGeneratebutton.Thisisthesitekeythatyousendto
yourcustomer.Itcontainsallofthespecificationsyouhaveentered
concerninglicenseterms,level,andoptions.

WhenyourcustomerreceivesthesitekeyandentersitintotheCrypKey
windowoftheinstalledapplication,thecustomerisauthorizedtousethat
applicationunderthelicensetermsdefined.

4.3.2 Configuring Your Products


Tospecifytheproductsthatyourclientsisauthorizedtouse,usetheConfigure
windowofyourSiteKeyGenerator.Thisisaseparateoperationfromthatof
generatingSiteKeys.

C RY P K E Y S D K 7 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Procedure
1. IntheCrypKey Site Key Generator 6.0Window,clicktheConfigurebutton.

ThesystemdisplaystheConfigurewindow:

Figure 35: Configure Window

7 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

2. Ifyouareeditinganexistingproductfile,clicktheapplicablenameinthe
Applications listandproceedtoStep4.

Ifyouareconfiguringanewproduct,clickNewintheabovewindow.The
systemdisplaystheConfigurewindowwiththeNew Applicationpopup
superimposedontoit:

Figure 36: Site Key Generator with New Application


Popup Window

C RY P K E Y S D K 7 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

3. TypetheproductsfilenameintotheblankfieldandclickOK.Thepopup
windowdisappearsandthenameyouhavetypedisdisplayedinthe
Applications list,asshown:

Figure 37: Configuration Window with New Application

Youcanrenameordeletethenewentry,oranyexistingentry,byclicking
thenameinthelist,thenclickingtheRenameorDeletebutton.

4. IntheIDfield,enterauniqueproductidentifier.Forexample,enter1ifyou
areconfiguringyourfirstproduct.

5. IntheLicense Defaultstabpage,setthedefaultrestrictionsforthe
product.NotethatthelicenseautomaticallydefaultstoFixedifyoudo
notspecifyanetworklicense.

Thecheckboxchoicesareasfollows.Thesearedefaultsforthespecified
productandcanbechangedasneededforspecificcustomers.

EasyLicenseunlimitedlicensewithnorestrictions

7 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Add to existing licenseusedifacustomerwithanexistinglicenseis


specifiedintheCrypKeySiteKeyGenerator6.0Window

Networked licenseusediftheapplicationistoberunbyoneormore
usersconnectedtoaserver.

License countmaximumnumberoffixedorfloatinglicensesthata
customercanhaveforthespecifiedproduct.

Durationamountofusageallowedunderthelicense.Thiscanbe
unlimited(thedefault)orcanbeexpressedinnumberofdaysorruns.Ifyou
selectdaysorruns,thenumberboxtotherightbecomesactiveandyouare
abletoenterthenumberofdaysorrunsallowedforthelicense.

Passwordthepasswordtobeusedbyyourcustomer.Apassword
specifiedhereisrequiredintheCrypKey Site Key Generator 6.0Window
whenyouaresubsequentlygrantingalicense.

C RY P K E Y S D K 7 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

6. ClicktheOptionstabtodisplaytheOptionstabpage:

Figure 38: Site Key Generator Options Tab Page

7 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Intheabovewindow,clickthecomboboxarrowstoincreaseordecrease
thenumberofoptionstobeassignedtotheproduct.Asyouincreasethe
number,blankoptionentriesappearintheOptionnamessubwindow,as
shown:

Figure 39: Site Key Generator Options Combo Box

Toassignanametoanoptionnumber,clicktheoptionscheckbox,type
thenameinthetextboxatthebottomofthewindow,andclickthe
Renamebutton.

7. Clickthecheckboxesbesidetheoptionsthatyouwishtoassigntoalicense.

C RY P K E Y S D K 7 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

8. ClicktheLeveltabtodisplaytheLeveltabpage:

Figure 40: Site Key Generator Levels Tab Page

7 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Intheabovewindow,clickthecomboboxarrowstoincreaseordecrease
thenumberofoptionstobeassignedtotheproduct.Asyouincreasethe
number,blankoptionentriesappearintheLevel namessubwindow,as
shown:

Figure 41: Site Key Generator Levels Combo Box

Toassignanametoalevel,clickonanentrynumber,typeanameinthe
Descriptiontextbox,andclicktheRenamebutton.

Note:onlyonelevelcanbeassignedperlicense.

4.3.3 Incrementing Existing Licenses


TheSiteKeyGeneratorallowsyoutochangethelevels,options,type,and
restrictionofanexistingclientlicense.Youcandothisonlyifyouhaveavalid
sitecodefromanauthorizedcopyofCrypKeyprotectedsoftware.Youcannot
togglethisoptionusingyoursitecodefromthetrialperiod

C RY P K E Y S D K 8 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Procedure

1. ClicktheSKW iconintheCrypKeyprogramgrouptodisplaytheSiteKey
Generatormainwindow.

2. EnteravalidsitecodeintotheSite Codefield.

3. ClicktheAdd to Existing LicensecheckboxintheSiteKeyGenerator


dialogbox,asshown:

Figure 42: CrypKey Site Key Generator 6.0

4. Specifylevels,options,anddurationofthelicense.Thesechangesare
addedtothelicenseforthecustomerwhoprovidedthesitecode.

5. ClicktheGeneratebuttontoproduceanewsitekeyforthecustomer.

8 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4.4 Distributor Authorizing License


TheDistributorAuthorizingLicense(DAL)allowsyoutoauthorizeotherSite
KeyGeneratorstoauthorizeyourproduct.YouholdthemasterSiteKey
GeneratorandyourdistributorholdstheslaveSiteKeyGenerator.

Thebenefitofbringingdistributorsintoyourbusinessplanpertainsto
increaseddistributionandsalesofyourproduct.Distributorsauthorizetheir
clientstorunyourproduct,basedonthenumberofruns,days,orcopiesyou
specify,expandingyourworldwidemarketbase,hasslefree.

ToobtainauthorizationfortheDAL,sendusthesitekeyfromyourSiteKey
Generatoronceyouhavepaidforthisfeature.

4.4.1 Authorizing Distributors


YourmasterSiteKeyGenerator(SKG)canapplythefollowingconstraintsto
licensesassignedtoaslaveSKG:
ItcanlimitthenumberoflicensesthattheslaveSKGcangenerate.
ItcanlimitthenumberofdaysduringwhichtheslaveSKGcanbeusedto
distributelicenses.
Itcanrestrictthetotallimitation,intermsofdaysorruns,thattheslaveSKG
canapplytolicensesissuedbyit.

Note:AsingleslaveSKGcanissueonlyonetypeoflicenseeitherrunsor
daysbased,butnotboth.Forexample,ifyouwantyourdistributortoissue
10dayand10runtypelicenses,thenyoumusthavetheminstallcopiesof
theskw.exeandskw.inifilesintoseparatedirectories,licensingeachslave
SKGforaspecificlicensetype.

ThenumberoflicensesthataslaveSKGcanissueisbasedontheusagecount.
EachtimetheslaveSKGgeneratesakey,itdecrementsitsusagecount.The
usagecountofaslaveSKGisregulatedbythedurationsettinginthemaster
SKG.Theeffectsofvariousdurationsettingsandtheusagecountaredetailedin
Table2.

ThelicensecountshouldbesetintheMasterSKGto1,unlessyouareissuinga
networklicensefortheSKGslave.Thelicensecountisthenumberofuserswho
cansimultaneouslyrunthelicensedapplication.

C RY P K E Y S D K 8 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Ifyourapplicationhasanonnetworklicense,thenthelicensecountrepresents
thenumberoflicensesavailabletobetransferredout.Forexample,ifyou
licenseProductXasanonnetworkapplicationwithalicensecountof3,the
usercouldmakeacopyoftheprogramontwoothercomputersandtransfera
licensetoeachofthem,makingatotalofthreelicensedcopies.

Table 2: Effects of Duration Settings for Slave Site Key


Generator

Duration Option Effect


Setting Setting

unlimited Slave SKG can generate an unlimited number


of licenses for the specified product.
days = 10 Slave SGK can generate an unlimited number
of licenses for the specified product, but stops
functioning after 10 days.
runs = 15 Slave SGK can generate up to 15 licenses for
the specified product.
unlimited Days Only Slave SGK can generate an unlimited number
of day-type licenses (but not run-type
licenses) for the specified product.
days = 10 Days Only Slave SGK can generate an unlimited number
of day-type licenses (but not run-type
licenses) for the specified product, but stops
functioning after 10 days.
runs = 15 Days Only Slave SGK can generate up to 15 days of
total license time.
In this case, you could issue one 15-day
license or three 5-day licenses for the
specified product.
unlimited Runs Only Slave SGK can generate an unlimited number
of run-type licenses (but not day-type
licenses) for the specified product.

8 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Duration Option Effect


Setting Setting

days = 10 Runs Only Slave SGK can generate an unlimited number


of run-type licenses (but not day-type
licenses) for the specified product, but stops
functioning after 10 days.
runs = 15 Runs Only Slave SGK can generate up to 15 runs of
total license run time.
In this case, the slave could issue one 15-run
license or two 6-run and one 3-run license for
the specific product.

Procedure
1. SendyourdistributoracopyoftheSiteKeyGenerator.ThiscopyoftheSite
KeyGeneratorisunauthorizedatthisstage.

2. Tellyourdistributorto:

a) RuntheunauthorizedcopyofyourSiteKeyGenerator.

C RY P K E Y S D K 8 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

b) ClickLicenseintheSiteKeyGeneratorLicenseAuthorizationdialog
boxtodisplaythefollowingdialogboxshowingthesitecode:

Figure 43: Distributor's Unauthorized SKG License


Window
with Site Code

c) Provideyouthesitecode(viaemailortelephone).

3. TypethesitecodefromyourdistributorsslaveSiteKeyGeneratorintothe
SiteCodefieldinyourmastercopyoftheSiteKeyGenerator.

4. IfthewordMUNCHKINdoesntalreadyappearinthepasswordfield,type
itin.

8 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5. ClicktheCheckbuttoninyourMasterSKG.Afterafewseconds,itappears
asfollows:

Figure 44: Master Site Key Generator with Distributors


Site Code

Intheabovewindow,theProductfieldshouldreadskw.exe,whichisthe
SiteKeyGeneratorexecutablefile.TheMaster Copyoptionisselectedby
defaultintheOptionspanel.

6. IntheOptionspaneloftheabovewindow,selecttheproductsthatyou
wanttoenable.Youmustenableatleastoneproduct,keepinginmindthat
theavailableoptionsshouldalreadyhavebeensetupintheConfiguretab
page.

Note:whenlicensingaslaveSKG,youshoulddeselecttheMaster
Copyoption.Ifyouleaveitselected,youareauthorizingaMasterSKG,
therebyallowingadistributortocreatetheirownSiteKeyGenerators
withthecapabilityofissuinglicensestodistributors.

C RY P K E Y S D K 8 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

7. ClickGeneratetocreatethesitekeyforyourdistributor.YourMasterSite
KeyGeneratornowappearsasfollows(exampleselectedoptionsare
shown):

Figure 45: Master Site Key Generator with Slave Site Key
and
Selected Options

Note:theDays OnlyandRuns Onlyoptions,shownabove,appearonly


whenyouauthorizeaslaveSiteKeyGenerator.Theyareusedasspecial
licenserestrictionsforaslaveSKG.WhenyouenableRuns Only,andselect
therunslicense,theslaveSiteKeyGeneratorcanonlycreaterunslicenses.
Inaddition,thetotalnumberofrunsthegeneratorgrantsforaproductis
decrementedfromitsownlicensecount.Therefore,ifaslaveSiteKey
Generatorisawardedarunslicensewith1,000runs,andtheRuns Only
optionisenabled,thegeneratorhas800runsleftafterithasissued200runs
toaproduct.

TheserulesapplyinthesamewaytotheDays Onlyoptionanddays
license.

8 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

8. Sendthegeneratedsitekeytoyourdistributor.

9. YourdistributorentersthesitekeyintotheLicensewindowofhisorherSite
KeyGenerator:

Figure 46: Site Key Generator License Authorization

C RY P K E Y S D K 8 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

10. YourdistributorclickstheValidatebuttonintheabovewindow,resulting
inauthorizationoftheslaveSKGasshown:

Figure 47: Slave SKG License Window Authorized

YourdistributorisnowauthorizedtousetheSiteKeyGeneratortoissue
customerlicensesforhisorherproducts.Notethatthelicensedurationis
thesameasspecifiedintheMasterSKG(Figure45).

Youshouldntneedtocontactyourdistributoragainconcerningissuesof
licensevalidation,unlessthedistributorsharddrivecrashesorheorshe
loseauthorization.

8 9 C RY P K E Y S D K
U S E R M A N U A L
Programming Your Application
ThestandardprocessforimplementingCrypKey Section

5
involvesprogrammingtheSLAPIlibraryfunctions
intothesourcecodeofyourapplicationandproviding
theinterfacetoyourclients.

T hecompileandlinkprocedureisthefinalstageoftheprocess.SeeSection
13:AppendixISampleFileforanexample.Therearemanyotherpieces
ofsamplecodeavailableinyourCrypKey6.0sampledirectory.

5.1 Basic Programming Steps


Thefollowingstepsshowasuggestedalgorithmforestablishingthelicenseat
startup.Thestepsareprovidedmainlytoillustratewhattheprimaryfunctions
do.Thestepsyouactuallytakemaybeverysimilartothestepswedescribe,but
yourstepscanbetailoredforyourapplication.

CrypKeySDK6.0operatesverymuchasthepreviousversion,withthe
exceptionthatthe.ngnfileisrequiredinyourapplicationdirectory.Ifyoudont
includethisfile,errorsinthe200rangewilllikelyresult.

To establish the license:

1. CalltheInitCrypkey()function.

ThisfunctioninitializestheCrypKeysystemwiththepathofthefileto
checkforauthorization.Callitonopeningtheapplicationorstarting
theprogram,toinitializeCrypKey.

Thisfunctionreturns0ifsuccessful(CrypKeyinitialized)andreturnsa
negativevalueifunsuccessful(CrypKeynotinitialized).Ifthe
InitCrypkey()functionreturnsanegativevalue,displayanerror
messageanddisableorlimittheprogramasdesired.Youmayfindit
helpfultousetheExplainErr()functionwiththefailurecodetoretrieve
theappropriateerrormessage).

9 1 C RY P K E Y S D K
U S E R M A N U A L
NotethattheInitCrypkey()andGetAuthorization()functionsmustbe
calledatleastoncebeforeanyotherCrypKeyfunctionsarecalled.

FordetailsontheInitCrypkey()function,seethedescriptioninSection
12.3.26:InitCrypkey().

2. CalltheGetAuthorization()function.

TheGetAuthorization()functioncheckswhetherornottheprogramis
authorizedtorunandreturnsthelevel/optionsinformationifthe
programisauthorized.Thefunctionisalsousedtoincrementthecount
ofrunsused.

Callthisfunctiononopeningtheapplicationorstartingtheprogram,to
checkwhetherornottheuserisauthorizedtoruntheprogram,andcall
itwheneveryouneedtochecktheleveloroptionsettingfortheusers
license.Callthisfunctionasoftenaspossibleinordertostrengthenthe
securityofyourapplicationevenfurther.

Thisfunctionreturns0ifsuccessful(programauthorized),anegative
valueifunsuccessful(programnotauthorized),orapositivevalue
(signifyingthattheprogramhasamultiuserlicenseandmoreusersare
requestinguseoftheprogramthanthelicenseallows).

IftheGetAuthorization()functionreturns0,proceedtostep3onlyif
theuserwantstochangethelicensepermissions.

IftheGetAuthorization()functionreturnsanegativevalue,displayan
errormessageinformingtheuserthattheprogramisnotauthorized,
optionallywithanexplanation(youmayfindithelpfultousethe
ExplainErr()functionwiththefailurecodetoretrievetheappropriate
errormessage).Continueasoutlinedinstep3toprompttheuserto
authorizetheprogram,possiblyatalatertime(i.e.,offamenuitem
command).

IftheGetAuthorization()functionreturnsapositivevalue,whichisa
queuevalueindicatingthenumberofuserswhomustquitthe
applicationbeforealicensebecomesavailable,continuerepeatingcalls
toGetAuthorization()untiltheusergetsalicenseorgetstiredof
waitingandquits.

9 2 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

NotethattheInitCrypkey()andGetAuthorization()functionsmustbe
calledatleastoncebeforeanyotherCrypKeyfunctionsarecalled,and
GetAuthorization()mustalsobecalledrepeatedlyatregularintervals
whennetworklicensingisineffect.

SeetheGetAuthorization()functiondescriptioninSection12.3.13:
GetAuthorization()formoredetails.

3. CalltheGetSiteCode()function.

Thisfunctiongetsthesitecodefortheprogram.Callitwhenyouwant
toauthorizeanewlicenseorchangethecurrentlicensepermissions.It
returns0ifsuccessful,meaningthatthesitecodeisreturned,orreturns
1ifCrypKeyisnotyetinitialized.

Youmustdisplaythesitecodetotheuserinorderfortheusertobeable
toprovideittoyouwhenheorshecallsyoutorequestasitekey(for
instructionsoncreatingthesitekey,seeSection4:SiteKeyGenerator.
Theusercanshutdowntheprogramwhilewaitingforthesitekey;the
sitecodeisnotchangedwhentheprogramstartsupagain.

SeetheGetSiteCode()functiondescriptioninSection12.3.24:
GetSiteCode()formoredetails.

4. CalltheSaveSiteKey()function.

TheSaveSiteKey()functionsavesthesitekeyinformation,which
containsyourproductslicensingpermissionsforthecustomer'ssite.
Encryptedlicensefilesarecreatedfromthisfunctionandsavedonthe
computersharddisk.Callthefunctionaftertheuserhasenteredthe
sitekey.

IftheSaveSiteKey()functionreturns0,anewlicenseiscreatedforthe
customerssite.IftheSaveSiteKey()functionreturnsanegativevalue,
notifytheuserthatthesitekeyisinvalid.Youmayfindithelpfultouse
theExplainErr()functionwiththefailurecodetoretrievethe
appropriateerrormessage.

Notethatifthesitekeyissavedsuccessfully,thesitecodechanges.This
isdonetopreventtheuserfromreusinganoldsitekey.Ifyougivethe
userasitekeythatallows10runs,youdontwanttheusertoreusethat

9 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

oldkeylaterforanother10runs,evenifrecyclingisgoodforthe
environment.

SeetheSaveSiteKey()functiondescriptioninSection12.3.32:
SaveSiteKey()formoredetails.

5. CalltheEndCrypkey()function.

TheEndCrypkey()functionensuresthatthelicensingcontrolsystem
terminatescleanlywithouterrors.Callthisfunctionjustbeforeexiting
theprogram.Thereisnoreturnvalue.

NotethatifEndCrypkey()isnotcalledbeforetheprogramterminates,
variouserrorsmaybeencounteredthenexttimetheprogramisstarted
andtheInitCrypkey()functioniscalled.

SeetheEndCrypkey()functiondescriptioninSection12.3.7:
EndCrypkey()formoredetails.

5.2 GUI Programming Tasks


Inadditiontocheckingtoseeiftheprogramisauthorizedwhenyour
applicationisstarted,youmustprovidemenuoptionsthatenabletheuserto
authorizeyourproductandperformauthorizationtransfers.

5.2.1 Authorizing the Program

Procedure
To authorize the program:

1. ExecutetheGetSiteCode()function.

2. Checkthereturnvalueandcodetheappropriateresult(i.e.,disablethe
program).

3. OpenawindowpassingthesitecodeobtainedfromtheGetSiteCode()
functiontotheuser.

C RY P K E Y S D K 9 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

4. EnterthesitekeyinthewindowandpressesanOKbutton.

5. ExecutetheSaveSiteKey()function.

6. Checkthereturnvalueandcodetheappropriateresult(i.e.,disablethe
program).

5.2.2 Registering the Authorization Transfer on


the Target Computer

Procedure
1. Openawindowrequestingthedirectorypath.

2. Theuserentersorselectsthedefaultpathinthewindowandpressesan
OKbutton.

3. ExecutetheRegisterTransfer()function.

4. Checkthereturnvalueandcodetheappropriateresult(i.e.,disablethe
program).

5.2.3 Transferring the Authorization Out of the


Source Computer

Procedure
1. Openawindowrequestingthedirectorypath.

2. Theuserentersorselectsthedefaultpathinthewindowandpressesan
OKbutton.

3. ExecutetheTransferIn()function.

4. Checkthereturnvalueandcodetheappropriateresult(i.e.,disablethe
program).

9 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.2.4 Transferring the Authorization into the


Target Computer

Procedure
1. Openawindowrequestingthedirectorypath.

2. Theuserentersorselectsthedefaultpathinthewindowandpressesan
OKbutton.

3. ExecutetheTransferOut()function.

5.3 Compiling and Linking


ThefollowingsectionsexplainhowtocompileandlinkCrypKeyintoyourCor
C++application.

5.3.1 CrypKey Header File

Procedure
Includecrypkey.hinallmodulesthatmakecallstotheCrypKeylibrary.Ifyou
areusingtheCRP32DLL.DLLwithaCorC++module,youmustincludethe
followingstatement:

#defineDLL

5.3.2 Linking
Linktheappropriatelibrarytoyourapplication,dependingonthecompiler
andplatform.AlllibrarieshavebeencompiledusingtheLargememorymodel.
CrypKeyrequiresamplestackspaceyoushouldallowatleast10K.

Thetablebelowdescribestheavailablelibraries.Seealsothenotesfollowing
thetable.

C RY P K E Y S D K 9 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Table 3: Libraries
Library Compiler Platform Type
CRYPKEYCOM. All compilers that Win32 COM Object
DLL can use COM
objects
CrypKeyNET.DL All compilers that .NET .NET assembly
L can use .NET Framework
objects
LCRYPKB.LIB Borland MS-DOS 16-bit Static library
LCRYPKY7.LIB Microsoft C 7.0 MS-DOS 16-bit Static library
LCRYPKYM.LIB Microsoft C Win16 Static library
7.0/VC++
LCRYPKYD.LIB Microsoft C Win16 Import library for
7.0/VC++ DLL
LCRYPKYD.DLL Any Win16-based Win16 Dynamic link
compiler library
LCRYPKYB.LIB Borland C++ Win16 Static library
CRP32S42.LIB Microsoft VC++ Win32 Single-thread
up to 5.x static RT library
CRP32D42.LIB Microsoft VC++ Win32 Multi-thread
up to 5.x dynamic C RT
library
CRP32M42.LIB Microsoft VC++ Win32 Multi-thread
4.2 static RT library
CRP32D60.LIB Microsoft VC++ Win32 Multi-thread
6.0 dynamic RT
library
CRP32M60.LIB Microsoft VC++ Win32 Multi-thread
6.0 static RT library
CRP32S60.LIB Microsoft VC++ Win32 Single-thread
6.0 static RT library
CRP32DLL.DLL Any Win32-based Win32 Multi-thread RT
compiler library
CRP32DLL.LIB Microsoft VC++ Win32 Import library for
4.2 CRP32DLL.DLL
CRP32BST.LIB Borland C++ 4.51 Win32 Single-thread
static library

9 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Library Compiler Platform Type


CRP32BMT.LIB Borland C++ 4.51 Win32 Multi-thread
static library
CK16RMV.EXE Any 32-bit Win32 Win 95/98/ME
program libraries
CRYP95F.DLL Any 32-bit Win32 Win95/98/ME
program libraries
CRP9516F.DLL Any 32-bit Win32 Win95/98/ME
program libraries
CRP32001.NGN Any 32-bit Win32 Same directory
program on as 32-bit
Windows NT, application or CK
2000 or XP license

Note:IfyouareusingMicrosoftVC++inaWin32applicationthatdynamically
linkstoWindowsCruntimelibrary,youmustuseCRP32D42.LIBor
CRP32D60.LIB;otherwise,youlinkerrorswillresult.

CrypKeycanalsobeusedwithinnonCapplicationsbyapplyingthedynamic
linklibrary(DLL).

Library Notes

Ifyouaregettingunresolvedexternalsormultipledefinedexternals,its
probablethatyouarelinkingtothewronglibraryorhaveamodelcombination
thatwedonotsupport.

MicrosoftVisualC(MSVC)allows:
singleormultiplethreads
staticordynamicallylinkedruntimelibraries

ThereisadifferentCruntimelibraryforeachcombinationofthesepairsand
thecompilerautomaticallylinkstothecorrectoneforyou.

YoumustalsomakeadifferentCrypKeylibraryforeachcombinationandtell
thecompilerthecorrectonetolinkto.

MostMSVCsampleprojectsdefaulttomultithreadanddynamicruntimeCLib
(CRT),whichisacombinationwedon'tsupport.Werecommendthe
combinationofmultithreadwithstaticlibraries,asfewerproblemsoccurwith
thismodel.

C RY P K E Y S D K 9 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

CrypKeyusesthreeofthepossiblefourmodelcombinations.Thefollowing
tableshowsthelibrarynamesandthecombinationsforwhichtheyareused:

Table 4: Library Linkages

Name Type Linkage

CRP32D60.LIB Multi thread Dynamic CRT

CRP32M60.LIB Multi thread Static

CRP32S60.LIB Single thread Static

To use development tools such as Visual Basic, Access, Delphi, and


PowerBuilder with CrypKey:

1. Ensurethatyourapplicationisabletomakecallstodynamiclink
libraries.Refertodevelopmentsystemsmanualforinstructionsonhow
tocallandlinkDLLfunctions.

2. Declare/defineyourexternalCrypKeyfunctionswithinyour
application.

3. Sinceyouareunabletousethecrypkey.hlibraryfile,whichcontains
errorhandlingvariabledeclarations,youmayusetheintegervalue
providedwithinyourprogrammingordeclareyourownvariables
withinyourapplication.

4. Ensurethatyouhaveinstalledthelcrypkyd.dllorcrp32dll.dlllibraryfile.
Youmustincludethisfilewithyourinstallationdisks.

5. CalltheCKChallenge()functiontoensurethatthefileCRYP32DLL.DLL
hasnotbeenreplacedwithanimpostor.Thisfunctionrequirestwo
additionalsecretnumbersthatareprovidedwithyourdeveloperkeys.
Youcanusethenumbersinexample.cfortestingpurposes.

Thesecretnumbersarethepasswordnumberandthecompany
numberyoureceivewithyourmasteranduserkeys.Followingisan
examplesetofthesenumbers.

9 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

TheMasterKeyforEXAMPLE.EXE,company7956123,product1,
Floating:Y,NT:Y,NT_32_Bit_Lib:Y,is:

2A5D57C4E91DB05BF06CB4F760F98E70791A51751834

TheUserKeyforcompany7956123is:

D050815CD1A2A79DB1

Thepasswordnumberis:

984534120

5.4 COM Object


TheCrypKeyCOMObjectsaretoolsthathaveprovenusefulinconfiguring
protectionforapplicationsandissuinglicenses.Theessentialinformationyou
needonthistopicisprovidedhere.Additionaldetailisavailableinthe
documentnamedCrypKeySDKCOMObject,whicharefoundinyourCrypKey
directories.

UsingDynamicLinkLibraries(DLLs)withVisualBasicandotherlanguageshas
alwaysbeenadifficulttask.SinceLIBsareencapsulatedinaCOMobject,the
incorporationofCrypKeySDKfunctionsintoanapplicationbecomesmuch
easier.ThisisparticularlytruewithVisualBasic(VB),whereCOMsupportis
builtin.COMobjectsarealsosupportedbyC++,Java,andwebdevelopment
toolslikeIIS(InterDev)andColdFusion.

Note:.NETassembliesaresimilartoCOMobjectsandareusedin
essentiallythesameway.However,.NETassembliesareavailableonlyto
.NETlanguages(VB.NET,C#.NET,C++.NET).

ForeachCrypKeyfunction,youwillfindtheprototypesusedinC,C++,VBand
C#.NETinSec.12.3:FunctionDescriptions.
TheCprototypeisforusewiththeCrypKeyLibrary.
TheC++andVBprototypesareforusewiththeCrypKeyCOMObject.
TheC#.NETprototypeisforusewiththeCrypKey.NETassembly.

C RY P K E Y S D K 1 0 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.4.1 COM Object Identifiers


TheCOMobjectsinthelibraryhavespecificnamesandtypes,asshown:

Table 5: COM Object Identifiers

Object Name C++ Type

SDK CrypKey.SDK ICrypKeySDKPtr

Float CrypKey.SDKFloatRecord ICrypKeySDKFloatRecordPt


Record r

5.4.2 Installing a COM Object


ThefollowingprocedureassumesthatyouhavecompletedtheCrypKeybase
productinstallationonthesystemyouareusing.

Procedure
1. Switchtothedirectoryintowhichyouareinstallingthefiles.

2. Executethefollowingcommand:

regsvr32 CrypKeyCOM.dll

YouarenowreadytousetheCOMobjectfromanywhereinthesystem.Youdo
nothavetocopytheCOMobjectfileorregisteritmorethanonce.

TherearetwomethodsofusingtheCOMobjectwithVisualBasic:
referencingtheCOMObjectexplicitly
referencingtheCOMObjectbyname

Theabovemethodsaredescribedinthesectionsthatfollow.

Athirdmethod,alsodescribedbelow,usestheCOMobjectinC++.

1 0 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.4.3 Referencing a COM Object Explicitly


Tousethismethod,startVisualBasicandchoosethemenuProject/References.
IntheReferenceswindow,findtheitemnamedCrypKey COM 1.0 Type
Libraryandensurethereisacheckbesideit.PressOKtoclosethewindow.
Nowyoucanwriteyourcodelikethis:

Dim myObject As New CrypKeySDK


Dim initResult As Long

' initialize CrypKey


initResult =
myObject.InitCrypKey("c:\my_directory\my_product.exe", _
"<<replace this with your master key>>", _
"<<replace this with your user key>>", 0, 300)

' check if call successful


If (initResult = 0) Then
' check if we are authorized
Dim authResult As Long
Dim nOptLevel As Long
authResult = myObject.GetAuthorization(nOptLevel, 1)

' check if call successful


If (authResult = 0) Then
MsgBox "You are authorized with these options/
levels" & nOptLevel
' you should run your program now
Else
MsgBox "You are not authorized to run this
application!"
' you should abort your program now
End If
Else
MsgBox "Initialization failed!"
' you should abort your program now
End If

C RY P K E Y S D K 1 0 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.4.4 Referencing a COM Object by Name

Tousethismethod,nospecialprojectsetupisneeded.Youcanwriteyourcode
exactlyasshowninSec.5.4.3,exceptthatthefirsttwolinesarereplacedwith
thefollowingfourlines:

Dim myObject As Object


Dim initResult As Long

' create an instance of the CrypKey COM object


Set myObject = CreateObject("CrypKey.SDK")

Therestofthecoding,startingwithCrypKeyinitialization,issimilartothat
showninSec.5.4.3,withminormodifications.

5.4.5 Pre-defining DLL functions


ToillustratetheeaseofusingtheCOMobject,formattersofcomparison,the
oldmethodofpredefiningDLLfunctionsisdescribedhere.

Tousethismethod,youmustdefineeachfunctionintheCrypKeySDKDLL
thatyoucallandensurethattheDLLisintheapplicationorsystempath.This
methodismoreconfusingandpronetoerrorsthanusingaCOMobject.It
lookssomethinglikethisinVB:

' EXTERNAL FUNCTION DECLARATIONS

' Crypkey Functions


Declare Function InitCrypkey& Lib "crp32dll.dll"
(ByVal filepath$, ByVal MasterKey$, ByVal UserKey$,
ByVal allow_floppy&, ByVal network_max_checktime&)
Declare Function SaveSiteKey& Lib "crp32dll.dll"
(ByVal site_key$)
Declare Function GetSiteCode& Lib "crp32dll.dll"
(ByVal site_code$)
Declare Function GetAuthorization2& Lib "crp32dll.dll"
(ByVal decrement&)
Declare Function GetAuthorization& Lib "crp32dll.dll"
(ByRef oplevel&, ByVal decrement&)

1 0 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Declare Function Get1RestInfo& Lib "crp32dll.dll"


(ByVal which&)
Declare Function readyToTryDays& Lib "crp32dll.dll"
(ByVal oplevel&, ByVal numdays&, ByVal version&, ByVal
copies&)
Declare Function GetLevel& Lib "crp32dll.dll"
(ByVal DefinedLevels&)
Declare Function GetOption& Lib "crp32dll.dll"
(ByVal nDefinedOptions&, ByVal nOptionNum&)

Therestofthecoding,startingwithCrypKeyinitialization,issimilartothat
showninSec.5.4.3,withminormodifications,usingaCOMObjectinC++.

5.4.6 Using a COM object in C++


YoumustreferencetheobjectDLLinyoursourcecode.Thispicksupthetype
libraryfortheobjectandallowsthecompilertocompileyourapplication.
Followingisasampleofthesourcecodeforthis.

#import "CrypKeyCOM.dll" no_namespace named_guids


void main ()
{
// initialize COM library
CoInitialize (NULL);

{
// create an instance of the COM object
ICrypKeySDKPtr ptr;
ptr.CreateInstance ("CrypKey.SDK");

// initialize CrypKey properly


long nResult = ptr->InitCrypKey (_T("c:\\example.exe"),
T("2A5D 57C4 1B4C 135B F09E 17F7 600B 2D70 79E8
F275 C36A"),
T("D050 815C D1A2 A79D B1"), 0, 300);

// check if call successful


if (nResult == 0)

C RY P K E Y S D K 1 0 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

{
// check if we are authorized
long nAuthResult;
long nOptLevel;
nAuthResult = ptr->GetAuthorization (&nOptLevel,
1);

// check if call successful


if (nAuthResult == 0)
{
printf (You are authorized with these
options/levels %d,
nOptLevel);

// you should run your program now


}
else
{
printf (You are not authorized to run this
program!);

// you should abort your program now


}
}
else
{
printf (Initialization failed!);
}
}
}

1 0 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.4.7 COM Object Constants


TheCrypKeySDKCOMObjectsusethedatatypesdescribedbelowforinternal
operation.

Datatype:CKExplainEnum

ErrorName Value groupsoferrorcodestobeused


withtheExplainErrmethods
CKAuthError 1 Authorizationmethodserrors
CKSiteCodeError 2 GetSiteCodemethodserrors
CKSaveSiteKeyError 3 SaveSiteKeyerrors
CKRegisterTransferError 4 RegisterTransfererrors
CKTransferOutError 5 TransferOuterrors
CKTransferInError 6 TransferInerrors
CKDirectTransferError 7 DirectTransfererrors
CKInitializeError 8 InitCrypKeyerrors
CKReadyToTryError 9 ReadyToTrymethodserrors
CKKillLicenseError 10 KillLicenseerrors
CKAcquireError 11 Acquiremethodserrors
CKHardDriveError 12 HardDriveSerialNumbermethodserrors
CKFloatSnapError 13 FloatingLicenseSnapshotmethodserrors
CKCrypKeyCOMInternal 999 ErrorsinternaltothisCOMobject

C RY P K E Y S D K 1 0 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Datatype:CKRestrictionTypeEnum

ConditionName Value LicensetypesfromGetRestrictionInfo

CKRestrictionTypeNone0 licensewithnorestrictions
CKRestrictionTypeTime 1 licensewithatime(numberofdays)
restriction
CKRestrictionTypeRuns 2 licensewitharuns(numberofruns)
restriction

Datatype:CKBooleanValueEnum
ConditionName Value
CKBooleanFalse 0
CKBooleanTrue 1

Datatype:CKMaxLengthEnum
Parameter Value
CKMaxLenComputerName 15
CKMaxLenUserName 15

5.4.8 Internal COM Status Messages

Table 6: Internal COM Status Messages

Message Value Meaning

CKInternalOk -1000 Operation is normal.

CKInternalNullPoint -1001 A NULL pointer was


er passed as a parameter.

1 0 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Message Value Meaning

CKInternalMax -1002 Flags this value as the last


value in the CKInternal
table of values.

5.4.9 Referencing the Floating License


Snapshot Record
TheCOMobjectcontainsfunctionsusedtoencapsulatetheFloatingLicense
Snapshot(FLS)record.ThefollowingtablecontainsC++andC#.NET
prototypesforgettingorsettingeachdataitemintheFLSrecord.TheItem
NamesinthistableparallelthenamesintheFLSrecorditself(seeSec.12.3.11:
FloatingLicenseSnapshot).

Table 7: COM C++ and C#.NET Prototypes for FLS Record


Data Items

Item Language Prototype Description


Name

nId C++ HRESULT get_nId (long Gets the unique


*pVal); internal ID.

HRESULT put_nId (long Sets the unique


newVal) internal ID.

C#.NET property int nId Gets/Sets the


unique internal ID.

nUpda C++ HRESULT get_nUpdate Gets the internal


te (long *pVal); timestamp of the
last update.

HRESULT put_nUpdate Sets the internal


(long newVal) timestamp of the
last update.

C#.NET property int nUpdate Gets/Sets the


internal timestamp
of the last update.

C RY P K E Y S D K 1 0 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Item Language Prototype Description


Name

nStatu C++ HRESULT get_nStatus (long Gets the status of


s *pVal); the license;
0=running,
positive
number=queue
order.

HRESULT put_nStatus (long Sets the status of


newVal) the license;
0=running,
positive
number=queue
order.

C#.NET property int nStatus Gets/Sets the


status of the
license;
0=running,
positive
number=queue
order.

Ntime C++ HRESULT get_nTimestamp (long Gets the


stamp *pVal); timestamp of when
the license was
started; number of
seconds since
1900.

HRESULT put_nTimestamp (long Sets the


newVal) timestamp of when
the license was
started; number of
seconds since
1900.

C#.NET property int nTimestamp Gets/Sets the


timestamp of when
the license was
started; number of
seconds since
1900.

1 0 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Item Language Prototype Description


Name

StrUse C++ HRESULT get_strUserName (BSTR Gets the user


rName *pVal); name.

HRESULT put_strUserName (BSTR Sets the user


newVal) name.

C#.NET property string Gets/Sets the user


strUserName name.

StrComp C++ HRESULT get_strComputerName Gets the computer


uterNam (BSTR *pVal); name.
e
HRESULT put_strComputerName Sets the computer
(BSTR newVal) name.

C#.NET property string Gets/Sets the


strComputerName computer name.

strSpa C++ HRESULT get_strSpare Gets the data for


re (BSTR *pVal); internal use only.

HRESULT put_strSpare Sets the data for


(BSTR newVal) internal use only.

C#.NET property string strSpare Gets/Sets the data


for internal use
only.

C RY P K E Y S D K 1 1 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.5 External Linking using Binary Files


CrypKeycanbeexternallylinkedtoyourprogramusingfilestotransfer
informationbetweenyourprogramandaCrypKeyUserInterfaceexecutable
(cui.exe)calledbyyourprogram.Thecui.exeissuppliedbyCrypKeyandisin
theCrypKey.60\Demos\16Bitdirectory.ItisasimpleMSDOSprogramthat
makesallcallstotheCrypKeyClibraryandprovidestheuserwithaninterface
toallCrypKeylicensingfunctions.

RatherthanmakingtheCrypKeycallsyourself,yourprogramneedonlywritea
requestfile,callcui.exe,andreadthereplyfileleftbycui.exe.Theadvantagesof
usingthistypeoflinkare:
YourprogramissmallersincetheCrypKeylibraryisnotlinkedtoit.
YoudonotneedtoprogramtheCrypKeyinterface,sincetheCrypKey
UserInterfaceexecutablehandlesthisforyou.
YoucanuseCrypKeyfromprogramsinanylanguageorcompilerthat
canwriteabinaryfile.

5.5.1 External Linking Security


CrypKeyexternallinkingisdesignedtobeasecureprocess.Thefollowingsteps
havebeenprovidedtoensureasecure,tamperprooflinkbetweenyour
programandcui.exe:
Thefilesusedtotransfertheinformationareencrypted.Theencryption
keyisanumberthatyouchooseatrandomtocustomizetheencryption
foryourcompany.Theencryptionkeyislocatedincui.h.Youshould
changethistoarandomnumberofyourchoosingandrecompile
cui.exe.Thiscustomizescui.exeforyourcompany.
Yourprogramissuesauniquerandomnumberintherequestfilethat
mustbeechoedinthereplyfile.Thisensuresthatthereplyfileisalways
custommadeforeachrequest.Thesesamestepsareusedtosecurethe
sitecode/sitekeytransactionandhaveprovedhighlyeffective.

1 1 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.5.2 Transferred Information


Thefollowingtabledescribestheinformationviaexternallinks.

Table 8: Transferred Information Descriptions


Name Size Range Description
(Bytes
)
RandomNu 2 0-32768 This is used to secure the
m information exchange. Use this
number in the CKChallenge()
calculation and compare your
results to the results passed back
by cui2.exe.
RandomTw 2 0-32768 This is also used to secure the
o information exchange, along with
RandomOne.
Title Variabl Any char This is a text title displayed by
e cui2.exe to your customer.
Filepath Variabl Any char The path of the protected
e executable file.
UserKey Variabl Any char Issued by CrypKey.
e
MasterKey Variabl Any char Issued by CrypKey.
e
Decrement 2 0-65536 The number of runs that you want
to decrement from the total.
Allow 2 01 Set this to 0.
Floppy
NetHandle 2 0-65536 This is used to query an already
open network license. If you are not
allowing network usage of your
program, set this to 0.

C RY P K E Y S D K 1 1 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Size Range Description


(Bytes
)
NetworkMa 2 0-65536 This is the time in seconds after
xCheckTim which a network copy is deemed to
e be hung if it has not checked its
authorization. See the
InitCrypkey() function description
in Section 12.3.26: InitCrypkey().
Maintenanc 2 02 Set this to 0 if you simply want to
e check the state of the authorization.
Set this to 1 if you want to let the
user change his or her
authorization using cui2.exe. Set
this to 2 if the program is ending.

Theinformationyouaresendingtoandreceivingfromcui2.exeisthesame
informationasdescribedintheCrypKeyfunctioncalls.

To transfer information:

1. AssembletheinformationrequiredintothePassedOutstructure,
includingtworandomnumbers.

2. Writetheinformationtoafilenamedcui2_infile.tmp.

3. Runtheprogramcui2.exeandwaitforittocomplete.

4. Oncecui2.execompletes,readintheinformationfromafilecalled
cui2_outfile.tmp.

5. PerformtheCKChallenge()calculationandcomparethistothe
numberthatwaspassedout.

6. Theinformationfromthisfilecanbeusedasifitcamefromthe
CrypKeyfunctioncalls.

Thetestcodeandcui2.exeareautomaticallyplacedinthe
Crypkey.60\External\Cui2directorywhenyouinstallCrypKey.
Testcui2.c/testcui2.exeisanexampleprogramwritteninCthatuses
externallinking.Cui2.hisaCrepresentationofthestructurespassedinand
outofyourprogram.

1 1 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

5.5.3 External Text Link


ThisisanoptionalmethodoflinkingCrypKeytoyourapplicationandisuseful
ifyouhaveaDOSprogramthatcan'tcallCfunctions.Thisexternallinkis
designedforthemanyDOSprogramsthataremorecomfortablewithwriting
andreadingCommaDelimitedASCIItextfiles.SuchprogramsincludeDBASE,
FOXPRO,andCLIPPER.

Thissystemhasthefollowingfiles:

CUI2.EXE DOS"CrypKeyUserInterface"externallicensemanager

CUI2.C sourcecodeforCUI2.EXE

CUI2.MAK MSC7.0makefileforCUI2.EXE

TESTCUI2.EXE sampleexternallylinkedDOSprogram

TESTCUI2.C sourcecodeforTESTCUI2.EXE

TESTCUI2.MAK MSC7.0makefileforTESTCUI2.EXE

CUI2.H headerfilewithinformationforlinkingwithCUI2.EXE

ForcompleteinformationonwhatispassedtoandfromCUI2.EXE,see
CUI2.H.TodemonstrateandtestCUI2.EXE,putitinthesamedirectorywith
TESTCUI2.EXE,andthenrunTESTCUI2.EXE.Bothexecutablesarealready
locatedintheDEMOSdirectory.

5.6 Creating a Windows NT License Service


Installation
TocreateaWindowsNTLicenseServiceinstallation,includesetupex.exeand
cks.exeinyourinstallationscript.Thefilesetupex.exeisanNTinstallprogram.
Thefilecks.exeisaselfextractingzipfileofthe6requiredsetupfiles.

Note:dontextractthecks.exezipfilesetupex.exeexpectstoseethisfile
asis.

C RY P K E Y S D K 1 1 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

If,forexample,InstallShieldisused,thescriptshouldensurethatboth
setupex.exeandcks.exearecopiedintotheinstallationdirectory(i.e.,the
directorywheretheusersprogramisinstalled).TheInstallShieldscriptonly
callssetupex.exe.

5.6.1 Error Codes


Setupex.exereturnsanerrorcodeifitrunsintoaproblem.Thiscodeis
returnedinoneoftwoways:

1. intheprocessterminationcode,whichcanbereadbytheprocessthat
launchedsetupex.exe,ifthisissupported

2. if(1)isnotsupported,theerrorcodeiswritteninASCIItoafilecalled
setupex.xco,attermination

Someinstallationprogramsareabletoreceivethiserrorcode.Processingthese
codesisoptional.

Thereportederrorsthatarelikelytobecausedbyabuginyourinstallationare:

#define NTDRVR_INSTALL_ERR_NOT_NT -1
#define NTDRVR_INSTALL_ERR_REMOTE_DRIVE -2
#define NTDRVR_INSTALL_ERR_CANNOT_COPY_FILE -3
#define NTDRVR_INSTALL_ERR_CANNOT_RUN_CKSETUP -4
#define NTDRVR_INSTALL_ERR_CKS_EXE_MISSING -5
#define NTDRVR_INSTALL_ERR_CANNOT_RUN_CKS_EXE -6
#define NTDRVR_INSTALL_ERR_MISSING_FILE -7

Thefollowingerrorisreportedwhenyoudonothavepermissiontoloaddriver
files.

#define NTDRVR_INSTALL_ERR_REG_COULD_NOT_OPEN_ -8
SERVICEMANAGER

You can clear the above error by logging in as a local administrator of


the machine.

ThefollowingerrorsareunlikelytooccurandshouldbereportedtoCrypKey:

1 1 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

#define NTDRVR_INSTALL_ERR_REG_COULD_NOT_OPEN_SERVICE -9
#define NTDRVR_INSTALL_ERR_REG_COULD_NOT_REGISTER_ -10
DIRECTORY
#define NTDRVR_INSTALL_ERR_STARTSERVICE_COULD_NOT_OPEN_ -11
SERVICEMANAGER
#define -12
NTDRVR_INSTALL_ERR_STARTSERVICE_COULD_NOT_OPEN_SERVICE
#define NTDRVR_INSTALL_ERR_STARTSERVICE_COULD_NOT_ -13
START_SERVICE
#define NTDRVR_INSTALL_ERR_STOPSERVICE_COULD_NOT_OPEN_ -14
SERVICEMANAGER
#define NTDRVR_INSTALL_ERR_STOPSERVICE_COULD_NOT_ -15
OPEN_SERVICE
#define NTDRVR_INSTALL_ERR_STOPSERVICE_COULD_NOT_ -16
STOP_SERVICE
#define NTDRVR_INSTALL_ERR_REBOOT_NEEDED -17

5.6.2 Run Mode


CrypKeySDKhastworunmodessilentandverbose.

Insilentmode(SetupEx.EXE/S),setupex.exedoesnotputmessagesonthe
screen.ItdoescompletecheckingandinstallstheWindowsNTdriverifitcan.If
itcannotinstallthedriver,itreturnsanerrorcode.Sincesilentmodedoesnot
reporterrors,itisuptotheinstallationprogramtohandlethem.Notethatthe
REBOOT_NEEDEDmessageisnotanerror,butratherawarning.

Inverbosemode(SetupEx.EXE),setupex.exedisplaysanyerrorsitencounters.
ItdoescompletecheckingandinstallstheWindowsNTdriverifitcan.Ifit
cannotinstallthedriver,itreturnsanerrorcode.Notethatverbosemode
doesnotreporterrorsonscreenifitencountersWindows95/98/ME,butinstead
doesnothingandsilentlyreturns.

5.6.3 Installation Strategies


SimplestMethod

ForanyWin32platform,theeasiestinstallationstrategyistocopythefilesinto
theinstallationdirectoryandrunsetupex.exe.Thedriversetsuptheservice,ifit
shouldbesetup(i.e.,itisalocalWindowsNTdirectory).Ifthereisaproblem,

C RY P K E Y S D K 1 1 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

thedriverreportsittotheuser,therebydoingallthenecessaryinterfacework
foryou.

MoreCompleteMethod

Toprovideamorecompletepackage,youmaywishtoaddsomelogicfor
someonetryingtoinstallontoaserverfromaclient.Althoughyourprogram
maybeinstalledthisway,thedrivercannotandusersmustbewarnedofthis.
Youcanavoidthisissuebydisallowingclienttoserverinstallationsorby
offeringawaytorunonlythedriverinstallontheserver.

ApplyingMoreControl

Ifyouneedmorecontroloveryourinstallation,youcanuseourWindowsNT
installationsilentmodebycallingSetupEx.EXE/S.Youthenmustretrievethe
errorcodesandhandleallerrorsyourself.

5.6.4 Uninstalling the Driver


TheWindowsNTdriverhastheabilitytodopartialandcompleteuninstalls.If
otherdirectoriesareusingthedriver,theuninstallremovesonlythedirectory
setupex.exefromtheconfiguration.Ifnootherdirectoriesareusingthedriver,
theuninstallstopstheserviceandremoveallthefilesusedbythedriver.

Procedure
1. Locatesetupex.exeinthedirectoryyouwanttouninstall.

2. Fromthedirectory,runSetupEx.EXE/D.

Thisperformsallrequiredactions.Ifnootherdirectoriesareusingthedriver,all
driverfilesaredeletedandamessagenotifiestheuserthatthecomputermust
berebootedbeforeanotherinstallationcanbedone.Youcanavoidthis
messagebyusingthesilentmode(SetupEx.EXE/D/S).

Notethatiftheuserattemptsanotherinstallationbeforerebootingandthe
servicewasremoved,thefollowingError9messageappears:

1 1 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Register Directory: Unable to open CrypKey License Service.


Reason: The specified service does not exist as an installed
service.

Theaboveerrormessagedisappearsafterthecomputerisrebooted.

Ifyouwishtouninstallevenifthereareotherdirectoriesregistered,youcanuse
thSetupEx.EXE /Ucommand.

WARNING:thiscommandleavestheotherregistereddirectorieswithouta
drivertoservethem.Itisrecommendedthatthecommandoption/Dbeused
inreleaseversions,andthatoption/Ubeusedfortestpurposesonly.

Thedrivercanbereinstalledafterthe/Uoptionisrun,butyoumustfirst
reboot.Theotherregistereddirectories,ifanyarepresent,arestillconfigured.

5.6.5 Testing
Forasimpletest,placebothSetupEx.EXEandCKS.EXEinanydirectory,and
thencallSetupEx.EXE.YounowseeyourdirectoryinCyrpkey.ini.Ifthe
CrypKeyNTservicehadneverbeenonyoursystem,youwouldseethattoo.

5.6.6 Supported Versions of Windows NT


CrypKeysupportsWindowsNT3.5(Build807),WindowsNT3.51(Build1057),
andWindowsNT4.0(Build1381).OnlytheIntelbinariesareshipped.Contact
CrypKeyforuptodateplatformsupport.WindowsNTversionspredating
version3.5arenotsupported.

C RY P K E Y S D K 1 1 8
U S E R M A N U A L
Section

Protecting Your Software with


6
StealthPLUSTM
Animportantcomplementtoencryptedlicensingisthe
methodology,embodiedinStealthPLUSTM,toprotect
yourinstallationsagainsthackers.

tealthPLUSTMisanimportantcomponentofsoftwaresecurityandthe

S CrypKeySDK.YoumayimplementSDKfunctionsinyoursoftware,but
withoutantihackingprotection,anaverageskilledhackercanquickly
changeyourcodetoskipthesecurity.

Version6.0StealthPLUSTMhasevolvedtothehighestlevelofsecurityyet.
Althoughnoonecanguaranteethatyourprogramcan'tbehacked,wecan
guaranteethatStealthPLUSTMmakesyourprogramextremelytediousand
painfultohack.Anyversionofyourprogramthatishackedwillnotlikely
operateproperly.

StealthPLUSTMisastrongdeterrenttoreverseengineeringandpatching,
helpingtoensurethatthesecuritylogicyouputinyourprogramstaysinyour
program.Inlessthan60seconds,StealthPLUSTMautomaticallyimplementsa
batteryofsecuritymeasuresinyourprogram.

StealthPLUSTMprotectsyourprogramintwoways:

1 1 9 C RY P K E Y S D K
U S E R M A N U A L
1. Itcompressesandencryptstheprogram.Yourexecutablefileissmaller
afteryouhavestealthedit.Sincethecodeisactuallyencrypted,reverse
engineeringanddebuggingofthefilebecomesextremelydifficult.

2. Itguardsagainstpatchingwhileyourprogramisinmemory.Itistechnically
possibletodebugorredirectprogramexecution(patch)aroundthesecurity
codewhileitisinmemory.StealthPLUSTMdetectsdebuggersandpatches
andimmediatelyhaltsprogramexecution.

StealthPLUSTMalsocompletelyrewritesyourprogramandrunsitinmemoryin
smallpieces,minimizingtheamountofcodethatmustbeexposedatanygiven
time.Thisprocessprovidesanextremelystronglevelofprotection.

StealthPLUSTMissimpletouse.Simplytellittheinputandoutputfilepathsand
itdoestherest,rewritingyourEXEorDLLandbuildingtheabovesecurity
featuresintothem.

Foryourconvenience,wehaveincludedtwoversionsofStealthPLUSTM:

Note:ToruneitherversionofStealthPLUSTM,theSiteKeyGeneratormust
beauthorized.

UserInterfaceStealthPLUSTM(Stelthui.exe)

Thisversionhasawindowsuserinterfacethatallowsyoutobrowseand
savetheinputandoutputfilepaths.

CommandLineStealthPLUSTM(Stelthcm.exe)

ThisversionallowsyoutoeasilyautomatetheStealthPLUSTMprocessby
addingStealthPLUSTMtoyourmakefiles.Itacceptstheinputandoutput
pathsascommandlineparameters.TheStealthcommandsyntaxisas
follows:

Stelthcm.exe {input filepath} {output filepath}

where{input filepath}istheEXEorDLLyouwanttostealthand
{output filepath}isthestealthedfile.Thefilenamecanbethesameifit
isputinadifferentdirectory.

Thecommandlineversionisdesignedtoallowyoutoautomatethestealth
taskbyaddingittotheendofyourcompilingprocess.Manycompilers

1 2 0 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

supportacustomsteplikethis,soconsultyourcompiler'sdocumentation
forfulldetails.

6.1 Visual C++ Custom Step Example:

Procedure
1. CreateasubfoldernamedTreatedunderthefolderthatyourcompiler
outputsthetargetprogramorDLL.

2. IntheVC++IDE,selectthemenuitemProject\Settings,thenscrollthe
tabstotherightuntilyouseeontheCustom Buildtab.

3. Enterthefollowing:

Description: Stealth

Commands: c:\CrypKey.60\stealth\stelthcm.exe
$(InDir)\your.dll
$(OutDir)\treated\your.dll

Note:intheabove,thecommandInDircanbewrittenas
InputDir.Theparameteryour.dllcanalsobegivenas
your.exe.

Outputs: $(OutDir)\treated\your.dll

Note:intheabove,theparameteryour.dll canalsobe
givenas
your.exe.

CompletionoftheabovesequencecausesVC++toputastealthedcopyof
your.dlloryour.exeintheTreateddirectory.

6.2 StealthPLUSTM File Auto-Distribution


StealthPLUSTM(boththeinterfaceandcommandlineversions)haveauseful
additionalfeature:theycanpackallCrypKeydistributablefiles,aswellasyour
files,intoyourexecutable.

1 2 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

StealthPLUSTMcaneveninstalltheCrypKeyLicenseServiceuponfirstrunfor
you.ForinstructionsonhowtodousethisfeatureofStealthPLUSTM,seeSec.
5.6,CreatingaWindowsNTLicenseServiceInstallation.

TheAutoDistributionfeatureensuresthat:
yourEXEhasallofthefilesitneedstorun,nomatterwhereitis
yourEXEalwaysusesthecorrectversionofassociatedfiles
theNTDriverisinstalled
yourEXEisselfcontainedandeasytouse

C RY P K E Y S D K 1 2 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

6.3 Using the Interface (STELTHUI)

Procedure
1. IntheCrypKey.60\Stealthdirectory,clickthestealthui.exefilename.The
systemdisplaysthefollowingwindow(withtheSiteKeyfieldblank):

Figure 48: StealthPLUSTM Opening Window

1 2 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

2. IntheSiteKeyfield,typeinyourCrypKeySiteKey,andclicktheValidate
button.IftheSiteKeyisvalid,thesystemdisplaysthefollowingpopup
window:

Figure 49: StealthPLUSTM Validated Window

Intheabovewindow,noticethatthesitecodehasnowchanged.Thisis
standardinCrypKey.WhenCrypKeyvalidatesaprogramusingasitekey
generatedfromtheprogramssitecode,itreplacesthesitecodeforthat
program.

C RY P K E Y S D K 1 2 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

3. Intheabovewindow,clickOKifyouwishtoproceed.Thesystemdisplays
thefollowingwindow:

Figure 50: StealthPLUSTM Configuration Window

4. Intheabovewindow,usethePick Filebuttonstobrowseyourdirectories
andenterthefollowinginformation:

intheProgram to compressfield:thefullpathofthesourcedllor
executablefilethatyouwishtoprotect.

intheOutput programfield:thefullpathoftheprotecteddllor
executablefilethatistobedistributed.Ifyouwanttoplacethisfilein
thesamedirectoryasthesourcefile,youmustuseadifferentfilename.

5. Optionally,selectthecheckboxAutoinstall NT driversifyouwishtohave
StealthPLUSTMautomaticallyinstalltheCrypKeyLicenseServicedrivers
whenyourcustomerinstallsyourproduct.

1 2 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

6. Optionally,selectthecheckboxAttach and autoextract files in this


folder.ThisactivatesthePick folderbutton,whichyoucanusetofind
andenterthenameofafolder.Duringcompression,StealthPLUSTMextracts
filesfromthisfolderandpackthemintotheexecutablefileforyour
application.

Note:anyCrypKeyfilesplacedpreviouslyinthedirectoryAutoDistare
nowpacked.Iftherearefilesyoudonotneed,simplyremovethem
beforerunningtheStealthPLUSTMinterface.Similarly,otherfilesthat
youhaveplacedintheUserDistdirectoryarenowpacked.

NotethatStelthUI.Exeallowsyoutosavetheconfigurationandspecify
adifferentuserdirectoryforeachEXE.

7. UsethePick folderbuttontoselectthefolderwheretheNTdriversand
autoextractedfilesareplaced.

8. TosaveyourStealthPLUSTMconfiguration,clicktheSavebutton.Ifyouare
notplanningtostealthyoursoftwareduringthepresentsession,youcan
closethiswindow.

9. Whenyouarereadytostealthyoursoftware,clicktheBegin compression
button.

Note:ifyouhavestartedanewStealthPLUSTMsession,having
previouslyperformedSteps1to6,theStealthPLUSTMConfiguration
windowappearsasabove(Figure50),readyforyoutoclickthe
Begin compressionbutton.

C RY P K E Y S D K 1 2 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Thesystemnowdisplaysthefollowingpopupwindow,overlayingthe
StealthPLUSTMConfigurationwindow:

Figure 51: StealthPLUSTM Compression Begun

6.4 Using the Command Line Version


(STELTHCM)

Procedure
Syntax

Thesyntaxforthecommandlineversionofstealthisasfollows:

stelthcm.exe [-n] [-a directory] infile outfile

where

nistheoptionforAutoattachNTdrivers

aistheoptionforAttachandautoextractfilesinagivendirectory

infile andoutfilemustbegivenasdifferentfilenames

Ifapathhasspacesinit,surrounditwithdoublequotes.

1 2 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Results

Whenyourprogramruns,thetemporaryCrypKeyfiles,suchastheNTDriver,
areunpackedtoatemporarydirectory,run,anddeleted.Allotherfilesare
unpackedtotheEXE'sdirectorybeforetheEXEisrun.

Sample Stealthed Program

Asamplestealthedprogram,togetherwithpackedCrypKeyanduserfiles,is
intheCrypKey.###/Demos/SampleStealtheddirectory.

Notethatrunningthisprogramunpacksallfiles.

Theconfigurationusedtocreatethisprogramissavedasthefirstconfiguration
inStelthUI.Exe.

Note:ThisconfigurationiscorrectonlyifCrypKeyisinstalledto
C:\CrypKey.###.

C RY P K E Y S D K 1 2 8
U S E R M A N U A L
Section

Counter-Hacker Strategies
7
Themeasurespresentedherearenotguaranteed
unbreakable,butaredesignedtodeterlicensesystem
tamperingandrevealtamperingwhenitoccurs.

herearesomemeasuresyoucantakewhendevelopingyoursoftwareto

T helppreventusersfromtamperingwithyourproduct.Ensureyour
softwarerespondswitherrorcodeswhenafunctionfails.

Note:thesemeasuresaredesignedforenvironmentsthatdonotinclude
CrypKeyStealthPLUSTM.Whendistributingyoursoftware,usethe
StealthPLUSTMprogramthatisincludedinCrypKeySDK.Fordetailsonusing
StealthPLUSTM,seeChapter6.

7.1 Anti-tampering Measures


Theantitamperingmeasuresincludefeaturesthat:

preventthelicensesystemfrombeingcompromisedthroughthe
substitutionofanimpostorlicensesystem(i.e.,onethatalwaysgrants
alllicenserequests)

preventthelicensesystemfrombeingcompromisedthroughmultiple
patches(thereisnosetofpatchesthatcandefeatthelicensesystemfor
allapplications)

1 2 9 C RY P K E Y S D K
U S E R M A N U A L
prevent,throughasetofguidelines,anysingleapplication'slicense
verificationsubsystemfrombeingdefeatedbyanysinglepatch

requireanobviousandintentionalefforttodefeatforeachapplication

Thefollowingguidelinesmaygoagainstsomeacceptedcodingpractices.Itis
yourchoicewhetherornottoimplementthem.

Donotcomparetheauthorizationresultimmediatelyaftercallinga
CrypKeyfunction.Instead,savetheresultandcompareitlater.Thisis
securitybyobscurity.

Doanextracheckonauthorizationinsomeobscurebutfrequently
usedpartoftheprogram.Iftheresultisunauthorized,obtainthe
systemtime,donothinguntilthetimeisanevenmultipleof5(for
example),andthendisablesomethingimportant.

CalltheCKChallenge()function,especiallywhenusingaCrypKeyDLL
orexternallinking.Thisisaverydifficultfunctiontohack.

Incorporateaninternalandobscurechecksumoverthecodethatdeals
withthelicensesystemandwiththeverification.Obscurethechecksum
codeifyoucan.

Ifapplicable,takeoveranydebugandsinglestepvectorsthatmightbe
usedbydebuggers.Takegreatcarewhenusingsuchanadvanced
measure.

Addrandomitemstotheapplication,suchasmeaninglessreads,
compares,andsubtractions.Insituationswhereahardwaremonitoris
used,thismayincreasethenumberofhardwarebreakpointsthatoccur.

Verifytheresultmorethanonce.Provideafauxcompareimmediately
afterthecalltoGetAuthorization().

Dontdoacomparisonwithasinglecompare.Instead,performsome
mathematicaloperationsontheresult,computinganotherresultthatis
verifiedlaterinthecode.

Forplatformsthatpermitselfmodifyingcodeandwheretheactual
challengealgorithmsareincludedinthecode,hidethechallenge
algorithmsbyencryptingthecode.Decryptonlylongenoughtoverifya
challengeandthenreencryptit.Checksumthecodethatcallsthe

1 3 0 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

encrypt/decryptroutinestopreventalteration.Havetheentrypointin
thelicensemoduleverifythecodeoffset(ifapplicable)fromwhichit
wascalled.Encryptingthealgorithmsmakesthemmoredifficultto
locateinthecode.Also,encrypttheMasterKeyandtheUserKey.

Ifthehostoperatingsystempermits,placemostoftheauthorization
codeanddataintooverlaysthatcanbediscarded.

CallGetAuthorization()periodically(i.e.,every15minutes).

Thesearejustafewpossibilitiestoconsider.Thinkaboutantivirustechniques
andthemeasurestakentopreventcodemodification.Thosesameanti
tamperingtechniquesareapplicablehere.

7.1.1 Error Codes


Alwayshaveyourprogramrespondwithspecificerrorcodeswhenafunction
fails.SLAPIhasnumerousfunctionswithmanydifferenterrorcodes.When
somethinggoeswrongwithaparticularfunction,itisatremendoushelpto
knowspecificallywhichfunctionandoperationisfailing.Theproblemcanbe
determinedandresolvedmuchquickerwhenthisinformationisavailable.

AlwayscallInitCrypkey()andGetAuthorization()beforeanyotherCrypKey
functions.

AlwayscheckthereturnonInitCrypkey()anddonotlettheprogramrunifthe
returnislessthanzero.

EnsureEndCrypkey()iscallednomatterhowyourprogramisexited.Itisa
commonmistaketocallonlyEndCrypkey()inyourFile/Exitmenuroutine.If
theuserexitsbydoubleclickingthetitlebar,theEndCrypkey()functionis
skipped,whichcausesproblems.

1 3 1 C RY P K E Y S D K
U S E R M A N U A L
Network Licensing
CrypKeyallowsyoutocontrolthelicensesyouissue, Section

8
evenwhenyoursoftwareisdistributedacrossa
network.Ifmoreclientsrequestaccesstoyoursoftware
thanyouhaveallowed,CrypKeyprovidesaccessona
firstcome,firstservedbasis.

oucancontrolthenumberofusersandcomputersthatuseyoursoftware

Y
concurrentlyfromanetworkedserver.Youcantransferyourlicensesfrom
machinetomachineacrossanetwork.

Iftherearemorerequestsforaccesstoyoursoftwarethanyouhaveallowed,
CrypKeyqueuestherequests.Forexample,ifyouissueakeywiththeSiteKey
Generatorthatallowsfourfloatinglicenses,yourcustomercanrunyour
programonanyfourclientsinhisorhernetwork.Ifafifthclientattemptsto
startyourprogram,heorsheistoldtowaituntilsomeoneelsecurrently
runningtheprogramclosesit.Ifmoreusersattempttostartyourprogram,they
areplacedinafirstcome,firstservedqueue.Theclientseachgettheirturnin
theordertheiraccessattemptwasmade.

8.1 Implementing Floating Licenses


ItispossibletouseCrypKeyonanyMSDOS,Windows,orWindowsNTbased
computeronanetwork.Thenetworkoperationshavebeenmadetransparent
asmuchaspossible.Therearethreethingsyoumustdotochangeyoursingle
userapplicationintoamultiuserapplication:provideyourprogramwith
multiuserfunctionality,installtheappropriatenetworkdriver,andspecifya
floatinglicensetype.

8.1.1 Providing Multi-User Functionality


Ifyouintendyourprogramtobeusedbymorethanoneuserconcurrentlyover
anetworkandyouintendtolimitthenumberofuserswhocanuseyour
programconcurrently,youmustcallGetAuthorization()atregularintervals.
ThecalltoGetAuthorization()advisesCrypKeyastowhethertheuserisstill

1 3 3 C RY P K E Y S D K
U S E R M A N U A L
usingtheprogram.IfCrypKeysuspectsthatauserisnotusingtheprogram
(perhapsthemachinehascrashedorthenetworkconnectionhasfailed)it
takesthelicense,aftertheperiodofthenetwork_max_checktimeisexceeded,
andgivesittoauserwhohasrequestedaccess.Thisensuresthatthelicenses
arenotpermanentlyheldwhentheusersarenotusingtheprogram.

TherecommendedintervalbetweencallstoGetAuthorization()is5to30
minutes,dependingonyourapplication.Thenetwork_max_checktime
parameter,locatedintheInitCrypkey()function,isthemaximumtime(in
seconds)thatCrypKeyshouldwaitbeforereleasingalicensethatisnolonger
accessed.Network_max_checktimeshouldbetwoorthreetimestheexpected
intervalbetweencalls.

TheFloatingLicenseSnapshot()functionprovidesasnapshotofallusers
holdingorwaitingforanetworkfloatinglicense.

8.1.2 Installing a Network License Server


Theserveristhecomputerthathasyourprogramonitsharddrive.Fornetwork
licensing,CrypKeyprotectedprogramsrequireadrivertorunonthecomputer
thatactsasaserver.

Normally,usersreadyourprogramfromaclientcomputerthatisconnectedto
theserverviaanetwork.Youmustinstalltheappropriatenetworkdriveronthe
networkserverthatcontainsthelicensefileforyourprotectedprogram.Once
thedriverisrunning,CrypKeyoperatesontheserverfromanyothercomputer,
justasiftheserverwerealocaldrive.Formoreinformationoninstalling
networkdrivers,seetheinstallationinstructionsinSections2.2to2.5.

8.1.3 Specifying a Floating License Type


TheSiteKeyGeneratorenablesyoutospecifyafloatinglicense,intendedfor
useovernetworks.Youmustprovideafloatinglicenseiftheprogramistobe
usedoveranetwork.Afixed,ornodelocked,licensecannotbeusedovera
network;anerrorisgeneratedifthisisattempted.

1 3 4 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

8.2 CrypKey Network Drivers


The/NETDRIVEdirectorycontainstheNTCrypKeyDriverandNetworkdrivers
forotherserverplatforms.

Note:TheNTdriverisrequiredforstandaloneand/ornetworklicensingon
allNTplatforms,includingXP,Win2000,andNT.Allotherdriversinthe
/NETDRIVEdirectoryarerequiredonlyfornetworklicensing.

CrypKeyusesanencryptedfilerequest/responsemodeltohandlenetwork
authorizations.Thisinnovativeapproachhasmajoradvantages:
YourapplicationusesthesameCrypKeylibraryforallnetwork
platforms.Nochangestoyourapplicationarerequiredfordifferent
networks.
Sinceyourapplicationusesonlyonelibraryforallnetworks,thereisa
significantsavingstoyouincodesizeandcomplexity.
Yourprogramworksonanynetworkthatdoesfiletransfers.

8.2.1 Supported Platforms


Fivenetworkserveroperatingsystemsaresupportedandeachrequiresa
differentdriver.Thesedriversarelistedbelow,intheorderoflikelihoodthat
youwillusethem:

setupex.exe andcks.exe:Thesedriverfilesarerequiredtorunan
applicationonWindowsNT(includingWindowsNT/2000/XP)
standaloneorservermachines.

Note:youmustalwaysusethisdriverforbothstandaloneand
networkinstallationwhenrunningNTplatforms.

ckserver.nlm:ThisisaNovellNetWareLoadableModulethatworks
forNetWare3.x,4.x,5.x,and6.x.Ckserver.nlmdoesnotrequireany
configuration.Novellsupportsonlynetworkuse.

wckserve.exe:ThisisaWindowsprogramthatrunsonanyWindows
3.x,Windows95,Windows98,orWindowsMEserver.Itisunlikelythat
youneedtosupportthisplatformasaserver.

1 3 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

ckserver.exe:ThisdriverisintendedforanMSDOSserver.Itisa
terminateandstayresident(TSR)programandcannotberunona
Windowsserver.Itishighlyunlikelythatyouneedtosupportthis
platformasaserver.

OS2:Thisdriverisincludedforlegacysupport.

Allserverdriversrequiretheclienttohavereadandwriteaccesstotheshared
directory.ForNetWareservers,theclientmusthaveread,write,filescan,
modify,anddeletepermissions.

8.2.2 Installation Procedures


NT CrypKey Driver

ThisdriverisrequiredforstandaloneornetworklicensinguseonNTPlatforms.

Note:ThisisthemostimportantdriveroftheCrypKeysystem.Itisthe
CrypkeyLicenseServicerequiredonNT/2000/XPsystems.

Procedure
1. Copythefilessetupex.exeandcks.exetotheapplicationdirectory.

Note:Yourequireadministratorprivilegestoinstallthelicenseservice.

2. Runsetupex.exe.

setupexe.exeextractsandinstallsthefollowingfilesfromcks.exe:

WINNT/System32directory:ckldrv.sys,crypserv.exe
WINNTdirectory:ckrfresh.exe,setup_ck.dll,setup_ck.exe
Note:InWindowsXP,thesefilesgointotheWindowsandSystem
directories.

Tomeasurethesuccessoftheinstallation,afileiscreatedintheapplication
directorycalledsetupex.xco.Itcontainsonlythevalue0iftheinstallationis
successful.

C RY P K E Y S D K 1 3 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Seethereadme.txtin~\CRYPKEY.60\NETDRIVE\NTDRIVERfordetailsthat
havebeendocumentedafterpublicationofthismanual.

Novell Network Driver CKSERVER.NLM

Procedure
1. CopyCKSERVER.NLMtotheSystemdirectory.

2. IntheNovellAUTOEXECfile,insertthefollowingstatement:

LOAD CKSERVER

Thisstartsthedriveruponreboot.

3. Tostartthedrivermanually,ontheNovellserverinmonitormode,type

LOAD CKSERVER

Note:Novell'sPatchLevel#5forNovell3.x.istheminimumpatchlevel
requiredtorunCKSERVER.NLMon3.x.Thisisavailablefromusbyrequest.

Windows 3.x or WIN95 WCKSERVE.EXE

ThisisaWindowsprogramthatrunsinvisiblyinthebackground.Youmust
provideitthepathwhereyourCrypKeyprotectedapplicationresides.
Directoriesmustbedefinedinthecommandlineorbysettingtheenvironment
variableCKSERVE.(Thisisnotamisprinttheenvironmentvariableis
CKSERVE.)

Example1commandline

WCKSERVE.EXEC:\APP1;C:\UTIL\APP2;E:\WIN\APP3;

Example1autoexec.bat

SETCKSERVE=C:\APP1;C:\UTIL\APP2;E:\WIN\APP3;

Toinstallthisonyourcustomersmachine,ensureitisrestartedeachtimethe
machineisrebootedbyreferencingthisintheWindowsStartUpfolder.

1 3 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

DOS CKSERVE.EXE

ThisisaDOSTSRthatrunsinvisiblyinthebackground.Youmustprovideit
withthepathtothedirectorywhereyourCrypKeyprotectedapplication
resides.Directoriesmustbedefinedonthecommandlineorbysettingthe
environmentvariableCKSERVE.

Example1commandline

CKSERVE.EXEC:\APP1;C:\UTIL\APP2;E:\WIN\APP3;

Example1autoexec.bat

SETCKSERVE=C:\APP1;C:\UTIL\APP2;E:\WIN\APP3;

Toinstallthisonyourcustomersmachine,ensureitisrestartedeachtimethe
machineisrebootedbyreferencingthisintheAUTOEXEC.BAT.

OS2 Driver

WindowsCrypKeyprotectedprogramscanberunonanOS2machineand
networkedfromanOS2machineusingtheOS2driver.

CKSVROS2.EXEOS2drivernativeOS2program

CKSVROS2.HLPOS2driverhelpfile(OS2,notWindows,helpfile)

CKOS2WIN.HLPOS2driverWindowshelpfile

C RY P K E Y S D K 1 3 8
U S E R M A N U A L
Moving Protected Programs
Thelicensetransfersystemisanoptionalfeaturethat Section

9
allowsyourclientstotransfertheirlicensesfromone
computerordirectorytoanotherwithoutcontacting
you.

I fmultiplecopyfixedlicensesareissued,werecommendusingthelicense
transferfeaturetoallowyourcustomertodistributethemultiplecopiesto
differentsites.

TherearetwomethodsformovingaCrypKeylicense:

Direct Transfer:Usedtomovealicensefromonelocalornetworked
directorytoanother.

Floppy Transfer:Usedtomovealicensefromonecomputerto
anotherwhenthetwocomputersarenotnetworkedortheCrypKey
networkdriverisnotpresent.Inthiscase,themoveisdoneusinga
floppydisk.

Thesetwomethodsdonotactuallycopytheprogramfromonedirectoryto
another.Instead,theymovethelicensefromoneprogramtoacopyofthesame
programinadifferentdirectory.Theusermustthereforecopytheprogramto
thetargetdirectoryorcomputerbeforeusingthelicensetransferfunction.

9.1 Direct License Transfers


TheDirectTransfer()functionmustberunfromaprogramthathasavalid
license(thesourceprogram)andgivenadirectorypathtoanexistingcopyof
thesameprogramthatdoesnothaveavalidlicense(thetargetprogram)

Thefunctionsimplytransfersonelicensefromthesourcedirectorytothetarget
directory.Thetargetdirectorymustbelocal(i.e.,onadrivelocatedinthesame
computer)tothesourcedirectoryorthedirectoriesmustbeconnectedbya
networkandhaveaCrypKeynetworkdriverservicingeachofthem.

1 3 9 C RY P K E Y S D K
U S E R M A N U A L
9.1.1 Example
IfyouhaveaprogramwithonevalidfixedlicenseinC:\Tempandyouwantto
moveittoC:\Apps\Bingo:

1. CopyyourprogramtoC:\Apps\Bingo.

2. RuntheprogramthatisinC:\Temp.CallDirectTransfer()andprovide
itthepathnameofC:\Apps\Bingo.Instantly,thecopyin
C:\Apps\BingohasavalidlicenseandthecopyinC:\Tempdoesnot.

9.2 Floppy Disk License Transfers


Thefloppydisklicensetransferprocessinvolvestransferringthespeciallicense
filesandishandledentirelybytheCrypKeysystem.Atnotimeduringthe
transferprocessisyourlicensevulnerabletoreproductionbybitcopiers,file
duplication,orfiletampering.

Totransferalicensefromonecomputertoanother,youmusthaveacopyof
theprograminstalledandauthorizedononecomputerandacopyofthe
programinstalledbutnotauthorizedonanother.Assumingthatthetransferis
fromanalreadylicensedsourcecomputertoanunlicensedtargetcomputer
viafloppydisk:

1. Starttheprograminthetargetcomputerandregisterthetransferby
tellingtheprogramtocalltheRegisterTransfer()function.Theuser
mustsupplythepathtothefloppydisk.Thisfunctionputsaregistration
imprintfileonthefloppydisk.Takeoutthefloppydiskfromthetarget
computerandplaceitinthesourcecomputer.

2. Starttheprogramonthesourcecomputerandtellittocallthe
TransferOut()function.Theusermustsupplythepathtothefloppy
disk.Thisfunctionreadstheregistrationimprintfileandwritesa
matchinglicenseimprintfiletothefloppy.Italsodiscontinuesthe
licenseatthesourceifithadonecopyoritdecrementsthelicenseatthe
sourcebyoneifithadmultiplecopies.Takeoutthefloppydiskfromthe
sourcecomputerandreturnittothetargetcomputer.

3. Restarttheprograminthetargetcomputerandtelltheprogramtocall
theTransferIn()function.Theusermustsupplythepathtothefloppy
disk.Thiscompletesthetransferanddiscardstheintermediateimprint
files.

1 4 0 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Ifyouwantyourprogramtobeabletotransferitslicenseviafloppydisk,you
mustprogramyourapplicationtoallowtheusertoinitiatethefollowing
functions:

RegisterTransfer()

TransferOut()

TransferIn()

1 4 1 C RY P K E Y S D K
U S E R M A N U A L
Frequently Asked Questions
Thefollowingquestionsarefrequentlyaskedofour Section

1
technicalsupportrepresentatives.

0
uccessfullyansweringyourquestionsisapriorityoftheCrypKeySDK
technicalsupportteam.SinceCrypKeysinceptionin1992,wevestrivento
eliminateyourguesswork.Weencourageyoutoreadthroughthe
followingpagesbeforecontactingusforsupport.

10.1 General

10.1.1 Software Protection


Q Isillegalcopyingofmyproductarealconcern?

A Yes.Intodayshightechworld,youneedcopyprotection.Acopyrightsign
onyourproductdoesnotguaranteethatuserswillnotcopyyourproduct.
Copyrightlaws,likeallothers,canbebrokendespiteenforcementefforts.If
youreconsideringmarketingoverseas,thesituationisevenmoreserious.
ManycountriesoutsideNorthAmericaarewithoutanyformofcopyright
law,furtherincreasingthepossibilityforunpaidcopiesofyourproductto
enterthemarket.

AlthoughsoftwaregiantssuchasMicrosoftcanabsorbsalelossesrelatedto
illegalcopying,smallerplayers,whosemarketismoredefinedandvertical,
cannot.Softwareisnolongersolelyproducedbylargesoftwarehousesand
soldinmassquantities.Todayssoftwaredevelopersincludedoctors,
lawyers,engineers,andthoseinyourprofession:essentiallyanyindividual
withknowledgethatcanbesharedandmarketedthroughthemediumof
computers.

1 4 3 C RY P K E Y S D K
U S E R M A N U A L
10.1.2 CrypKey Advantages
Q WhyisCrypKeytheprotectionpackageofchoice?

A TheCrypKeylicensingsystemcircumventstheproblemsprevalentin
currentsoftwareprotectiontechnology,asoutlinedbelow:

Table 9: Software Protection Technology Problems and


Solutions
Copy Protection Description CrypKey Solution
Problem
Key failure Keys transfer CrypKey replaces
(hardware software from one hardware and disk keys
(dongle) or disk computer to another. with telephone or email
keys are subject Hardware keys can authorization, where client
to higher rate of suffer from fatal static computers become the
failure than shock and diskette key so that clients can
computers) keys can suffer from easily transfer your
media failure or be protected product to other
misplaced. Because computers. With CrypKey,
users frequently your master disk is MS-
transfer software, this DOS copyable and is not
action, while required for product
protected, must transfers.
remain as convenient
as possible.
Hardware Hardware keys can be No hardware key means
incompatibilities incompatible with no hardware
some computers, incompatibilities. CrypKey
printers, or other has an outstanding record
hardware keys. Disk of running on any PC-
keys can be compatible computer,
incompatible with including foreign
certain makes of machines (i.e., Japanese
computers and NEC PC) and diskless
different sizes of disk workstations.
drives.

1 4 4 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Copy Protection Description CrypKey Solution


Problem
Induced When a copy Your clients are up and
downtime protection key fails, running after one quick
time is required to telephone call rather than
obtain a new one. waiting for a hardware or
This depends on key disk key in the mail.
inventory, protection
company
replacement
procedures, and
client location.
Failure to protect Bit copiers, sold as With CrypKey, your
programs that can product cannot be copied
make backup copies by a bit copier. Your
of copy-protected product is shipped on an
software, can easily MS-DOS copyable disk and
copy most disk keys. runs in demonstration
mode until telephone
authorization, whereby it
becomes fully functional.
Because your disk does
not need to be copy
protected, you can
manufacture your disks
yourself.

1 4 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Copy Protection Description CrypKey Solution


Problem
Costs Key problems can eat Non-technical staff can
up more than 50 issue telephone
percent of your authorization with the
technical support CrypKey Site Key
allowance. Generator, freeing up your
technical staff for
technical support.
Client annoyance Market acceptance of Deliver product upgrades
hardware keys and renew licenses
(dongles) is declining. instantly. CrypKey allows
you to specify levels
and/or options and the
duration or number of
times clients can use your
product. You also have the
option of selling your
product on a time or per-
use license basis.

10.1.3 Telephone Authorization


Q HowdoesCrypKeyprotectproductswithoutusingkeys?

A TelephoneauthorizationreplaceskeysintheCrypKeysystem.Theprocess
isasfollows:

onceinstalledonyourclientscomputer,yourproductgeneratesa
sitecodespecifictothatcomputer,whichyourclientsendsyouby
telephone,email,orfax

usingCrypKey,yougenerateanauthorizationcode(forimmediate
orlaterdistributiontoyourclient)thatallowsyourproducttorun
onlyonthecomputerthatgeneratedthesitecode

10.1.4 Client Annoyance


Q Wontcustomersbeannoyedbyneedingtomakeatelephonecalltouse
myproduct?

C RY P K E Y S D K 1 4 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

A CrypKeyusershaveadvisedusthatthisdrawbackistypicallyperceived
ratherthanactual,mitigatedbyclientreliefovertheabsenceofhardwareor
diskkeys.However,waystocapitalizeontheCrypKeytelephone,email,or
faxauthorizationsysteminclude:

Shipyourproducttopotentialclientsindemonstrationform.When
yourclientsarereadytobuy,usetheauthorizationinteractionto
answerquestionsandgetcustomerfeedback.

Sendyourclientsadiskthatdemonstratesyourproductsoptions.
Askclientstocallwhentheyhavedeterminedwhichoptionsthey
want.WithCrypKey,youcanturnonthedesiredoptionsduringthe
call,andclientsoftenpurchasemoreoptionsthanoriginally
ordered.

Ensureyourclientiscomfortableandsatisfiedwithrunningyour
product.Clientsappreciatesupportandyoumaypreventproblems
andillwillfromoccurring.

10.1.5 24-hour Telephone Support


Q DoIneed24hourtelephonesupport?

A No.CrypKeystriallicensingfeatureensuresthatclientscancontactyoufor
permanentauthorizationduringregularbusinesshoursandcanopenand
useyourproductanytimetheychoose,includingweekendsandholidays.
CrypKeyallowsyoutoexpeditetherepairormodificationoflicenses.
CrypKeydramaticallyreducesyourcustomersupporthours.

10.1.6 Computer Signatures


Q Isacomputerssignaturederivedfromthevolumeserialnumber?Ifso,
hackerscouldalterthisnumberwithprogramssuchasNortonUtilitiesor
PCToolsorthosethatdirectlyaccessharddisksectors.Ifnot,howdifficult
iscloningthemachineauthorizedtorunmyproduct?

A Computersignaturesarederivedfromunchangeableparametersparticular
tothemachinessoftwareinstallation,whicharenearlyimpossibleto
duplicateonanothermachine.

1 4 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

10.1.7 License Transfer to Floppy Disk


Q TransferringthelicenseformyCrypKeyprotectedproducttodiskseems
dangerous.Apiratecoulddiskcopythefloppytogenerateanexactimageof
thefirstthatcouldeasilybeusedtoauthorizeothermachines.Istheonus
onmetoenableordisablethetransfertofloppy?

A Althoughthedecisiontoallowfloppydisklicensetransfersisyoursalone,
notethatatransferincorporatesthefollowingprocess:

1. Thesignatureofthetargetcomputeriswrittenonthefloppy(in
highlyencryptedfiles).

2. Thelicenseistransferredfromthesourcecomputertothefloppy.

3. Thelicenseistransferredfromthefloppytothetargetcomputer.

EvenifthefloppyiscopiedafterStep2,itonlyworksinthespecifictarget
computerbecauseofinformationencodedinStep1.

Q Whatifthetransfertothefloppyiscorrupted?Doesthatmeanthelicenseis
deletedfromthesourcemachine,butisunreadablefromthefloppy?

A Yes.Werecommendthatcustomersminimizethenumberoftimesthe
transferisdone,andtakeprecautionswiththeirmedia.Thereislittle
chanceofthishappeningwithDirectTransfer,sincetheprocessincludes
manysafetytests.

10.2 Technical

10.2.1 Disk Compression Programs


Q IsCrypKeyaffectedbydiskcompressionanddefragmentationprograms
suchasNortonUtilitiesSpeedDiskorNutsandBolts?

A CrypKeyisgenerallyimmunetotheseprograms.WithSpeedDisk,however,
adheretoinstructionsinNortonUtilitiesSpeedDisk,page62,toensure
CrypKeylicensingfilesremainundamaged(seeSection11.5:Norton
UtilitiesSpeedDiskformoreinformation).

C RY P K E Y S D K 1 4 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

10.2.2 Watcom Support


Q DoesCrypKeysupportWatcomC++9.5andhigher?

A Yes.CrypKeysupportstheWatcomdevelopmentenvironmentviaour16
and32bitDLLsalongwithMSDOSprogramswithexternallinking
capabilities.

10.2.3 Library Impacts


Q DoesCrypKeyaffectotherthirdpartylibraries?

A No.CrypKeyishighlynonintrusive,meaningthatitworkswithvirtually
anysoftware,andmoreimportantly,anyhardware.

10.2.4 Hard Disk Failure


Q Whathappensiftheharddiskfails,thusinvalidatingtheCrypKeylicense?

A Weprovideanewlicense,noquestionsasked.Ourclientsalwaysreceive
thebenefitofthedoubt.

Inreality,harddiskfailuresamongCrypKeyclientsarerare.CrypKeys
threeyearrelationshipwithFlowel,apopularflowcalculationprogramwe
marketworldwide,hasresultedineightreportedharddiskcrashes,of
whichwefeelonlytwoaresuspect.

10.2.5 Product Update Releases


Q HowdoesCrypKeymanageproductupdatereleases?

A CrypKeysimplifiesreleasingyourproductupdates.Copythenewversionof
theproductovertheoldoneanditassumestheexistinglicense.

10.2.6 Multiple Program Names


Q Canasingleproducthavemultiplemodules/namesinrelationtoone
CrypKeylicense?

1 4 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

A Yes.Tosuccessfullyawardaproductmultiplenames,ensureallnameskey
offonefileguaranteedtooccupythesamedirectoryasyourproduct.
CrypKeyallowsyoutoselectthefileyouwantthelicensebasedon.

Forexample,allversionsofProduct1keyoffafilenamedproduct1.dat,
locatedinthesamedirectoryasthe.exeforeveryinstallationofyour
product.ThismethodmakesiteasytoconsistentlyinstallCrypKeyinall
yourproductversions.

10.2.7 Floating Licenses


Q MyclientssometimesranthreefloatingcopiesofmysimpleWindows
productwhentheywereonlylicensedfortwo.Howdidthishappen?

A CrypKeysmechanismforcountinglicensenumbersisfoolproof.Ifa
particularapplicationofyourproductfailstocallGetAuthorization()
regularly,itlosesitslicense.ParametersoftheInitCrypkey()callcontrol
thetimebeforetheapplicationfails.Changetheseparameterstosuityour
requirementstopreventunauthorizeduseofyourproduct.

10.2.8 Computer Clock Manipulation


Q CanclientstamperwithCrypKeystimedependentlicensesbysettingback
theirPCclocks?

A No.CrypKeyrecordseachtimeclientschecktheirlicensestatusfromwithin
yourproduct.Ifclientssetbacktheirclocksmorethan75minutes,CrypKey
generatesanerrorcodeforyourproduct.

Additional Clock Manipulation Checks

Thereareprogramsavailableonthemarketdesignedtotrytodeceivetime
restrictedsoftwareprotectionsystems.Theseprogramsautomatethe
processofchangingacomputer'sclockinordertobypasstimerestricted
protection.Theseprogramschangethetimeregisteredbytheprotected
program.Forexample,iftheregisteredtimeneverextendsbeyondyour
program'strialperiod,ausercanintheoryrunyourprogramindefinitely.

CrypKeysafeguardsagainstclockmanipulationsbymonitoringyour
customers'computersfortheinconsistenciesgeneratedbysuchanattack.
CrypKeydetectswhentimeisfalselyreportedtoyourprogram,and

C RY P K E Y S D K 1 5 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

preventsyourprogramfromrunning.TimesreportedbyCrypKeyarethat
oftheserver,adjustedtothelocaltimezoneofthecomputer.

CrypKeymayalsodetectclockmanipulationifusersadjusttheircomputer
clockbymorethanseveralhours,evenforbenignpurposessuchastesting.
Ifyourprogramispreventedfromrunninginthesesituations,your
customercancorrectthesituationbyrebootinghisorhercomputer.

10.2.9 CD-ROM Distribution


Q DoesCrypKeysupportdistributionviaCDROM?

A Yes.CrypKeycanbeusedifyouinstalltheexecutabletoyourharddrive
fromaCDROMoritremainsresidentontheCDROM.

Inthelattercase,theproblemthatarisesconcernstheinabilityofCrypKey
towriteitslicensefiles,whicharecreateddynamically,tothereadonlyCD
ROM.CircumventthisissuebystoringCrypKeylicensefilesonyourhard
drive.CrypKeystoreslicensefileswhereyouspecify.

Inanetworklicensesituation,ratherthandownloadingalargeprogram
acrossthenetworkwhenitruns,installtheprogramonthetargetmachine
andensureonlythelicenseresidesontheserver.

10.2.10 Internet Distribution


Q CanfilesprotectedbyCrypKeybedistributedovertheInternet?

A Yes.BecauseCrypKeyeliminateshardwareordiskkeytechnology,it
providesanidealchannelforinternetdistribution.

10.2.11 File Set Protection


Q CanCrypKeyprotectasetoffiles?

A Yes.UseCrypKeytoprotectanunlimitednumberofprogramsrelatedto
yourproduct.Theoptionsfeatureindividuallyenablesordisablesupto32
programsperproductatnoadditionalcost.

1 5 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Youcansetupsubmodulestocheckthemainmoduleslicensefile.You
achievethisbypassingthemainmodulepathtotheInitCrypkey()callin
allmodules.AllmodulesmustalsousethemainmodulesMasterandUser
Keys.

10.2.12 Foreign System Compatibility


Q IsCrypKeycompatiblewithforeignPCsandoperatingsystems?

A Yes.CrypKeyisfullyfunctionalontheJapaneseNECPCandtheKanji
versionofWindows95.OtherAsianandEuropeanversionsofWindowsare
alsosupported.

10.2.13 Removable Hard Drives


Q DoesCrypKeyworkwithremovableharddrives(i.e.,IomegaZipandJaz
drives)?

A Yes.CrypKeyfullysupportsIomegaZipandJazdrives.CrypKeyprotected
productscanbenormallyinstalledandrunfromthesedrives.Other
removableharddrives,however,arenotsupportedandCrypKeyprotected
softwaredoesnotrunfromthem.

10.2.14 Anti-Virus Software


Q WillCrypKeytriggerantivirussoftwarethatisinuseonacomputer?

A No.CrypKeydoesnotconflictwithanyantivirussoftware.

10.2.15 Installer Software


Q IsCrypKeycompatiblewithsuchinstallersoftwareasInstallShield3?

A Yes.CrypKeyisfullycompatiblewithallinstallersystems,especially
InstallShield3.WeuseInstallShield3inourownsoftwareandhavenever
experiencedproblems.

C RY P K E Y S D K 1 5 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

10.2.16 US Exports
Q CanIexportmyCrypKeyprotectedproductfromtheUnitedStates?

A Yes.CrypKeycomplieswithU.SDepartmentofCommercerulesforexport
toallcountriesexceptCubaandSyria.

10.2.17 Software Certification


Q IfIintegrateCrypKeyintomysoftware,willIhavedifficultiesgettingmy
softwarecertified?

A No.CrypKeysupportsallelementsrequiredtoallowyourproducttoquality
forMicrosoftsDesignedforWindowscertification.

10.2.18 Windows 98
Q DoesCrypKeyworkonWindows98?

A Yes.CrypKeyandCrypKeyprotectedproductsrununderWindows98.
Note,however,thatifyouareconvertingfromFAT16toFAT32,youmust
firsttransferyourlicensetoanothercomputertoretainyourauthorization.

1 5 3 C RY P K E Y S D K
U S E R M A N U A L
Troubleshooting
Havingtrouble?Thissectionprovidessolutionsto Section

1
somecommonproblems.

1
inceimplementingCrypKeySDKcancreateproblemsinsome

S environments,youshouldcheckyourenvironmenttypeagainstthelisted
typestopinpointproblemsandidentifysolutions.

ThischapterincludesthemostcommonproblemsreportedtoCrypKeys
technicalsupportteam.Forproblemsnotlistedhere,pleasevisitourwebsiteat
www.crypkey.comandreviewoursearchablesupportdatabase.Thedatabase
isaccessibleusingacustomerpasswordthatyoucanobtainfromus.

11.1 CrypKey Error Messages


MostCrypKeyoperationalproblemsaremanifestedbyerrormessages.These
errorscanbegeneral(notspecifictofunctions)orspecifictofunctions.

11.1.1 General Errors


CrypKeygeneralerrorsarelistedinSec.12.2:GeneralErrorValues.

Generalerrorcodesareintheranges100to199,and200to299.General
errorsincludenetworkandDLLcommunicationerrors.Youshouldalways
checkforthesereturnvaluesandgivesomeexplanationtothecustomerifthey
occur.ExplainErr()(Sec.12.3.8)returnsanappropriatemessage.

Note:errorsinthe200to299rangeresultfromsecuritychecks.Themost
commoncauseoftheseerrorsistheplacementofthe.ngnfileinadifferent
directorythantheonetheexecutableresidesin.Inthesecases,movingthe
.ngnorexecutabletotheproperlocationshouldcleartheerror.Ifitdoes
not,pleasecontactCrypKeytechnicalsupport.

1 5 5 C RY P K E Y S D K
U S E R M A N U A L
ThemostcommonCrypKeyerrorisError102withthemessage
NETWORK_NO_CKSERVE.SeeSec.11.2foradetaileddiscussionofthiserror.

11.1.2 Function Errors


YoullfinddetailsoffunctionspecificerrorcodesinSec.12.3:Function
Descriptions.SeealsoSec.14.2:CrypKeyReturnCodesforaquickreferenceof
errorsgeneratedbytheInitCrypkey()andGetAuthorization()functions.These
twofunctionsarerequiredinallCrypKeyoperationsandconsequentlyerrors
generatedfromthemtendtobemorefrequentandcriticalthanerrors
generatedfromotherfunctions.

11.2 General Error 102


Asmentionedearlier,Error102(NETWORK_NO_CKSERVE)isthemost
commonCrypKeyerrormessage.IttellsyouthatCKSERVE.EXE(orits
equivalent)isnotservingtheprogram.ThismeansthattheCrypKeydriveryou
areusingisnotservingthedirectorywhereyourCrypKeyprotectedapplication
islocated.AllCrypKeyprotectedapplicationsmustbeservedbythedriver.
ThiserrorusuallyoccursonWindowsNT.

Ifyouencounterthiserror,sendanemailmessagecontainingthedateof
setupex.exetoCrypKeytechnicalsupportatsupport@crypkey.com.

1 5 6 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

11.2.1 CrypKey License Service Problems


WhenthereisaproblemwiththeCrypKeyLicenseService,theuserreportsone
ofthefollowing:
Anerrorwindowsuchastheoneshown:

Figure 52: Network Disconnect Message Window


AreturncodeanderrormessagefromSDK:

INITIALIZATIONFAILURE

NETWORK:NETWORKDRIVERAPPEARSNOTTOBESERVINGIN
DIRECTORY/102
ProblemsofthistypeusuallyoccuronNTorNovellNetwarefilesystemswhere
thedirectorysecurityismodified.Refertothefollowingtroubleshootingcharts
forassistancewiththisproblem.

1 5 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 53: NT File System Troubleshooting Flowchart

C RY P K E Y S D K 1 5 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 54: Novell File System Troubleshooting Flowchart

1 5 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

11.2.2 CrypKey Technical Support


Whenrequestingtechnicalsupportfromsupport@crypkey.com,ensureto
includethefollowinginformation:
companyname
CrypKeyaccountnumber
abriefandconciseexplanationoftheproblem
errormessages:yourapplicationserrormessagesmaybeambiguousornot
havesignificantmeaningtoCrypKeysupport.Forthisreason,developyour
applicationtoreferencetheassociatedCrypKeyfunctionandreturncodein
yourerrormessages.
sequenceofeventsrequiredtorecreatetheproblem.Includeinformation
suchas:
orderofCrypKeyfunctionscalled
returncodesfromthosefunctions
operatingsystem
licensetypeandduration

C RY P K E Y S D K 1 6 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

.cknfilethisisafilecreatedbytheCrypKeyfunctionsandcontainsuseful
informationthatmaybevaluableforresolvingyourproblem.Thefile
residesinyourCrypKeydirectories.Whenopened,the.ckninformation
appearsinawindowsimilartothefollowing:

Figure 55: .ckn Diagnostic File

theCrypKeylibrariesused
yourcompilerandversion

11.3 Windows NT Diagnostics


TheWindowsNTdrivermaintainstwoerrorlogfiles.Youcanhelpusrectify
yourWindowsNTdriverproblemsbysending(byemailorfax)theerror.log
andtheerrord.logfiles,locatedintheC:\WinNTandtheC:\WinNT\System
directories.

1 6 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

11.4 NetWare-related Issues


ThefollowingerrorscanoccuronNovellnetworksusingCrypKeyckserver.nlm.

11.4.1 Sample Error 1


IfyourclientsattempttoexecuteyourCrypKeyprotectedproductfroma
NetWareserver,anerrormessageresemblingthefollowingoccurs:
CKSERVEisnotservingthisdirectory
Tosolvethiserror,ensure:
CKSERVER.NLMisrunningontheserver
theCKSERVER.NLMpathstatementwithintheautoexec.ncfiscorrect
thedirectorynamedoesnotcontainaperiod
themaximumnumberofusersfortheCrypKeyprotectedproductis
notexceeded

11.4.2 Sample Error 2


Ifyourreferencedlibraryroutinecannotbelocatedwithinthecurrent.nlm,the
loadedNovellclib.nlmlibrarymaynotbecurrent,generatinganerrormessage
resemblingthefollowing:
Undefinedsymbol:_chk
Tosolvethiserror:
1. ImplementtheNovellpatchlibup5.exeoranewerpatch(availablefrom
CrypKeyorNovell).
2. Ensureacopyofdirectfs.nlmisloaded.
3. Shutdowntheserverandrestart.Thisloadsthenewclib.nlms
(clib.nlmscannotbemanuallyunloadedandloaded).

11.4.3 Sample Error 3


IfnoneofyourclientsareloggedontothenetworkexecutingtheCrypKey
protectedprogram,butanerrorstatingthatthereareusersloggedonappears:
1. Deletethe<programname>.tb2filefromthenetwork.
2. Shutdowntheserverandrestartit.

C RY P K E Y S D K 1 6 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

3. Restarttheapplication.

11.5 Norton Utilities Speed Disk


SpeedDiskisthedefragmentationutilityincludedinSymantecsNorton
Utilities.Unfortunately,SpeedDiskmovesCrypKeylicensingfiles,causing
licenseloss.CrypKeyusesfourspeciallicensingfiles(.ent,.rst,.key,and.41s)to
controlyourproductlicensing.Thesefilesarehiddensystemfilesandresidein
thesamedirectoryastheprotectedproduct.

To prevent license loss:

1. OpenSpeedDisk,andchooseFile, Options, Customize, and


Unmovable Files.

2. Specifythatthe*.ent,*.rst,and.key,filescannotbemoved(the.41sfiles
neednotbespecified).

3. ChooseFile, Options, Optimization,andSavetosavethenew


profile.

1 6 3 C RY P K E Y S D K
U S E R M A N U A L
Function Reference
WhenusingsomeofCrypKeyfunctions,youllneed Section

1
backgroundinformationandtechnicaldetails.

2
hissectioncontainsreferenceinformationthatsupportstheother

T sectionsinthismanual.Itdescribesthefunctionsandgeneralerrorvalues
usedbyCrypKeyandprovidesassistanceforprogrammingyourCrypKey
code.Forfunctiondeclarations,refertothesamplecode.

12.1 Function Summary


Foraquickreferenceoffunctionsyntax,seeAppendixII(Sec.14.1:CrypKey
Functions).

Table 10: Function Summary


Name Function
AcquireLicense() Allows an unlicensed CrypKey-protected program
to acquire a license from a licensed copy. It is the
opposite of the DirectTransfer() function.
CKChallenge() Used to authenticate the CrypKey DLL, ensuring
that it is not an impostor. The function name in
Visual Basic is ckChallenge.
CKChallenge32() Used to authenticate the CrypKey DLL, ensuring
that it is not an impostor. The function name in
Visual Basic is CKChallenge32.
CKTimeString() Translates, into a text string, the ULONG time
values returned by the functions
GetAuthorization() and
FloatingLicenseSnapshot().

1 6 5 C RY P K E Y S D K
U S E R M A N U A L
Name Function
CrypkeyVersion() Returns the version number of the CrypKey library
currently in use. The function name in Visual Basic
is crypkeyVersion.
DirectTransfer() Called from an application that has authorization,
this function transfers the applications
authorization license to another directory.
EndCrypkey() Notifies CrypKey that the program is terminating.
ExplainErr() Returns a text string that explains the return code
of various functions.
ExplainErr2() Returns a text string (written into string text) that
explains the return code of various functions.
FloatingLicenseGetR C#.NET function only: returns a single record of
ecord() the current floating license status. The function
FloatingLicenseTakeSnapshot() needs to be
called before this function.
FloatingLicenseSnap Returns a snapshot of all users holding or waiting
shot() for a network-floating license.
FloatingLicenseTake C#.NET function only: returns a snapshot of all
Snapshot() users holding or waiting for a network floating
license.
Get1RestInfo() Returns authorization options, the number
allowed, and the number used.
GetAuthorization() Gets the level at which the program is authorized
to run or an authorization failure code. Also used
to decrement the number of uses count.
GetAuthorization2() The same as GetAuthorization(), except this
function decrements the number of uses count
only.
GetDrivePermanentS Proprietary CrypKey software function that
erialData() accesses the following hard drive information on a
customers computer: model number, serial
number, firmware data.
GetLastError() Returns the text for the last error reported.
GetLastErrorCode() C#.NET function only: returns the number of the
last error reported. Used when you use some of
the safe code alternative functions in C#.NET.
GetLevel() Returns the level of authorization or -1 if the
program is not authorized.

1 6 6 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Function
GetNetHandle() Gets the network license handle of the protected
program.
GetNumCopies() Gets the number of license copies that the current
site has been granted.
GetNumMultiUsers() Gets the number of customers to whom the site
license has been granted.
GetOption() For a specific option, the function returns 1 if the
option is on, 0 if the option is off, and -1 if the
program is not authorized.
GetRestrictionInfo() Gets information on any restrictions that are
present in the license.
GetSiteCode() Gets the site code for the program installation
location (site).
GetSiteCode2() Returns a pointer to the site code. The same as
GetSiteCode(), except text is not written to a
string.
InitCrypkey() Initializes CrypKey with the required runtime
information.
KillLicense() Kills the protected program's license and provides
a confirmation code.
ReadyToTry() Sets up a days class, one-time automatic license
without version control. The function name is
readyToTry in Visual Basic.
ReadyToTryDays() Sets up a days class, one-time automatic license.
The function name is readyToTryDays in Visual
Basic.
ReadyToTryRuns() Sets up a runs class, one-time automatic license.
The function name is readyToTryRuns in Visual
Basic.
RegisterTransfer() Called from an application that does not have
authorization, this function registers the
application by placing special files on a disk or
directory.
SaveSiteKey() Used to save the site key that is acquired by the
customer. The key is checked before it is saved.

1 6 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Function
SetNetHandle() Sets the network license handle reference of the
protected program.
TransferIn() Called from an application that does not have
authorization, this imports an authorization license
by reading special files from a disk or in a directory
that were created by the TransferOut() function.
TransferOut() Called from an application that has authorization,
this exports the applications authorization license
by writing special files out to a directory where a
registration file was created using the
RegisterTransfer() function. Only the registered
application can successfully call the TransferIn()
function to import this license.

12.2 General Error Values


MostCrypKeyfunctionsthatreturnvaluescanreturngeneralerrorcodesin
additiontofunctionspecificerrorcodes(describedinSec.12.3:Function
Descriptions).ThesegeneralerrorsincludenetworkandDLLcommunication
errors.Youshouldalwayscheckforthesereturnvaluesandgivesome
explanationtothecustomeriftheyoccurExplainErr()(Sec.12.3.8)returnsan
appropriatemessage.

Note:asmentionedinthetablebelow,errorsinthe200to299range
resultfromsecuritychecks.Themostcommoncauseoftheseerrorsisthe
placementofthe.ngnfileinadifferentdirectoryfromtheonewherethe
executableresides.Inthesecases,movingthe.ngnorexecutabletothe
properlocationshouldcleartheerror.Ifitdoesnot,pleasecontactCrypKey
technicalsupport.

C RY P K E Y S D K 1 6 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Table 11: General Errors and Solutions


Name Value Message Solution
FILE_INFO_FAIL -100 Could not get If you see this error, ensure
the licensing you have the most recent
information for software. Send an email
unknown message to
reason (wrong support@crypkey.com
operating containing the dates of the
system or CrypKey files you are using
insufficient and we tell you if you have
memory) the most recent software.
NETWORK_ -101 The network If you encounter this error,
DISCONNECTE connection ensure you are using the
D appears to most recent driver. Do this
have been lost by sending an email
message to
support@crypkey.com that
states the date of the driver
you are using.
NETWORK_NO_ -102 CKSERVE.EXE The CrypKey driver you are
CKSERVE (or its using is not serving the
equivalent) is directory where your
not serving the CrypKey-protected
program application is located. All
CrypKey-protected
applications must be served
by the driver. This error
usually occurs on Windows
NT. To solve this problem,
ensure the NT driver is
installed. If you still
experience problems, send
an email message
containing the date of
setupex.exe to
support@crypkey.com.
For further information
about this error, see also
Chapter 11,
Troubleshooting, (p. 155).
NETWORK_BA -103 The reply file This error is usually caused
D_ REPLY was either by an old driver. Please
damaged or contact us via email at

1 6 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Message Solution


tampered with support@crypkey.com with
the date of the driver that
you are using.
INIT_NOT_ -104 CrypKey Check the return value from
SUCCEEDED initialization InitCrypKey. This should
did not provide you with
succeed information about the
problem.
THUNK_FAILUR -105 Unable to Ensure both of the thunk
E perform the DLLs (Crp95f.dll and
thunk Cryp9516f.dll) are in the
operation application directory. If they
are in the application
directory and you continue
to receive the error please
email support@crypkey.com
and report the dates of your
thunk libraries.
BAD_THUNK -106 The DLL is If this error occurs, ensure
replaced with you have the original copy
an impostor of the CrypKey thunk DLLs.
If you still encounter this
problem, send the dates of
the DLLs you are using to
support@crypkey.com.
NO_MEMORY -107 A request for Email us at
memory failed support@crypkey.com if this
error occurs.
OLD_THUNK -108 The DLL is Ensure both of the thunk
replaced with DLLs (Crp95f.dll and
an older Cryp9516f.dll) are in the
version or an application directory. If they
older version is are in the application
already directory and you continue
running to receive the error please
email support@crypkey.com
and let us know the dates of
your thunk libraries.
THUNK_BLOCK -109 THUNK dll is Email us at
ED used but not support@crypkey.com if this
released by error occurs.
another

C RY P K E Y S D K 1 7 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Message Solution


application
NETWORK_BA -110 A reply to a Email us at
D_CRC network support@crypkey.com if this
request is error occurs.
corrupted
INIT_NOT_CALL -111 All functions Ensure InitCrypkey() is
ED require init to called before calling any
be called other functions.
EASYLIC_OPER -112 Certain Instruct the user that this
ATION_NOT_AL operations operation is not allowed.
LOWED such as license
transfers are
not allowed
with
EasyLicence
(see Sec.
4.2.2).\
[various -200 The .ngn file is The 200-series errors are
messages] to possibly not in generated by security
-299 the same checks. Ensure that the
directory as .ngn file is in the same
the executable. directory as the executable.
If this action does not clear
the error, email us at
support@crypkey.com.

1 7 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3 Function Descriptions


Thissectionprovidesdetailedinformationaboutthepurpose,use,syntax,
parameters,andinteractionofCrypKeyfunctions.

YoucanalsoseeasummaryofthesefunctionsinSec.12.1:FunctionSummary,
andinAppendixIIQuickReference(Sec.14.1:CrypKeyFunctions).

Whereapplicable,eachdescriptionincludesaprototypestable,showingthe
following:
Cprototype,forusewiththeCrypKeyLibrary
C++prototype,forusewiththeCrypKeyCOMobject
VisualBasic(VB)prototype,forusewiththeCrypKeyCOMobject
C#.NETprototype,forusewiththeCrypKey.NETassembly

NotethatsomeoftheC#.NETmethodsareunsafecodebecausetheypass
valuesbyreference.Thesefunctionsareprovidedforcompatibilityonly.
Alternatemethodsexistthatcontainsafecodeandareinmanycasesprovided
inthisdocument.

12.3.1 AcquireLicense()
AcquireLicense()isanewfunctionthatallowsanunlicensedCrypKey
protectedprogramtoacquirealicensefromalicensedcopy.Itistheopposite
oftheDirectTransfer()function.

Forthisfunctiontobesuccessful,certainconditionsmustbemet:
thetargetdirectorymustnotalreadyhaveavalidlicense
thesourcemusthaveatleastonevalidlicense
ifeithersourceortargetdirectoryisnotlocal,aCrypKeydrivermustbe
operationonthemachinethedirectoryison

Ifthesourcelicenseisafixedlicenseandhasmorethanonecopy,thisfunction
transfersexactlyonecopytothetargetanddecrementthesourcenumberof
copiesbyone.

C RY P K E Y S D K 1 7 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Ifthesourcelicenseisafloatinglicensewithxusersallowed,theentirelicense
includingxusersistransferred.

Note:ifthesourcedirectoryisnotlocal,thesourcelicensedoesnothavetobea
floatinglicensetobetransferred.

Usage
1. Acompanycandistributefixedlicensestoanumberofclientcomputersby
havingtheclientacquirethelicensefromaserverblessedwithmultiple
fixedlicenses.

2. AnewversionofCrypKeyprotectedsoftwarecanautomaticallyacquireits
licensefromtheoldversion.

Prototypes
Language Syntax
C int AcquireLicense (char *licensePath);

C++ long AcquireLicense (BSTR bstrDirectory);

VB AcquireLicense (strDirectory as String) as Long

C#.NET CKAcquireErrorEnum AcquireLicense (String


*pstrDirectory);

Parameter
ThelicensepathisapointertoaNULLterminatedstringthatgivesthe
directoryfromwhichthelicenseistobeacquired.Forsuccessfuloperationof
thefunction,thedirectorymustcontainavalidlicenseforthecallingprogram.

Return Value
Ifthefunctionoperatesnormally,itreturnsthevalue0.Otherwise,itreturns
oneoftheerrorvaluesdescribedinthetablebelow.

1 7 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Message Solution

AL_SOURCE_NOT_AU -1 Source of Ensure the source


THORIZED application application has a valid
must be license.
authorized
for this
operation

AL_TARGET_APP_NO -2 Target Ensure there is the copy


T_FOUND application of the application in the
was not target directory.
found

AL_FLOPPY_NOT_ALL -3 Operation Do not acquire licenses


OWED not allowed from or to floppy disks.
on floppy
disk

AL_SITEKEYFILE_NOT -4 Source site Contact CrypKey


_FOUND key file was technical support if you
not found get this error.

AL_RSTKEYFILE_NOT -5 Source .RST Contact CrypKey


_FOUND file was not technical support if you
found get this error.

AL_COULD_NOT_WRI -6 Could not Ensure the target


TE_SITEKEYFILE write to directory is writable and
target site ensure there is not a
key file read-only copy of
<appname>.key in the
target directory.

AL_TARGET_WRITE_P -7 Target site he Ensure there is not a


ROTECTED filed his write read-only copy of
protected <appname>.key in the
target directory.

AL_SOURCE_SAME_A -8 Source Ensure the source and


S_TARGET directory is target directories are
the same has different.
target
directory

C RY P K E Y S D K 1 7 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Message Solution


AL_THIS_IS_AUTHORI -9 Target Remove the current
ZED already has authorization using the
authorization KillLicense function if
you are sure you dont
want the current license.

AL_LICENSE_SOURCE -10 Source of Ensure the application is


_NOT_FOUND application in the source directory.
was not
found

AL_COULD_NOT_INIT -11 Could not A driver is probably


IALIZE_SOURCE initialize missing. Contact
CrypKey in CrypKey technical
source support if you get this
directory error.

12.3.2 CKChallenge()
Note:itisrecommendedthat,insteadofthisfunction,32bitprogramsuse
CKChallenge32()seeSec.12.3.3.

CKChallenge()verifiesthattheCrypKeyDLLhasnotbeenreplacedwithan
impostorDLL(itisalsoverifiestheauthenticityoftheCrypKeyexternal
program.Inordertousethisfunction,youmusthavethecompanyand
passwordnumbersthatCrypKeygaveyouwhenyoureceivedyourMasterKey
andUserKey.

Ifyoudoacalculationwiththeseandtwootherrandomlychosennumbersand
thencalltheDLLtodothesamecalculationwiththesamefournumbers,the
DLLshouldarriveatthesameanswer.OnlytherealDLLcandecodetheMaster
KeyandUserKeytogetyourcompanyandpasswordnumbersforthe
calculation,soanimpostorDLLhasgreatdifficultyprovidingthecorrect
answerforanypossiblevaluesofthetworandomnumbers.

1 7 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Usage
CallCKChallenge()whentheprogramfirststartstoensuretheauthenticityof
theDLL(ortheexternalprogramifyouareusingexternallinking).Youcanalso
callthisfunctionperiodicallytocheckthatthelicenseisvalidinsteadof(orin
additionto)usingGetAuthorization().Ifthelicenseisnotvalid,CKChallenge()
doesnotreturnthecorrectcodes.

Prototypes
Language Syntax

C unsigned short ckChallenge (unsigned short random1,


unsigned short random2);

C++ long CKChallenge (long nRandom1, long nRandom2);

VB CKChallenge (nRandom1 as Long, nRandom2 as Long)


as Long

C#.NET int CKChallenge (int nRandom1, int nRandom2);

Parameters

Random1

Random1isa16bitnumberchosenatrandom.Agoodwaytogetarandom
numberistousethesystemtime.Thisnumbermustbelessthan32,768.

Random2
Random2isa16bitnumberchosenatrandom.Agoodwaytogetarandom
numberistousethesystemtime.Thisnumbermustbelessthan32,768.

Return Value
CKChallenge()returnstheresultofthechallengecalculationdoneusingthe
twoparametersofthisfunction.Theactualcalculationthatthefunctionreturns
is:

initializeresultto0
repeat11times:

C RY P K E Y S D K 1 7 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

result = (result * random1 + companyNum) mod 16381 +


(result * random2 + passNum) mod 16369
where:
resultistheresultofthecalculation
random1andrandom2aretwonumbersbetweenbutnotequalto0and
65,536.
companyNumandpassNumareyourCrypKeyassignedsecretnumbers

TheactualcalculationthatyouwoulddoinCcodeisasfollows:

#define UINT unsigned integer


#define ULONG unsigned long
#define USHORT unsigned short
USHORT Challenge(ULONG companyNum, ULONG passNum, USHORT
random1,
USHORT random2)
{
int I;
ULONG ret,r1,r2;
r1 = (ULONG)random1;
r2 = (ULONG)random2;
ret = 0;
for (i=0,i<11;i++)
ret = (ret*r1+companyNum)%16381L+(ret*r2+passNum)%16369L;
return (USHORT)ret;
}

Notes
TheInitCrypkey()andGetAuthorization()functionsmusthavebeencalled
andreturnedsuccessfullyforCKChallenge()towork.NotethatCKChallenge()
doesnotreturnthecorrectcodeiftheprogramisnotauthorized.Thisgivesyou
anotherway(besidesGetAuthorization())tocheckforavalidlicense.This
functioncanonlybecalledfromapplicationsthathavetheirownMasterKey
andUserKey.CKChallenge()doesnotworkifyouareusingtheMasterKey
andUserKeyforexample.exe.

1 7 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.3 CKChallenge32()
CKChallenge32()isusedtoauthenticatetheCrypKeyDLL,ensuringthatitis
notanimpostor.ItisalsousedtoverifytheauthenticityoftheCrypKeyexternal
program.Inordertousethisfunction,youmusthavethecompanyand
passwordnumbersprovidedbyCrypKeywiththeMasterKeyandUserKey.

Ifyouperformacalculationwiththeseandtwootherrandomlychosen
numbersandthencalltheDLLtodothesamecalculationwiththesamefour
numbers,theDLLshouldarriveatthesameanswer.OnlytherealDLLcan
decodetheMasterKeyandUserKeytogetyourcompanyandpassword
numbersforthecalculation.AnimpostorDLLhasgreatdifficultyprovidingthe
correctanswerforanypossiblevaluesofthetworandomnumbers.

Usage
CallCKChallenge32()whentheprogramstartstoensuretheauthenticityofthe
DLL(ortheexternalprogramifyouareusingexternallinking).Youcanalsocall
thisfunctionperiodicallytocheckthatthelicenseisvalidinsteadof(orin
additionto)usingGetAuthorization().Ifthelicenseisnotvalid,
CKChallenge32()willnotreturnthecorrectcodes.

Prototypes
Language Syntax

C Long CKChallenge32 (long random1, long


random2);

C++ Long CKChallenge32 (long nRandom1, long


nRandom2);

VB CKChallenge32 (nRandom1 as Long, nRandom2 as


Long) as Long

C#.NET int CKChallenge32 (int nRandom1, int nRandom2);

Parameters

Random1

Random1isa31bitnumberchosenatrandom.Agoodwaytogetarandom
numberistousethesystemtime.Thisnumbermustbelessthan2311.

C RY P K E Y S D K 1 7 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Random2
Random2isa31bitnumberchosenatrandom.Agoodwaytogetarandom
numberistousethesystemtime.Thisnumbermustbelessthan2311.

Return Value
CKChallenge32()returnstheresultofthechallengecalculationdoneusingthe
twoparametersofthisfunction.Theactualcalculationthatthefunctionreturns
is:

{
int i;
long ret;

ret = 1;
for(i=2;i<11;i++)
{
ret = ret%32769 * ( (random1/i)%32769 + (companyNum/i)%32769);
ret = ret%32769 * ( (random2/i)%32769 + (passNumDiv2/i)%32769);
}

return(ret);
}

where:
retistheresultofthecalculation.
random1andrandom2aretwonumbersbetweenbutnotequalto0and
2311.
companyNumandpassNumareyourCrypKeyassignedsecretnumbers.

TheactualcalculationthatyouwoulddoinCcodeisalsoshowninexample.c
intheSampledirectory.

1 7 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Notes
TheInitCrypkey()andGetAuthorization()functionsmustbecalledand
returnedsuccessfullyforCKChallenge32()towork.NotethatCKChallenge32()
doesnotreturnthecorrectcodeiftheprogramisnotauthorizedthisgives
youanotherway(besidesGetAuthorization())tocheckforavalidlicense.This
functioncanonlybecalledfromapplicationsthathavetheirownMasterKey
andUserKey.

12.3.4 CKTimeString()
ThefunctionsGetAuthorization()andFloatingLicenseSnapshot()bothreturn
ULONGvaluesthatrepresenttime.Thisfunctiontranslatesthetimeintoatext
string.

Seeexample.cforanexampleofhowtousethisfunction.

Prototype
char*FUNCTYPECKTimeString(char*timestringbuf,ULONGt)

Parameters
timestringbuf

timestringbufisabuffertoputthetimestringatleast30byteswide.Thetime
stringisintheformYYMMDDHH:MM:SS.

tisthe32bitintegervaluereceivedfromtheCrypKeyfunctiontobetranslated
totext.Itreturnsapointertotimestringbufforconvenience.

12.3.5 CrypkeyVersion()
CrypkeyVersion()returnstheversionnumberoftheCrypKeysystemcurrently
inuse.

Usage
CallCrypkeyVersion()wheneveryouneedtoknowwhichversionofCrypKeyis
linkedtoyourprogramcode.

C RY P K E Y S D K 1 8 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Prototypes
Language Syntax

C int CrypkeyVersion ();

C++ long CrypKeyVersion ();

VB CrypKeyVersion () as Long

C#.NET int CrypKeyVersion ();

Return Value
CrypkeyVersion()returnsatwodigitnumberthatindicateswhichversionof
theCrypKeylibraryisinuse(33indicatesv3.3,40indicatesv4.0,43indicates
v4.3,etc.).

12.3.6 DirectTransfer()
Calledfromanapplicationthathasauthorization,DirectTransfer()transfers
theapplicationsauthorizationlicensetoanotherdirectory.Thistransfercould
befromonedirectorytoanotheronthesamecomputerorfromonenetwork
drivetoanother.

Thedirectorywherethefunctionisinitiatedmustalsobethedirectorywhere
thelicenseresides.

Note:TheInitCrypKey()andGetAuthorization()functionsmustbe
successfullycalledbeforeDirectTransfer()isused.

Usage
UseDirectTransfer()wheneveryouneedtotransferalicensefromone
locationtoanotherandthereisadirectconnectionbetweenthetwodrives.

Prototypes
Language Syntax

C int DirectTransfer (char *directory);

C++ long DirectTransfer (BSTR bstrDirectory);

1 8 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

VB DirectTransfer (strDirectory as String) as Long

C#.NET CKDirectErrorEnum DirectTransfer (String


*pstrDirectory);

Parameter
Directory
Directoryisapointertoanullterminatedtextstringthatcontainsthepathof
thedirectorytowhichtoexportthelicense.

Return Value

Table 12: DirectTransfer() Values


Name Value Message Solution
DT_OK 0 The function
completed
successfully

DT_THIS_NOT_ -1 This site is If there is no


AUTHORIZED not authorization, you
authorized; cannot transfer a
there is license. Obtain
nothing to authorization before
transfer attempting to
transfer your license.

DT_TARGET_APP_NO -2 A copy of the A copy of the program


T_ FOUND program must be located in the
must be in target directory. If it is
the target not there, you cannot
directory transfer the license.

DT_FLOPPY_NOT_ -3 Illegal There are certain steps


ALLOWED attempt to that you must take when
transfer transferring by floppy
license to a disk. If you are using this
target call, ensure you are
directory on doing a direct transfer,
a floppy. not a transfer by floppy
disk.

C RY P K E Y S D K 1 8 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Message Solution


DT_SITEKEYFILE_NO -4 The Site Key This function must have
T_ FOUND file could not access to the site key
be opened. file. If this function
cannot access the site
key file, the function
gives you errors. Ensure
the file is in the
application directory. If
you encounter this
problem, please email
support@crypkey.com.

DT_RSTKEYFILE_NOT -5 The This function must have


_ FOUND restriction file access to the restriction
could not be file. If this function
opened. cannot access the
restriction file, the
function gives you
errors. Ensure this file is
in the application
directory. If you
encounter this problem,
please email
support@crypkey.com.

DT_COULDNOT_WRI -6 The target This function must read


TE_ SITEKEYFILE directory and write to specific files
may be write in your directory. If you
protected. are able to do this but
still receive this error,
please email us at
support@crypkey.com.

DT_SOURCE_WRITE_ -7 The directory This function must read


PROTECTED of the source and write in both the
license for target and source
the transfer directories. If you are
is write able to do this but
protected. continue to have
problems, please email
us at
support@crypkey.com.

1 8 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Message Solution


DT_SOURCE_SAME_A -8 The source To use this function you
S_ TARGET directory is must be transferring
also being from one directory to
used as the another. You cannot
target transfer a license from a
directory. directory into the same
directory.

GeneralerrorvaluesalsoapplyseeSection12.2:GeneralErrorValues.

Notes
TheDirectTransfer()functionoverwritesanexistinglicenseatthetarget
locationwithoutwarning.Therefore,alwaysbecarefultocheckwhether
overwritingisdesirable.

12.3.7 EndCrypkey()
EndCrypkey()notifiesCrypKeythattheprotectedprogramisbeing
terminated.ThisallowsCrypKeytoensurethatitsstateofoperationisreleased
properlybeforehand.

Usage
EnsurethatEndCrypkey()iscalledbeforetheprotectedprogramterminates.
Forexample,ifyouarewritinginC++,agoodplacetocallthisfunctionisinthe
applicationobjectdestructor.NotethatyoumustensureEndCrypkey()is
callednomatterhowthecustomershutsdownyourprogram,evenifthe
customerdoubleclicksontheSystemmenu.

Prototypes
Language Syntax

C void EndCrypkey();

C++ void EndCrypKey();

VB EndCrypKey()

C#.NET void EndCrypKey();

C RY P K E Y S D K 1 8 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Notes
EndCrypkey()isusedonlytoupdatethestatusofamultiuserfloatinglicense.
Itisnotrequiredforanyotherpurpose;therefore,ifaprogramterminates
abnormallywithoutcallingthisfunction,therewillnotbeanyabnormaleffects
fromCrypKeywhentheprogramisrestarted.

12.3.8 ExplainErr()
ExplainErr()returnsastringexplainingthereturncodesofCrypKeyfunctions.

Note:thedatatypeCKExplainEnum(seeSec.5.4.7:COMObjectConstants)
containstheconstantvaluesforerrorshandledbyCOMObjects.Seealso
theGetLastError()function.

Usage
Itisnotmandatorythatyoushowtheseparticularexplanationstotheuser,but
itisrecommendedthatsomeexplanationbegivenwhenaCrypKeyerrordoes
occur.

Prototypes
Language Syntax
C char *ExplainErr (int functioncode, int
errcode);

C++ BSTR *ExplainErr (long nFunctionCode, long


nErrorCode);

VB ExplainErr (nFunctionCode as Long, nErrorCode as


Long) as ByRef String

C#.NET String *ExplainErr (CKExplainEnum nFunctionCode,


int nErrorCode);

1 8 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Parameters
Functioncode
Functioncodemustbeoneoftheelementsinthetablebelow.Thesecodesare
definedincrypkey.h.Functioncodedetermineswhichfunctionisexplained.

Table 13: Functioncode Values


Name Value Function
EXP_AUTH_ERR 1 GetAuthorization()
EXP_GET_SITECODE_E 2 GetSizeCode()
RR
EXP_SAVE_SITEKEY_ER 3 SaveSiteKey()
R
EXP_REG_ERR 4 RegisterTransfer()
EXP_TO_ERR 5 TransferOut()
EXP_TI_ERR 6 TransferIn()
EXP_DT_ERR 7 DirectTransfer()
EXP_INIT_ERR 8 InitCrypkey()
EXP_RTT_ERR 9 ReadyToTry(),Days(), Runs()
EXP_KL_ERR 10 KillLicense()

Errcode
ErrcodeisthespecificerrorcodereturnedbyoneoftheSLAPIfunctions.The
functionsarelistedinTable13.

Return Value
ExplainErr()returnstheappropriateerrormessage.

12.3.9 ExplainErr2()
ExplainErr2()returnsastringexplainingthereturncodesofvariousother
SLAPIfunctions.ThisfunctionissimilartoExplainErr(),buttheerrormessage
iswrittenintoyourstringtextinsteadofbeingreturnedasastring.

Note:thedatatypeCKExplainEnum(seeSec.5.4.7:COMObjectConstants)
containstheconstantvaluesforerrorshandledbyCOMObjects.Seealso
theGetLastError()function.

C RY P K E Y S D K 1 8 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Usage

Itisnotmandatorythatyoushowtheseparticularexplanationstotheuser,but
itisrecommendedthatsomeexplanationbegivenwhenaCrypKeyerrordoes
occur.

Prototypes
Language Syntax
C void ExplainErr2 (int func, int err, char
*text);

C++ void ExplainErr2 (long nFunctionCode, long


nErrorCode, BSTR *pbstrError);

VB ExplainErr2 (nFunctionCode as Long, nErrorCode


as Long, strError as ByRef String)

C#.NET String *ExplainErr2 (CKExplainEnum


nFunctionCode, int nErrorCode);

Parameters
Functioncode
Functioncodemustbeoneoftheelementsinthetablebelow.Thesecodesare
definedincrypkey.h.Functioncodedetermineswhichfunctionisexplained.

Table 14: Functioncode Values


Name Value Function
EXP_AUTH_ERR 1 GetAuthorization()
EXP_GET_SITECODE_E 2 GetSizeCode()
RR
EXP_SAVE_SITEKEY_ER 3 SaveSiteKey()
R
EXP_REG_ERR 4 RegisterTransfer()
EXP_TO_ERR 5 TransferOut()
EXP_TI_ERR 6 TransferIn()
EXP_DT_ERR 7 DirectTransfer()
EXP_INIT_ERR 8 InitCrypkey()

1 8 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Function


EXP_RTT_ERR 9 ReadyToTry(), Days(), Runs()
EXP_KL_ERR 10 KillLicense()
EXP_AL_ERR 11 AcquireLicense()
EXP_HDSN_ERR 12 GetDrivePermanentSerialData()
EXP_FLS_ERR 13 FloatingLicenseSnapshot()

Errcode
ErrcodeisthespecificerrorcodereturnedbyoneoftheSLAPIfunctions.The
functionsarelistedinTable14.

Text
Thetextparameterisapointertothebufferwheretheerrormessageiswritten.
Itmustbe80charactersinsize.

Note
ExplainErr2()isanoptionalalternativetotheExplainErr()function.

12.3.10 FloatingLicenseGetRecord
ThisfunctionisusedonlyinCOMObjectsandC#.NETAssemblies.Calledfrom
anapplicationthathasauthorization,thefunctionreturnsasinglerecordofthe
currentfloatinglicensestatus.ThefunctionFloatingLicenseTakeSnapshot(),
usedonlyinCOMObjectsandC#.NETAssemblies,mustbecalledbeforethis
function.

Prototypes
Language Syntax
C [n/a]

C++ long FloatingLicenseGetRecord (long nRecord,


IcrypKeySDKFloatRecord **ppRecord, long
*pnResult);

VB [n/a]

C#.NET int FloatingLicenseGetRecord (int nRecord,


CrypKeyFloatRecord *pRecord);

C RY P K E Y S D K 1 8 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Notes
ThisfunctionoperatesonlyinCOMObjectsandC#.NETAssemblies.

12.3.11 FloatingLicenseSnapshot
TheFloatingLicenseSnapshot()functiongivesasnapshotofallusersholding
orwaitingforanetworkfloatinglicense.Thefunctionfillsthebufferwith
entries,oneforeachuseraccessingthelicense.

Eachentrycontainsthecomputername,userloginname,localtimeatwhich
theuserstartedusingorwaitingforalicense,andtheusersqueuestatus(0
meanstheyhavealicense,otherwiseitisanintegerthatindicatestheorderin
whicheachentrygetsalicense).Thisisthepertinentinformationgiven;therest
isforinternaluse.

Prototypes
Language Syntax
C int FloatingLicenseSnapshot (unsigned long
bufSize, int *numEntries, FLS_REC *buf);

C++ long FloatingLicenseTakeSnapshot (long


*pnEntries, long *pnResult);

VB FloatingLicenseTakeSnapshot (pnEntries as ByRef


Long) as Long

C#.NET CKFloatSnapErrorEnum FloatingLicenseTakeSnapshot


(int *pnEntries);
// unsafe

- or -

FloatSnapErrorEnum FloatingLicenseTakeSnapshot2
(); // safe
- plus -
int FloatingLicenseGetNumEntries (); // safe

1 8 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Parameters
Bufsize
Bufsizeisthesizeofthebufferallocatedtoreceivetheinformation.

NumEntries
NumEntriesisapointertoanintegersizedbufferthatreceivesthenumberof
entriesinthetable.

Buf
Bufisapointertoabufferofatleastbufsizebytesinsizeandreceivesoneentry
foreachuserthatiscurrentlyaccessing,orattemptingtoaccess,thelicense.

Return Value

Table 15: Floating License Snapshot Return Values


Name Value Meaning Solution
FLS_OK 0 The function
completed
successfully.
FLS_NO_NETWORK_L -1 Application Ensure you have a
ICENSE does not floating license before
have a using this function.
floating
license.
FLS_NETWORK_TABL -2 Network Contact CrypKey
E_NOT_FOUND table file technical support if you
(.tb2) could get this error.
not be found.
FLS_COULDNOT_OPE -3 Network Contact CrypKey
N_USERTABLE_FILE table file technical support if you
(.tb2) could get this error.
not be
opened.
FLS_BUFFER_TOO_SM -4 Buffer not Ensure you have
ALL large enough allocated enough space
to hold in your buffer to receive
snapshot this information.
information.

C RY P K E Y S D K 1 9 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Notes
TheversionofthisfunctionusedinCOMObjectandC#.NETisnamed
FloatingLicenseTakeSnapshot()andisusedinconjunctionwiththeCOM
ObjectandC#.NETfunctionFloatingLicenseGetRecord().

Ascommentedintheprototypes,thefirstC#.NETcodegiven:

CKFloatSnapErrorEnum FloatingLicenseTakeSnapshot (long


*pnEntries);

isunsafecode.

ThesecondC#.NETcodegiven:

FloatSnapErrorEnum FloatingLicenseTakeSnapshot2 (); safe


- plus -
long FloatingLicenseGetNumEntries ();

issafecode.

FLS_RECisthestructureofeachinformationalentry.ItisdefinedinCrypKey.h.
ThecontentsofeachrecordaredescribedinTable16:FloatingLicense
SnapshotRecordStructure.SeealsoSec.5.4.9:ReferencingtheFloating
LicenseSnapshotRecord,whereyouwillfindtheC++andC#.NETprototypes
forfunctionsusedtoencapsulatetheFLSrecord.

Table 16: Floating License Snapshot Record Structure


Item Name Size (Bytes) Description

Id 2 unique id for the record, used internally


Update 4 timestamp of last update, used internally
Status 2 if running: 0
if waiting: a positive integer representing the
queue position
Starttime 4 local timestamp of when the application started
running or waiting in the queue could be
seconds since 1900 or 1970, depending on the
compiler

1 9 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

UserName 16 text user name


ComputerNam 16 text computer name
e
Spare 32 reserved

12.3.12 Get1RestInfo()
Get1RestInfo()isusedtoreturnoneofthreedifferenttypesofrestriction
information:licensetype,numberofdaysorrunsallowed,ornumberofdays
orrunsused.Thetypeofinformationreturneddependsonthevalueofthe
whichinputparameter.

Usage
UseGet1RestInfo()wheneveryouneedtogetlicenserestrictioninformation.

Prototypes
Language Syntax
C int Get1RestInfo (int which);

C++ long Get1RestInfo (long nWhich);

VB Get1RestInfo (nWhich as Long) as Long

C#.NET CKGet1ErrorEnum Get1RestInfo (CKWhichEnum


nWhich);

Parameter
Which
Thewhichparameterissettooneofthefollowing:

1: returnsauthopt(indicatingwhetherthelicenseisunlimited,daysbased,
orrunsbased)

2: returnsnum_allowed(indicatingthenumberofdaysorrunsallowed)

3: returnsnum_used(indicatingthenumberofdaysorrunsused)

C RY P K E Y S D K 1 9 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 17: Get1RestInfo() Values


Name Value Message
not defined 0- Returns the which variable as defined
32768 above.
G1_OUT_OF_RANGE -1 The which variable is out of range.

Note
Get1RestInfo()isanoptionalalternativetousingtheGetRestrictionInfo()
function.

12.3.13 GetAuthorization()
GetAuthorization()getsthelevelatwhichtheprotectedprogramisauthorized
torunalongwiththeoptionsenabledoranauthorizationfailurecode.Itisalso
usedtodecrementthenumberofruns,iftheapplicationisrestrictedbyruns.

Usage
GetAuthorization()canbecalledatyourdiscretiontodeterminethelevelof
authorizationthattheuserisgranted.Itcanalsobecalledtodecrementthe
numberofusestheprogramhasleftifitisrestrictedbynumberofruns.Call
thisfunctionaftercallinganyfunctionthatchangesthelicensestate,suchas
SaveSiteKey(),TransferOut()orTransferIn(),sothattheprogramcanalterits
behavioraccordingtothechangethathasoccurred.

Prototypes
Language Syntax
C int GetAuthorization (unsigned long *oplevel,
int decrement);

C++ long GetAuthorization (long *pnOptLevel, long


nDecrement);

VB GetAuthorization (nOptLevel as ByRef Long,


nDecrement as Long) as Long

C#.NET CKAuthErrorEnum GetAuthorization (int

1 9 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

*pnOptLevel, int nDecrement); // unsafe

Parameters
Oplevel
Oplevelisapointertoa32bitbuffer.Theoplevelisreturnedinthisvariableif
theprogramisauthorized.Itisacombinationofoptionandlevelinformation
storedin32bits.

Decrement
Ifthisnumberisnotzeroandtheprotectedprogramisrestrictedtothenumber
ofrunsallowed,thenumberofrunsremainingdecrementsbythisnumber.

Return Value

Table 18: GetAuthorization() Values


Name Value Meaning Solution
not defined >0 The program is You may want your
authorized to run. program to allow the
The program has a user to wait, by
floating license and recalling this function
more users are every 30 seconds until
requesting to use a seat becomes
the program than available, or the user
the license allows. gives up.
The number
indicates how many
users must quit
before the next user
is authorized to run.
CrypKey queues
requests for access
and provides access
on a first-come, first-
served basis.
AUTH_OK 0 The program is
authorized to run.

C RY P K E Y S D K 1 9 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


AUTH_INIT_FAIL -1 CrypKey has not If you get this error
been initialized. message, please
obtain the return value
from InitCrypkey().
Something has gone
wrong in the
InitCrypkey()
function call.
AUTH_DISALLO -2 An attempt is being If this error occurs, you
W_FLOPPY made to run the are probably trying to
protected program run a protected
from a floppy disk. program from a floppy
disk. CrypKey must
write a signature to
the hard drive. If the
program is running
from a floppy disk, it
cannot write to the
hard drive.
AUTH_BAD_PAT -3 Could not read the If this error occurs,
H site key file. there is a problem
reading the site key
file on your hard drive.
You must have the
ability to read and
write directly to the
hard drive. If you are
able to read and write
directly to the hard
drive and you continue
to receive the error,
please email
support@crypkey.com.
AUTH_NOT_ -4 The program has If you receive this
PRESENT never been error, the program
authorized at the needs to be
current site. authorized. You can
authorize your
program using your
Site Key Generator.

1 9 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


AUTH_ -5 The program is If you receive this
DIFFERENT moved or the error, ensure the User
password is Key you are using in
incorrect. the InitCrypkey()
function call is the
same as the User Key
that was given to you
by CrypKey. If you
continue to receive
this error, please email
the User Key to
support@crypkey.com.
AUTH_BAD_ -6 The Master Key is If you receive this
MASTERKEY not correct for this error, ensure the
program. Master Key you are
using matches the
program name that
you are using in the
InitCrypkey()
function call. The file
name that must be in
the InitCrypKey()
function call is the
license file name that
you gave to CrypKey. If
you continue to have
problems, please
email all of the
information you have
to
support@crypkey.com.
AUTH_SITEKEY -7 The site key file is If you receive this
_CRC damaged or error, delete the
tampered with. license files and run
the application again.
You must be
reauthorized at this
time. Please email
support@crypkey.com
if this solution does
not work for you.

C RY P K E Y S D K 1 9 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


AUTH_TIME_TO -8 The system time is This error occurs when
O_EARLY set to a date earlier the system time is
than the date on moved. You must re-
which the Site Key authorize the software.
was issued. The system time
cannot be moved by
more than one hour
and fifteen minutes at
any time.
AUTH_TIME_ -9 The program is This error occurs when
SETBACK restricted by days the system time is
and the system time moved. You must re-
is set back. authorize the software.
The system time
cannot be moved by
more than one hour
and fifteen minutes at
any time.
AUTH_TIME_ -10 The program is The users time has
RUNOUT restricted by days expired. The user must
and the time has be re-authorized to
expired. use the software.
AUTH_RUNS_ -11 The program is The users time has
RESTR restricted by runs expired. The user must
and the number be re-authorized to
allowed is reached. use the software.
AUTH_NOT_ -12 The user tried to Ensure the user has
NOUGH_RUNS perform an more runs left than the
operation that number stated in the
requires more runs decrement parameter
than are available. of this function.
AUTH_MISSING -13 The restriction file is The CrypKey-protected
_ RST_FILE deleted. application cannot find
the .rst file in the
application directory. If
this file is moved or
deleted, the protected
application will not
run. The only way to
solve this problem is
to re-authorize the
user.

1 9 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


AUTH_RST_BA -14 The restriction file is This error occurs if the
D_ CRC damaged or user has attempted to
tampered with. alter the .rst file. The
only solution to this
problem is to re-
authorize the user.
Please contact
support@crypkey.com
if you continue to
receive this error.
AUTH_RST_BA -15 The restriction file is If this error occurs, you
D_ LOCATION moved or must re-authorize the
overwritten. user. This error can
occur for several
reasons (e.g., the user
runs Norton Utilities
Speed Disk, the user
uninstalls and
reinstalls, the user
changes the time on
the PC, the user
moves the application
directory, etc.). If you
continue to receive
this error, please
contact
support@crypkey.com.
AUTH_ENTRY_ -16 The user has This error is created
CHECK_FAIL attempted to reuse when a user is trying
an old site key. to enter a site key that
was not created for
the site code the user
has. Please obtain the
site code and request
the user to enter the
new Site Key.

C RY P K E Y S D K 1 9 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


AUTH_NETTABL -17 Could not open or If this error occurs,
E FILE_FAIL read the network ensure the user is able
user table file. to read and write to
the hard drive. When
running over a
network, CrypKey
creates a file with the
extension ._tb. This file
should be opened and
closed every time you
run a CrypKey-
protected application
over the network. If
you continue to
receive this error,
please contact
support@crypkey.com.
AUTH_NETMAX -18 More people are This error occurs when
_EXCEEDED using the protected more users try to use
program than SLAPI the protected
can handle. application than
authorized. If you
cannot eliminate this
error, please contact
support@crypkey.com.

1 9 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


AUTH_NETWO -19 An attempt is being This error occurs when
RK_NOT_ALLO made to run the the user who is trying
WED program in to run the application
client/server mode has not received a site
and a floating key that has network
license has not been privileges. If you
issued for the site. continue to receive
this error after
granting the
permissions, please
contact
support@crypkey.com.
AUTH_RSTFILE -20 .RST file is write Ensure this file is not
_WRITE_PROTE protected write protected.
C
AUTH_TIME_CL -21 Computer clock Reboot your computer.
OCK_TAMPERIN tampering detected Contact support if this
G error persists.
KEY_BAD_LOCA -22 Application site key If you have not moved
TION is moved or copied or copied your
application for this file,
contact support.

GeneralerrorvaluesalsoapplyseeSection12.2:GeneralErrorValues.

Notes
Theoptionsaresinglebitsofinformationthatcanbeturnedonoroff
individuallywhenalicenseiscreatedusingtheSiteKeyGenerator.Theoptions
existsothatyoucanturnonoroffdifferentfeaturesofyourproduct.The
optionsarestoredinanumericalsequencestartingatonewiththehighendbit
oftheoplevel32bitvalue.Theremainingbitsareusedtoholdthelevel
number.

ThelevelisanumberthatissetbytheSiteKeyGenerator.Itincrementally
controlsthequalityofsomeservicesyoursoftwareprovides,suchasthe
numberofrecordsallowedforadatabase.Themaximumleveldependsonthe
numberofoptionsyouhaveconfigured.

Thereare32bitsavailabletoboththeoptionandlevelvalues.Forexample,if
fouroptionsaredefinedinskw.ini,oplevellookslikethis:

C RY P K E Y S D K 2 0 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Figure 56: Options and Levels

Inthisexample,themaximumlevelis228or268,435,456.

InitCrypkey()mustbecalledatleastoncebyyourapplicationbeforeusingthe
GetAuthorization()function,andthisfunctionmustbecalledatleastonce
beforeanyotherSLAPIfunctioniscalled.

TheoptionsorlevelscanalsobeobtainedbyusingGetOption()orGetLevel().
Forsecurityreasons,thisistheonlyfunction,alongwithGetAuthorization2(),
thatcantellyouifanincorrectpasswordisenteredintotheSiteKeyGenerator.

TheC#.NETprototypefortheGetAuthorization()functionisunsafecode.The
safeC#.NETalternativeisGetAuthorization2().

12.3.14 GetAuthorization2()
ThisfunctionissimilartoGetAuthorization()inthatitdeterminesifthe
programisauthorizedtorun;anddecrementsthelicensecount.However,
GetAuthorization2()doesnotobtainoptionandlevelinformation.

Usage
ThisfunctionisusedinthesamemannerasGetAuthorization()andis
intendedforlanguagesthatareunabletoobtaintheopleveldataorforcases
whereyoudonotwanttoobtaintheopleveldata.

2 0 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Prototypes
Language Syntax
C int GetAuthorization2 (int decrement);

C++ long GetAuthorization2 (long nDecrement);

VB GetAuthorization2 (nDecrement as Long) as Long

C#.NET CKAuthErrorEnum GetAuthorization2 (int


nDecrement);

Parameter
Decrement
Ifthedecrementnumberisnotzeroandtheprotectedprogramisrestrictedby
thenumberofrunsallowed,thenumberofrunsremainingaredecrementedby
thedecrementnumber.

Return Value
SeeGetAuthorization()foradescriptionofthereturnvaluesforthisfunction.

Notes
InitCrypkey()mustbecalledatleastoncebyyourapplicationbeforethe
GetAuthorization2()functionisused.GetAuthorization2()mustbecalledat
leastoncebeforeanyotherSLAPIfunctioniscalled.

Forsecurityreasons,thisistheonlyfunction,alongwithGetAuthorization(),
thatcantellyouifanincorrectpasswordisenteredintotheSiteKeyGenerator.

ThisfunctionisanoptionalalternativetousingtheGetAuthorization()
function.

12.3.15 GetDrivePermanentSerialData()
GetDrivePermanentSerialData()isaproprietaryCrypKeysoftwarefunction
thataccessesthefollowingharddriveinformationonacustomerscomputer:
modelnumber,serialnumber,firmwaredata.

C RY P K E Y S D K 2 0 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.16 GetLastError()
Thisfunctionreturnsthetextforthelasterror.UnliketheSDKfunctions
ExplainErr()andExplainErr2(),thefunctioncodedoesnotneedtobe
supplied.ThefunctioncodeisseteachtimeoneofthefunctionsintheCOM
objectiscalled.Thus,thisfunctionreturndonlytheerrortextforthelast
functioncalled.

Prototypes
Language Syntax
C [n/a]

C++ BSTR *GetLastError ();

VB GetLastError () as String

C#.NET String *GetLastError ();

Notes
SeealsoGetLastErrorCode().

12.3.17 GetLastErrorCode()
Thisfunction,usedonlyinC#.NETAssemblies,returnsonlythenumberfor
thelasterror.UnliketheSDKfunctionsExplainErr()andExplainErr2(),the
functioncodedoesnotneedtobesupplied.Thefunctioncodeisseteachtime
oneofthefunctionsintheCOMobjectiscalled.Thus,thisfunctionreturns
onlytheerrornumberforthelastfunctioncalled.

Prototypes
Language Syntax
C [n/a]

C++ [n/a]

VB [n/a]

C#.NET int GetLastErrorCode();

2 0 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.18 GetLevel()
Thisfunctionreturnsthelevelatwhichtheprotectedprogramisauthorizedto
run.

Usage
Youmayusethisfunctionatyourdiscretion.

Prototypes
Language Syntax
C unsigned long GetLevel (int numDefineOpts);

C++ long GetLevel (long nNumOptions);

VB GetLevel (nNumOptions as Long) as Long

C#.NET int GetLevel (long nNumberOfOptions);

Parameter
NumDefineOpts
NumDefineOptsisthenumberofoptionsthattheprotectedprogramhas
defined.

Return Value
Thereturnvalueisthecurrentlevelthatisavailabletotheuserfromthe
program.

12.3.19 GetNetHandle()
TheGetNetHandle()functiongetsandreturnsthenetworklicensehandleof
theprotectedprogram.

Usage
IfyouwantseveralSLAPIlicensedprogramssharingasinglenetworkseat,you
canusethisfunctiontogetthehandleandthendistributeitusingthe
SetNetHandle()function.Thisfunctionshouldbecalledonlyaftersuccessful
callstoInitCrypkey()andGetAuthorization()havebeenmade.

C RY P K E Y S D K 2 0 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Prototypes
Language Syntax
C unsigned short GetNetHandle ();

C++ long GetNetHandle ();

VB GetNetHandle () as Long

C#.NET int GetNetHandle ();

Return Value
Thisfunctionreturnsthehandletoanetworkresource.

Notes
Theusermustdesignawaytotransmitthereturnvaluetootherexecutables
sharingthenetworkseat(seetheSetNetHandle()functiondescriptionin
Section12.3.33:SetNetHandle()formoreinformation.

OnlyoneoftheprogramssharingthenetworkseatcancallEndCrypkey()
successfullypreferably,thelastprogramtostopexecutingcallsthisfunction
sincethismeansthatusageofthenetworkseatisclearlynolongerrequired.

12.3.20 GetNumCopies()
GetNumCopies()obtainsthenumberofcopiesthatthesiteisgrantedunder
thecurrentlicenseprovidedtoit.

Usage
Ifyouwanttograntmultiplecopysitelicenses,theprogramshoulddisplaythe
numberofcopiesitisgrantedtotheuser.Thecopiescanbedistributedbythe
userthroughthetransferfunctions.

2 0 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Prototypes
Language Syntax
C int GetNumCopies ();

C++ Long GetNumCopies ();

VB GetNumCopies () as Long

C#.NET CKCopiesErrorEnum GetNumCopies ();

Return Value

Table 19: GetNumCopies() Values


Name Valu Message
e
Not defined 0- Returns the number of license copies
255 available.
GNC_CRYPKEY_NOT_ -1 CrypKey has not been initialized.
INITIALIZED

12.3.21 GetNumMultiUsers()
GetNumMultiUsers()getsthenumberofusersthatthesitehasgrantedinits
license.

Usage

Ifyouwanttograntmultipleusersitelicenses,theapplicationshoulddisplay
thenumberofusersithasgrantedtotheuser.

Prototypes
Language Syntax
C int GetNumMultiUsers ();

C++ long GetNumMultiUsers ();

VB GetNumMultiUsers () as Long

C#.NET int GetNumMultiUsers ();

C RY P K E Y S D K 2 0 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value
Thisfunctionreturnsthenumberofconcurrentnetworkusesgrantedinthe
license.

12.3.22 GetOption()
GetOption()determinesthestatusofaspecificoption.Thefunctiongetsthe
optionbitspecifiedinthecurrentauthorizationlicense.

Usage
Youcancallthisfunctionatyourdiscretion.

Prototypes
Language Syntax
C int GetOption (int numDefineOpts, int optnum);

C++ long GetOption (long nNumOptions, long


nOptionNum);

VB GetOption (nNumOptions as Long, nOptionNum as


Long) as Long

C#.NET CKOptionErrorEnum GetOption (int


nNumberOfOptions, int nOptionNumber);

Parameters
NumDefineOpts
NumDefineOptsisthenumberofoptionsthattheprotectedprogramhas.

Optnum
Optnumisthenumberoftheoptionforwhichyouwantastatus.

2 0 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 20: GetOption() Values


Name Valu Message
e
OPTION_ON 1 The specified option is on.
OPTION_OFF 0 The specified option is off.
OPTION_UNAUTHORIZ -1 The program is not authorized.
ED

Note
Thisfunctionisasimpleralternatetoobtainingtheoptionfromthe
informationpassedbytheGetAuthorization()function.

12.3.23 GetRestrictionInfo()
GetRestrictionInfo()getsinformationonanyrestrictionsthatarepresentinthe
license.

Usage
Itisnotnecessarytotakeanyactiononthisinformation,however,youmay
wanttodisplaythisinformationatyourdiscretion.

Prototypes
Language Syntax
C int GetRestrictionInfo (int *authopt, unsigned
long *start_date, int *num_allowed, int
*num_used);

C++ long GetRestrictionInfo (long *pnAuthOpt, long


*pnStartDate, long *pnNumAllowed, long
*pnNumUsed);

VB GetRestrictionInfo (nAuthOpt as ByRef Long,


nStartDate as ByRef Long, nNumAllowed as ByRef
Long, nNumUsed as ByRef Long) as Long

C#.NET CKRestrictionErrorEnum GetRestrictionInfo (int


*pnAuthOpt, int *pnStartDate, int

C RY P K E Y S D K 2 0 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

*pnNumberAllowed, int *pnNumberUsed);

Parameters
Authopt
Authoptissettooneofthevalueslistedinthefollowingtable(asdefinedin
crypkey.h):

Table 21: Authopt Values


Name Valu Meaning
e
RESTR_NONE 0 Unlimited
RESTR_TIME 1 Days
RESTR_RUNS 2 Runs

Start_date
Start_dateissettothedatethelicensewasissued,insecondssincethestartof
theyear1970(UniversalCoordinatedTime).

Num_allowed
Num_allowedissettothenumberofdaysorrunsallowedbythecurrent
license.

Num_used
Num_usedissettothenumberofdaysorrunsinthecurrentlicenseusedupso
far.

Return Value

Table 22: Num_used Values


Name Valu Meaning
e
GRI_OK 0 The restriction information is valid.
GRI_INVALID -1 The restriction information is not valid.

2 0 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Notes
TheGetRestrictionInfo()functionisvalidonlyiftheprotectedprogramis
authorizedtorunoriftheprogramisnotauthorizedtorunduetoexpired
restrictions(i.e.,ifthedaysorrunshaveexpired).

Thealgorithmforbreakingdownthestart_datefordisplayinCcodeisas
follows:

#include "time.h"
char* _sgtime(long ltime);
m_datetime = _sgtime(start_date);
char* _sgtime(long ltime)
{
static char time_str[60];
struct tm *t;
ltime -= 2209075200;
t = gmtime(&ltime);
if(t != NULL)
{
strcpy(time_str,_ultoa(t->tm_mday,text,10));
strcat(time_str,"-");
strcat(time_str,_ultoa(t->tm_mon+1,text,10));
strcat(time_str,"-");
strcat(time_str,_ultoa(t->tm_year,text,10));
strcat(time_str," ");
strcat(time_str,_ultoa(t->tm_hour,text,10));
strcat(time_str,":");
strcat(time_str,_ultoa(t->tm_min,text,10));
strcat(time_str,":");
strcat(time_str,_ultoa(t->tm_sec,text,10));
}
else
{

C RY P K E Y S D K 2 1 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

strcpy(time_str,"Predates 01-01-70 00:00:00");


}
return(time_str);
}
InVisualBasic,youcanpassthevalueofstart_datereturnedby
GetRestrictionInfo()toasingleprecisionvariableandthenadd216(65,536)to
theresulttogetthecorrectnumber.This,ineffect,replacesthebitthatwas
truncatedbecauseVisualBasicslongintegerissigned,butthevaluethatis
returnedisunsigned.

12.3.24 GetSiteCode()
GetSiteCode()obtainsthesitecodeforthecomputeranddirectoryfromwhich
aprotectedprogramisrun.Thesitecodemustbereportedbytheuserbeforea
sitekeycanbeissuedfortheprogram.

Usage
IftheprotectedprogramdetectsitisnotauthorizedviatheGetAuthorization()
function,itmust,atminimum,showtheprogramssitecodeandallowtheuser
toenterasitekey.

Prototypes
Language Syntax
C int GetSiteCode (char *site_code);

C++ long GetSiteCode (BSTR *pbstrSiteCode);

VB GetSiteCode (strSiteCode as ByRef String) as


Long

C#.NET CKCodeErrorEnum GetSiteCode (StringBuilder


*pbstrSiteCode);

Parameter
Site_code
Site_codemustbeacharacterbufferofatleast30bytesinsize.Thefunction
storesthesitecodeinthebuffer.

2 1 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 23: GetSiteCode() Values


Name Valu Message Solution
e
GSC_OK 0 Function was
performed
successfully.
GSC_CRYPKEY_NO -1 CrypKey has This occurs if there is a
T_ INITIALIZED not been problem in the
initialized. InitCrypkey() function.
Please refer to the
description about this
function for more
information. If you
continue to receive this
message, please contact
support@crypkey.com.
GSC_ENTRY_FILEO -2 The entry file This occurs when you
PEN_FAIL could not be cannot access the .ent file.
opened. You must be able to read
from and write to this file.
If you continue to receive
this message, please
contact
support@crypkey.com.

12.3.25 GetSiteCode2()
GetSiteCode2()returnsapointertothesitecodefortheprogramlocation.The
sitecodemustbereportedbytheuserbeforeyoucanissueasitekey.

Usage
IftheprogramdetectsitisnotauthorizedviatheGetAuthorization()function,
itmust,atminimum,showtheprogramssitecodeandallowtheusertoentera
sitekey.

C RY P K E Y S D K 2 1 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Prototypes
Language Syntax
C char *GetSiteCode2 ();

C++ BSTR *GetSiteCode2 ();

VB GetSiteCode2 () as ByRef String

C#.NET String *GetSiteCode2 ();

Return Value
Thisfunctionreturnsapointertothesitecode.

Note
ThisfunctionisanoptionalalternativetousingtheGetSiteCode()function.

12.3.26 InitCrypkey()
InitCrypkey()initializesCrypKeywithruntimeinformation;thisfunctionmust
becalledbeforeanyotherCrypKeyfunction.

Usage
CallInitCrypkey()attheprogramstartup.Forexample,ifyouareusingC++,a
goodplacetodothisisintheapplicationobjectconstructor.

2 1 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Prototypes
Language Syntax
C int InitCrypkey (char *filepath, char
*masterkey, char *userkey, int allow_floppy,
unsigned network_max_checktime);

C++ long InitCrypKey (BSTR bstrFilePath, BSTR


bstrMasterKey, BSTR bstrUserKey, long
nAllowFloppy, long nNetworkTimeout);

VB InitCrypKey (strFilePath as String, strMasterKey


as String, strUserKey as String, nAllowFloppy as
Long, nNetworkTimeout as Long) as Long

C#.NET CKInitErrorEnum InitCrypKey (String


*pstrFilePath, String *pstrMasterKey, String
*pstrUserKey, int nAllowFloppy, int
nNetworkTimeout);

Parameters
Filepath
Filepathisthepathoftheprogramfilethatischeckedforauthorization.This
filenamecanbethesamenameasyourexecutableorDLL,oryoucanchoose
touseadummyfileifyouhavemorethanoneapplicationthatyouwouldlike
toprotectwithinyourproduct;simplychooseafilenamethatisalwayspresent
inyourapplicationdirectory.Thisdummyfileneednotcontainany
information,itsimplymustresideintheapplicationdirectoryandbespecified
intheInitCrypkey()functioncall.

Masterkey
MasterkeyisthehexadecimalstringassignedtoyourprogrambyCrypKey
(Canada)Inc.atpurchasetime.

Userkey
UserkeyisthehexadecimalstringassignedtoyourpasswordbyCrypKey
(Canada)Inc.atpurchasetime.

C RY P K E Y S D K 2 1 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Allow_floppy
Setallow_floppyto1toallowauthorizationofaprogramonafloppy.Thisis
usuallysetto0,astheentirefloppycanbesuccessfullybitcopied.

Network_max_checktime
Network_max_checktimeisthetime,inseconds,thatCrypKeywaitsfora
programtocheckforauthorizationunderafloatinglicense.Afterthistime,the
userisdeletedfromthequeueofuserscurrentlyusingtheprogramorwaiting
foraccesstoit.ThisishowCrypKeyhandlesuserswhomaynothaveloggedoff
properlybyusingEndCrypkey()(perhapsbecausetheircomputercrashed).If
theuserattemptstoaccesstheprogramagain,theuserisputattheendofthe
queue,behindanyotherusersalreadyusingtheprogramorwaitingforaccess.
Thenumberyouchooseforthisparameterdependsonhowoftenyoucall
GetAuthorization(),butitalsodetermineshowfastahungcomputeris
detectedbyCrypKeyandthelicenseonthatcomputerlicensereleasedfor
otherstouse.WerecommendthatyoucallGetAuthorization()every5to30
minutes,dependingontheapplication.Thesettingfor
network_max_checktimeshouldbetwotothreetimestheGetAuthorization()
interval.

2 1 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 24: InitCrypkey() Values


Name Value Meaning Solution
INIT_OK 0 CrypKey
initialization
was
successful.
INIT_FILE_NOT_FOUN -1 The program This error occurs if the
D file could not license file that you
be located. specified is not located
in the application
directory. You must
ensure that the file that
you specified in the
filepath parameter of
the InitCrypKey()
function call is in the
location that you stated.
If you continue to
receive this error, please
contact
support@crypkey.com.
INIT_MASTERKEY_CR -2 The Master If you receive this error,
C_FAILURE Key in the ensure the file name in
program the filepath parameter
source code matches the file name
is incorrect. you sent to CrypKey for
your Master Key. Also,
ensure the Master Key
that was sent to you is
the same as the Master
Key that is in your
masterkey parameter in
the InitCrypkey()
function call. If you
continue to receive this
error, please contact
support@crypkey.com.

C RY P K E Y S D K 2 1 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


INIT_BAD_PRODUCT_ -3 The Master This error occurs if the
NAME Key does not Master Key in the
match the InitCrypkey() function
program does not match the file
name (i.e., name you specified in
the Master the InitCrypkey()
Key in function. If you continue
EXAMPLE.C to receive this error,
only works please contact
for a program support@crypkey.com.
named
EXAMPLE.EX
E). CrypKey
supplies you
with a Master
Key for your
program.
INIT_KEYFILE_CREATI -4 There was no If you encounter this
ON_FAIL available disk error, ensure you have
space to full permission to the
write the key application directory.
file or the CrypKey must be able to
directory is read and write directly
write to the hard drive. If you
protected. continue to receive this
error, please contact
support@crypkey.com.
INIT_NETWORK_NOT -5 An attempt is If this error occurs,
_ PURCHASED being made ensure you have the
to run the ability to create network
program in a licenses. The fastest way
network to do this is to contact
context support@crypkey.com.
without
purchasing
the network
license.

2 1 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


INIT_NT_NOT_ -6 An attempt is If this error occurs,
PURCHASED being made ensure you have the
to run the ability to create network
program in a licenses. The fastest way
Win16 NT to do this is to contact
context support@crypkey.com.
without
purchasing
the NT
license.
INIT_NT32BIT_NOT_ -7 An attempt is If this error occurs,
PURCHASED being made ensure you have the
to run the ability to create network
program in a licenses. The fastest way
Win32 NT to do this is to contact
context support@crypkey.com.
without
purchasing
the NT
license.
INIT_WIN95_NOT_ -8 An attempt is If this error occurs,
PURCHASED being made ensure you have the
to run the ability to create network
program licenses. The fastest way
under to do this is to contact
Windows 95 support@crypkey.com.
without
purchasing
the Windows
95 license.
INIT_WIN32S_NOT_ -9 An attempt is If this error occurs,
PURCHASED being made ensure you have the
to run the ability to create network
program licenses. The fastest way
under the to do this is to contact
Win32s support@crypkey.com.
context
without
purchasing
the Win32s
license.

C RY P K E Y S D K 2 1 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


INIT_MULTIPLE_CALL_ -10 This function This error occurs if you
TO_INIT has already call InitCrypkey() more
been called than once before the
during the EndCrypKey() function
execution of is called. If you need
the protected further assistance,
program. please contact
support@crypkey.com.
INIT_THUNK_LIB_NO -11 The thunk If this error occurs,
T_ FOUND library could ensure you have both
not be found. crp9516f.dll and
cryp95f.dll in the
application directory.
These files are needed if
you are running on
Windows 95/98 and your
application is 32 bit. If
you need further
assistance, please
contact
support@crypkey.com.
INIT_THUNK32_DLL_ -12 A file is If you need further
CORRUPT corrupt or assistance, please
has been contact
tampered support@crypkey.com.
with.
INIT_THUNK16_DLL_ -13 A file is If you need further
CORRUPT corrupt or assistance, please
has been contact
tampered support@crypkey.com.
with.
INIT_32_DLL_CORRU -14 A file is If you need further
PT corrupt or assistance, please
has been contact
tampered support@crypkey.com.
with.
INIT_THUNK32_DLL_ -15 A file is Ensure you have the
VERSION outdated. distributor files that
match the version of
CrypKey you are using.

2 1 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Value Meaning Solution


INIT_THUNK16_DLL_ -16 A file does Ensure you have the
VERSION not match distributor files that
the installed match the version of
version of CrypKey you are using.
CrypKey.
INIT_THUNK32_DLL_ -17 A file is If you need further
TAMPERED corrupt or assistance, please
has been contact
tampered support@crypkey.com.
with.
INIT_THUNK16_DLL_ -18 A file is If you need further
TAMPERED corrupt or assistance, please
has been contact
tampered support@crypkey.com.
with.
INIT_THUNK32_DLL_ -19 The file has If you need further
UNKNOWN ERROR detected an assistance, please
unknown contact
problem. support@crypkey.com.
INIT_THUNK16_DLL_ -20 The file has If you need further
UNKNOWN ERROR detected an assistance, please
unknown contact
problem. support@crypkey.com.
INIT_PRE_V6_MASTE -21 You are using Contact CrypKey for a
RKEY a master key version 6.0 master key.
from a
version
previous to
version 6.0 of
CrypKey.

GeneralerrorvaluesalsoapplyseeSection12.2:GeneralErrorValues.

Note
Thefilepathparametercannotbejustthefilenameofyourprogram;itwillnot
workundersomecircumstancesunderWindows95.Youmustcarefully
providethisfunctionthefullpathsothatitcanfindyourlicense.

C RY P K E Y S D K 2 2 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.27 KillLicense()
TheKillLicense()functionisusedtodisableanexistinglicenseandprovidesa
confirmationcodethatcanbeenteredintotheSiteKeyGeneratorinorderto
displaythedetailsofthedeauthorization.

Usage
Youcanusethisfunctionwhenyouwanttoremoveanexistinglicenseand
provideyourcustomerwiththemeansofprovingthatthelicenseisdeactivated
viatheconfirmationcode.

Prototypes
Language Syntax
C int KillLicense (char *confirmCode);

C++ long KillLicense (BSTR *pbstrConfirmCode);

VB KillLicense (bstrConfirmCode as ByRef String) as


Long

C#.NET CKKillErrorEnum KillLicense (StringBuilder


*pbstrConfirmCode); // unsafe

- or

String *KillLicense (); // safe

Parameter
ConfirmCode
ConfirmCodeisahexadecimalstringthatcanbeenteredintotheSiteKey
Generatortodisplayinformationconfirmingthatthelicenseisdeactivated.

2 2 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value
Table 25: KillLicense() Values
Name Valu Message Solution
e
KL_OK 0 Function
was
performed
successfully
.
KL_CRYPKEY_NOT_INITIALIZ -1 CrypKey If this error occurs,
ED has not yet obtain the return
been code from the
initialized. InitCrypkey()
function. Something
has gone wrong in
the InitCrypkey()
function call.
InitCrypkey() must
be called before this
function.
KL_CRYPKEY_NOT_AUTHOR -2 The This error indicates
IZED protected that the application
program is for which you are
not trying to kill the
authorized license does not
have authorization
and, therefore, you
cannot kill the
license.
KL_LICENSE_WRITE_PROTE -3 The license If this error occurs,
CTED files are ensure you are able
currently to read and write
write directly to the hard
protected. drive. If you cannot
do this, you cannot
perform this
function.

Notes
TheconfirmationcodeprovidedbythisfunctioncanbeenteredintheSite
CodefieldoftheSiteKeyGenerator.Informationaboutthelicensethatwas
terminatedisdisplayedwhenthecheckbuttonispressed.

C RY P K E Y S D K 2 2 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Thisfunctiondoesnotremovethespecialharddrivesignatureofthe
automaticlicensingfunctions.

AscommentedintheC#.NETprototype,thefirstcodegiven:

CKKillErrorEnum KillLicense (StringBuilder *pbstrConfirmCode);

isunsafecode.

ThesecondC#.NETcodegiven:

String *KillLicense ();

issafecode.

12.3.28 ReadyToTry()
TheReadyToTry()functionimplementsaonetimeautomaticlicensefora
CrypKeyprotectedapplication.Thislicenseisbasedonadaystimeperiod
withoutversioncontrol.

Usage
Thisfunctionneedstobecalledonlyonce,justafter
initialization/authorization.Thefirsttimeitiscalled,ittakesaminuteorsoto
setuptheautomaticlicense.Forsubsequentcallsatthesamesite,thisfunction
takesnoaction,asitdetectsthatithasalreadybeenrun.

Prototypes
Language Syntax
C int ReadyToTry (unsigned long oplevel, int
numDays);

C++ long ReadyToTry (long nOptLevel, long nNumDays);

VB ReadyToTry (nOptLevel as Long, nNumDays as Long)


as Long

C#.NET CKTryErrorEnum ReadyToTry (int nOptLevel, int


nDays);

2 2 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Parameters
Oplevel
Theoplevelparameteristhe32bitsthatcomprisethelevelandoptions.The
valuethatispassedhereisreturnedastheoplevelparameterinthe
GetAuthorization()function.

NumDays
NumDaysisthenumberofdaysforwhichyouwanttheprogramtobe
temporarilyauthorized.

C RY P K E Y S D K 2 2 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 26: ReadyToTry() Values

2 2 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
RTT_OK 0 The
function
completed
successfully
.
RTT_COULD_NOT_GET_SI -1 The This error occurs if you
TE_ CODE function are not able to retrieve
could not the site code
get the site information. You need
code the ability to read and
information write directly to the
. hard drive. If you do
not have this ability,
you cannot perform
this function. If you
continue to receive
this error, please
contact
support@crypkey.com.
RTT_COULD_NOT_GET_SI -2 The This error occurs if you
TE_ KEY function are not able to retrieve
could not the site key
get the Site information. You need
Key the ability to read and
information write directly to the
. hard drive. If you do
not have this ability,
you cannot perform
this function. If you
continue to receive
this error, please
contact
support@crypkey.com.

C RY P K E Y S D K 2 2 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
RTT_COULD_NOT_SAVE_S -3 The This error occurs if you
ITE_KEY function are not able to retrieve
could not the site code
save the information. You need
Site Key to the ability to read and
the hard write directly to the
drive. hard drive. If you do
not have this ability,
you cannot perform
this function. If you
continue to receive
this error, please
contact
support@crypkey.com.
RTT_RESERVED_4 -4 Reserved.
RTT_BAD_DOS -5 MS-DOS This error occurs if you
3.31 or or your user is not
higher running a system with
must be MS-DOS 3.31 or
running on higher. The user must
the site. use this as the
absolute minimum.
RTT_BAD_TRUENAME -6 Could not If you receive this
get the full error, you ensure the
pathname full path name of the
of the CrypKey license file is
protected located in the
program. InitCrypkey()
function. If you
continue to receive
this error, please
contact
support@crypkey.com.
RTT_NO_REDIRECT -7 This This error occurs if you
function are not running the
does not application off a local
work on drive of the server. If
network you continue to
redirector receive this error,
drives. please contact
support@crypkey.com.

2 2 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
RTT_NO_DPB -8 Could not If you receive this
get the error, please contact
drive CrypKey support at
parameter support@crypkey.com.
block from
the site
hard drive.
RTT_NO_MEM -9 Not enough This error occurs if
memory there is not enough
was memory available to
available to perform this function.
execute If you have plenty of
this memory available,
function. please contact
support@crypkey.com
RTT_CANT_GET_CLUSTER -10 Could not If you receive this
read a error, please contact
cluster CrypKey support at
from the support@crypkey.com.
site hard-
drive.
RTT_BAD_STAT -11 Could not If you receive this
get file error, please contact
statistics CrypKey support at
from the support@crypkey.com.
site hard
drive.

C RY P K E Y S D K 2 2 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
RTT_NO_ROOM -12 The site This error occurs if
hard drive there is not enough
has run out memory available to
of space. perform this function.
If you have plenty of
memory available,
please contact
support@crypkey.com.
RTT_BAD_SECTOR_READ -13 There is a If you receive this
bad sector error, please contact
read from CrypKey support at
the site support@crypkey.com.
hard drive.
RTT_BAD_SECTOR_WRITE -14 There is a If you receive this
bad sector error, please contact
write to the CrypKey support at
site hard support@crypkey.com.
drive.
RTT_FILE_SEARCH -15 The file If you receive this
search of error, please contact
the site CrypKey support at
hard drive support@crypkey.com.
has failed.
RTT_FILE_ACCESS -16 The If this error occurs,
function ensure the program
could not file is in the application
access the directory. If you
protected continue to receive
program this error, please
file. contact
support@crypkey.com.
RTT_FILE_NOT_FOUND -17 The If this error occurs,
function ensure the program
could not file is in the application
find the directory. If you
protected continue to receive
program this error, please
file. contact
support@crypkey.com.

2 2 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
RTT_FILE_OPEN -18 The This error occurs when
function the protected
could not application cannot be
open the opened. Ensure you
protected have full read and
program write privileges. If you
file. continue to receive
this error, please
contact
support@crypkey.com.
RTT_DONE_THIS -19 This This error occurs if the
program user tries to execute
has already the ReadyToTry()
had its trial period more than once
period at on a particular hard
this hard drive. This function
drive site. cannot be run twice.
The user must be
authorized to avoid
this error.
RTT_NO_SIG -20 The This error occurs if no
function signature is found on
could not the hard drive. A
find a signature should be
signature written to the hard
on the site drive the first time the
hard drive. software runs. If you
continue to receive
this error, please
contact
support@crypkey.com.
RTT_NO_LISTFILE -21 The If this error occurs,
function ensure you have the
could not most recent CrypKey
find a files. Send information
listfile on about the files you are
the site using to
hard drive. support@crypkey.com,
and we will advise you
how to proceed.

C RY P K E Y S D K 2 3 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
RTT_CANT_FIND_DRIVE -22 The If you receive this
function error, ensure you have
could not full read and write
find the site access to the hard
hard drive. drive. If you continue
to receive this error,
please contact
support@crypkey.com.
RTT_NO_GOOD_PUTS -23 The If this error occurs,
function ensure you have the
could not most recent CrypKey
find a good files. Send information
signature about the files you are
on the site using to
hard drive. support@crypkey.com.
RTT_NO_REAL_DRIVE -24 The If you receive this
function error, please contact
could not CrypKey support at
find a real support@crypkey.com.
drive.

2 3 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
RTT_32BIT_FILE_ACCESS -25 Windows If this error occurs,
3.11 32-bit ensure the 32-bit file
file access access is disabled. If it
must be is not disabled, you
disabled. cannot run a CrypKey-
protected application.
If you continue to
receive this error,
please contact
support@crypkey.com.
RTT_CLOSE_ALL_FILES -26 Another If you receive this
program error, please contact
has a disk CrypKey support at
lock on the support@crypkey.com.
site hard
drive.
RTT_MAX_RTTREQ_EXCEE -27 The This error occurs when
DED maximum the number of
number of days/runs of the trial
days/runs license has exceeded.
has You can avoid this
exceeded. error by authorizing
the user via the Site
Key Generator.

Notes
TheReadyToTry()functiondoesnotfeatureversioncontrollikeitsderivative
variantsReadyToTryDays()andReadyToTryRuns().Forprogramming
purposes,itsversionnumberparameterisalwaysconsideredtobezero.

Ifthereadytotryfeatureisused,itisagoodideatomakesurethattheuserhas
theabilitytoaccessthesitecodefromtheapplicationnomatterwhaterror
codeisreturned.Then,ifthereadytotryperiodfails,youcanalways
reauthorizeyourusersforxnumberofrunsordaysbycreatingasitekeyfor
them.

C RY P K E Y S D K 2 3 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.29 ReadyToTryDays()
TheReadyToTryDays()functionimplementsaonetimeautomaticlicensefor
aCrypKeyprotectedapplication.Thislicenseisbasedonadaystimeperiod
withversioncontrol.

Thisfunctionneedstobecalledonlyonce,justafter
initialization/authorization.Thefirsttimeitiscalled,ittakesaminuteorsoto
setuptheautomaticlicense.Forsubsequentcallsatthesamesite,thisfunction
takesnoactionunlesstheversionnumberisincremented.

Prototypes
Language Syntax
C int ReadyToTryDays (unsigned long oplevel, int
numDays, int version, int copies);

C++ long ReadyToTryDays (long nOptLevel, long


nNumDays, long nVersion, long nCopies);

VB ReadyToTryDays (nOptLevel as Long, nNumDays as


Long, nVersion as Long, nCopies as Long) as Long

C#.NET CKTryErrorEnum ReadyToTryDays (int nOptLevel,


int nDays, int nVersion, int nCopies);

Parameters
Oplevel
Theoplevelparameteristhe32bitsthatcomprisethelevelandoptions.The
valuethatispassedhereisreturnedastheoplevelparameterinthe
GetAuthorization()function.

NumDays
NumDaysisthenumberofdaysforwhichyouwanttheprogramtobe
temporarilyauthorized.

Version
ThisnumberisusedtodistinguishoneAutomaticLicenseimplementation
fromanother,whichallowssubsequentlicensestobecreatedbynewer
versionsoftheprotectedprogram.Itcanbefrom1upto32.

2 3 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Copies
Thisisthenumberoffixedlicensecopiesthatyouwishtogranttheuserwhen
thisfunctionisrun.

Return Value
SeeSection12.3.28:ReadyToTry()foralistofreturnvalues.

Notes
Theversionparameternormallyisbegunat1andproceedsincrementally
upwardsfromthereforeachnewreleaseoftheprogram.

Inordertocreateafloatinglicensewithaspecificnumberofmultiusers,you
canenteranegativevalueinthecopiesparameter.Thisresultsinafloating
licensewithanumberofusersequaltotheabsolutevalueofthenumber
entered(e.g.,7wouldcreateafloatinglicensewith7users).

12.3.30 ReadyToTryRuns()
TheReadyToTryRuns()functionimplementsaonetimeAutomaticLicense
foraCrypKeyprotectedapplication.Thislicenseisbasedonarunsrestriction
withversioncontrol.

Usage
Thisfunctionneedstobecalledonlyonce,justafter
initialization/authorization.Thefirsttimeitiscalled,ittakesaminuteorsoto
setupthereadytotrylicense.Forsubsequentcallsatthesamesite,this
functiontakesnoactionunlesstheversionnumberisincremented.

Prototypes
Language Syntax
C int ReadyToTryRuns (unsigned long oplevel, int
numRuns, int version, int copies);

C++ long ReadyToTryRuns (long nOptLevel, long


nNumDays, long nVersion, long nCopies);

VB ReadyToTryRuns (nOptLevel as Long, nNumDays as


Long, nVersion as Long, nCopies as Long) as Long

C#.NET CKTryErrorEnum ReadyToTryRuns (int nOptLevel,

C RY P K E Y S D K 2 3 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

int nRuns, int nVersion, int nCopies);

Parameters
Oplevel
Theoplevelparameteristhe32bitsthatcomprisethelevelandoptions.The
valuethatispassedhereisreturnedastheoplevelintheGetAuthorization()
function.

NumRuns
NumRunsisthenumberofrunsyouwanttheprogramtobeauthorizedfor
temporarily.

Version
Theversionnumberisusedtodistinguishoneautomaticlicense
implementationfromanother,allowingsubsequentlicensestobecreatedby
newerversionsoftheprotectedprogram.Theversionnumbercanbeavalue
from1to32.

Copies

Thecopiesparameteristhenumberoffixedlicensecopiesthatyouwantto
granttheuserwhenthefunctionisrun.

Return Value
SeetheReadyToTry()functiondescriptioninSection12.3.28:ReadyToTry()for
alistofreturnvalues.

Notes
Theversionparameternormallybeginsat1andproceedsincrementally
upwardsforeachnewreleaseoftheprogram.

Inordertocreateafloatinglicensewithaspecificnumberofmultiusers,you
canenteranegativevalueinthecopiesparameter.Thisresultsinthecreation
ofafloatinglicensewithanumberofusersequaltotheabsolutevalueofthe
numberentered(e.g.,7createsafloatinglicensewith7users).

2 3 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.31 RegisterTransfer()
TheRegisterTransfer()functioniscalledfromanapplicationthatdoesnotyet
haveauthorizationandregisterstheapplicationbyplacingregistrationfileson
adiskordirectory.Theseregistrationfilesareusedbyanapplicationthatdoes
haveauthorizationtotransfertheauthorization.

Usage
ThedirectoryfortransferismostlikelyA:\becausethetransferisusuallyfrom
onecomputertoanotherusingafloppydisk.However,thistransfercouldbe
fromonedirectorytoanotheronthesamecomputer,orevenfromone
networkdrivetoanother.Forthisreason,theusermustbeabletoenterthis
parameter.

Prototypes
Language Syntax
C int RegisterTransfer (char *directory);

C++ long RegisterTransfer (BSTR bstrDirectory);

VB RegisterTransfer (bstrDirectory as String) as


Long

C#.NET CKRegisterErrorEnum RegisterTransfer (String


*pstrDirectory);

Parameter
Directory
Thedirectoryparameterisapointertoanullterminatedtextstringthat
containsthepathofthedirectorywheresomeencryptedtextfiles(the
registration)areplaced.

C RY P K E Y S D K 2 3 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 27: RegisterTransfer() Values


Name Valu Message Solution
e
REG_OK 0 The function
completed
successfully.
REG_THIS_ALREADY_ -1 Only This error occurs if there
AUTHORIZED unauthorized is already a license
sites can present for the
receive application. You can only
transferred transfer a license into an
licenses. unauthorized
application. This
includes trial licenses.
REG_COULDNOT_OPE -2 The file could If this error occurs,
N_ TARGET_REGFILE not be please ensure you have
opened in read and write access to
the supplied the application directory.
directory due If you continue to
to invalid receive this error, please
directory, contact
write support@crypkey.com.
protection,
disk not
ready or no
disk space.
REG_TARGET_ALREAD -3 There are This error occurs if the
Y_ REGISTERED already application you try to
imprint files transfer already has
present in registration. This also
the supplied occurs if you have tried
directory. to register the transfer
more than once.
REG_SOURCE_ALREA -4 The site can This error occurs if the
DY_ REGISTERED only have application you try to
one transfer already has
outstanding registration. This also
registration occurs if you have tried
at a time. to register the transfer
more than once.

2 3 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
REG_CANNOT_OPEN_ -5 The If this error occurs,
REGFILE matching please ensure you have
registration read and write access to
file in the the application directory.
same If you continue to
directory as receive this error, please
the program contact
could not be support@crypkey.com.
opened.
REG_CANNOT_WRITE -6 The If this error occurs,
_ REGFILE matching please ensure you have
registration read and write access to
file in the the application directory.
same If you continue to
directory as receive this error, please
the contact
application support@crypkey.com.
could not be
written to.
GeneralerrorvaluesalsoapplyseeSection12.2:GeneralErrorValues.
Note
SeeSection9:MovingProtectedProgramsformoreinformation.

12.3.32 SaveSiteKey()
TheSaveSiteKey()functionisusedtosavetoafilethesitekeyissuedtothe
user.Thekeyischeckedfirstbeforeitissaved.

Usage
IftheprogramdetectsitisnotauthorizedviatheGetAuthorization()function,
itmust,atminimum,showtheprogramssitecodeandallowtheusertoentera
sitekey.

C RY P K E Y S D K 2 3 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Prototypes
Language Syntax
C int SaveSiteKey (char *site_key);

C++ long SaveSiteKey (BSTR bstrSiteKey);

VB SaveSiteKey (bstrSiteKey as String) as Long

C#.NET CKKeyErrorEnum SaveSiteKey (String


*pstrSiteKey);

Parameters

Site_key
Thesite_keyparameterisapointertothestringcontainingtheuserenteredsite
key.Spacesareremovedfromthekeybythisfunctionbeforeitisprocessed.

Return Value

Table 28: SaveSiteKey() Values


Name Valu Message Solution
e
SITE_KEY_OK 0 The function
completed
successfully.
SITE_KEY_ENTRY_CHE -1 The user is This error occurs if the
CK_ FAIL likely trying user attempts to re-
to reuse an enter a site key from a
old key. previous site code. The
user must give you the
site code they currently
have and must enter the
site key you create for
that site code.
SITE_KEY_ENTRY_CRC_ -2 The key has This error occurs only if
FAIL likely been the site key the user has
mistyped. entered is incorrect. The
most common mistake is
to enter a 1 rather
than an I.

2 3 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
SITE_KEY_FILEWRITE_ -3 The key file This error occurs if there
FAILURE could not be are no read and write
written (disk privileges to the
may be full). application directory. If
you continue to receive
this error, please contact
support@crypkey.com.
SITE_KEY_NO_LICENSE -4 No license This can occur if the
_TO_ADD_TO exists to customers license
which this expires before he has he
license can used his update key. The
be added. customer needs a new
authorization.
SITE_KEY_WRONG_AD -5 Cannot add Ensure that add-ons to
D_ON_TYPE licenses of the customers license
different have the same
types. Days restriction type that was
vs Runs. present in the original
license. For example,
you cant add days to a
runs-restricted license.

GeneralerrorvaluesalsoapplyseeSection12.2:GeneralErrorValues.

Note
SeeSection5.1:BasicProgrammingStepsformoreinformation.

GetSiteCode()mustbecalledbeforetheSaveSiteKey()functioniscalled.We
recommendthatyoualwaysshowthesitecodetotheuserbeforeorwhile
allowingtheusertoenterthesitekey.

YoushouldalwayscallGetAuthorization()tofindoutthechangeinthestateof
thelicenseimmediatelyafterthisfunction.

12.3.33 SetNetHandle()
TheSetNetHandle()functionsetsthenetworklicensehandle(i.e.passesthe
handleofaSLAPInetworkresourcetotheprogram).

C RY P K E Y S D K 2 4 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Usage
IfyouwantseveralSLAPIlicensedprogramssharingasinglenetworkseat,you
canuseGetNetHandle()togetthehandleandthendistributeitusingthe
SetNetHandle()function.TheSetNetHandle()functionshouldalwaysbe
calledafterthecalltoInitCrypkey()ismadeandbeforetheGetAuthorization()
callismade.

Prototypes
Language Syntax
C void SetNetHandle (unsigned short net_handle);

C++ long SetNetHandle (long nNetHandle);

VB SetNetHandle (nNetHandle as Long) as Long

C#.NET void SetNetHandle (int nNetHandle);

Parameter
Net_handle
Net_handleisahandletoanetworkresourceobtainedbycalling
GetNetHandle().

Note
OnlyoneoftheprogramssharingthenetworkseatcancallEndCrypkey()
successfullypreferably,thelastprogramtostopexecutingcallsthisfunction,
sincethismeansthatthenetworkseatisclearlynolongerrequired.

12.3.34 TransferIn()
Calledfromanapplicationthatdoesnothaveauthorization,theTransferIn()
functionimportsanotherauthorizationlicensebyreadingthetransferfiles
fromafloppydiskordirectorycreatedbytheTransferOut()function.Tobea
validtransfer,thesitecallingthisfunctionmusthavebeguntheprocessby
usingtheRegisterTransfer()function.

2 4 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Usage
ThedirectoryfortransferismostlikelyA:\becausethetransferisusuallyfrom
onecomputertoanotherusingafloppydisk.However,thistransfercouldbe
fromonedirectorytoanotheronthesamecomputerorevenfromonenetwork
drivetoanother.Forthisreason,theusermustbeabletoenterthisparameter.

Prototypes
Language Syntax
C int TransferIn (char *directory);

C++ long TransferIn (BSTR bstrDirectory);

VB TransferIn (bstrDirectory as String) as Long

C#.NET CKInErrorEnum TransferIn (String


*pstrDirectory);

Parameter
Directory
Thedirectoryparameterisapointertoanullterminatedtextstringthat
containsthepathofthedirectorywherethelicensefilesareimported.

C RY P K E Y S D K 2 4 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 29: TransferIn() Values


Name Valu Message Solution
e
TI_OK 0 The function
completed
successfully.
TI_THIS_ALREADY_ -1 A transfer in This error occurs if you
AUTHORIZED is allowed try to transfer a license
by an into an application that
unauthorize already has
d program authorization. You can
only. only transfer a license
into an unauthorized
application. A trial
license is considered a
license, so you must to
kill your trial license
before you can transfer
in a full authorization.
TI_HARDDISK_REGFILE -2 Registration If you receive this error,
_ NOT_FOUND file in the your system is not able
same to find the .reg file
directory as needed to perform the
the transfer. You must have
application completed the
is missing. RegisterTransfer() and
the TransferOut()
functions successfully
before you can perform
the TransferIn()
function.
TI_HARDDISK_REGFILE -3 Registration If you receive this error,
_ CRC_FAILURE file in the the .reg file is corrupted.
same The only way to solve
directory as this problem is to delete
the the .reg file you have
application and try the transfer
has been process again. If the
damaged or problem persists, you
tampered must request
with. authorization.

2 4 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
TI_REGFILE_NOT_FOU -4 Registration This error occurs if the
ND file not .reg file is not found in
found in the the directory specified
given direc- by the transfer function.
tory. This file must be in the
correct directory to
complete the transfer.
The RegisterTransfer()
and the TransferOut()
functions must be
completed successfully
before you can perform
the TransferIn()
function.
TI_REGFILE_CRC_FAILU -5 Registration If you receive this error,
RE file in the the .reg file is corrupted.
given The only way to solve
directory this problem is to delete
has been the .reg file you have
damaged or and try the transfer
tampered process again. If the
with. problem persists, you
must request
authorization.
TI_HARDDISK_REGFILE -6 Registration This error occurs if the
_ MOVED file in the .reg file is not found in
same the directory specified
directory as by the transfer function.
the This file must be in the
application correct directory to
has been complete the transfer.
moved. The RegisterTransfer()
and the TransferOut()
functions must be
completed successfully
before you can perform
the TransferIn()
function.

C RY P K E Y S D K 2 4 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
TI_REG_FILES_DONT_ -7 A copy of This error occurs if the
MATCH the transfer registration file in the
files from a directory to which you
previous are trying to transfer is
license different than the
transfer is registration information
probably on the floppy disk you
being used. are using to transfer.
TI_SOURCE_HAS_NO_ -8 The transfer In order to complete the
LICENSE out TransferIn() function,
operation you must first complete
has not the RegisterTransfer()
been done and the TransferOut()
yet. functions.
TI_SITEKEYFILE_NOT_ -9 The Site Key If you receive this error,
FOUND file was not please contact
found in the support@crypkey.com.
given
directory.
TI_DIFFERENT_SITEKE -10 The Site Key If you receive this error,
Y file or the .reg file is corrupted.
registration The only way to solve
file has this problem is to delete
been the .reg file you have
damaged or and try the transfer
tampered process again. If the
with. problem persists, you
must request
authorization.
TI_COULDNOT_WRITE_ -11 A write error If you receive this error,
SITEKEYFILE has please contact
occurred in support@crypkey.com.
the same
directory as
the
application.

2 4 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
TI_RSTKEYFILE_NOT_ -12 The This error occurs if the
FOUND restriction .rst file is not in the
file was not directory specified by
found in the the transfer function.
given This file must be in the
directory. correct directory to
complete the transfer. In
order to complete the
TransferIn() function,
you must first complete
the RegisterTransfer()
and the TransferOut()
functions.
TI_DIFFERENT_RSTFILE -13 The If you receive this error,
restriction the .rst file is corrupted.
file or the The only way to solve
registration this problem is to delete
file has the .rst file you have and
been try the transfer process
damaged or again. If the problem
tampered persists, you must
with. request authorization.
TI_COULDNOT_WRITE_ -14 A write error This error occurs if you
RSTKEYFILE has do not have the ability to
occurred in read and write to the
the same directory. If you continue
directory as to receive this error,
the please contact
application. support@crypkey.com.

GeneralerrorvaluesalsoapplyseeSection12.2:GeneralErrorValues.

Notes
SeeSection9:MovingProtectedProgramsformoreinformation.

C RY P K E Y S D K 2 4 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

12.3.35 TransferOut()
Calledfromanapplicationthathasauthorization,theTransferOut()function
exportstheapplicationsauthorizationlicensebyplacingtransferfilesona
floppydiskorinadirectorywherearegistrationfilealreadyexistsfromacallto
theRegisterTransfer()function.Thesetransferfilesmustbeusedbythesame
applicationthatcreatedtheinitialregistrationfilestotransferthelicensein.

Usage
ThedirectoryfortransferismostlikelyA:\becausethetransferisusuallyfrom
onecomputertoanotherusingafloppydisk.However,thistransfercouldbe
fromonedirectorytoanotheronthesamecomputerorevenfromonenetwork
drivetoanother.Forthisreason,theusermustbeabletoenterthisparameter.

Prototypes
Language Syntax
C int TransferOut (char *directory);

C++ long TransferOut (BSTR bstrDirectory);

VB TransferOut (bstrDirectory as String) as Long

C#.NET CKOutErrorEnum TransferOut (String


*pstrDirectory);

Parameter
Directory
Thedirectoryparameterisapointertoanullterminatedtextstringthat
containsthepathofthedirectorywherethelicensefilesareexported.

2 4 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Return Value

Table 30: TransferOut() Values


Name Valu Message Solution
e
TO_OK 0 The function
completed
successfully.
TO_THIS_NOT_AUTHORI -1 The This error occurs if you
ZED application try to transfer a license
must be out from an
authorized application that does
in order to not contain
do a transfer authorization. You can
out. only transfer a license
out of an authorized
application.
TO_REGFILE_NOT_FOUN -2 No If you receive this
D registration error, your system
file was cannot find the .reg
found in the file that is needed to
given do the transfer. You
directory. must complete the
RegisterTransfer()
function successfully
before you able
perform the
TransferOut()
function.
TO_REGFILE_CRC_FAILUR -3 The If you receive this
E registration error, the .reg is
file has corrupted. The only
been way to solve this
damaged or problem is to delete
tampered the .reg file you have
with. and try the transfer
process again. If the
problem persists, you
must request
authorization.

C RY P K E Y S D K 2 4 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
TO_DIFFERENT_APPLICA -4 The transfer This error occurs if you
TION is being try to transfer a license
attempted out from a different
for a application than the
different RegisterTransfer()
application. function has recorded
in its license
information. You can
only transfer a license
from the same
application into which
you are transferring.
TO_TARGET_ALREADY_H -5 The transfer This error occurs if the
AS_ LICENSE files are TransferOut()
already in function has already
the given been performed once.
directory. Please ensure that you
only attempt to
transfer the license
out of the application
once.
TO_SITEKEYFILE_NOT_F -6 The key file If you receive this
OUND in the given message, please
directory is contact
missing. support@crypkey.com.
TO_COULDNOT_WRITE_ -7 The key file This error occurs if you
SITE KEYFILE could not be do not have read and
written to write access to the
the given specific directory. If
directory. you continue to
receive this error,
please contact
support@crypkey.com.

2 4 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Name Valu Message Solution


e
TO_RSTKEYFILE_NOT_FO -8 The If this error occurs,
UND restriction ensure you have a file
file in the in your directory with
given the extension .rst. If
directory is the file is not there, try
missing. to run the application
again. This process
should create the file.
If this does not work,
you must request
authorization.
TO_COULDNOT_WRITE_ -9 The This error occurs if you
RST KEYFILE restriction do not have read and
file could write access to the
not be specific directory. If
written to you continue to
the given receive this error,
directory. please contact
support@crypkey.com.
TO_COULDNOT_WRITE_ -10 The This error occurs if you
REGKEYFILE registration do not have read and
file could write access to the
not be specific directory. If
written to you continue to
the given receive this error,
directory. please contact
support@crypkey.com.
TO_SOURCE_WRITE_ -11 The source This error occurs if you
PROTECTED directory is do not have read and
write write access to the
protected. specific directory. If
you continue to
receive this error,
please contact
support@crypkey.com.

GeneralerrorvaluesalsoapplyseeSection12.2:GeneralErrorValues.

Note
SeeSection9:MovingProtectedProgramsformoreinformation.

C RY P K E Y S D K 2 5 0
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

Section

1
3
Appendix I Sample File
Thissectioncontainsafile,example.c,thatshows
samplecode.Toviewthecrypkey.hfileandotherfiles
containing16and32bitsamplecode,lookatthe
samplesdirectorywehaveprovided.

everalexamplefilesareavailableinyourCrypKeyv6.0installation

S directories,showingCrypKeyfunctioncallsfromavarietyofprogramming
environments.Somesamplesaresuppliedbycustomers.Allcanbe
improvedupon.

EXAMPLE.Cisthebestonetolookatforasimpledemonstrationofhow
functioncallsworktogethertoprotectandlicenseanapplication.

The16bitsamplestendtobeabitoutdatedcheckthemanualforthelatest
informationifyouareusingthese.The32bitsamplesprovidegoodreference
information,aswellassomeinterfaceideas.

Eachexampleisalittledifferent,andworthalookjusttoseehowtheauthor
usesCrypKey.

ThecompiledexecutablesformostsamplescanbefoundintheDEMOS
directory.

2 5 1 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

ImportantNoteforVisualBasic:becauseofapropertyofVBintegers,function
declarationsfor32bitcodeand16bitcodearenotthesame.Youcangetthe
functiondeclarationsfor32bitcodefromtheFORJIMsample.

13.1 Example.c
/**************************************************************************
*FILETYPE:maincode
*FILE:EXAMPLE.C
*PURPOSE:SimpleexampleofCrypKeySoftwareLibraryusage
*PROGRAM:EXAMPLE.EXE
*LINKS:lcrypkey.libcrypkeylibrarylargemodel
*INCLUDES:stdio.hcrypkey.cstime.h
*COPYRTS:CRYPKEYCANADAINC.
*AUTHOR:JamesMcCartney
*CREATED:June25,1992
**************************************************************************/
#ifdefWIN32
#include<windows.h>
#endif//WIN32
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
#include<dos.h>
#include<malloc.h>
#include"crypkey.h"

/***************Functionsinthisfile********************************/
intdo_auth(void);
unsignedlongtime100();/*getstimeofdayto1/100th*/
USHORTchallenge(ULONGcompanyNum,ULONGpassNum,USHORTrandom1,USHORT
random2);
intPrintFloatingLicenseSnapshot(void);
longchallenge32(longcompanyNum,longpassNum,longrandom1,longrandom2);
/***************Functionsinthisfile********************************/

/***************DefinesandGlobals***********************************/
//Thesearepersonalizedkeysthatareissuedtoyouuponpurchaseofcrypkey
#defineUSER_KEY"D050815CD1A2A79DB1"

#ifdefWIN32
//Usethisifprogramis32bit
#defineMASTER_KEY"f2c938d2d34678d2e9217c18d78ea6a8e466cf49520f92cdd1b6916\
bd460d60e7c7b4cc7cc1750bd7188f90ac132b915e82fc8fa60a1d299da0f28ea3c66bd42db\
0be62149daaee4dba55c0e70ce1c13bd343f8b7573abc1e7da0695955ab2bd377f50a9be29a\
04cf816b30cd171e1509ad65100c999e52a35f45a215212a970"
#else
//Usethisifprogramis16bit
//#defineMASTER_KEY"2A5D57C41B4C135BF09E17F7600B2D7079E8F275C36A"
#endif

#defineCHECKPERIOD15//secondsbetweenauthorizationchecksonanetwork
//itis10justfordemo,10minismorepractical

C RY P K E Y S D K 2 5 2
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

char*authTypes[]={"NONE","TIME(DAYS)","RUNS"};
/***************DefinesandGlobals***********************************/

/**************************************************************************
*FUNCTION:main
*PURPOSE:simpledemonstrationofCrypKey
*ARGUMENT:n/a
*CALLS:TheCrypKeyAPI
*RETURNS:n/a
*REVISED:Nov16,1997forVer4.3
**************************************************************************/
main(intargc,char*argv[])
{
//theseareusedinckChallenge(),whichisaverificationfunction
#defineCOMPANYNUM79560//thesearethecorrectnumbersforexample.exe
#definePASSNUM984534120//youcanusetheminyourtestsifyouneedto

intdone=FALSE;
intret,err,c,i,num_tries=0;
intauthopt,num_allowed,num_used;//restrictioninfo
ULONGlevel,start_date,start;
charpath[400],timestring[30];

charserial[100],model[100],firmware[50];
intGMIret;

printf("CrypKeyTestProgrampath=[%s]\n\n",argv[0]);

/********************************************************************
MASTERKEYandUSERKEYareissueduponpurchaseofCrypKey
TheyinsurethatSite_Keycanonlygeneratekeysforyourproduct
*********************************************************************/
//initcrypkeybeforeusinganyotherfunctions
//printf("StartInit\n");
err=InitCrypkey(argv[0],MASTER_KEY,USER_KEY,FALSE,3*CHECKPERIOD);
//printf("DoneInit\n");

if(err)
{
printf("InitializationFailure%s(%d)for%s\n",
ExplainErr(EXP_INIT_ERR,err),err,argv[0]);
return(0);
}

printf("InitializationOKCrypKeyVersion%d\n",CrypkeyVersion());

GMIret=GetDrivePermanentSerialData(model,serial,firmware);

if(GMIret)
printf("GETSERIAL:err=%d%s\n",GMIret,ExplainErr(EXP_HDSN_ERR,GMIret));
else
printf("\n===============================================\nPermanentHard
DriveData!:\nSerial=%s\nModel=%s\nFirmware=
%s\n===============================================\n\n",serial,model,
firmware);

printf("Hitakeytocontinue");
getch();
printf("\n");

2 5 3 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

err=GetAuthorization(&level,1);//checkauthorization,useup1run

//Usethechallengefunctiontocheckthelibraryisnotanimpostor
//ThisonlyneedstobedoneifyouareusingtheDLL
//Itisshownherefordemonstrationpurposeonly

if(err==0)//checkthisonlyifwethinkweareauthorized
#ifdefWIN32
//Checknew32bitchallenge
{
ULONGrandom1,random2,result1,result2;
//generatesomerandomnumbersthiscanbedoneanywayyoulike
random1=time(NULL);
random2=random1*time(NULL);
result1=challenge32(COMPANYNUM,PASSNUM/2,random1,random2);
result2=CKChallenge32(random1,random2);
if(result1!=result2)
{
printf("Challenge32functionfailedprogramaborting\n");
printf("chal=%uckChal=%u\n",result1,result2);
exit(1);
}
else
printf("Challenge32functionsuccessful!\n");
}
#else
//use16bitchallengefunction
{
USHORTrandom1,random2,result1,result2;//noteUSHORTthesemustbe16
bit!
//generatesomerandomnumbersthiscanbedoneanywayyoulike
random1=(unsignedshort)time(NULL);
random2=random1*(unsignedshort)time(NULL);
result1=challenge(COMPANYNUM,PASSNUM,random1,random2);
result2=CKChallenge(random1,random2);
if(result1!=result2)
{
printf("Challengefunctionfailedprogramaborting\n");
printf("chal=%uckChal=%u\n",result1,result2);
exit(1);
}
else
printf("Challengefunctionsuccessful!\n");
}
#endif
elseif(err<0)//OnlyifwearenotauthorizedTryforatriallicense
{
printf("AttemptingtogenerateaTrialLicensethismaytakeaminute\n");
ret=ReadyToTryDays(33,3,1,1);//Level33,3Days,Version1,1copy
printf("ReadyToTryreturned%d%s\n",ret,ExplainErr(EXP_RTT_ERR,ret));
}

/*********************************************************************
Note:thisprogramloopstoprovideanetworkexample.
YourprogramonlyneedstoperiodicallycallGetAuthorizationif
multiplenetworkcopiesaretoberanconcurrentlyonanetwork.
/*********************************************************************/
ungetch('');//forceitthroughthelooponcetoprintauthorizationstate
start=0;//timingloop
while(!done)
{
if(!kbhit())
{

C RY P K E Y S D K 2 5 4
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

printf("[A=Authorize][D=DirectTransfer][L=AcquireLicense]\n[1=RunOnce]
[K=KillLicense][R=Registersite]\n[S=FloatingLicenseUser
Snapshot]\n[O=TranferOut][I=TransferIn][Q=Quit]\n");
printf("What'syourambition?:");
}

while(!kbhit())
{
if((time(NULL)start)>CHECKPERIOD)
{
num_tries++;
start=time100();
err=GetAuthorization(&level,0);
start=time100()start;
if(!err)
{
printf("\nAuthorizationcheck#%dtook%ldms:%s\n",
num_tries,start*10,
ExplainErr(EXP_AUTH_ERR,err));
}
else
{
printf("\nAuthorizationcheck#%dtook%ldms:%s\n",
num_tries,start*10,
ExplainErr(EXP_AUTH_ERR,err));
}

start=time(NULL);
}
}
c=getche();
printf("\n");

switch(c)
{
case'A':case'a':
do_auth();
break;

case'D':case'd':
{
chardtPath[120];
printf("Enterthepathofthecopyofthisprogramtotransferlicense
to:\n");
scanf("%s",dtPath);
err=DirectTransfer(dtPath);
printf("DirectTransfer:%d%s\n",err,ExplainErr(EXP_DT_ERR,err));
}
break;

case'L':case'l':
{
chardtPath[120];
printf("Enterthedirectorytotransferlicensefrom:\n");
scanf("%s",dtPath);
err=AcquireLicense(dtPath);
printf("AcquireLicense:%d%s\n",err,ExplainErr(EXP_AL_ERR,err));
}
break;

case'Q':case'q':
EndCrypkey();
done=TRUE;
break;

2 5 5 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

case'R':case'r':
printf("Pathtoplaceregistrationfile:");
scanf("%s",path);
printf("\n");
err=RegisterTransfer(path);
printf("REG:%s\n",ExplainErr(EXP_REG_ERR,err));
break;

case'O':case'o':
printf("Pathtofindregistrationfile:");
scanf("%s",path);
printf("\n");
err=TransferOut(path);
printf("TO:%s\n",ExplainErr(EXP_TO_ERR,err));
break;

case'I':case'i':
printf("Pathtofindtransferfiles:");
scanf("%s",path);
printf("\n");
err=TransferIn(path);
printf("TI:%s\n",ExplainErr(EXP_TI_ERR,err));
break;

case'K':case'k':
{
intret;
intc;
chars[50];

printf("ThiswilldeleteyourlicensepressYtoverify:");
c=getche();
printf("\n");
if((c!='Y')&&(c!='y'))
break;
ret=KillLicense(s);
printf("KillLicense()returned%d,Verification:%s\n",ret,s);
err=GetAuthorization(&level,0);//updateourstatus
}
break;

case'1':
err=GetAuthorization(&level,1);//checkauthorization,useup1run
printf("RunOnce%s\n",ExplainErr(EXP_AUTH_ERR,err));
break;

case'S':case's':
err=PrintFloatingLicenseSnapshot();
printf("Snapshotreturneda%d\nHitanykeytocontinue\n",err);
start=time(NULL);
while(!kbhit())
if((time(NULL)start)>CHECKPERIOD/2)//don'twaitso
longwelosethelicense
break;
while(kbhit())getch();
printf("\n");
break;

default:break;
}

err=GetAuthorization(&level,0);//rechecktheauthorization

C RY P K E Y S D K 2 5 6
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

printf("=================================================================\n");
printf("Thisfileis%sauthorizedatthissite:%s\nLEVEL=%ld\n",
(err==0)?"now":"NOT",ExplainErr(EXP_AUTH_ERR,err),level&0x00FF);

printf("OPTIONSAvailable:");
//Notethatthisprogramhas8optionsdefinedinskw.ini
//Therefore,wecheckthetop8bitsof'level'fortheseoptions
//Wecouldalsouseget_option,anewfunctionthatiseasiertouse
for(i=31;i>23;i)
if((1L<<i)&level)
printf("#%d",32i);

//displayrestrictions
ret=GetRestrictionInfo(&authopt,&start_date,&num_allowed,&num_used);
if(ret==0)
printf("RESTRICTIONS:TYPE:%sSTART:%s\n#ALLOWED:%d#USED:%d\n",

(authopt<0)?"N/A":authTypes[authopt],CKTimeString(timestring,start_date),
num_allowed,num_used);
printf("NumberofCopiesallowedfromthissite:%d\n",get_num_copies());
printf("NumberofNetworkUsersallowedfromthissite:
%d\n",get_num_multi_users());

/*
{
intserr,stz;
serr=GetServerTimeZone(&stz);
printf("ServerTimeZone=%derr=%d\n",stz,serr);
}
*/

printf("=================================================================\n\n")
;

#ifdefTEST_OTHER_CALLS//definethistoseeothercallsinaction
printf("Sitecodeis%s\n",GetSiteCode2());//somelanguagesneedtousethis
//inteadofget_site_code()
printf("Level=%d\n",get_level(8));
for(i=1;i<=8;i++)
printf("Opt%d=%d",i,get_option(8,i));
printf("\n");

printf("RESTRICTIONS:TYPE:%s#ALLOWED:%d#USED:%d\n",
authTypes[Get1RestInfo(1)],Get1RestInfo(2),Get1RestInfo(3));
ExplainErr2(1,2,text);
printf("Errortextforfunc1err2is\n[%s]\n",text);

printf("=================================================================\n\n")
;

#endif
}

EndCrypkey();
return(0);
}

/**************************************************************************
*FUNCTION:do_auth()
*PURPOSE:doestheSiteCodeSiteKey()transactionwiththecustomer
*ARGUMENT:none
*RETURNS:nonzeroiferror
**************************************************************************/

2 5 7 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

intdo_auth()
{
interr;
charsite_code[50],key[50];

if(err=GetSiteCode(site_code))//lettheuserauthorize
{
printf("GETSITECODE:%s%d\n",ExplainErr(EXP_GET_SITECODE_ERR,err),err);
//printf("InitializationFailure'%s'isnotthepathofthisfile\n");
return(0);
}

printf("SiteCode:%s\nEnterSiteKeyor'.'toquit:",spc(site_code));
key[0]=0;
while(!kbhit());//waitforentry
gets(key);

if(key[0]=='.')
return(0);

err=SaveSiteKey(key);

printf("%s\n",ExplainErr(EXP_SAVE_SITEKEY_ERR,err));

return(0);
}

/**************************************************************************
*FUNCTION:time100()
*PURPOSE:getstimeofdayin100sofseconds
*ARGUMENT:n/a
*RETURNS:timeofdayinhundredsofseconds
**************************************************************************/
unsignedlongtime100()/*getstimeofdayto1/100th*/
{
#ifdefWIN32
SYSTEMTIMEt;
GetSystemTime(&t);
return((t.wHour*60+t.wMinute)*60+t.wSecond)*100+t.wMilliseconds/10;
#else
structdostime_tt;
_dos_gettime(&t);
return((t.hour*60+t.minute)*60+t.second)*100+t.hsecond;
#endif//notWIN32
}

/**************************************************************************
*FUNCTION:challenge()
*PURPOSE:doesthecalculationfortheCrypKeyckChallengeverification
*ARGUMENT:companyNumassignedbyKenonic
passNumassignedbyKenonic
random1makeoneupyourself
random2makeoneupyourself
*RETURNS:nonzeroiferror
**************************************************************************/
USHORTchallenge(ULONGcompanyNum,ULONGpassNum,USHORTrandom1,USHORT
random2)
{
inti;
ULONGret,r1,r2;

r1=(ULONG)random1;

C RY P K E Y S D K 2 5 8
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

r2=(ULONG)random2;

ret=0;

for(i=0;i<11;i++)
ret=(ret*r1+companyNum)%16381L+(ret*r2+passNum)%16369L;

return(USHORT)ret;
}

intPrintFloatingLicenseSnapshot(void)
{
FLS_REC*buf;
intret,numEntries,i;
unsignedlongbufSize;
chartimestring[30];

//allocateabuffer
bufSize=(unsignedlong)sizeof(FLS_REC)*ABS_MAX_USERS;
if((buf=(FLS_REC*)malloc(bufSize))==NULL)
{
printf("Couldnotallocateenoughspaceforthis!\n");
return99;
}
ret=FloatingLicenseSnapshot(bufSize,&numEntries,buf);

if(ret!=0)
printf("Error%d%s\n",ret,ExplainErr(EXP_FLS_ERR,ret));
else
{
printf("\nFloatingLicenseSnapshot:%dEntriesret=%d\n\n",numEntries,ret);
printf("StatusDate/TimeStartedComputerNameUserName\n");
printf("==============================================================\n");

for(i=0;i<numEntries;i++)
printf("%6d%s%15s%15s\n",buf[i].status,
CKTimeString(timestring,buf[i].starttime),
buf[i].computerName,buf[i].userName);
printf("==============================================================\n");
}

free(buf);
return(ret);
}

#ifdefWIN32
/**************************************************************************
*FUNCTION:challenge32()
*PURPOSE:doesthecalculationfortheCrypKeyckChallenge32verification
*ARGUMENT:companyNumassignedbyKenonic
passNumDiv2assignedbyKenonic
random1makeoneupyourself
random2makeoneupyourself
*RETURNS:nonzeroiferror
*NOTES:Thisfunctionuseslongs,notunsignedlongs,tobeVBfriendly
Ifunsignedlongsareaccidentlyused,itwillnotwork
**************************************************************************/
longchallenge32(longcompanyNum,longpassNumDiv2,longrandom1,longrandom2)
//VBusersshoulddividetheirPassNumby2manually,beforecodingit,
//togetPassNumDiv2
{
inti;
longret;

2 5 9 C RY P K E Y S D K
U S E R M A N U A L
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

ret=1;
for(i=2;i<11;i++)
{
ret=ret%32769*((random1/i)%32769+(companyNum/i)%32769);
ret=ret%32769*((random2/i)%32769+(passNumDiv2/i)%32769);
}

return(ret);
}
#endif

C RY P K E Y S D K 2 6 0
U S E R M A N U A L
Appendix II Quick Reference
Section

1
4
14.1 CrypKey Functions
FollowingarebriefdescriptionsofCrypKeyfunctionsandtheirCprototypes.
Formoredetails,includingtheirprototypes,seeChapter12:Function
Reference.

AcquireLicense() EndCrypkey()
allows an unlicensed CrypKey protected program to acquire a Notifies CrypKey that the program is stopping. This function is
license from a licensed copy. only necessary if you are using Network features.
int AcquireLicense (char *licensePath); void EndCrykey();

CKChallenge() ExplainErr()
Verifies that the CryKey DLL has not been replaced with an Returns a text string explaining the return code of various
impostor DLL. functions.
unsigned int CKChallenge (unsigned int random1, unsigned char far *ExplainErr(int functioncode, int errcode);
int random2);

CKChallenge32() ExplainErr2()
Verifies that the CryKey DLL has not been replaced with an Returns a text string explaining the return code of various
impostor DLL. functions. This function is similar to the Explain Err() function,
long CKChallenge32 (long random1, long random2); but your error message is written into your string text.
void ExplainErr2(int functioncode, int errcode, char *text);

CKTimeString() FloatingLicenseGetRecord()
Translates, into a text string, the ULONG time values returned Used only in COM Objects and C#.NET Assemblies: called from
by the functions GetAuthorization() and an application that has authorization, this function returns a
FloatingLicenseSnapshot(). single record of the current floating license status.
char * FUNCTYPE CKTimeString(char *timestringbuf, ULONG t) [Prototypes available for C++ and C#.NET but not for C or VB.]

CrypKeyVersion() FloatingLicenseSnapshot()
returns the version number of the CrypKey system currently in Returns a snapshot of all users holding or waiting for a network
use. floating license.
int CrypkeyVersion (); int FloatingLicenseSnapshot (unsigned long bufSize, int
*numEntries, FLS_REC *buf);

DirectTransfer()
Called from an application that has authorization, this function
transfers the applications authorization license to another
directory.
int DirectTransfer(char far *directory);
FloatingLicenseTakeSnapshot() GetNumMultiUsers()
Used only in COM Objects and C#.NET Assemblies: returns a Gets the number of multi-users this site has been granted.
snapshot of all users holding or waiting for a network floating int GetNumMultiUsers();
license.
[Prototypes available for C++ and C#.NET but not for C or VB
see Sec. 12.3.11: FloatingLicenseSnapshot.]

Get1RestInfo() GetOption()
Used to return one of three different types of data depending Used to determine the status of a specific option.
on the value of the which input parameter. int GetOption(int numDefineOpts, int optnum);
int Get1RestInfo(int which);
which can be 1 returns authopt, 2 returns num_allowed,
3 runs num_used

GetAuthorization() GetRestrictionInfo()
Gets the level at which the program is authorized to run or an Gets information on any restrictions that are present in the
authorization failure code. Also used to decrement the number license.
of uses count. Must be called, together with InitCrypKey, int GetRestrictionInfo (Int far *authopt, ULONG far
before any other CrypKey function. *start_date, int far *num_allowed, int far *num_used);
int GetAuthorization(unsigned long *oplevel, int decrement);

GetAuthorization2() GetSiteCode()
Determines if the program is authorized to run, and Gets the site code for this program location. The site code
decrements the license count but does not obtain option must be reported by the customer before the developer can
and level information. issue the site key.
int GetAuthorization2 (int decrement); int GetSiteCode(car far *site_code);

GetDrivePermanentSerialData() GetSiteCode2()
proprietary CrypKey software function that accesses the Returns a pointer to the site code for this program location.
following hard drive information on a customers computer: char *GetSiteCode();
model number, serial number, firmware data.

GetLastError() InitCrypkey()
Returns the text for the last error reported. Initializes CrypKey with runtime information. This function and
[Prototypes available for C++, VB and C#.NET but not for C.] GetAuthorization() must be called before any other function
in CrypKey.
int InitCrypkey(char far *filepath, char far *masterkey, char
far *userkey, int allow_floppy, unsigned
network_max_checktime);

GetLastErrorCode() KillLicense()
C#.NET function only: returns the number of the last error Disables an existing license and provides a confirmation code
reported. that can be entered into the Site Key Generator in order to
long GetLastErrorCode(); display the details of the de-authorization.
int KillLicense (char *confirmCode);

GetLevel() ReadyToTry()
Used to determine the level at which your program has been Implements a one-time automatic license based on a days
authorized to run. time period, without version control.
Unsigned long GetLevel(int numDefineOpts); int ReadyToTry (unsigned long oplevel, int numDays);

GetNetHandle() ReadyToTryDays()
Gets and returns the network license handle of the protected Implements a one-time automatic license based on a days
program. time period, with version control.
int ReadyToTryDays (unsigned long oplevel, int numDays, int
GetNumCopies() version, int copies);
Gets the number of license copies that the current site has
been granted.
ReadyToTry_Runs()
Implements a one-time automatic license based on a runs
restriction with version control.
int ReadyToTryRuns (unsigned long oplevel, int numRuns, int
version, int copies);

RegisterTransfer()
Called from an application that does not yet have
authorization, this function registers the application by placing
license imprint files on a disk or in a directory.
int RegisterTransfer(char far *directory)

SaveSiteKey()
This function is used to save to file the site key that has been
acquired from the user. The key is checked before it is saved.
int SaveSikeKey(char far *site_key);

SetNetHandle()
Sets the network license handle, i.e. passes the handle of a
SLAPI network resource to the program.
void SetNetHandle (unsigned short net_handle);

TransferIn()
Called from an application that does not have authorization,
this function transfers the applications authorization license in
by reading transfer out license imprint files on a disk or in a
directory.
int TransferIn(char far *directory);

TransferOut()
Called from an application that has authorization, this function
transfers the applications authorization license out by placing
license imprint files on a disk or in a directory.
int TransferOut(char far *directory);
14.2 CrypKey Return Codes
InitCrypkey() GetAuthorization()
Defined Name within Return Defined Name within Return
CRYPKEY.H Value CRYPKEY.H Value
INIT_OK 0 AUTH_OK 0
INIT_FILE_NOT_FOUND -1 AUTH_INIT_FAIL -1
INIT_MASTERKEY_CRC_FAILU -2 AUTH_DISALLOW_FLOPPY -2
RE
INIT_BAD_PRODUCT_NAME -3 AUTH_BAD_PATH -3
INIT_KEYFILE_CREATION_FAIL -4 AUTH_NOT_PRESENT -4
INIT_NETWORK_NOT_PURCH -5 AUTH_DIFFERENT -5
ASED
INIT_NT_NOT_PURCHASED -6 AUTH_BAD_MASTERKEY -6
INIT_NT32BIT_NOT_PURCHAS -7 AUTH_SITEKEY_CRC -7
ED
INIT_WIN95_NOT_PURCHASE -8 AUTH_TIME_TOO_EARLY -8
D
INIT_WIN32S_NOT_PURCHAS -9 AUTH_TIME_SETBACK -9
ED
INIT_MULTIPLE_CALL_TO_INIT -10 AUTH_TIME_RUNOUT -10
INIT_THUNK_LIB_NOT_FOUN -11 AUTH_RUNS_RESTR -11
D
INIT_THUNK32_DLL_CORRUP -12 AUTH_NOT_ENOUGH_RUNS -12
T
INIT_THUNK16_DLL_CORRUP -13 AUTH_MISSING_RST_FILE -13
T
INIT_32_DLL_CORRUPT -14 AUTH_RST_BAD_CRC -14
INIT_THUNK32_DLL_VERSION -15 AUTH_RST_BAD_LOCATION -15
INIT_THUNK16_DLL_VERSION -16 AUTH_ENTRY_CHECK_FAIL -16
INIT_THUNK32_DLL_TAMPER -17 AUTH_NETTABLEFILE_FAIL -17
ED
INIT_THUNK16_DLL_TAMPER -18 AUTH_NETMAX_EXCEEDED -18
ED
INIT_THUNK32_DLL_UNKNO -19 AUTH_NETWORK_NOT_ALLO -19
WN ERROR WED
INIT_THUNK16_DLL_UNKNO -20 AUTH_RSTFILE_WRITE_PROT -20
WN ERROR EC
INIT_PRE_V6_MASTERKEY -21 AUTH_TIME_CLOCK_TAMPERI -21
NG
KEY_BAD_LOCATION -22

14.3 CrypKey 6.X OS File Distribution


Matrix
FILENAME WIN9 WIN WIN NT WIN WIN NOVEL
X ME 2000 XP L
cryp95f.dll5
crp9516f.dll5
ck16rmv.exe5
lcrypkyd.dll
crp32dll.dll
hdsnl.dll

crp32001.ngn
wckserve.exe 2
setupex.exe 1
cks.exe1
ckserver.exe
ckserver.nlm
cknetwk.exe

Legend:
Indicates files required for 16Bit applications.
Indicates files required for 32Bit applications.
Indicates optional files depending on XP Home Edition/Pro compatibility mode
settings.
Cells with a gray background indicate files required for a network.
Files in italics are specific to CrypKey Instant.
Files in gray text are specific to CrypKey SDK.
Files in regular black text are common to both SDK and Instant.

CRYPKEY INSTANT refer to Sections 3.6.1 and 3.6.2 in the CrypKey Instant
Manual
CRYPKEY SDK refer to Sec. 2.6, Libraries and Distribution Files and Table 3:
Libraries, in the CrypKey SDK manual

Notes
1. setupex.exe and cks.exe are files used to install the NT driver (Crypkey License
Service) required on all NT systems whether networked or stand-alone.
2. wckserve.exe is required for Win9X/ME servers
3. splash.int is required for custom splash screen. See online database for more
information.
4. See online database for more information regarding language support.
5. Thunk files for Win9X/ME go into the application or license directory only.
6. If you use static libraries, crp32dll.dll or lcrypkyd.dll do not need to be
distributed.
Figure 57: CrypKey Program Flowchart
Figure 58: Example Win9X/ME CrypKey Configuration
Glossary
Thisglossarycontainsdefinitionsoftermsusedinthis Section

1
manual.

5
hetermscommonlyusedinthismanualaredefinedinthissection.These
definitionshelpyouunderstandtheCrypKeySDKproductandits
protectionstrategies.

.NET
.NETisaframeworkforobjectsandhowtheyworktogether..NETobjectsare
languageneutralandmaybewritteninC#,C++,VisualBasic,J#,orother
languages.Thecodegeneratedfor.NETisanintermediatelanguagethatneeds
theCommonLanguageRuntime(CLR)tointerpretthecode.Theuseofthe
CLRallows.NETcodetorunondifferentoperatingsystemsandplatforms
withouthavingtorecompilethecode.

.NET Assembly
A.NETassemblyisafilecontaining.NETclasses.Theassemblycontainsclass
definitionsthatallowother.NETprogramstoidentifyandusetheclasses
withinit.

Automatic License
ThisisalicensethatiscreatedbyusingtheReadyToTry()functionoroneofits
variants.Suchlicensesarecreatedautomaticallybythesoftwarewithout
requiringyouoryourdistributortoprovideasitekey.
Common Object Model (COM)
TheCommonObjectModelisaspecificationforobjectsandhowtheywork
together.COMobjectsarelanguageindependentandmaybewritteninC++,
VisualBasic,Java,orotherlanguages.ThecodegeneratedforCOMisstandard
Windowsmachineexecutablebinaries.

COM Object
ACOMobjectisafilecontainingCOMclasses.TheCOMobjectcontainsclass
definitionsthatallowotherCOMprogramstoidentifyandusetheclasses
withinit.

Company Number
ThisisoneoftwospecialkeysusedintheCKChallenge()function(theother
keyisthepasswordnumber).Thecompanynumberkeyisbasedonaprivate
numberthatCrypKeyassignstoyourcompany.

Developer Keys
ThesearethefourkeysthatCrypKeyissuesyouafterreceivingpayment.These
include:
companynumber
passwordnumber
MasterKey
UserKey

Fixed License
Aproductlicenseusableonlyonthecomputerwhereitwasinstalled(node
lockedlicense).Althoughtheprogramcanbecopiedtoothercomputers,its
inherentsecurityensuresitcanonlyrunonthecomputerwhereitwas
installed.

Floating License
Aproductlicensethatallowsapredeterminednumberofproductcopiesto
runconcurrentlyonvariousclientcomputersfromasingle,networkedserver
copy.

Level
Aparameterdefinedforaproductlicense.TheSiteKeyGenerator
communicatestheleveltoyourproductviathesitekey,enablingyoutocontrol
howyourproductrunsandwhichinstanceofyourproductisauthorized.
CrypKeySDKcommunicatesonlythelevelvaluetotheprotectedapplication;
youmustimplementtheaction(s)withintheproductbasedonthelevel.

License
Aprotectedproductsauthorizationisdefinedbythelicense.Thelicense
containsdetailsoftheauthorization,includinglevels,options,licensetype,and
licenserestriction.Inphysicalterms,thelicenseconsistsoffourhiddensystem
filesthatresideinthesamedirectorylocationastheprotectedprogram.

Master Key
AhexadecimalnumberissuedbyCrypKey,basedonyourcompanynumber
andproductname.TouseCrypKeywithyourproduct,youneedaMasterKey
andUserKey(thesekeysareenteredintotheInitCrypkey()function).

Option
Selectionofaspecificationthatmayincludeorexcludeacomponentaspartof
aproductlicense.Together,thenumericsymbolsfortheoptionsandlevels
definedforyourproductcomprisea32bitnumberusedaspartofthesitekey.

Password Number
OneoftwospecialkeysusedintheCKChallenge()functionwhenusingthe
CrypKeyAPI(theotherkeyisthecompanynumber).Thepasswordnumberis
basedontheproductpassword,whichyouspecify.CrypKeycreatesthe
passwordnumberfromyourproductpasswordandprovidesittoyou.

Site
Insoftwarelicensing,theinternalbootdevice(harddrive)ofthecomputer
whereaprotectedprogramisinstalled.Thetermisgenerallysynonymouswith
thecomputeritself.

Site Code
Asitespecifichexadecimalnumberissuedbyaprotectedproductwhen
installedonaclientscomputer.ThesitecodeisprovidedbytheGetSiteCode()
function.Yourcustomersprovidethesitecodewhenrequestinglicensing
changesfortheproduct.

Site Key
Ahexadecimalnumberbasedonaclientssitecode,createdbyviatheSiteKey
Generator.Thesitekeyunlocksclientsoftwarefeaturesandlicenserestrictions.

User Key
AhexadecimalnumberissuedbyCrypKey,basedonyourproductpassword.
TouseCrypKeywithyourproduct,youneedaMasterKeyandaUserKey
(enterthesekeysintheInitCrypkey()function).
Index
Thisindexincludespagereferencesforsignificant Section

1
occurrencesoftopicsandterms.

6
ysignificantoccurrences,wemeanappearancesofatermwhere
informationisprovidedaboutitsmeaningoruseintheCrypKeycontext.
Whereappropriate,wehavealsoprovidedseealsocrossreferences
betweenterms.

.
.NET assembly......................................................42, 48, 96, 166, 182, 196

.NGN file.................................................20, 47, 87, 94, 150, 162, 165, 255

A
AcquireLicense().....................................................................................181

anti-virus software..................................................................................148

authorization transfer
into target computer...........................................................................92
out of source computer.......................................................................92
registering........................................................................................... 91
authorizing
distributors.......................................................................................... 80
MS-DOS program.................................................................................57
Site Key Generators............................................................................78
Windows program...............................................................................51
your program......................................................................................91
automatic license...................................................................................259

C
CD-ROM distribution...............................................................................146

certification............................................................................................. 148

CKChallenge().............................10, 95, 126, 160, 169, 170, 171, 172, 251

CKChallenge32().............................................................................172, 173

cks.exe.................................................................................................... 131

ckserve.exe.......................................................................................44, 132

ckserver.nlm.....................................................................................45, 131

client annoyance....................................................................................142

clock manipulation.................................................................................146

CloneBuster........................................................................................18, 63

COM Object.....................................................42, 48, 93, 96106, 182, 184

company number.............................................................................10, 260

computer signatures...............................................................................143

CRP32001.NGN file.......................................................................20, 47, 94

cryp9516f.dll............................................................................................. 48

cryp95f.dll................................................................................................. 48

CrypKey Instant........................................................................................16

CrypKey SDK
features...........................................................................................1, 17
installation.......................................................................................... 24
trial period............................................................................................2
crypkey.h..................................................................92, 179, 181, 202, 240
CrypkeyVersion().............................................................................160, 174

cui.exe.................................................................................................... 106

D
DAL........................................................................................................... 78

days license.............................................................................................. 61

defragmentation programs.....................................................................144

developer keys...............................................................................3, 9, 260


obtaining............................................................................................. 10
temporary........................................................................................... 11
development
platforms...............................................................................................8
process................................................................................................ 15
tools.................................................................................................... 95
direct transfer......................................................................................... 135

DirectTransfer().......................................135, 160, 175, 177, 180, 181, 251

disk compression....................................................................................144

Distributor Authorizing License.................................................................78

distributors, authorizing...........................................................................80

E
EndCrypkey()....................................90, 127, 160, 178, 198, 208, 230, 251

errors......................................................................................110, 155, 162


codes................................................................................................ 127
Novell NetWare.................................................................................155
example.exe...................................................................................8, 11, 58

Example.exe............................................................................................. 51

ExplainErr()...................................88, 89, 90, 149, 160, 162, 179, 180, 251

ExplainErr2()...................................................................................180, 182
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

exporting to United States......................................................................148

external links
security............................................................................................. 107
using binary files...............................................................................106

F
features................................................................................................1, 17

file set protection....................................................................................147

fixed license............................................................................................ 260

floating license
defined.............................................................................................. 260
specifying.......................................................................................... 130
FloatingLicenseSnapshot().............................................................181, 183

floppy transfer........................................................................................135

foreign system compatibility..................................................................147

functions................................................................................................. 159

G
Get1RestInfo()........................................................................160, 185, 186

GetAuthorization()....88, 89, 127, 130, 160, 171, 173, 180, 181, 187, 204,
205, 227, 229

GetAuthorization2()................................................................161, 194, 195

GetDrivePermanentSerialData().....................................................181, 196

GetLevel()...............................................................................161, 194, 197

GetNetHandle().......................................................................161, 198, 229

GetNumCopies().............................................................................161, 199

GetNumMultiUsers().......................................................................161, 199

GetOption().............................................................................161, 194, 200


GetRestrictionInfo().................................................................161, 201, 202

GetSiteCode()...........................................................89, 161, 204, 229, 262

GetSiteCode2()...............................................................................161, 205

guarantee................................................................................................. 16

H
hacking................................................................................................... 125

hard drives
failure................................................................................................ 144
removable......................................................................................... 147

I
information transfer........................................................................107, 108

InitCrypkey().....88, 89, 127, 161, 171, 173, 180, 181, 194, 195, 206, 261,
262

installer software....................................................................................148

installing
32-bit thunk library.............................................................................48
CrypKey SDK.......................................................................................24
MS-DOS network driver.......................................................................44
network driver...................................................................................130
Novell NetWare...................................................................................45
Windows 95 network driver.................................................................43
Windows NT driver..............................................................................43
Internet distribution................................................................................147

K
keys............................................................................................................ 3
master............................................................................................... 3, 9
obtaining............................................................................................. 10
site............................................................................................3, 10, 11
temporary........................................................................................... 11
B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

user................................................................................................... 3, 9
KillLicense()....................................................................161, 180, 181, 213

L
levels..................................................................................59, 60, 194, 261

libraries
linking................................................................................................. 93
third party......................................................................................... 144
licenses
changing............................................................................................. 76
defined........................................................................................17, 261
establishing......................................................................................... 88
floating.............................................................................................. 145
limiting................................................................................................ 61
moving.............................................................................................. 135
preventing loss.................................................................................157
transferring...............................................................................136, 143

M
Master Key......................................................................................3, 9, 261

MS-DOS
network driver.....................................................................................44
program.............................................................................................. 57
multiple program names........................................................................145

N
network licensing....................................................................................130

Norton Utilities Speed Disk.....................................................................157

Novell NetWare......................................................................................... 45

O
options................................................................................59, 60, 194, 261
P
packing list............................................................................................... 40

password
number.......................................................................................10, 261
temporary (for development)..............................................................11

R
readme..................................................................................................... 41

readme!.hlp.............................................................................................. 40

ReadyToTry()...................................................161, 180, 181, 215, 221, 259

ReadyToTryDays()...........................................................................161, 222

ReadyToTryRuns()............................................................................161, 223

RegisterTransfer()...................................................161, 180, 181, 225, 230

releases.................................................................................................. 145

run modes
silent................................................................................................. 111
verbose............................................................................................. 111
runs license.............................................................................................. 61

S
SaveSiteKey()...........................................89, 162, 180, 181, 187, 227, 229

SetNetHandle().......................................................................162, 198, 229

setupex.exe....................................................................................110, 131

setupex.xco............................................................................................ 110

silent mode............................................................................................. 111

site.......................................................................................................... 261

site code........................................................................................... 16, 262


B AT T L E - P R OV E N S O FT WA R E P R O T E C T I O N & L I C E N S E S E C U R I T Y

obtaining............................................................................................. 11
transferring......................................................................................... 17
site key......................................................................................... 3, 10, 262
creating............................................................................................... 11
transferring......................................................................................... 17
Site Key Generator
defined................................................................................................ 59
software protection.................................................................................139

Stealth directory.................................................................................42, 43

StealthPlusTM...................................................................................11523

StealthPLUSTM..........................................................................18, 19, 42, 43

support............................................................................................... 8, 143

supported platforms...............................................................................131

system requirements..................................................................................7

T
tampering............................................................................................... 125

telephone authorization.........................................................................142

testapp.exe............................................................................................... 51

thunk library............................................................................................. 48

TransferIn().............................................................162, 180, 181, 187, 230

TransferOut()...........................................................162, 180, 181, 187, 235

trial period..................................................................................................2

U
unlimited license......................................................................................61

updates................................................................................................... 145
User Key.......................................................................................... 3, 9, 262

V
verbose mode......................................................................................... 111

W
Watcom................................................................................................... 144

wckserve.exe....................................................................................43, 131

Windows 95 network driver......................................................................43

Windows 98............................................................................................ 148

Windows NT
driver installation program...............................................................109
supported versions...........................................................................113
uninstalling driver.............................................................................112
Windows NT drivers..................................................................................43

Windows program
authorizing....................................................................................51, 52

You might also like