Home

Rockey4ND User`s Guide

image

Contents

1. printf Find Rock 08X n Ip1 FEITIAN Rockey4ND User s Guide retcode Rockey RY_OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i 1 while retcode 0 retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j p1 0 p2 5 p3 1 strcpy char buffer Ver10 retcode Rockey RY_WRITE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode FEITIAN Rockey4ND User s Guide ShowERR retcode return printf Write s n buffer 7 p1 0 p2 5 memset buffer 0 64 retcode Rockey RY_READ amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Read s n buffer if Istremp buffer Ver10 handleEnd handle j break retcode Rockey RY_RANDOM amp handleEnd amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Random 04X n
2. FEITIAN Rockey4ND User s Guide SE will be displayed on the button in turn when you click on it If you check Auto S E box the statements you have added will be marked automatically See Figure 5 6 User ID Zone UIZ User identification information may be read from or written to the UIZ of the ROCKEY4ND dongle in hexadecimal See Figure 5 6 Single Operation Zone SOZ Click Read button to read the content of the dongle that has been selected into the memory Click Write button to write the content of the memory to the dongle that has been selected Batch Operation Zone BOZ You can change all User IDs of the dongles in the edit area Enter a start ID in the User ID field Choose a method for setting the ID see below Click Batch Write button to update all IDs of the dongles gt User ID The value entered in User ID field will be written to the first dongle of the dongle list Then 1 is added onto the value and the updated value is written to the next dongle For example the values 124 and 125 will be written to the second dongle and the third dongle respectively after the initial value 123 is written to the first dongle if User ID radio button is checked and Batch Write button is clicked gt User ID Its function is similar to that of User ID button except that the ID value is descended gt Use Time ID Use the time value of the system clock as the User ID gt No Change The value o
3. FEITIAN Rockey4ND User s Guide return printf Set Moudle 1 Pass 4X Decrease no allow n p2 pl 2 p2 3 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 2 Pass 04X Decrease no allow n p2 p1 3 p2 4 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 3 Pass 4X Decrease no allow n p2 pl strcpy char buffer cmd2 retcode Rockey RY_WRITE_ARITHMETIC amp handle j amp 1p1 amp 1p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write Arithmetic 3 n FEITIAN Rockey4ND User s Guide 1p1 lp2 p1 p2 p3 p4 O retcode Rockey RY_CALCULATE3 amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Calculate Input p1 0 p2 0 p3 0 p4 0 n printf n printf Moudle printf Moudle printf Moudle printf Moudle x n p1 x n p2 x n p3 x n p4 w N FP Q retcode Rockey RY_CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retc
4. include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 DWORD Ipi Ip2 BYTE buffer 1024 p1 Oxc44c p2 Oxc8f8 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find specified ROCKEY4ND retcode Rockey RY FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return printf Hello FeiTian n FEITIAN Rockey4ND User s Guide It is a very simple security objective We only need to call the function Find a ROCKEY dongle You may refer to the introduction of the function Find a ROCKEY dongle in the section ROCKEYAND API Services For testing purposes you might try to run this program with and without the ROCKEYAND dongle attached to the computer 7 4 3 Open Dongle Step 2 We add an operation to open ROCKEY with specified passwords at the beginning of the program If the dongle can be opened the program continues Otherwise the program exits include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEYAND Variable p1 0xc44c
5. void main WORD handle 16 p1 p2 p3 p4 retcode DWORD 1p1 1p2 BYTE buffer 1024 WORD rc 4 int 1 77 char cmd1 A E E B F F C G G D H H p1 xc44c p2 Oxc8f8 p3 0x0799 p4 xc43b retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode FEITIAN Rockey4ND User s Guide ShowERR retcode return printf Find Rock 8X n 1p1 retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i ibe while retcode retcode Rockey RY FIND NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 8X n 1p1 j printf n for j 9 j lt i j FEITIAN Rockey4ND User s Guide 1p2 9012345678 retcode Rockey RY SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Seed 4X 4X 4X 84X n pl p2 p3 p4 rc p1 rc 1 p2 rc 2 p3 rc 3 p4 pl strcpy char buffer cmd1 retcode
6. include DrawCircleView h include DrawParamDlg h include DrawMethodDlg h ifdef _DEBUG define new DEBUG_NEW undef THIS_FILE static char THIS_FILE FILE endif WORD p1 8xc44c p2 8xc8f8 p3 0x0799 p4 0xc43b DWORD 1p1 1p2 WORD handle 16 BYTE buffer 1024 void CDrawCircleView DrawCircleMidPoint_Rockey CDC pDC int iCenterX int iCentery int r int x int y r int p 1 r FEITIAN Rockey4ND User s Guide int seed 0 short p1 p2 p3 p4 CirclePlotPoints pDC iCenterX iCenterY x y TRACE Hardware n m_lpCircleBuf x x m_lpCircleBuf y y m_nPointCount 1 while x lt y t p1 p p2 x p3 y p4 seed if RunRockey WORD amp p1 WORD amp p2 WORD amp p3 WORD amp p4 AfxMessageBox Runtime error break if p lt p pl else p p2 Yas X TRACE d d d p x y CirclePlotPoints pDC iCenterX iCenterY x y m_lpCircleBuf m_nPointCount x m_lpCircleBuf m_nPointCount y m_nPointCount X y TRACE n FEITIAN Rockey4ND User s Guide BOOL CDrawCircleView RunRockey WORD amp A WORD amp B WORD amp C WORD amp D WORD retcode 1p1 10 retcode Rockey RY_CALCULATE1 amp handle 0 amp lp1 amp lp2 amp A amp B amp C amp D buffer if retcode return FALSE else return TRUE Note ROCKEY4ND has as many as 128 instructions Developers do not need to consider the start and e
7. int i j num p1 Oxc44c p2 Oxc8f8 p3 0 p4 0 retcode Rockey RY FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide ale while retcode 0 retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j p1 0 p2 2 p3 1 strcpy char buffer 03 retcode Rockey RY WRITE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write 03 n p1 0 p2 1 memset buffer 0 64 FEITIAN Rockey4ND User s Guide retcode Rockey RY READ amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Read s n buffer num atoi buffer if num printf Hello FeiTian n
8. In the above program we defined a handle array to save the opened ROCKEY handle to prepare for the next operation on the specified dongle When we find the dongle we open it and we close all opened ROCKEY handles before exiting the program Developers are better off operating in this manner but for a large program it is OK to open close the dongle just once at the beginning end of the program Frequent open and close operations will reduce performance We open the dongle in share mode so that other programs may also simultaneously operate with the dongle You can find the source code of the samples above from the CD ROM or under Samples directory FEITIAN Rockey4ND User s Guide Note We called function RY_OPEN and RY_CLOSE in the above program We must open ROCKEY before all operations with the exceptions of RY_FIND and RY_FIND_NEXT This is similar to the operation on the disk files You should close the dongle immediately after finishing dongle related operations 7 5 Advanced Application Examples This section is dedicated to providing additional illustrative examples of methods you may employ to protect your software with ROCKEYAND These examples are intentionally simplified and not intended to be a complete solutions for software protection The method appropriate for your application will depend on constraints set by your licensing agreement and other factors If you are familiar with the API call already you may skip to Chapter 8 ROC
9. num else return p1 0 p2 1 sprintf buffer ld num retcode Rockey RY_WRITE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write ld n num retcode Rockey RY_CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n 7 5 2 Seed code advanced applications FEITIAN Rockey4ND User s Guide Step 17 You may use different seed codes for different software modules or in different places in the application Then verify the seed codes in the applications include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4 ND 32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode DWORD Ipi Ip2 BYTE buffer 1024 int i j p1 Oxc44c p2 Oxc8f8 p3 0 p4 0 retcode Rockey RY_FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY_OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide ale while retcode 0 retc
10. p1 Ip2 0x12345678 retcode Rockey RY SEED amp handleEnd amp Ip1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide printf Seed 04X 04X 04X 04X n p1 p2 p3 p4 retcode Rockey RY CLOSE amp handleEnd amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n In Step 23 the UID is used to distinguish the dongles with the same passwords For example dongles with UID of 11111111 hexadecimal correspond to software A include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode WORD handleEnd DWORD Ipi Ip2 BYTE buffer 1024 inti j p1 Oxc44c p2 Oxc8f8 p3 0x0799 p4 0xc43b FEITIAN Rockey4ND User s Guide retcode Rockey RY_FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY_OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return ale while retcode 0 retcode Rockey RY_
11. ROCKEY4ND Demo Password1 p2 Oxc8f8 ROCKEYAND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return retcode Rockey RY_OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return FEITIAN Rockey4ND User s Guide printf Hello FeiTian n retcode Rockey RY CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return 7 4 4 User Memory Steps 3 and 4 Initialize ROCKEY with Editor or API Write Hello FEITIAN to the dongle and read it back from the dongle See Step 3 and Step 4 Initialize ROCKEY and write Hello FEITIAN to it Step 3 include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEYAND Variable BYTE buffer 1024 ROCKEYAND Variable p1 0xc44c ROCKEY4ND Demo Password1 p2 0xc8f8 ROCKEYAND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Passwor
12. RY_CALCULATE1 handle Handle of the dongle Ip1 Start point of calculation Ip2 Module number p1 Input value 1 n2 Input value 2 n3 Input value 3 p4 Input value 4 Return value A value of 0 indicates that the function works properly Any other value indicates an error When the function is executed successfully n1 Return value 1 n2 Return value 2 n3 Return value 3 p4 Return value 4 Notes For example if the algorithm in the dongle is A B C Then the result by calling calculation 1 is p1 p2 p3 For example if the algorithm in the dongle is A A G FEITIAN Rockey4ND User s Guide If p1 0 when inputting then you may figure out the content of the module specified by p1 Ip2 when returning although you cannot read the content of the module directly If possible you d better verify the content of the module with an algorithm instead of comparing in the program Function RY_CALCULATE2 Calculation 2 Objective Input parameters Perform specified calculation function RY_CALCULATE2 handle Handle of the dongle Ip1 Start point of calculation p2 Seed code p1 Input value 1 p2 Input value 2 p3 Input value 3 n4 Input value 4 Return value A value of O indicates that the function works properly Any other value indicates an error When the function is executed successfully p1 Return value 1 n2
13. Return value 2 p3 Return value3 p4 Return value 4 When the dongle is calling the algorithm by calculation 2 the initial values of Notes registers E F G and H are the seed return value of Ip2 In other words the dongle uses lp2 as the seed code and calls RY_SEED function and puts the return values into registers E F G and H respectively for processing by the user Function RY_CALCULATE3 Calculation 3 Objective Perform specified calculation Input parameters function RY_CALCULATE3 handle Handle of the dongle Ip1 Start point of calculation p2 Start address of module p1 Input value 1 p2 Input value 2 n3 Input value 3 p4 Input value 4 FEITIAN Rockey4ND User s Guide Return value A value of 0 indicates that the function works properly Any other value indicates an error When the function is executed successfully p1 Return value 1 n2 Return value 2 p3 Return value 3 p4 Return value 4 Notes When the dongle is calling the algorithm by calculation 3 the initial values of registers E F G and H are the contents of the successive 4 modules starting at Ip2 For example the initial values of registers E F G and H are as follows when calling calculation 3 with lp2 0 E Content of module 0 F Content of module 1 G Content of module 2 F Content of module 3 If the address of the module is greater than 63 the
14. Rockey RY WRITE ARITHMETIC amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode FEITIAN Rockey4ND User s Guide ShowERR retcode return j printf Write Arithmetic 1 n 1p1 lp2 7 pl p2 p3 3 pn retcode Rockey RY_CALCULATE1 amp handle j amp lp1 81p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode 3 w N e ShowERR retcode return J printf Calculate Input p1 1 p2 2 p3 3 p4 4 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 printf n printf Moudle 7 x n p3 truelp1 MAKELONG p2 p1 printf truelp1 x n truelp1 if findlp1 truelp1 printf Hello FeiTian n else break retcode Rockey RY CLOSE amp handle j 81p1 amp 1p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch FEITIAN Rockey4ND User s Guide 8 2 2 2 Complex example 2 In Step 28 we get the return codes of a seed code with the calculation 2 function Then we compare these return codes with the return codes we get with the same seed code at the beginning of the program If they are different the program will be terminated include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode return printf Error Code d n retcode
15. Rockey RY_WRITE_ARITHMETIC amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write Arithmetic 2 n 1p1 1p2 0x12345678 pl 1 p2 2 p3 3 p4 4 retcode Rockey RY_CALCULATE2 amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide printf Calculate Input p1 1 p2 2 p3 3 p4 4 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 printf n if rc p1 amp amp rc 1 p2 88 rc 2 p3 88 rc 3 p4 printf Hello FeiTian n else break retcode Rockey RY CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch 8 2 2 3 Complex example 3 In Step 29 we get the values stored in the 64 modules by using the calculation 3 function Remember that the modules may not be read even with the Advanced passwords You may write some important data to the modules or perform some other operations include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4 ND _32 h void ShowERR WORD retcode if retcode return printf Error Code d n retcode void main FEITIAN Rockey4ND User s Guide WORD handle 16 p1 p2 p3
16. This measure prevents attempts of the passwords by attackers 9 2 5 What are same numbered dongles The dongles have the same order number In other words they share the same passwords Each copy of the software is delivered with a dongle to end users Since all the delivered dongles have the same number devopers do not need to re compile each copy of the software 9 2 6 What can I do if I forget the passwords of the dongle Use another dongle Or you must prove that you ordered that dongle before For details consult our post sales 9 2 7 Is it true that a data sharer can be used to share a dongle The data sharer can be prevented if you do as follows generate a random number at the beginning of the program and store it at a fixed address in the memory of the dongle and verify if the data at that address is equal to the random number at runtime of the program If the program is also running on another computer which works with the dongle a different random number must have been written to that address 9 2 8 Will it slow down the running of software to write a complex algorithm to the ROCKEYAND dongle No The difference between the time consumed by the simplest algorithm and the time consumed by the most compliex algorithm is merely several tens of milliseconds If the complex algorithm is not invoked frequently you cannot perceive the slowness 9 2 9 What is the problem if my USB dongle is recognized as Unknown Device Th
17. amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return seed Rockey Ip2 0x12345678 retcode Rockey RY SEED amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return if pl 0xD03A amp amp p2 0x94D6 amp amp p3 0x96A9 amp amp p4 0x7F54 printf Hello FeiTian n else printf Hello error n return Rockey4ND User s Guide FEITIAN Rockey4ND User s Guide Close Rockey retcode Rockey RY CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return 7 4 7 User ID Steps 8 and 9 Write the User ID to the dongle with the Editor or API User ID may be a software version or product type and it may also be used in some encryption schemes See Step 8 and Step 9 Note Advanced passwords are needed for Step 8 Initialize ROCKEY and write User ID to the dongle See Step 8 include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEYAND Variable BYTE buffer 1024 ROCKEY4ND Variable p1 0xc44c ROCKEY4ND Demo Password1 p2 0xc8f8 ROCKEYAND Demo Password2 p3 0x0799 ROCKE
18. amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Random 04X n p1 Ip2 0x12345678 retcode Rockey RY_SEED amp handleEnd amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Seed 04X 04X 04X 04X n p1 p2 p3 p4 retcode Rockey RY_CLOSE amp handleEnd amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n FEITIAN Rockey4ND User s Guide Chapter 8 ROCKEY4ND Hardware Algorithms Developers may define their own algorithms and securely store them inside ROCKEY4ND The dongle may then be used to calculate a result and the result used by the application Since the ROCKEY4ND s User Algorithm Zone UAZ is unreadable even by the manufacturer this type of software protection is potentially very powerful Developers may use either the ROCKEY editor or the RY_WRITE_ARITHMETIC function to write algorithms to the dongle 8 1 ROCKEY User Defined Algorithm Introduction 8 1 1 Instruction Format All instructions must be in the following format reg1 reg2 op reg3 value reg1 reg2 and reg3 are registers value is a figure op is an operator For example A A B ROCKEY supports the following operators lt 1 amp and value is a decimal number between 0 and 63 Note operator is used
19. or indirectly related to the cause of action In no event shall Feitian be liable for any damages caused by your failure to meet your obligations nor for any loss of data profit or savings or any other consequential and incidental damages even if Feitian has been advised of the possibility of damages or for any claim by you based on any third party claim FEITIAN Rockey4ND User s Guide 6 Termination This Agreement shall terminate if you fail to comply with the terms herein Items 2 3 4 and 5 shall survive any termination of this Agreement FEITIAN Rockey4ND User s Guide Quick Start H The ROCKEY4ND evaluation kit is provided to developers for trial purpose It includes the product package documentation CD ROM extension cable and dongle The dongle is the same as the formal dongle except that the access password for it is public P1 C44C P2 C8F8 P3 0799 P4 C43B If customers want to purchase the product after evaluation a dongle with a unique password will be provided for security consideration H To install ROCKEY4ND SDK run Setup exe in the kit with which you can finish the installation of the SDK through a wizard For details see Chapter 3 ROCKEYAND SDK H You can find the dongle editor Rockey4ND_Editor exe under Editor directory in Utilities directory of the SDK You can modify test or write to the dongle using this tool For details see Chapter 5 ROCKEYAND Editor H An envelope encryption too
20. p4 retcode DWORD 1p1 1p2 BYTE buffer 1024 int i j char cmd2 A E E B F F C G G D H H pl xc44c p2 Oxc8f8 p3 0x0799 p4 xc43b retcode Rockey RY FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 88X n 1p1 retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return a le while retcode retcode Rockey RY_FIND NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode FEITIAN Rockey4ND User s Guide ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 8X n 1p1 i printf n for j 8 j lt i j p1 p2 1 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 8 Pass 04X Decrease no allow n p2 DZ p2 2 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode
21. printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode DWORD findlp1 truelp1 DWORD 1p1 1p2 BYTE buffer 1024 int i J char cmd A E E B F F C G G D H H pl xc44c p2 Oxc8f8 p3 0x0799 p4 xc43b retcode Rockey RY FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return J printf Find Rock 88X n 1p1 findlp1 1p1 retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return a ale while retcode FEITIAN Rockey4ND User s Guide retcode Rockey RY FIND NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR NOMORE break if retcode ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 88X n 1p1 printf n for j 8 j lt i j p1 7 p2 0x2121 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return y printf Set Moudle 7 Pass 4X Decrease no allow n p2 p1 strcpy char buffer cmd retcode
22. so you can make full use of the encryption functions of ROCKEY4ND Developers can decide where and how to encrypt their software API encryption is more secure than envelope encryption and especially so when the internal algorithm function of ROCKEYAND is utilized But API encryption must work with the original program and it can take the developer more time to become familiar with the API FEITIAN Rockey4ND User s Guide Chapter 2 ROCKEY4ND Hardware Features 2 1 ROCKEYAND Internal Structure At the core of ROCKEYAND is a specialized CPU with a USB interface It supports the USB 1 0 standard and is compatible with USB 2 0 standard In addition to the CPU is a non volatile memory chip that can save your data in the event of a power loss The ROCKEYAND functions are divided into User Module and Algorithm zones The developer may store important information such as an application serial number inside the dongle You can write to the ROCKEY4ND dongle as many as 100 000 times there is no appreciable limit on the numbers of reads The ROCKEY4ND chip supports special functions for random number generation seed code generation and user defined algorithm interpretation 2 2 ROCKEYAND Hardware Interface ROCKEYAND USB supports USB Standard 1 1 At the most 16 USB dongles can attach to a computer with a USB extension HUB The LED of ROCKEY4ND USB indicates the status of the dongle In a normal state after the dongle is attached to the computer t
23. 130 9 1 Typical Solutions to Some Problems aaaaaaaaaaaaaaaaasaaasanasannsnnnsnnnnnnnnnnnnnnnnnnnnnnsnnnsnnnnnnnnnnnsnnnsnnnsnnnsnnnsnnai 130 D2 FAOS SERERREEEPELLEEFEIERPEFEHPE PEFELPEPPEFEUERERFFELEEFFEFEDELTEFFEUEFFEREESEEGERSEERFEEREDELTFESPPERFEPNFDELEFPEFLERSEPREHELSEESFUFRFPEELELEREFRLERFRERNER 130 FEITIAN Rockey4ND User s Guide Chapter 1 Introduction 1 1 About ROCKEY4ND ROCKEY4ND is an advanced software protection system that attaches to the USB port of a computer Your software may be duplicated but it will only run when your ROCKEY4ND dongle is attached to the computer It can also limit the use of your software Your application will interact with ROCKEY4ND at start up and during runtime If the dongle has been removed or if an application module has been accessed a preset number of times it can issue an error message and terminate or take other alternative actions to ensure compliance with your licensing agreement ROCKEYAND is versatile and can be applied to other scenarios as required Unlike some competing products ROCKEY4ND is a powerful miniature computer with a CPU memory and specialized firmware built in that allows for a robust interaction with your application You may write complex algorithms that are securely stored in the dongle and then call those algorithms from time to time in your application This method for software protection is strongly recommended and is very difficult to crack and al
24. 90 90 90 00 90 90 90 90 0O 00 90 00 90 00 00 00 00 00 00 00 00 90 00 00 90 00 00 00 00 00 90 90 90 00 90 90 00 90 90 90 00 90 00 90 Page 1 Figure 5 7 5 3 1 Test There are five components to the Test screen User Data Zone UDZ Calculation Zone User ID Zone UIZ Module Attribute Zone and the Seed Calculation Zone See Figure 5 8 FEITIAN Rockey4ND User s Guide s ROCKEYAND_Editor 1 2 Rockey4ND_1 File Edit View Help LDPuWdeseb BA amp BER C r Local donglefwirxP Input Password Edit Test Self Test amp 0x031b1553 gt User Memory User Algonthm Zone User Memoy1 O User Memory 2 Read Calculate 0000 00 00 00 00 00 00 00 00 amp Parameters 0 Cale1 OcCale2 OCale3 UAZ Add 0 Mod lo l A 0 V 0 W Operating status o MR 0 16 19 11 Read user memorySucce A 16 19 12 Read user memorySucce Results x 16 19 14 Write user memorySucce A 0 B jo w 16 19 16 Road user momorySucee A 16 20 21 Set module zoneSuccess c 0 D 0 w 16 20 32 Read user memorySucce A 16 21 22 Read user memorySucce Module Zone User ID x 16 21 28 Read user memorySucce Read x 16 21 38 Write algoritamSuccessfu x 16 21 43 Write user memorySucces AU A 16 21 45 Read user memorySucce 00 INYA 08 INVA amp User x 16 21 48 Read user IDSuccessfull oer A z 16 21 50 Read user IDSuccessfull SU DE LINE Sees x 16 21 52 Write user IDS
25. G A A lt C A A D B B B C C C D D D p1 xc44c p2 Oxc8f8 FEITIAN Rockey4ND User s Guide 0x0799 xc43b p3 p4 retcode Rockey RY FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 88X n 1p1 retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return al alg while retcode retcode Rockey RY FIND NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 88X n 1p1 FEITIAN Rockey4ND User s Guide printf n for j 9 j lt i j jf pl 7 p2 0x2121 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 7 Pass 04X Decrease no allow n p2 printf n YA p1 strcpy char buffer cmd retcode Rockey RY_WRITE_ARITHMETIC amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retco
26. Moudle 1 Pass 4X Decrease no allow n p2 FEITIAN Rockey4ND User s Guide retcode Rockey RY SET MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 2 Pass 4X Decrease no allow n p2 pl 3 p2 4 p3 9 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return J printf Set Moudle 3 Pass 4X Decrease no allow n p2 printf n p1 strcpy char buffer cmd retcode Rockey RY WRITE ARITHMETIC amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write Arithmetic 1 n lp1 Ip2 7 p1 5 p2 3 p3 1 p4 exffff FEITIAN Rockey4ND User s Guide retcode Rockey RY_CALCULATE1 amp handle j amp lp1 81p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Calculate Input p1 5 p2 3 p3 1 p4 exffff n printf Result 5 23 3 17 x2121 lt 1 Oxffff 8xBC71 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 t1 pl pl 10 strcpy char buffer cmd1 retcode Rockey RY_WRITE_ARITHMETIC amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Sh
27. NET ShellOption Algorithm 3DES E RedisposeStrongName No CreateNewStrongName StrongFileName Encrypt BLOB Data Encrypt String Data Encrypt Resource Data Encrypt Method Body Method List Figure 6 6 Choose a function or functions to be encrypted Feitian Shell Protect Center 1 0 9 1210 Project File Protect Language View Help HSEeuBE a8 LG D El Rockey4 ND Index Type Import File Export File PL c44C 01 Net_32 E MyExplorer exe E MyExplorer_packed exe P2 C8F8 02 PE 32 E NOTEPAD EXE E NOTEPAD_packed EXE E Bind UID No 03 DATA32 E Ecma 335 pdf E Ecma 335_packed pdf UID Start 00000000 UID End 00000000 E Bind Module No Desc No Select Function to Encrypt x Module index 0 oor E v Bind Fb Lian MiyExplorer Form Check Time intervals 120 M ctor Message Title Error ADispose MSG of No Dongle Can t Find the Dongle ie tializeComponent E NET ShellOption Main Algorithm E 3DES MlistBoxi_DoubleClick 2 h Mbuttoni Click E RedisposeStrongName No Amenul tem2_Click CreateNewStrongName No menultem4 Click StrongFileName menultems Cli ck Encrypt BLOB Data No Meere F meni emiU_Ll c Encrypt String Data No Mmenultemi1 Click Encrypt Resource Data No Mmenultemi4 Click Encrypt Method Body No IMAmenultemd Click Method List Encrypt All x Figure 6 7 FEITIAN Rockey4ND User s Guide Date protection options Feitian Shell Protect Center 1 0 9 1210 Project File Protect Language
28. Objective To check if another specific ROCKEY4ND is attached to the USB port Input parameters function RY_FIND_NEXT p1 Password 1 p2 Password 2 p3 Password 3 optional p4 Password 4 optional lp1 The hardware ID of the last dongle found by RY_FIND or RY_FIND_NEXT FEITIAN Rockey4ND User s Guide Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will write the ROCKEY4ND Hardware ID HID to Ip1 7 2 3 Open the ROCKEY4ND dongle RY OPEN Objective To open a ROCKEYAND dongle with specified passwords or hardware ID Input parameters function RY OPEN p1 Password 1 p2 Password 2 p3 Password 3 optional p4 Password 4 optional pl Hardware ID Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will write the handle address to the handle parameter 7 2 4 Close the ROCKEY4ND dongle RY_CLOSE Objective To close a ROCKEY4ND dongle with a specific handle Input parameters function RY_CLOSE handle ROCKEY4ND s handle Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error 7 2 5 Read the ROCKEY4ND dongle RY_READ Objective To read the contents of the User Data Zone UDZ Input parameters functi
29. View Help HEOBRSaKY C440 01 Net_32 E MyExplorer exe E MyExplorer_packed exe P2 C8F8 02 PE 32 E NOTEPAD EXE E NOTEPAD_packed EXE E Bind UID No 335_packed pdf UID Start 00000000 UID End 00000000 No No Module index 0 Bind HID 00000000 Check Time intervals 120 Message Title Error MSG of No Dongle Can t Find the Dongle E DataProtect Option Algorithm 3DES 05 Select WIN32 Figure 6 8 Net Rockey4 ND dongle options Pi C44C P2 C8F8 Access Mode Share Mode Logon Module Index E Bind UID No UID Start 00000000 UID End 00000000 Bind HID 00000000 Check Time intervals 120 ConfigFile Name clicfgRY4ND ini Message Title Error MSG of No Dongle Can t Find the Dongle MSG of Too Users Too Users Logined MSG of No Config File Can t Find NetWork Config File Figure 6 9 Results after adding an envelope FEITIAN Rockey4ND User s Guide 01 Net_32 E MyExplorer exe E MyExplorer_packed exe y Ok 02 PE_32 E NOTEPAD EXE E NOTEPAD_packed EXE v Ok 03 DATA32 E Ecma 335 pdf E Ecma 335_packed pdf v Ok module number is 0 Module is reduced No Open the back timing detection Detection time interval is 120 Error Message title Error Tips can not find the USB keys Can t Find the Dongle Encryption Results Sucess Figure 6 10 FEITIAN Rockey4ND User s Guide Chapter 7 ROCKEY4ND APIs The ROCKEYAND Application Programming Interface API is the
30. needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find all Rockey for i 0 i lt 16 i if 0 i retcode Rockey RY FIND amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break else Notice p1 Last found hardID retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode Error printf Error Code d n retcode return printf Found Rockey 08X n Ip1 HID i p1 Save HardID retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode FEITIAN Rockey4ND User s Guide return printf n rynum i Do our work for i 0 i lt rynum i printf Rockey 08X module status HID i for j 0 j lt 16 j pl j Module No retcode Rockey RY_CHECK_MOUDLE amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return if p2 printf O else printf X printf n Close all opened Rockey for i 0 i lt rynum i retcode Rockey RY CLOSE amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode
31. operation progress and you may stop your operations at any time Note All numbers are input and displayed in hexadecimal with the exception of the number of generated seed codes in the test screen 5 2 Operation 5 2 1 Input Password You may enter the Basic and Advanced passwords as shown in Figure 5 5 FEITIAN Rockey4ND User s Guide sw ROCKEYAND_Editor 1 2 Rockey4ND_1 File Edit View Help Deus 2 BA amp KBE A le Local donglefWirxP M Input Password Edit Test Self Test amp 0x081b1653 i i 2 Se Basic PW1 Basic Pw2 Adv PWT Adv Pw2 Auto save pass ES Operating status A 16 19 11 Read user memorySucce x 16 19 12 Read user memorySucce sf 16 19 14 Write user memorpSucces w 16 19 16 Read user momorySucoc Figure 5 5 Make sure you enter the correct passwords If the Basic passwords are incorrect Editor cannot find the dongle If the Basic passwords are correct and the Advanced passwords are invalid the Editor should find the dongle and allow Read functions but it will not allow Write functions If you click DEMO button you may perform any operations on DEMO dongles The 4 passwords for DEMO dongles are P1 C44C P2 C8F8 P3 0799 P4 C43B The passwords will be saved automatically when you choose Auto save password This function avoids future password entry errors If the entered password information corresponds with the attached ROCKEYAND dongl
32. or pull down menus such as print save and refresh Shortcut keys and icons are also offered 2 Status Bar The Status Bar is at the bottom of the screen The Status Bar message is for the dongle selected in the Device Selector See below portion of the screen Status messages are Read Write and Ready See Figure 5 2 FEITIAN Rockey4ND User s Guide sw ROCKEY4ND_Editor 1 2 Rockey4ND_1 File Edit View Help UB SA AR yawa E W Local dongle WinkP amp 0x08fb1653 Input Password Self test Testing input Error code User Memory 1 User Memory 2 User ID Random Seed Test Module Test calc 1 Test calc 2 Test calc 3 Initialize dongle Testing result 8 Operating status Operation Settings T Status Found 1 ROCKEY4ND testing 1 0x08fb1653 Select all Self testing please wait Figure 5 2 3 Tree View This is the upper left portion of the screen and shows the current OS version and ROCKEYAND dongles that are attached to the computer See Figure 5 3 FEITIAN Rockey4ND User s Guide s ROCKEYAND_Editor 1 2 Rockey4ND 1 File Edit View Help oD238s22B2AX 5880 Local dongle winxP Edit Test SelfTest 08fb1 653 amp ia User Data Zone User Algonthms Zone User Memoy 1 O User Memory 2 an EA 00 00 00 00 nana m 00 0
33. p4 buffer if retcode ShowERR retcode return printf Write alb2c3d4e5f6 n p1 0 p2 2 memset buffer 0 64 retcode Rockey RY_READ amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Read s n buffer FEITIAN Rockey4ND User s Guide if Istremp buffer a1 printf Run Module 1 n else break p1 2 p2 2 memset buffer 0 64 retcode Rockey RY READ amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Read s n buffer if Istremp buffer b2 printf Run Module 2 n else break retcode Rockey RY_CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch Step 16 Write anumber to the UDZ and decrease it during run time as a means of controlling a software module We recommend you use the encryption idea in Step 12 combined with Step 16 include lt windows h gt FEITIAN Rockey4ND User s Guide include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode DWORD Ipi Ip2 BYTE buffer 1024
34. retcode retcode Rockey RY_FIND NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 8X n 1p1 printf n for j 0 j lt i j pil 75 p2 0x2121 p3 0 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide printf Set Moudle 7 Pass 4X Decrease no allow n p2 printf n lp2 0x12345678 retcode Rockey RY_SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Seed 84X 04X 04X 84X n pl p2 p3 p4 printf n pl p2 1 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 8 Pass 04X Decrease no allow n p2 p1 1 p2 2 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set
35. stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEY4ND Variable p1 0xc44c ROCKEY4ND Demo Password1 p2 Oxc8f8 ROCKEYAND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return retcode Rockey RY_OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error FEITIAN Rockey4ND User s Guide printf Error Code d n retcode return retcode Rockey RY RANDOM amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Random 04X 04X 04X 04X n p1 p2 p3 p4 sprintf buffer 04X p1 p1 0 Pos p2 4 Length p3 1 retcode Rockey RY_WRITE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Write s n buffer p1 0 Pos p2 4 Length buffer 4 0 retcode Rockey RY_READ amp handle amp lp1 amp lp2 amp p1 am
36. strong method because a failure to properly decrypt the string can cause the application to terminate or take other actions in accordance with the licensing agreement FEITIAN Rockey4ND User s Guide 5 Use API encryption and Envelope encryption together The strongest protection method will have the developer first using a complex and dynamic implementation of the ROCKEY API and then protecting this new file with the ROCKEY Envelope Keep the end user environment in mind when you design the software protection solution You should flexibly adopt the methods suggested here within the limitations and objectives of your environment and licensing policy FEITIAN Rockey4ND User s Guide Chapter 9 FAQs Some frequently asked questions about ROCKEY4ND are listed in this chapter You may find the solution to your problems with the use of the ROCKEY4ND dongle hereinafter 9 1 Typical Solutions to Some Problems H Test the dongle using Rockey4ND_editor under Editor directory H Replace the current version of the driver with the newest version which can be downloaded from Feitian website The website will be updated between whiles H Check if the problem persists after using another computer with your device H Check if your computer has been attacked by a virus or the like which may block the program you are using 9 2 FAQs 9 2 1 What is an evaluation kit The evaluation kit is designed for developers to evaluate the dong
37. was not either an original part of the Product or a Feitian provided enhancement or upgrade to the Product 3 Warranty Feitian warrants that the hardware and Software storage media are substantially free from significant defects of workmanship or materials for a time period of twelve 12 months from the date of delivery of the Product to you 4 Breach of Warranty In the event of breach of this warranty Feitian s sole obligation is to replace or repair at the discretion of Feitian any Product free of charge Any replaced Product becomes the property of Feitian Warranty claims must be made in writing to Feitian during the warranty period and within fourteen 14 days after the observation of the defect All warranty claims must be accompanied by evidence of the defect that is deemed satisfactory by Feitian Any Products that you return to Feitian or a Feitian authorized distributor must be sent with freight and insurance prepaid EXCEPT AS STATED ABOVE THERE IS NO OTHER WARRANTY OR REPRESENTATION OF THE PRODUCT EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 5 Limitation of Feitian s Liability Feitian s entire liability to you or any other party for any cause whatsoever whether in contract or in tort including negligence shall not exceed the price you paid for the unit of the Product that caused the damages or are the subject of
38. 0 00 00 00 00 00 00 z Benet E 00 00 00 00 00 00 00 00 D 00 00 00 00 00 00 00 90 e 00 00 00 00 W Operating status 00 00 00 00 5 A 16 19 11 Read user memorySucce 90 in un ta lu x 16 19 12 Read user memorySucce 00 00 00 KA 16 19 14 Write user memorySucce 00 00 00 a 16 19 16 Read user memorySucec oo 00 oo 16 20 21 Set module zoneSuccess MJ Auto S E a A 16 20 32 Read user memorySucce 1 User ID Zone 11111111 00 6 ao o2 0 03 o 04 o V 06 O 0 RRR 07 O white v Batch Operation User ID Single Operaton _ UserID O UserID Batch Writ Read Write Sites een ite Figure 5 3 4 Operation Status The time results and error prompt of the previous operations will display here This section is the lower left portion of the screen See Figure 5 4 FEITIAN Rockey4ND User s Guide sn ROCKEY4ND_Editor 1 2 Rockey4ND_1 File Edit View Help Dehn ahd yaa Local donglefwirxP Input Password Edit Test Se Tet User Data Zone User Algorithms Zone User Memoy1 O User Memory 2 arm Sm Wu 00 00 00 00 00 00 ofc O 00 00 00 00 00 00 Apr 00 00 00 00 90 90 o2 e B c E 00 00 00 00 00 00 H 00 00 00 00 00 00 2 m 00 00 00 00 00 00 00 00 00 00 00 00 Di g 00 00 00 00 00 00 ASAD 7 9 Operating status 00 00 00 00 00 00 e x 16 13 11 Re
39. 0 DOM DO 1 DO Batch Operation User ID Single Operaton User ID O UserID O No Change O Use Time ID lt Figure 5 6 Here you may edit the specified ROCKEY There are 6 components on the Edit screen User Data Zone UDZ Module Zone User Algorithm Zone UAZ User ID Zone UIZ Single Operation Zone SOZ and Batch Operation Zone BOZ User Data Zone UDZ The UDZ is a user defined memory space Data may be entered here in hexadecimal or ASCII text in the field provided Click the Read button to read data from the UDZ and Write to write to the UDZ If you click the Read or Write button a progress bar will appear After the operations are finished the results will be displayed in the Operation Status section See Figure 5 6 Module Zone This part of the screen is used to update the values and decrement attributes of the ROCKEY4ND modules To add new values to a module simply enter the new value in the field of the module and click Write The Decrement attribute can likewise be altered All 64 ROCKEYAND modules are displayed here labeled O to F in hexadecimal User Algorithm Zone UAZ You can write some algorithm statements here which consist of operands and operator s such as A A B refer to Chapter 8 There is a button after each statement marking the statement The flag of the start statement S end statement E intermediate statement blank and standalone statement
40. 00 00 00 00 00 00 00 00 90 90 90 00 00 90 90 00 00 00 00 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OO 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Operating status 16 19 11 Read user memorySucce 2 Read user memorySucce 4 Write user memorySucces A 16 19 16 Read user memorySucce 16 20 21 Set module zoneSuccess 16 20 32 Read user memorySucce 16 21 22 Read user memorySucce VU 16 21 28 Read user memorySucce A 16 21 38 Write algoritamSuccesstu A 16 21 43 Write user memorySucce A 16 21 45 Read user memorySucce 8 Read user IDSuccessfull 0 Read user IDSuccessfull 2 Write user IDSuccessfully Kee 16 22 34 Batch geneiate seedSuc User Memory 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 90 90 00 00 90 90 00 90 00 00 00 90 90 00 00 00 00 00 00 00 90 00 00 00 00 00 00 00 00 90 00 90 90 00 00 90 00 00 90 00 90 90 00 00 00 00 00 00 00 00 00 90 00 00 00 00 00 00 00 00 90 90 00 00 00 90 00 00 00 00 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 90 90 90 00 00 90 00 90 90 00 00 00 00 90 00 00 00 00 00 00 00 00 00 00 90 00 00 00 00 90
41. A successful operation will result in module unit p1 storing value p2 and the Decrement attribute set to 0 or 1 7 2 12 Check a ROCKEY4ND Module RY CHECK MOUDLE Objective To read the attributes of a specific ROCKEY4ND module Input parameters Junction RY_CHECK_MOUDLE handle ROCKEYAND s handle p1 Module Number Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in p2 populated in the value from the Zero Value attribute 1 module value is not zero and p3 populated with the value from the Decrement attribute 1 module can be decreased 7 2 13 Write Arithmetic RY_WRITE_ARITHMETIC Objective To write user defined mathematical instructions to the User Algorithm Zone UAZ Input parameters function RY_WRITE_ARITHMETIC handle ROCKEYAND s handle p1 position of first instruction in UAZ buffer buffer address of the algorithm command string Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in the UAZ populated with the algorithm command string from the buffer 7 2 14 Calculate 1 RY_CALCULATE1 Objective To return the results of a calculation performed in ROCKEY4ND using input provided by the developer and the RY_CALCULATE1 function I
42. Click the Read Module Attributes button to update this portion of the Test screen N A means that the Zero Value attribute is 0 Valid means the Zero Value attribute is not 0 If the Dec button is grayed out the module cannot be decremented If it is to be decremented clicking the Dec button will reduce the value stored in the module by 1 Seed Calculation Zone There are two small sections to the Seed Calculation Zone The top section will display four calculated seed results for any entered seed code Enter a decimal number in the Number Generate field in the bottom section and that same number of random seed codes and corresponding results will be written to a text file defined in the File field The default file is Random_Seed txt under the directory of the executable FEITIAN Rockey4ND User s Guide 5 3 2 Self test Test all ROCKEY4ND dongles attached to the computer one by one or test only selected dongle s First you can specify the items that will be tested All specified dongles will be tested automatically sm ROCKEYAND_Editor 1 2 Rockey4ND_1 File Edit View Help h A HM s a Ba E Local dongle win lt P l Input Password Edit Test Self Test amp 0x08161653 a Selt test Testing input Testing result Error code User Memory 1 User Memory 2 User ID Random Seed Test Module Test calc 1 Test calc 2 Test calc 3 Init
43. FEITIAN S ee i Rockey4ND User s Guide Feitian Technologies Co Ltd Website www FTsafe com FEITIAN Revision History Rockey4ND User s Guide Date Revision Description FEITIAN Rockey4ND User s Guide Software Developer s Agreement All Products of Feitian Technologies Co Ltd Feitian including but not limited to evaluation copies diskettes CD ROMs hardware and documentation and all future orders are subject to the terms of this Agreement If you do not agree with the terms herein please return the evaluation package to us postage and insurance prepaid within seven days of their receipt and we will reimburse you the cost of the Product less freight and reasonable handling charges 1 Allowable Use You may merge and link the Software with other programs for the sole purpose of protecting those programs in accordance with the usage described in the Developer s Guide You may make archival copies of the Software 2 Prohibited Use The Software or hardware or any other part of the Product may not be copied reengineered disassembled decompiled revised enhanced or otherwise modified except as specifically allowed in item 1 You may not reverse engineer the Software or any part of the product or attempt to discover the Software s source code You may not use the magnetic or optical media included with the Product for the purposes of transferring or storing data that
44. FEITIAN Rockey4ND User s Guide ShowERR retcode return printf Set Moudle 8 Pass 04X Decrease no allow n p2 p1 8 retcode Rockey RY_CHECK_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Check Moudle 8 if p2 printf Run Modul 2 else break retcode Rockey RY_CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n Step 21 This program discussed how to perform multi module encryption and check the status of the modules Many applications are segmented into program modules that users may choose or purchase separately For example a user may purchase three of four available application modules and the licensing policy would allow the user to execute only those modules that were purchased ROCKEY4ND modules may be used to enforce this licensing scheme include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main FEITIAN Rockey4ND User s Guide inti j rynum WORD retcode DWORD HID 16 WORD handle 16 p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEY4ND Variable p1 Oxc44c ROCKEYAND Demo Password1 p2 Oxc8f8 ROCKEY4ND Demo Password2 p3 0 Program
45. FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 08X n Ip1 printf n FEITIAN Rockey4ND User s Guide for j 0 j lt i j Ip1 0x11111111 retcode Rockey RY_WRITE_USERID amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write User ID 08X n Ip1 y Ip1 0 retcode Rockey RY_READ_USERID amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return if Ipl 0x11111111 handleEnd handle j break p2 12 p3 1 strepy char buffer Hello Feitian retcode Rockey RY WRITE amp handleEnd amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write s n buffer FEITIAN Rockey4ND User s Guide p2 12 buffer 512 0 retcode Rockey RY READ amp handleEnd amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Read s n buffer retcode Rockey RY_RANDOM amp handleEnd amp lp1
46. KEYAND Hardware Algorithms 7 5 1 User Data Zone advanced application In Step 14 we will write Hello FEITIAN to User Data Zone UDZ In general we would write Hello FEITIAN to the UDZ as one character string but security may be enhanced by writing it in two parts and then later combining the character strings include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode DWORD Ip1 Ip2 BYTE buffer 1024 BYTE buf 1024 inti j p1 Oxc44c p2 0xc8f8 p3 0 p4 0 FEITIAN Rockey4ND User s Guide retcode Rockey RY_FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY_OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i 1 while retcode 0 retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR NOMORE break if retcode ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR re
47. Note All interface parameters must be defined in your program ROCKEY4ND cannot transfer NULL or O pointers Use of Null or 0 pointers in your program will generate an error Parameter Name Parameter Type Parameter Meaning Function A 16 bit number API function Handle Address of a 16 bit ROCKEY4AND session FEITIAN Rockey4ND User s Guide number address Address of a 32 bit number long parameter 1 Address of a 32 bit number long parameter 2 Note All parameters must be defined in the program Do not pass a Null pointer Otherwise an error will occur Address of a 16 bit number Address of a 16 bit number Address of a 16 bit number Address of a 16 bit number NEE Za Address of a 8 bit number e function is a 16 bit number It stands for the specific function and it is defined below Parameter Name Parameter Type Parameter Meaning RY_FIND 1 Find ROCKEYAND RY_FIND_NEXT 2 Find next ROCKEY4ND RY_OPEN 3 Open ROCKEY4ND RY_CLOSE 4 Close ROCKEY4ND RY_READ 5 Read ROCKEY4ND RY_WRITE 6 Write ROCKEY4ND RY_RANDOM 7 Generate Random Number RY_SEED 8 Generate Seed Code RY_WRITE_USERID 9 Write User ID RY_READ_USERID 10 Read User ID RY_SET_MOUDLE 11 Set Module RY_CHECK_MOUDLE 12 Check Module FEITIAN Rockey4ND User s Guide RY WRITE ARITHMETIC 13 Write Arithmetic RY_CALCULATE1 14 Calcu
48. PE folder Select Type FeiTian OCKEY FEITIAN suna io Figure 6 1 Main interface Figure 6 2 FEITIAN Rockey4ND User s Guide Rockey4ND dongle options pi C44C We C8F8 E Bind UID No UID Start 00000000 UID End 00000000 E Bind Module No Desc No Module index 0 Bind HID 00000000 Check Time intervals 120 Message Title __ Error MSG of No Dongle Can t Find the Dongle Figure 6 3 Add File dialog box File Path Program v Program ata _ Figure 6 4 FEITIAN Rockey4ND User s Guide The file type is recognized automatically When a file is selected related envelope options are displayed on the right side PE envelope options Feitian Shell Protect Center 1 0 9 1210 Project File Protect Language View Help cars No DATA32 E Ecma 335 pdf UID Start 00000000 UID End 00000000 No No Module index Bind HID Check Time intervals Message Title MSG of No Dongle Can t Find the Dongle Check Parent Replace Code File Protect Figure 6 5 Net envelope options FEITIAN Rockey4ND User s Guide B Feitian Shell Protect Center 1 0 9 1210 Project File Protect Language View Help DER 02 03 DATA32 E Ecma 335 pdf E Ecma 335_packed pdf UID Start 00000000 UID End 00000000 E Bind Module No Desc No Module index 0 Bind HID 00000000 Check Time intervals 120 Message Title Error MSG of No Dongle Can t Find the Dongle E
49. Y4ND Demo Password3 p4 0xc43b ROCKEY4ND Demo Password4 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n FEITIAN Rockey4ND User s Guide return retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return Ip1 0x88888888 retcode Rockey RY_WRITE_USERID amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Write User ID 08X n Ip1 retcode Rockey RY CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return Verify the User ID If the User ID is not 0x88888888 output Hello DEMO See Step 9 include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode FEITIAN Rockey4ND User s Guide WORD handle p1 p2 p3 p4 ROCKEYAND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEY4ND Variable p1 0xc44c ROCKEY4ND Demo Password1 p2 0xc8f8 ROCKEYAND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program need
50. _PE the dongle selection dialog box will not be displayed and the dongle type will be selected automatically to facilitate the integrated or individual release of this system F The types of the envelope file supported by the current dongle can be recognized automatically according to the presence of related DLL file in the folder When an unsupported file type is added a message will be displayed 3 The enveloper based on the command line A If you do not want to use the interface program you can develop a self defined upper level interface based on this command line program B Apparently the commands of the command line program are complex If you do not want to learn how to use them the C source files for generating a command line from data structure can be available upon request to facilitate your development of interface 4 The enveloper module on the dongle This is the core module for implementing different types of dongle and file enveloping By developing this module and place it into a corresponding folder the required functions can be achieved independent of the upper level interface and the command line program Currently the following modules have been implemented win32_PE win32_DOTNET and win32_DATA for Rockey4ND and win32_PE win32_DOTNET and win32_DATA for NetRockey4ND Screenshots FEITIAN Rockey4ND User s Guide Choose a dongle type this bor is not displayed if there is only one DLL file under WIN32
51. _WRITE_USERID amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write User ID 08X n Ip1 Ipl 0 retcode Rockey RY_READ_USERID amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Read User ID 08X n Ip1 sprintf buffer 08X Ip1 GetLocalTime amp st printf Date 04d 02d 02d n st wYear st wMonth st wDay FEITIAN Rockey4ND User s Guide sprintf buf 04d 02d 02d st wYear st wMonth st wDay if stremp buf buffer gt 0 printf ok n else break retcode Rockey RY CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch 7 5 4 Module advanced applications Step 20 Module encryption allows you to selectively control portions of your application with the ROCKEY4ND modules include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode DWORD Ipi Ip2 BYTE buffer 1024 FEITIAN Rockey4ND User s Guide inti j p1 Oxc44c p2 Oxc8f8 p3 0x0799 p4 0xc43b retcode Rockey RY FIND amp handle 0 amp lp1 amp
52. ad user memorySucce H co t go ae ga 06 m JM 16 19 12 Read user memorySucce Br 3 00 00 00 00 00 00 07 l A 16 19 14 Write user memorySucce 0 00 00 00 00 00 00 v w 16 19 16 Read user memorySucec 0068 00 00 00 00 00 00 v A 16 20 21 Set module zoneSuccess Y Auto S E wrie x 16 20 32 Read user memorySucce Module Zone User ID Zone cole write ojo O wite mo Om aa o2 o O write 10 0 O write UserID 1111111 ma n JOC up oC 120 e Me mul 6 0 Oe 10 DOW or o O wie 150 _ OC wis Batch Operation User ID Single Operaton UserID User ID LI O No Change O Use Time ID la Figure 5 4 5 Operation Main Window The Operation Main Window has five selection tabs Password Edit Test Self Test and Batch Write Each tab corresponds to a screen and a function Template files rki can be opened by dragging and dropping the template file to the open Editor window It can also be opened from the file pull down menu in the Editor or by clicking the file from Explorer You may print preview the template file and print it out You may use the Editor without a ROCKEY4ND dongle attached to the computer and save the results to a template file The template file can later be used for a Write or Batch Write to a ROCKEY4ND dongle s The template file may be updated with the Editor while dongles are attached A progress bar will display all your
53. address will be wrapped For example when calling calculation 3 with Ip2 62 the initial values of registers E F G and H are as follows E Content of module 62 F Content of modle 63 G Content of module 0 H Content of module 1 8 1 5 Writing Self defined Algorithms to Dongle 8 1 5 1 Writing Algorithms Aside from the use of ROCKEY4ND Editor developers can also use the interface RY_WRITE_ARITHMETIC to develop a program for writing algorithms themselves Function RY_WRITE_ARITHMETIC Write algorithm Objective Write algorithms as defined by developers Input parameters function RY_WRITE_ARITHMETIC handle Handle of the dongle p1 Start point of the calculation buffer String of algorithm instructions Return value A value of O indicates that the function works properly Any other value indicates an error For example FEITIAN Rockey4ND User s Guide strepy buffer A A E A A F A A G A A H p1 3 retcode Rockey RY_WRITE_ARITHMETIC handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer You can see that the algorithm to be written is placed into buffer and the instructions are separated by commas The first instruction will be set to the start of the algorithm and the last instruction will be set to the end of the algorithm automatically For example Address 3 of algorithm area A A E Address 4 of algorithm area A A F Address 5 o
54. alue indicates an error A successful operation will result in the following addresses populated with seed code return values p1 Return Code 1 p2 Return Code 2 p3 Return Code 3 p4 Return Code 4 7 2 9 Write the User ID RY_WRITE_USERID Objective To write the user defined User ID to the User ID Zone UIZ Input parameters function RY WRITE USERID handle ROCKEYAND s handle Ip1 User ID Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error 7 2 10 Read User ID RY_READ_USERID Objective To read the user defined User ID from the User ID Zone UIZ Input parameters function RY_READ_USERID handle ROCKEY4ND s handle Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in the lp1 address populated with the User ID 7 2 11 Set a ROCKEY4ND Module RY_SET_MOUDLE Objective To write a value to a specific ROCKEY4ND module and set the Decrement attribute FEITIAN Rockey4ND User s Guide Input parameters function RY SET MOUDLE handle ROCKEYAND s handle o1 Module Number p2 Module Unit Value p3 If decreasing is allowed 1 allowed O not allowed Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error
55. amp amp p4 0xBE5A printf Hello OK n else break retcode Rockey RY_CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch In Step 18 we use four outputs of the seed code function to encrypt and decrypt a character string Be sure you only include the decrypt portion of the code in the application version that is sent to end users include lt windows h gt FEITIAN Rockey4ND User s Guide include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode void main char str 20 Hello FeiTian DWORD mykey 12345678 int n slen WORD handle 16 p1 p2 p3 p4 retcode DWORD Ipi Ip2 BYTE buffer 1024 int i j p1 Oxc44c p2 Oxc8f8 p3 0x0799 p4 0xc43b retcode Rockey RY FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide while retcode 0 retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4
56. ans of protecting and controlling a program module include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode FEITIAN Rockey4ND User s Guide void main WORD handle 16 p1 p2 p3 p4 retcode DWORD Ipi Ip2 BYTE buffer 1024 inti j p1 Oxc44c p2 Oxc8f8 p3 0x0799 p4 0xc43b retcode Rockey RY_FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i 1 while retcode 0 retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j p2 12 p3 1 strcpy char buffer alb2c3d4e5f6 retcode Rockey RY_WRITE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp
57. ata from and write data to the dongle perform arithmetic operations in the dongle or test the dongle for malfunctions See Chapter 5 ROCKEY4ND Editor e ROCKEYAND has an API set that you may use to create flexible and powerful software protection systems This document provides VC examples and other examples are provided on the CD ROM under Samples directory See Chapter 7 ROCKEY4ND APIs 1 2 Software Protection Mechanism of ROCKEY4ND FEITIAN Rockey4ND User s Guide The protected software application must call the ROCKEY4ND dongle during run time since the application is dependant on the hardware It is impossible to duplicate the chipset of the ROCKEY4ND hardware and so too it is impossible to duplicate your software ensuring your software is protected from piracy 1 3 Hardware Configuration User memory is divided into 2 parts The size of each is 500 bytes The length of the algorithm area is 128 units The number of the modules is 64 1 4 ROCKEYAND Benefits 1 Compact Design The dongle is compact and portable 2 High Speed ROCKEYAND was designed to process even very complex algorithms with minimal delay for your application Users will typically notice no degradation in application performance as a result of ROCKY4ND being implemented 3 Ease of Use ROCKY4ND s reduced API set simplifies the programming effort in implementing API calls within your code and the Envelope program has also been improved for inc
58. buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j Encrypt my data slen strlen str Ip2 mykey retcode Rockey RY SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return for n 0 n lt slen n str n str n char p1 char p2 char p3 char p4 printf Encrypted data is s n str Decrypt my data Ip2 mykey FEITIAN Rockey4ND User s Guide retcode Rockey RY SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return for n 0 n lt slen n str n str n char p1 char p2 char p3 char p4 printf Decrypted data is s n str retcode Rockey RY CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch 7 5 3 User ID advanced applications Step 19 Some developers will write the current date to the UID when initializing the dongles During runtime the software may compare the current system ti
59. clude lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEYAND Variable p1 0xc44c ROCKEY4ND Demo Password1 p2 Oxc8f8 ROCKEYAND Demo Password2 p3 0x0799 ROCKEYAND Demo Password3 p4 0xc43b ROCKEY4ND Demo Password4 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return FEITIAN Rockey4ND User s Guide retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return p1 0 p2 3 p3 0 retcode Rockey RY_SET_MOUDLE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return printf Set Moudle 0 Pass 04X Decrease no allow n p2 retcode Rockey RY_CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return If module O is valid in the program output Hello FEITIAN Otherwise terminate or exit the program See Step 11 include lt windows h gt include lt std
60. code return printf Set Moudle 3 Pass 4X Decrease no allow n p2 printf n 27 p1 17 strcpy char buffer cmd2 retcode Rockey RY_WRITE_ARITHMETIC amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write Arithmetic 3 n 1p1 17 lp2 p1 1 FEITIAN Rockey4ND User s Guide p2 2 p3 3 BSS retcode Rockey RY_CALCULATE3 amp handle j amp lp1 81p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Calculate Input p1 1 p2 2 p3 3 p4 4 n printf n printf Result 1 2 3 4 1 2 3 4 0x14 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 retcode Rockey RY CLOSE amp handle j 81p1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch 8 2 2 Complex Algorithm Application Examples 8 2 2 1 Complex example 1 In Step 27 we first search the dongle and get its hardware ID Then we use the calculation 1 function in the program to get the hardware ID again Compare the two hardware IDs If they are different the program will be terminated include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4 ND 32 h void ShowERR WORD retcode FEITIAN Rockey4ND User s Guide if retcode return
61. d before operation ERR_OPEN_OVERFLOW 16 Too many dongles opened gt 16 ERR_NOMORE 17 No more dongle s can be found ERR_NEED_FIND 18 Use FindNext without Find ERR_DECREASE 19 Decrement error FEITIAN Rockey4ND User s Guide ERR_AR_BADCOMMAND 20 Algorithm command error ERR_AR_UNKNOWN_OPCODE 21 Algorithm operator error ERR_AR_WRONGBEGIN 22 The first command of algorithm contains a constant ERR AR WRONG END 23 The last command of algorithm contains a constant ERR_AR_VALUEOVERFLOW 24 The value of the constant of the algorithm is greater than 63 ERR_TOOMUCHTHREAD 25 The number of the threads that open a dongle in a process is greater than 100 ERR_RECEIVE_NULL 0x100 Cannot receive ERR_UNKNOWN_SYSTEM 0x102 Unknown operating system ERR_UNKNOWN Oxffff Unknown error 7 4 Basic Application Examples FEITIAN offers several program examples to help beginners quickly familiarize themselves with ROCKEY These sample programs are intentionally simplified to illustrate various security objectives and should not be construed as sufficient for most real world implementations These samples are for demonstration purposes only This document is not intended to illustrate how to take full advantage of the ROCKEY software protection system that will depend on particularities of the developer the application and the licensing objectives Section 7 5 Advanced Application Exam
62. d4 Set to 0 Try to find Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n FEITIAN Rockey4ND User s Guide return retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return p1 0 Pos p2 14 Length strcpy char buffer Hello FeiTian retcode Rockey RY_WRITE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Write s n buffer retcode Rockey RY_CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return In Step 3 we have written Hello FEITIAN to the ROCKEY dongle In Step 4 we will read the contents of the dongle Read dongle contents Step 4 include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main FEITIAN Rockey4ND User s Guide WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEYAND Variable p1 0xc44c ROCKEY4ND Demo Password1 p2 0xc8f8 ROCKEYAND Demo Password2 p3 0 Program
63. de retcode Rockey RY_FIND NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode FEITIAN Rockey4ND User s Guide ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 8X n 1p1 i printf n for j 8 j lt i j p1 p2 1 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return y printf Set Moudle 0 Pass 4X Decrease no allow n p2 Dez p2 2 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode FEITIAN Rockey4ND User s Guide return printf Set Moudle 1 Pass 4X Decrease no allow n p2 pl 2 p2 3 p3 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 2 Pass 04X Decrease no allow n p2 p1 3 p2 4 p3 retcode Rockey RY SET MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR ret
64. de return printf Write Arithmetic 1 n lp1 1p2 Il Il N we ve p1 p2 Il w u we p3 1 p4 exffff retcode Rockey RY_CALCULATE1 amp handle j amp lp1 81p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode FEITIAN Rockey4ND User s Guide ShowERR retcode return printf Calculate Input p1 5 p2 3 p3 1 p4 exffff n printf n printf Result 5 23 3 17 x2121 lt 1 Oxffff 8xBC71 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 retcode Rockey RY_CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch 8 2 1 2 Calculation 2 example In Step 25 we write algorithm A A B A A C A A D A A E A A F A A G A A H to the UAZ and the calculation result is 0x7b17 include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode return printf Error Code d n retcode void main FEITIAN Rockey4ND User s Guide WORD handle 16 p1 p2 p3 p4 retcode DWORD 1p1 1p2 BYTE buffer 1024 int i j char cmd1 A A B A A C A A D A A E A A F A A G A A H pl xc44c p2 Oxc8f8 p3 0x0799 p4 xc43b retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 am
65. e printf Error Code d n retcode return 7 4 9 Collaboration Step 13 Multi ROCKEY dongles with the same passwords may work on the same computer no matter whether the dongle types are the same or not The program can distinguish the dongles because every dongle has a unique hardware ID See Step 13 FEITIAN Rockey4ND User s Guide include lt windows h gt include lt stdio h gt include Rockey4 ND 32 h Include ROCKEYAND Header File void main inti rynum WORD retcode WORD handle 16 p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEYAND Variable BYTE buffer 1024 ROCKEYAND Variable p1 0xc44c ROCKEYAND Demo Password1 p2 Oxc8f8 ROCKEY4ND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find all Rockey for i 0 i lt 16 i if 0 i retcode Rockey RY_FIND amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break else Notice p1 Last found hardID retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode Error printf Error Code d n retcode return printf Found Rockey 08X 1p1 FEITIAN Rockey4ND User s Guide retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 am
66. e you will be taken to the Edit screen automatically The system will automatically begin to search for attached dongles Note You may edit save open and print template files without inputting the passwords However you cannot operate the dongle without at least the Basic passwords Entering the Basic passwords will allow you to both edit template files and perform Read operations on the corresponding attached dongle 5 2 2 Edit FEITIAN Rockey4ND User s Guide The ROCKEY Hardware ID HID is displayed for all found dongles The HID is globally unigue and cannot be changed See Figure 5 6 m Dongle ID s ROCKEY4ND_Editor 1 2 File Edit View Help Leu Local donge amp 0x081b1663 Bild aA A Input Password Edit Start statement gt User DataZone Algorithms Zone UserMemoy1 User Memory 2 Read Write 0000 00 W Operating status 00 nn x 16 19 11 Read user memorySucce oli Al de eee A 16 19 12 Read user memorySucce 00 00 00 00 00 o r v 16 19 14 Write user memorySucce 16 19 16 Read user memorySuccp wf 16 20 21 Set module zoneSucce M 16 20 32 Read user memorySucce OOB B00R0R v Z Auto S E User ID Zone ge wo 00 Geo Tamm j Write 6 to Module 0 OC wie _ 12 o O wie C u Write and allow decrement we a OO 4
67. ee Step 12 include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEY4ND Variable p1 0xc44c ROCKEY4ND Demo Password1 p2 Oxc8f8 ROCKEYAND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return retcode Rockey RY_OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return p1 0 retcode Rockey RY_CHECK_MOUDLE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer FEITIAN Rockey4ND User s Guide if retcode printf Error Code d n retcode return if p2 1 printf Update Please n return if p3 1 p1 0 retcode Rockey RY_DECREASE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return printf Hello FeiTian n retcode Rockey RY_CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcod
68. elect the content you want to install FEITIAN Rockey4ND User s Guide il ROCKEYAND SDE 1 15 Setup Choose Components Choose which featur2s of ROCKEY4ND SDK V1 15 you want to ROCKEY4ND API Library 12 ROCKEY4ND API Head File Figure 3 4 Step 5 Select the path to install the SDK iB ROCKEYARD SDK Y1 15 Setup Choose Install Location Choose the folder in which to install ROCKEY4hD SDK 11 15 tion Folder C Program Files FeitisnROCKEYAND Browse Figure 3 5 Step 6 Finish installing the SDK Rockey4ND User s Guide FEITIAN jG ROCKEYARD SDE 1 15 Setup Completing the ROCKEY4ND SDK 1 15 Setup Wizard ROCKEY4ND SDK 1 15 has been installed on your computer Click Finish to close this wizard Cancel Figure 3 6 3 2 Uninstalling SDK You may use Add or Remove Programs from the Windows Control Panel or select FEITIAN and then Uninstall from the Windows Start menu to uninstall the installed components FEITIAN Rockey4ND User s Guide Chapter 4 Basic Concepts This chapter covers the basic concepts and functions of the ROCKEYAND software protection system All ROCKEY users should read this chapter carefully to familiarize themselves with ROCKEY 4 1 Passwords When developers purchase ROCKEY they will get 4 16 bit passwords The first two are Basic passwords first grade passwords the last two are Advanced passwords second grade passwords The 4 passwords
69. er p1 Input value 1 p2 Input value 2 o3 Input value 3 p4 Input value 4 Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in the addresses p1 p2 p3 and p4 populated with the results of the calculation 7 2 17 Decrease Module Unit RY_DECREASE Objective To decrease the value in a specified ROCKEYAND module by 1 Input parameters function RY_DECREASE handle ROCKEYAND s handle p1 Module number Return value FEITIAN Rockey4ND User s Guide A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will reduce the value stored in module p1 by 1 7 3 Error Codes ERR_SUCCESS 0 No error ERR_NO_ROCKEY 3 No ROCKEYAND found ERR_INVALID_PASSWORD 4 ROCKEY4ND found with incorrect basic password ERR_INVALID_PASSWORD_OR_ID 5 ncorrect password or hardware ID ERR_SETID 6 Error setting hardware ID ERR_INVALID_ADDR_OR_SIZE 7 ncorrect target address or length ERR_UNKNOWN_COMMAND 8 Unknown command ERR_NOTBELEVEL3 9 nternal error ERR_READ 10 Error reading data ERR_WRITE 11 Error writing data ERR_RANDOM 12 Random number error ERR_SEED 13 Seed error ERR_CALCULATE 14 Calculation error ERR_NO_OPEN 15 Dongle not opene
70. f User ID field will be written to each of the dongles in the list without any change 5 3 Save Work The template can be saved to the disk or be printed for backup FEITIAN Rockey4ND User s Guide amp ROCKEY4ND_Editor 1 2 Rockey4ND_1 Two Page Zoomin Zoom Out E Y Local donglefwirxP Pink Men Page Prev Pase 1 amp 0x08 b1653 ROCKEY4ND data template User Memuryl 00 00 00 00 00 00 00 00 OO AA AA AA AA AA AA AA AA AA AA AA AA AA AA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 00 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 00 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 OO 00 00 90 00 90 00 00 00 00 00 90 90 90 90 00 90 90 90 90 90 00 00 OO 90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 00 90 00 90 90 00 90 00 00 00 00 00 00 00 00 00 00 00 00 00
71. f algorithm area A A G Address 6 of algorithm area A A H 3 is the start point of the algorithm in the dongle and 6 is the end point of the algorithm in the dongle After executing the instruction at address 6 the program will go to the user part The calling of the program in the dongle must begin from the start point of the algorithm If the calling point is not the start point of the algorithm 4 random numbers will be returned 8 1 5 2 Restrictions on Algorithm Instruction There are some restrictions on algorithm instruction They are described below with some example instructions A A B Valid instruction D D D Valid instruction A B Invalid instruction must be in the format of algorithm such as A B B A 0 Invalid instruction must be in the format of algorithm such as A A A C 3 B Invalid instruction the constant must be postfixed for example C B 3 D 3 4 Invalid instruction only 1 constant is allowed in an instruction A A B Invalid instruction the division operater is not supported H E 200 Invalid instruction the constant must be lower than 64 A A 63 Valid or invalid instruction constants are not allowed in the first and last instructions 8 2 User Defined Algorithm Examples 8 2 1 Basic Algorithm Application Examples 8 2 1 1 Calculation 1 example First we write the algorithm We only need to write the algorithm once The code used to write the algorithm s to the dongle does not appear in the applicati
72. for comparison For example the results of C A B are listed below C A B B A A lt B 0 FFFF A B FFFF FFFF A gt B FFFF 0 It will write either FFFF or 0 to parameter C according to the table above First let us have a look at the algorithm example we will write to the dongle A A B B B E C A F D B C H HAH A B C are registers in the dongle There are a total of eight 16 bit registers in the dongle and they are designed A B C D E F G and H 8 1 2 Internal Algorithms amp Application Interface FEITIAN offers 3 calculation functions to call the user defined algorithms RY_CALCULATE1 RY_CALCULATE2 and RY_CALCULATE3 These three functions are structurally similar Data is passed and received by way of the memory addresses p1 p2 p3 and p4 When passing data to registers FEITIAN Rockey4ND User s Guide Register A p1 Register B p2 Register C p3 Register D p4 Register variables vary according to the calculation type Register E Register F Register G and Register H When receiving data from registers p1 Register A p2 Register B p3 Register C p4 Register D Registers A B Cand Dare user interface variables Registers E F G and Hare internal variables 8 1 3 Differences between the Three Functions p1 p2 p3 and p4 correspond to registers A B C and D in all three calculation functions These registers are used nearly ident
73. for the demo dongles in the SDK are P1 C44C P2 C8F8 P3 0799 P4 C43B The passwords are burned into the hardware so that neither the user nor the manufacturer may change them The developers must input the 4 passwords correctly to have full access to the dongles The developer should set any reference to the Advanced password set to zero in the application program that is delivered to the end user you should never reveal the Advanced passwords to the end user in any form The Basic passwords allow the end users to access all necessary ROCKEY functions We will discuss when one should input the Basic passwords and when both Basic and Advanced passwords are required in the chapters that follow 4 2 Order Code The Order Code is five to seven characters in length and corresponds to a unique customer password set You may use the Order Code for reordering ROCKEY4ND to be sure that all of the units in your inventory are consistent 4 3 Hardware ID FEITIAN will burn a globally unique Hardware Identification HID number into each ROCKEYAND dongle The HID cannot be changed You may use the HID to positively identify an individual ROCKEY4ND The HID is readable with the Basic passwords It is impossible to write HID even if you have the advanced passwords 4 4 User Data Zone The User Data Zone UDZ is a memory space that the developer can use to store data needed by the software protection system Users can read from and write to thi
74. he LED will be on all the time If the LED blinks it indicates that the driver is not installed Other LED responses indicate hardware failure Note ROCKEYAND is a plug and play USB device To unplug a ROCKEYAND while writing reading the dongle may cause crashes to the operating system in some instances FEITIAN Rockey4ND User s Guide Chapter 3 Installing ROCKEY4ND SDK You will find the program Setup exe under the root directory of the CD ROM included in the Software Developer s Kit SDK The contents of the CD ROM are not zipped Experienced developers may simply copy all necessary content to the computer The content of the CD ROM consists of two parts Tools under the directory Tools Some documents on how to use these tools are provides in the corresponding folder APIs for different programming languages 3 1 Installing SDK Below we will discuss how to install and use the development package Step 1 FEITIAN provides a Setup exe installation wizard program on the CD ROM You may select the components you need The installation of the drivers is also integrated in this wizard Double click the setup exe file from the root directory of the ROCKEY4ND CD ROM You will see the first screen of the Setup Wizard pictured below Figure 3 1 Select language at the first step Language selection Please select a language to use during the installation u Figure 3 1 Step 2 Close other application to avoid the
75. ialize dongle Tested contents 9 Operating status ekka Settings Operation Testal Status Found 1 ROCKE Y4ND testing 1 020861653 Figure 5 9 Note This test is like a Format command in that it will delete any data or parameters stored in the dongle It would be best to run the Self Test upon receipt of the dongle or if there is a significant problem with the dongle FEITIAN Rockey4ND User s Guide Chapter 6 ROCKEY4ND Envelope Encryption The ROCKEY4ND Envelope encryption is a good solution if you do not have the source code or the time to use the API functions Currently the envelope tool has the following features 1 The components of the envelope tool include the interface program for entering parameters by users the enveloper based on the command line and the enveloper module on the dongle 2 Interface program A Parameters for all dongles from Feitian are supported B The encryption parameters for PE NET and data envelope files are supported The files are divided into two types program and data Program types that can be recognized automatically win32PE WIN64PE WIN32 NET and WIN64 NET Supported language environments Simplified Chinese Traditional Chinese and English More can be specified by adding self defined language environments to the folder language A maximum of 16 language files can be specified for now E When there is only one DLL file in folder WIN32
76. ically by the three calculation functions The differences between the functions can be seen by reviewing the results written to registers E F G and H When a developer s ROCKEY4ND internal program is called registers A B C and D will be populated with data from p1 p2 p3 and p4 The content of registers E F G and H will be initialized according to the calculation function in use See below Internal Variable RY_CALCULATE1 A P1 B P2 C P3 D P4 E High 16 bits of hardware ID F Low 16 bits of hardware ID G Value stored in module Ip2 H Random number Internal Variable RY_CALCULATE2 A P1 B P2 C P3 D P4 E Seed return value 1 depending on the seed code in Ip2 F Seed return value 2 depending on the seed code in Ip2 G Seed return value 3 depending on the seed code in Ip2 H Seed return value 4 depending on the seed code in Ip2 FEITIAN Rockey4ND User s Guide Internal Variable RY CALCULATE3 P1 P2 P3 P4 Content of the module specified by Ip2 Content of the module of Ip2 1 Content of the module of lp2 2 Content of the module of Ip2 3 GO T OSLO a gt 8 1 4 API Interface of the User s Applications Below is the definition and description of the three calculation functions Function RY_CALCULATE1 Calculation 1 Objective Perform specified calculation Input parameters function
77. io h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEYAND Variable BYTE buffer 1024 ROCKEYAND Variable FEITIAN p1 Oxc44c p2 0xc8f8 p3 0 p4 0 Rockey4ND User s Guide ROCKEY4ND Demo Password1 ROCKEY4ND Demo Password2 Program needn t Password3 Set to 0 Program needn t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return retcode Rockey RY_OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer Error printf Error Code d n retcode retcode Rockey RY_CHECK_MOUDLE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer printf Error Code d n retcode printf Hello FeiTian n if retcode return p1 0 if retcode return if p2 else return retcode Rockey RY CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return FEITIAN Rockey4ND User s Guide In Step 10 we set p2 3 allowed software run times and p3 1 Decrement allowed That is to say module O p1 0 sets the maximum software run time to 3 S
78. is problem occurs occasionally Generally your device is not attached properly to the computer or some interference exists Remove your dongle and try to attach it again 9 2 10 Why can t I see the USB device in Device Manager when I use the dongle with a Windows 98 computer which has a USB port Maybe the USB supporting option is disabled in BIOS 9 2 11 How can update the software of the dongle If you are a testing user you will be sent the last minute updates Otherwise you can go to our website http www FTsafe com to get the latest DK FEITIAN Rockey4ND User s Guide 9 2 12 was prompted Rockey4ND dll not found when protecting FoxPro and VB programs by calling APIs What is the problem Although Rockey4ND dll is present under current directory you must copy it to a system directory because FoxPro and VB programs find the dynamic linking libraries only in system directory FEITIAN Appendix A Contents of SDK Directory Rockey4ND User s Guide Directory Description Setup exe Installer Flielist txt List of files Api32 32 bit APIs Api64 64 bit APIs Docs User manual s Driver For Win98 Driver for Windows 98 SE Include Header files NetRockey Network dongle DK Samples Sample programs Utilities Dongle Editor and Envelope Encryptor FEITIAN Rockey4ND User s Guide Appendix B Performance Comparison of Dongles Feitian is always dedicated to provide prod
79. l Envelope exe is also provided under Envelope directory of the SDK You can encrypt Windows PE files Net files and data files using this tool simply by clicking on the target file and related functions For details see Chapter 6 ROCKEY4ND Envelope Encryption H By incorporating the ROCKEYAND API into your applications to be protected you can get the most out of the dongle with the highest level of security For details see Chapter 7 ROCKEY4ND APIs H You can find some frequently asked questions and the answers in Chapter 9 H For updates and any other things you are interested in visit us at http www FTsafe com FEITIAN Rockey4ND User s Guide Contents Chapter 1 Introduction sssrin kaka wasiba ka kakaa E akka ha 1 II ABOUt ROCKEY4N Divi b sdlsssa sankl sk pikd sk lakark sikabeki akausk sikisak iki usk sskabab ak ssk ssk bak ak ask sikia ak naka m u 1 1 2 Software Protection Mechanism of ROCKEYAND aaaaaaaasasasssssasasssasasassaaaasaaaaasaaaaaaaaadaaaaaaakaaaaaaaaaaaaaaaaa 1 1 3 Hardware Configuration wazawa wina wakikua needed 2 1 4 ROCKEYAND Benefits aaaaaaaaaaaaaaaaaaaaaaaaausannananaasssssnas nan nanansaaasa annannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 2 1 5 How to Choose a Right Software Protection Solution zuuureesseessennsennnennnonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 2 Chapter 2 ROCKEYAND Hardware Features aaaaaaaaaaaaaasas
80. late 1 RY_CALCULATE2 15 Calculate 2 RY_CALCULATE3 16 Calculate 3 RY_DECREASE 17 Decrease Module Unit e handle is the pointer for ROCKEY operation s handle e Ip1 and Ip2 are the pointers for long integer parameters Their content depends on the functions e p1 p2 p3 and p4 are the pointers for short integer parameters Their content depends on the functions e buffer is the pointer for character buffer Its content depends on the functions 7 2 ROCKEYAND API Services Here we discuss the API services in detail The following functions marked with require the two Advanced passwords Note p3 and p4 are Advanced passwords They are for developers to operate on the dongle The Advanced passwords should not appear in the software you offer to your customers and you should set the two Advanced passwords 0 when searching for dongles in your application 7 2 1 Find a ROCKEY4ND dongle RY_FIND Objective To check if a specific ROCKEY4ND is attached to the USB port Input parameters function RY_FIND p1 Password 1 p2 Password 2 p3 Password 3 optional p4 Password 4 optional Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will write the ROCKEY4ND Hardware ID HID to Ip1 7 2 2 Find the Next ROCKEY4ND dongle RY_FIND_NEXT
81. le product It usually includes a package documentation a CD ROM and a dongle The dongle is the same as the formal dongle except that the access password for it is public If customers want to purchase the product after evaluation a dongle with a unique password will be provided for security consideration 9 2 2 What is the order number The order number is a reference number for management purpose in fact It does not associate with the passwords of the dongle directly 9 2 3 Is it possible that others can buy a dongle as same as mine That is impossible The passwords of the dongle of each customer are different We keep the record of each customer We can sign a security agreement with you if necessary We will deliver the dongle to you as required 9 2 4 Are the passwords of ROCKEY4ND dongle secure enough Yes they are very secure They include 4 passwords divided into 2 levels Each is 16 bits in length The 1 level includes 2 basic passwords for basic operations on the dongle The 2 level passwords are dedicated advanced passwords provided to developers for controlling writing to the dongle and defining encryption algorithms These FEITIAN Rockey4ND User s Guide 2 passwords must not appear in the software delivered to end users If the advanced passwords are entered in error and the special memory has been written 4 times the dongle will be locked for 2 seconds No operations can be performed during the 2 seconds
82. lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return als while retcode 0 retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j p1 0 p2 0x2121 p3 0 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Set Moudle 0 Pass 04X Decrease no allow n p2 retcode Rockey RY_CHECK_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Check Moudle 0 if p2 printf Run Modul 1 n else break printf n p1 8 p2 OxFFFF p3 0 retcode Rockey RY_SET_MOUDLE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode
83. me with the date stored in the UID The program would take appropriate actions or continue based on the results of the comparison include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4 ND 32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode FEITIAN Rockey4ND User s Guide void main WORD handle 16 p1 p2 p3 p4 retcode DWORD Ip1 Ip2 BYTE buffer 1024 BYTE buf 1024 inti j SYSTEMTIME st p1 Oxc44c p2 Oxc8f8 p3 0x0799 p4 0xc43b retcode Rockey RY_FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 08X n Ip1 retcode Rockey RY_OPEN amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return j ale while retcode 0 retcode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode FEITIAN Rockey4ND User s Guide return retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j Ip1 0x20021101 retcode Rockey RY
84. metic n Ipi 24 Ip 7 3 p1 t1 p2 t2 p3 t3 p4 retcode Rockey RY_CALCULATE1 amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 retcode Rockey RY_CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return print f Nn getch J 8 2 3 Advanced Algorithm Application Examples In Step 31 we will write the core algorithms or codes of the application to the ROCKEY dongle Below are three programs the original program the ROCKEY initializing program and the final program for the end users The original program include stdafx h include DrawCircle h include DrawCircleDoc h include DrawCircleView h include DrawParamDlg h FEITIAN Rockey4ND User s Guide include DrawMethodDlg h ifdef DEBUG define new DEBUG NEW undef THIS FILE static char THIS_FILE FILE endif void CDrawCircleView DrawCircleMidPoint CDC pDC int iCenterX int iCenterY int r int x 0 int y r int p 1 r TRACE Origin n CirclePlotPoints pDC iCenterX iCentery x y m_lpCircleBuf x m_lpCircleBuf y m_nPointCount 1 X y while x lt y X if p lt p 2 x 1 else Voss pt 2 x y 1 TRACE d d d
85. most flexible and powerful means of protecting your software The security level of your software is determined by how you implement the API The API set has been simplified and is intended to make the ROCKEY4ND programming effort as effective as possible API encryption enables you to call ROCKEY in your application to enhance its security level You may check the existence of the dongle anywhere in your application and take actions as a result of the check You may also check the data you stored in the UDZ You may use the Editor program to set and write data to the modules write algorithms to the User Algorithm Zone UAZ user information to the User ID zone UID or take other actions All such operations may be performed with the API We will take the interface of the C language to demonstrate how to call the API Similarly you may call other language interfaces the same way 7 1 ROCKEYAND Function Prototype and Definition WORD Rockey WORD function WORD handle DWORD Ip1 DWORD Ip2 WORD p1 WORD p2 WORD p3 WORD p4 BYTE buffer FEITIAN provides developers with a unified function from which they can employ all ROCKEYAND operations This function is defined as a multi function function Below is a call example for C language and we will discuss future applications in a similar way retcode Rockey function handle p1 lp2 p1 p2 p3 p4 buffer The ROCKEY function parameters are defined as
86. n t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return retcode Rockey RY_OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return Ip1 0 retcode Rockey RY READ USERID amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return if Ip1 0x88888888 printf Hello FeiTian n else printf Hello DEMO n return retcode Rockey RY_CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode FEITIAN Rockey4ND User s Guide printf Error Code d n retcode return 7 4 8 Module Steps 10 11 and 12 Set module value and attributes with Editor or API then check if the module is allowed to be used Determine whether to activate the associated application module The module value may also be used by the program Check if the module is allowed to be decreased to limit the number of software executions See Step 10 Step 11 and Step 12 Note Advanced passwords are needed for Step 10 Initialize ROCKEY and set module value For example we set module 0 to be valid and its value cannot be decreased See Step 10 in
87. nd attributes of an algorithm ROCKEY will automatically assign a Start End attribute to the instructions In practice this means that if the developer writes a two instruction algorithm to the User Algorithm Zone UAZ and then a three instruction algorithm the result will not be a single five instruction algorithm Algorithms that begin with Null or E will produce unpredictable results 8 3 Tips 1 Make randomized calls to the ROCKEY API Randomly scatter calls to the ROCKEY API from within your application Calls made to the API from time to time will make it very difficult to mimic the behavior of the protection method or hack the application 2 Use dynamic information with the seed code function The use of dynamic information with the seed code function such as system date makes the protection method stronger because the results can change with the input and calculation 3 Do not repeatedly use the same protection method in your application If you use the same protection method several times in your application it will be easier for the cracker to find the rule and crack your application Protection methods that are complex and rely on a number of different checks and calculations are the most difficult to crack 4 Encrypt the character string and data In Step 18 of this document we showed an encryption method using information stored inside the dongle Encrypting a character string in the manner described is a
88. ned area for instruction storage The number of instructions that may be stored in the UAZ varies according to the ROCKEY4ND model ROCKEYAND supports a maximum of 128 instructions Please refer to Chapter 8 ROCKEYAND Hardware Algorithms The User Algorithm Zone UAZ cannot be read and may only be written with Advanced passwords 4 7 User ID The User ID is a 32 bit memory allocation that may be used to store an application serial number or other identification information It may be read with the Basic passwords and written with the Advanced passwords 4 8 Random Number ROCKEYAND can generate a true random number from its hardware The random number can be used to prevent tracing or used in hardware algorithms 4 9 Seed and Return Values ROCKEYAND contains a proprietary algorithm that will generate four 16 bit return values from input of a 32 bit seed code and the Basic Advanced passwords ROCKEY dongles with the same passwords should return the same values if the seed codes are the same The return values will be different for ROCKEY dongles with different Basic Advanced passwords FEITIAN Rockey4ND User s Guide Chapter 5 ROCKEYAND Editor 5 1 Brief Introduction You may use the ROCKEYAND Editor to edit data stored in ROCKEYAND test its functions or write in batch The Editor is a convenient tool for learning to use ROCKEYAND and its edit operations You can find the tool under Editor directory of the SDK or in the installati
89. need of rebooting the system FEITIAN Rockey4ND User s Guide 7G ROCKEYARD SDE Y1 15 Setup Welcome to the ROCKEY4ND SDK Y1 15 Setup Wizard This wizard will guide you through the installation of ROCKEY4ND SDK Y1 15 Tt is recommended that you close all other applications before starting Setup This will allow Setup to update certain system tiles without rebooting your computer Click Next to continue Figure 3 2 Step 3 View the software release agreement is ROCKEYARD SDE 1 15 Setup License Agreement Please review the license terms before installing ROCKEY4ND SDK v1 15 Press Page Down to see the rest of the agreement Feitian Technologies Co Ltd Software Developer s Agreement All Products of Feitian Technologies Ltd Feitian including but not limited to evaluation copies diskettes CD ROMs hardware and documentation and all Future orders are subject to the terms of this Agreement If you do not acree with the terms herein please return the evaluation package to us postage and insurance prepaid within seven days of their receipt and we will reimburse you the cost of the 3 Pradiirk lece Freinht and reacnnahle handling charnes If you accept the terms of the agreement click I Agree to continue You must accept the agreement to install ROCKEY4ND SDK 11 15 Feitian ROCKEY4ND SDK Installation System Figure 3 3 Step 4 Figure 3 4 show the type of installation Please s
90. needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return retcode Rockey RY_OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return p1 0 Pos p2 14 Length buffer 14 0 retcode Rockey RY_READ amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf s n buffer retcode Rockey RY CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode FEITIAN Rockey4ND User s Guide printf Error Code d n retcode return 7 4 5 Generate a true random number with ROCKEY Step 5 Generate a random number when the program starts and write this random number to the dongle The program should check if the random number is correct during run time If a sharing device is installed to this computer and someone else runs this program also from another computer another random number will be generated and written to the dongle Thus the program on the first computer will be terminated since the random number is not correct include lt windows h gt include lt
91. nput parameters function RY_CALCULATE1 handle ROCKEYAND s handle lp1 Start point of calculation p2 Module number p1 Input value 1 p2 Input value 2 o3 Input value 3 FEITIAN Rockey4ND User s Guide p4 Input value 4 Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in the addresses p1 p2 p3 and p4 populated with the results of the calculation 7 2 15 Calculate 2 RY_CALCULATE2 Objective To return the results of a calculation performed in ROCKEYAND using input provided by the developer and the RY_CALCULATE2 function Input parameters function RY_CALCULATE2 handle ROCKEY4ND s handle p1 Start point of calculation p2 Seed Code 32 bit p1 Input value 1 p2 Input value 2 p3 Input value 3 p4 Input value 4 Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in the addresses p1 p2 p3 and p4 populated with the results of the calculation 7 2 16 Calculate 3 RY_CALCULATE3 Objective To return results of a calculation performed in ROCKEYAND using input provided by the developer and the RY_CALCULATE3 function Input parameters function RY_CALCULATE3 handle ROCKEYAND s handle p1 Start point of calculation Ip2 Module numb
92. ode return printf n getch 8 2 2 4 Complex example 4 In Step 30 we use all the three calculation functions and we write 4 calculation sections to the ROCKEY dongle The results of the three calculations are used for additional calculations Of course you may let ROCKEY perform much more complex calculations according to your situation FEITIAN Rockey4ND User s Guide include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4 ND 32 h void ShowERR WORD retcode if retcode return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode DWORD 1p1 1p2 BYTE buffer 1024 int i j int t1 t2 t3 char cmd H H H A A 23 F B 17 A A F A A G A A lt C A A D B B B C C C D DAD char cmdi A A B A A C A A D A A E A A F A A G A A H char cmd2 A A B A A C A A D A A E A A F A A G A A H char cmd3 H H4H A A A B B B C C C D A B D D C pl xc44c p2 Oxc8f8 p3 0x0799 p4 xc43b retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return j printf Find Rock 88X n 1p1 retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer FEITIAN Rockey4ND User s Guide if retcode if ShowERR retcode return a Lp while
93. ode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return seed Rockey Ip2 0x12345678 retcode Rockey RY SEED amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Seed 04X 04X 04X 04X n p1 p2 p3 p4 Close Rockey retcode Rockey RY_CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return printf n getch Verify the return codes of the seed code to see if the program should be terminated Step 7 include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable FEITIAN DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEYAND Variable p1 0xc44c ROCKEYAND Demo Password1 p2 0xc8f8 ROCKEYAND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return retcode Rockey RY_OPEN amp handle
94. ode Rockey RY_FIND_NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR_NOMORE break if retcode ShowERR retcode return retcode Rockey RY OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j Ip2 0x12345678 retcode Rockey RY_SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Seed 04X 04X 04X 04X n p1 p2 p3 p4 if pl 0xD03A amp amp p2 0x94D6 amp amp p3 0x96A9 amp amp p4 0x7F54 printf Hello Fei n else break FEITIAN Rockey4ND User s Guide Ip2 0x87654321 retcode Rockey RY_SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Seed 04X 04X 04X 04X n p1 p2 p3 p4 if p1 0xB584 amp amp p2 0xD64F amp amp p3 0xC885 amp amp p4 0x5BA0 printf Hello Tian n else break Ip2 0x18273645 retcode Rockey RY SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Seed 04X 04X 04X 04X n p1 p2 p3 p4 if p1 Ox2F6D amp amp p2 0x27F8 amp amp p3 0xB3EE
95. on RY_READ handle ROCKEYAND s handle p1 off set of UDZ zero base o2 length unit is byte buf address of buffer Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in the contents of the UDZ written to the memory buffer 7 2 6 Write to the ROCKEY4ND dongle RY_WRITE Objective To write data to the User Data Zone UDZ Input parameters function RY_WRITE handle ROCKEYAND s handle p1 off set of UDZ o2 length unit is byte FEITIAN Rockey4ND User s Guide buf address of buffer Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error 7 2 7 Generate a Random Number RY RANDOM Objective To get a random number from the dongle Input parameters function RY_RANDOM handle ROCKEYAND s handle Return value A return value 0 indicates that the function worked correctly Any other return value indicates an error A successful operation will result in the p1 address populated with the random number 7 2 8 Generate Seed Code Return Values RY_SEED Objective To get return codes from the input of a seed code Input parameters function RY_SEED handle ROCKEYAND s handle p2 Seed Code Return value A return value 0 indicates that the function worked correctly Any other return v
96. on delivered to the end user pl strcpy buffer H H H A A 23 F B 17 A A F A A G A A lt C A A D B B B C C C D D D retcode Rockey RY_WRITE_ARITHMETIC handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer Then call the following algorithm from the program 1p1 Start point of calculation FEITIAN Rockey4ND User s Guide 1p2 7 Module number p1 5 Initial value of A p2 3 Initial value of B p3 1 Initial value of C p4 Oxffff Initial value of D retcode Rockey RY_CALCULATE1 handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer The command begins to execute from instruction O Ip1 of the UAZ and the registers are initialized as follows A 5 p1 B 3 p2 C 1 p3 D Oxffff p4 E the upper 16 bit of HID F the lower 16 bit of HID G the value in module 7 Ip2 H random number 16 bit Assuming that the value in module 7 is 0x2121 the result of this calculation will be 5 23 3 17 0x2121 lt 1 A Oxffff Oxbc71 Calculation 1 example codes Step 24 include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 8 return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode DWORD 1p1 1p2 BYTE buffer 1024 int 1 j char cmd H H H A A 23 F B 17 A A F A A
97. on directory The ROCKEYAND Editor interface is organized into five parts Tool Bar amp Pull down Menu Status Bar Tree View Operation Status Log and Operation Main Window See Figure 5 1 s ROCKEYAND_Editor 1 2 Rockey4ND 1 File Edit View Help aghan Ba e BD Local donglefwirsP amp 009161653 Input Password Test Self Test User Data Zone User Algorithms Zone User Memoy1 O User Memory 2 Ja Read Write 0 00 00 00 00 00 00 A J M 00 00 00 DD 00 00 ef JA 00 00 00 00 00 00 j D a 00 00 00 00 00 00 u JA 00 00 00 00 00 00 05 je 00 00 00 00 00 00 06 DO 00 00 00 00 00 o Os 00 00 00 00 90 90 Auto S E 3 Operating status x 16 13 45 Read user memorySucce A 16 13 46 Read user memorySucce lt lt Module Zone User ID Zone o o OL write ofo O wrie o o OL wie os o O write ofo OL write 100 OL write J UserID 0 ofo OL Witte 11 o OL wrie o o O write 12 o _ O write o o OL write 13 o O wrie r os fo OL Witte 14 o O L write oz o OL write 15 0 O wire Batch Operation User ID Single Operaton Sv OLE No Change O Use Time ID IKI Figure 5 1 1 Tool Bar amp Pull down Menu This is the very topmost section of the screen The typical Windows functions can be invoked from the icons
98. owERR retcode return printf Write Arithmetic 2 n 1p1 10 lp2 0x12345678 p1 1 p2 2 p3 3 p4 4 retcode Rockey RY_CALCULATE2 amp handle j amp lp1 81p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Calculate Input p1 1 p2 2 p3 3 p4 4 n FEITIAN Rockey4ND User s Guide printf Result d 3a 94d6 96a9 7f54 1 2 3 4 8x7b17 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 t2 p1 p1 17 strcpy char buffer cmd2 retcode Rockey RY_WRITE_ARITHMETIC amp handle j amp 1p1 amp 1p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write Arithmetic 3 n Ipi 17 1p2 pl 1 p2 2 p3 3 priS retcode Rockey RY_CALCULATE3 amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Calculate Input p1 1 p2 2 p3 3 p4 4 n printf Result 1 2 3 4 1 2 3 4 0x14 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 t3 p1 printf n p1 24 strcpy char buffer cmd3 retcode Rockey RY_WRITE_ARITHMETIC amp handle j amp 1p1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return FEITIAN Rockey4ND User s Guide printf Write Arith
99. p p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Read s n buffer if buffer printf Hello FeiTian n FEITIAN Rockey4ND User s Guide else exit 0 retcode Rockey RY CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return 7 4 6 Seed Steps 6 and 7 Read the seed code return values with the Editor or API The seed code calculation is performed inside the dongle and the algorithm is confidential You may verify the return codes or use the return codes in an encryption routine See Step 6 and Step 7 Read the return codes of fixed seed code 0x12345678 Step 6 include lt windows h gt include lt stdio h gt include Rockey4_ND_32 h Include ROCKEY4ND Header File void main WORD retcode WORD handle p1 p2 p3 p4 ROCKEY4ND Variable DWORD Ip1 Ip2 ROCKEY4ND Variable BYTE buffer 1024 ROCKEYAND Variable p1 0xc44c ROCKEYAND Demo Password1 p2 Oxc8f8 ROCKEYAND Demo Password2 p3 0 Program needn t Password3 Set to 0 p4 0 Program needn t Password4 Set to 0 Try to find specified Rockey retcode Rockey RY FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Not found printf ROCKEY not found n return FEITIAN Rockey4ND User s Guide retc
100. p p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf n rynum i Do our work for i 0 i lt rynum i Read Rockey user memory p1 0 Pos p2 12 Length buffer 12 0 retcode Rockey RY READ amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf s n buffer Output Ip1 0 retcode Rockey RY_READ_USERID amp handlel i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Read User ID 08X n Ip1 p1 0 FEITIAN Rockey4ND User s Guide retcode Rockey RY_CHECK_MOUDLE amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode Error printf Error Code d n retcode return printf Check Moudle 0 if p2 printf Allow else printf No Allow if p3 printf Allow Decrease n else printf Not Allow Decrease n Close all opened Rockey for i 0 i lt rynum i retcode Rockey RY_CLOSE amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode printf Error Code d n retcode return A maximum of 16 dongles may be attached to the same computer at the same time The program can access any dongle you specify
101. p p4 buffer if retcode ShowERR retcode return printf Find Rock 8X n 1p1 retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return al ale while retcode retcode Rockey RY FIND NEXT amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ERR NOMORE break if retcode ShowERR retcode return retcode Rockey RY_OPEN amp handle i amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer FEITIAN Rockey4ND User s Guide if retcode ShowERR retcode return i i printf Find Rock 8X n 1p1 printf n for j 8 j lt i j lp2 0x12345678 retcode Rockey RY_SEED amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Seed 04X 04X 04X 84X n pl p2 p3 p4 printf n YA pl 10 strcpy char buffer cmd1 retcode Rockey RY_WRITE_ARITHMETIC amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write Arithmetic 2 n 1p1 10 1p2 0012345678 pl 1 FEITIAN Rockey4ND User s Guide p2 2 p3 3 BSS retcode Rockey RY_CALCULATE2 amp handle j amp lp1 81p2 amp p1 amp p2 amp p3 amp p4 b
102. p x y CirclePlotPoints pDC iCenterX iCenterY x y m_lpCircleBuf m_nPointCount x X m_lpCircleBuf m_nPointCount y y m_nPointCount TRACE n FEITIAN Rockey4ND User s Guide Initialize dongle include stdafx h include lt windows h gt include inc Rockey4_ND_32 h void ReportErr WORD wCode printf ERROR d n wCode int main int argc char argv WORD p1 0xc44c p2 0xc8Ff8 p3 0x0799 p4 xc43b DWORD 1p1 1p2 WORD handle 16 BYTE buffer 1024 BYTE cmdstr B B B B B 1 B B 2 B B 1 A A B C C 1 C C 2 B A C WORD retcode retcode Rockey RY_FIND amp handle 8 amp 1p1 amp 1p2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ReportErr retcode return printf Find successfully n retcode Rockey RY_OPEN amp handle amp 1p1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ReportErr retcode return printf Open successfully n pl 10 FEITIAN Rockey4ND User s Guide retcode T Rockey RY_WRITE_ARITHMETIC amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 cmdstr if retcode ReportErr retcode return printf Write arithmetirc successfully n retcode Rockey RY_CLOSE amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer return The final program for the end users include stdafx h include DrawCircle h include DrawCircleDoc h
103. ples are also a good reference but the developer will need to determine the best protection method given his own constraints and objectives Some key points that you need to pay attention to when programming e P3 and P4 are Advanced passwords enabling the developers to write to the dongles Each of them should be set to a valid value only in this case They should be set to 0 in the software delivered to end users e Be sure that none of the address parameters in the ROCKET4ND functions are Null pointers For example even if you do not require the Buffer but it cannot be null otherwise the result is unpredictable The following sample programs are written in VC 6 0 Let us discuss how to perform the required functions step by step from an original program Software developers who develop software in other languages please do not skip this section There are no special developing skills for the C language Most software developers will understand the concepts illustrated here 7 4 1 Original Program Step 0 This program is the original program before it is protected with ROCKEY4ND FEITIAN Rockey4ND User s Guide include lt windows h gt include lt stdio h gt void main Anyone begin from here printf Hello FeiTian n 7 4 2 Find Dongle Step 1 We add an operation to find the ROCKEY at the beginning of the program If the dongle is found the program will continue If it is not found the program will exit
104. printf Error Code d n retcode return The above program searches all dongles with the same passwords attached to the computer and displays the status of every module in every listed dongle O means that the module may be used and is not zero X means FEITIAN Rockey4ND User s Guide that the module cannot be used In a protection scheme that relies on ROCKEYAND modules this program would help the developer identify modules that are usable from ones that should be terminated 7 5 5 The same code dongle advanced applications If you have several software products but only a single purchase code meaning that the passwords are all the same you may use the solution indicated below to differentiate the dongles In Step 22 the UDZ is used to distinguish the dongles with the same passwords For example the dongles with UDZ content of Ver 10 correspond to software A include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4_ND_32 h void ShowERR WORD retcode if retcode 0 return printf Error Code d n retcode void main WORD handle 16 p1 p2 p3 p4 retcode WORD handleEnd DWORD Ip1 Ip2 BYTE buffer 1024 int i j p1 Oxc44c p2 Oxc8f8 p3 0x0799 p4 0xc43b retcode Rockey RY FIND amp handle 0 amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return
105. raa Ea aAA A EA seinuaaesvdeatshcvdeutiasvivatdasvluanianelserdsasanenazegl 14 5 3 5aVe Work sens AA a AA AA aa ana re ne an haare ne nn Teen 17 Chapter 6 ROCKEYAND Envelope Encryption aa22aaaaaaaua nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnni 21 Chapter 7 ROCKEYAND APIS wisccissscsescsssssssnscsassscassesssodsassenadeasscnadeasscnabeassnaabosssnaadescessaisicansadsecsessssecdedssssectes 28 7 1 ROCKEYAND Function Prototype and Definition 2aaaaaaaaaasaaasanasannsnnnsnnnsnnnsnnnnnnnnnnnnnnsnnnsnnnsnnnsanisana 28 7 2 ROCKEYAND API SErVICES 2 nn ns an Ass uns Aus aus Buss Bun uss isn din 30 7 3 Error Codes O SI ACCIMOSINEEIWA IKOCIHOSIKOCIHO A Ne n WA nS 35 7 4 Basic Application Ba mpi aa aaa akaka a Eaa Ar Ea a aa A r E TAr EASA ETER E ENESTE E ERETI ENERE AEAEE 36 7 5 Advanced Application Examples aaaaaaaaaaasaaasannsannnannnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnna 58 Chapter 8 ROCKEY4ND Hardware Algorithms 22aaaaaaaaaaannnnnnnunnnnnnnnnnnnnnnnnnnnnnnnsnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 89 8 1 ROCKEY User Defined Algorithm Introduction aaaaaaaaaaaaasanasannsanasannsnnnsnnnsnnnsnnnsnnnnnnsannsannsannsannsnna 89 8 2 User Defined Algorithm Examples aaaaaaaaaaaanasansaansannsnnnsnnnsnnnsnnnsnnnsnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnsnnnsnnnsnnnsnnnsnnai 94 2235 A MDS EEE AAA AWA WAA AA WAA A E A AWA 128 Chapter 9 FAQS aaa
106. reased security with the release of ROCKEYAND Developers lead time in implementing ROCKEYAND is vastly reduced saving both time and costs in deploying security into your software 4 High Security Levels Redesigned ROCKEYAND offers a much higher level of security over previous version ROCKEYAND implements a two level security system to segregate users who require read only access from those who require administrative privileges ROCKEYAND has a built in time gate to prevent software tracking and is powerful enough to support developer defined algorithms that brings software protection to a new level of security 5 High Reliability FEITIAN employs an advanced customers managing system for ROCKEY4ND We guarantee that the password of every customer is unique and that the hardware ID of every dongle is also unique The password and hardware ID are burnt into the CPU it is absolutely impossible to change even for us the manufacturer 6 Broad Support for Operating Systems ROCKEYAND protected applications may run on Windows 98 SE ME 2000 XP 2003 Linux MAC 7 Abundant Programming Language Interfaces ROCKEY4ND provides interfaces for these common development tools PB DELPHI VFP VB VC C BUILDER and etc 1 5 How to Choose a Right Software Protection Solution The protection level applied to software not only depends on the dongle but also on how the developer uses the dongle Even if the dongle is the best in the world a r
107. s space at any time The total UDZ is 1000 bytes The UDZ is divided into 2 parts The low part 0 499 bytes Users with any level of passwords have full permission read write The high part 500 999 bytes Users with basic passwords password land password 2 can only read the UDZ Users with advanced passwords password 3 and password 4 have full permission read write 4 5 Module Zone The Module Zone was designed for multi module encryption It may be used to store module specific data for FEITIAN Rockey4ND User s Guide Envelope encryption and or API calls A ROCKEY4ND module is a 16 bit protected memory space There are 64 modules in each ROCKEYAND dongle so as many as 64 application modules may be protected with a single ROCKEY4ND dongle The developer may write data into the ROCKEY4ND modules and then use that data along with ROCKEYAND functions to create powerful and flexible software protection systems If the content of the module is not 0 you can use the module if it is 0 you cannot use the module You may determine if a module is useable by analyzing the attributes of the module The exact content can only be determined algorithmically ROCKEYAND modules cannot be read and it can only be written with Advanced passwords The Decrement attribute can be read with the Basic passwords and can be written with the Advanced passwords 4 6 User Algorithm Zone The User Algorithm Zone UAZ is a user defi
108. snnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnsnnnnnnnnnUnnnnnnnnnnnnnnnnnnnn 4 2 1 ROCKEYAND Internal Structure sangen an 4 2 2 ROCKEY4ND Hardware Interface aaaaaaaaaaaasasasasssasasasasssaaaaaaaaaaaaaaaaasadaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaa 4 Chapter 3 Installing ROCKEYAND SDK aaaaaaaaaaaaaaaaaanaa a tnnnnntnnnnnnnnnnnnnnnnnnnnannnnnannnnnnnnnnnnnnnnannnnnannnnnnnnnnnnnnnnnnnss 5 3 1 InstallingeSDK osoan eieaa aaia i EE EE E A cdsuaeteceseceanaesed 5 3 2 Uninstalling SDK UA WA WA lks WA KE WA WA WA AA WA AA E ead EE E a eaten 8 Chapters Bai iia 9 AS PASS WOM AAA 9 AZ OFGEL IAA AA E AA aa 9 4 3 Hardware Du ee ee ae duevehecda ces teduevesecdteceasetveveeecdy cen sedueveseedtvcnnsedveveueedteces cebde 9 A A ISEb Data ZOMG E EA E EA E A ssabanasasnwesssaeauenasetesndantucbasanssvauduesasitossracidepasateess T 9 1 5 Module ZOMG ane anan ee E E AA E N A A A T A A EES 9 4 6 User Algorithm Zone u nn en e En a aiie 10 AT S ET j D A E EEE REEL EEE EEE 1 MAPYA NAE EDINA SASHA SN SAANA MAE SRI r S 10 4 8 Random N MBer ln sadktn ssnas ussk gandasum kskks stsnn skah lbrlsskskaassh sis snstosikissninudinir 10 4 9 Seed nd Return Vai E das 10 Chapter 5 ROCKEYAND Editor innnan censuses vseeessoceucuesssdeece 11 S T BriefIntr duti l E ccocecenstodttegs eawseunaecbastahosvseuupecbasuanesosusaacoa sess egodersaetoateshessdestaadodsusassvaewaastodserdessdeseaeds 11 5 2 Operaatio stera nanie araa aranana aeaaeae aa
109. tcode return i printf Find Rock 08X n Ip1 printf n for j 0 j lt i j FEITIAN Rockey4ND User s Guide p1 0 p2 10 p3 1 strcpy char buffer Hello retcode Rockey RY WRITE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write Hello n pl 12 p2 12 p3 1 strcpy char buffer FeiTian retcode Rockey RY WRITE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Write FeiTian n p1 0 p2 10 memset buffer 0 64 retcode Rockey RY READ amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Read s n buffer p1 12 FEITIAN Rockey4ND User s Guide p2 12 memset buf 0 64 retcode Rockey RY_READ amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buf if retcode ShowERR retcode return printf Read s n buf printf n printf s n strcat buffer buf retcode Rockey RY CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return getch Step 15 You may write a serial number in the User Data Zone UDZ and then verify it during run time as a me
110. though ROCKEYAND was designed to implement extremely high levels of security it is also relatively easy to implement The ROCKEY4ND API set has been simplified and improved based on experience gained from earlier versions The ROCKEY4ND product also includes an Envelope encryption tool Envelope exe for encrypting Windows Portable Executable files such as dll exe and arx Net file and data files It is very easy to use Only a few seconds will be taken to encrypt a file The ROCKEY4ND Envelope tool is an ideal solution if you do not possess the source code for your application or are unfamiliar with implementing an API A security system that combines both the API set and the Envelope program will offer the greatest level of protection There are several components to the ROCKEY4ND software security solution and each of them will be discussed in this document The following is an overview of the ROCKEY4ND components along with a reference to where they will be discussed in this document e The ROCKEY4ND Envelope program Envelope exe is a fast and convenient means of encrypting exe dll arx and other Portable Executable PE files This solution is ideal if you do not have access to source code or you are not familiar with the ROCKEY4ND API set See Chapter 6 ROCKEY4ND Envelope Encryption e The ROCKEY4ND Editor Rockey4ND_Editor exe is a graphical tool for performing operations on the dongle The Editor may be used to read d
111. uccessfully 02 INVA 10 INVA Calculate M 16 21 55 Read user IDSuccessfull mer PA 03 INVA 11 INVA Seed 0 04 INVA 12 INVA rea I I I a KA YE L 28 Batch Generate Seed 06 INVA 14 INVA g Number 100 07 INVA IEA File EATzst Random_ See 8 gt v Figure 5 8 User Data Zone The UDZ is a user defined memory space Data may be displayed in hexadecimal form or as ASCII text Click the Read button to read data from the UDZ You may view hexadecimal data or ASCII text here Calculation Zone Be sure that you are familiar with the calculation functions before using the Calculation Zone First select the calculation you would like to test For Calc1 and Calc3 a Module entry box will appear For Calc2 a Seed Code box will appear Then input the start address of your algorithm stored in the UAZ The start address is where the instruction is marked with S or SE Enter hexadecimal input values to the parameter A B C and D Enter the module number or seed code and click the Calculate button The results of the operation will be written to the parameters listed in the Results section of the Calculation Zone User ID Zone UIZ Click the Read button to read the user defined ID from the UIZ of the ROCKEY4ND dongle UIZ is 32 bits in length Module Attribute Zone This zone indicates the status of the Zero Value and Decrement attributes of the ROCKEYAND modules
112. ucts with high stability integrity and quality and make continuous improvements Developers can get free trial offerings from us You are appreciated if you can complete the following form and send it to us Performance Comparison of Dongles Items for comparison ROCKEY4ND Competing Product Y N USB interface device N Operating voltage as low as 2 2v Passwords and ID number burned into CPU even manufacturer cannot change them Memory read write unit N Unique hardware ID for each dongle Able to work in parallel with dongles of the same or different kind without V any problems Able to work in series for same numbered dongles WA Good adaptability works normally even when a printer is connected N No conflicts even when printing N Support for direct envelope encryption for executable files without the V need of source code of the software Able to prevent the track and crack by debugging tools N Customizable onboard algorithms WA Encrypted software can word under Windows 98 SE 2000 KP 2003 J 2 level password control developer passwords do not appear in user V software Mass storage CPU program memory N 1000 bytes or more user memory J Onboard time gate preventing track by software WA Able to encrypt a set of software programs modules N
113. udimentary implementation of security with your dongle can render the total security solution weak ROCKEYAND dongles offer two protection methods envelope encryption and API encryption You may invoke the program Envelope exe under Envelope directory of the SDK to perform the envelope encryption function As the name indicates envelope encryption adds an envelope to the user s designated files to protect them The envelope will call the dongle When users execute the program protected by the envelope FEITIAN Rockey4ND User s Guide the protected program will automatically call the ROCKEY4ND and decide whether to allow the program to continue according to the results of the call The envelope program directly encrypts the compiled files The advantage of envelope encryption is that it is very easy and quick to implement and the source code does not need to be modified The envelope method is the ideal choice if there is no time for learning the API method or if the source code is lost or unavailable The disadvantage is that an envelope program uses a rule based encryption method and rule based encryption methods are not as strong as methods that use an encryption key Also envelope encryption cannot support script languages that cannot be compiled such as VBA For API encryption developers need to choose the appropriate language interface according to their programming language to access the dongle API encryption was designed to be flexible
114. uffer if retcode ShowERR retcode return printf Calculate Input p1 1 p2 2 p3 3 p4 4 n printf n printf Result d 3a 94d6 9689 7f54 1 2 3 4 8x7b17 n printf Calculate Output p1 x p2 x p3 x p4 x n pl p2 p3 p4 retcode Rockey RY CLOSE amp handle j amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf n getch 8 2 1 3 Calculation 3 example In Step 26 we write algorithm A A B A A C A A D A A E A A F A A G A A H to UAZ and the calculation result is 0x14 include lt windows h gt include lt stdio h gt include lt conio h gt include Rockey4 ND _32 h void ShowERR WORD retcode if retcode return printf Error Code d n retcode FEITIAN Rockey4ND User s Guide void main WORD handle 16 p1 p2 p3 p4 retcode DWORD 1p1 1p2 BYTE buffer 1024 int i j char cmd2 A A B A A C A A D A A E A A F A A G A A H pl xc44c p2 Oxc8f8 p3 0x0799 p4 xc43b retcode Rockey RY_FIND amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return printf Find Rock 88X n 1p1 retcode Rockey RY OPEN amp handle amp lp1 amp lp2 amp p1 amp p2 amp p3 amp p4 buffer if retcode ShowERR retcode return a le while retco

Download Pdf Manuals

image

Related Search

Related Contents

XtremeMac Soma Travel  - Betriebsrat Tamsweg  Bushnell 11-9320C Digital Camera User Manual  SoftBank 101N 取扱説明書  Portal Manager API-Programmierhandbuch    DPM Central Station Service Manual  1 - Roland Central Europe  Manual EN  Samsung SGH-P520 User Manual  

Copyright © All rights reserved.
Failed to retrieve file