UniKey API Protection Solution

From SecuTech Wiki
Revision as of 19:06, 10 April 2012 by Cloud (talk | contribs)
Jump to navigationJump to search


UniKey provides the most reliable hardware and software tools available in the market today. Both of the two ways of software protection prove to be effective. However, if you want to maximize your software protection, certain strategies of implementing software protection need to be employed.

Challenges Facing Software Protection Companies

While software protection companies are trying their best to enhance the software protection level, software crackers get engaged in developing more sophisticated means of deconstructing software protection measures, in order to duplicate and distribute illegal copies of unlicensed software and to reverse engineer code so as to steal intellectual property.

Once aware of the strategies of software crackers, software protection companies should implement the latest and strongest techniques for protecting software.

In theory, there is no software protection that is absolutely uncrackable. However, if you constantly implement up‐to‐date strategies using the strongest software protection methods, you significantly decrease your vulnerability to such attacks.

Software protection concerns

There are two main methods of attacking protected applications that concern software publishers most. a. Simulating calls to the protection device b. Simulating the software used by the manufacturer of the protection device.

Five Levels of Protection Guide

Since there are quite a few APIs available in the library of UniKey products, it proves quite difficult for vendors to be clear about the function of each API as well as which API should be applied for their specific purpose. In view of this, we decide to classify the APIs into five specific levels of protection so as to better serve our customers specific needs.

 The primitive level of protection

 The basic level of protection

 The average level of protection

 The professional level of protection

 The expert level of protection

The Advantages of Primitive Level of Protection

There are five APIs for primitive level of protection:

long UniKey_Find(WORD* pHandle, DWORD* pSetting1, DWORD* pSetting2);

long UniKey_Find_Next(WORD* pHandle, DWORD* pSetting1, DWORD* pSetting2);

long UniKey_User_Logon(WORD* pHandle, WORD* pPassword1, WORD* pPassword2);

long UniKey_Vender_Logon(WORD* pHandle, WORD* pPassword1, WORD* pPassword2, WORD* pPassword3, WORD* pPassword4);

long UniKey_Logoff(WORD* pHandle);

The advantages of primitive protection

Primitive level of protection can give you an easy and quick protection for your software. You do not need to write much code. And with the several lines of codes you will make your software protected.

The main functions of primitive level of protection APIs can let you know your dongle's HID. And with this specific HID, you can easily know whether the dongle inserted is yours or not.

In this part you will learn how to apply a primitive protection to your software. You can refer to the following picture and have a quick understanding of it.

The method enables you to have a quick and easy protection for your software. All you need to do is to call serveral functions in your project. The main usage of the APIs is offered below.


UniKey_Find The first API you need to use is UniKey_Find. It enables you to find your UniKey dongle and return a code number to show you the UniKey dongle’s HID (Hardware ID) as well. HID is important since it helps you decide whether or not a dongle belongs to you when you check it.

When you use the UniKey_Find function, it will return a code. The return code will show you whether or not the call is successful. For example, if it returns a 0 code, it means the UniKey_Find function works fine. If it returns a 200 code, it means it failed to find your dongle. At this time, you need to check whether or not your UniKey dongle is properly connected to your computer.

UniKey_Find_Next The UniKey_Find_Next function, it is used for finding the next UniKey dongle. There are times when you want two or more UniKey dongles to work together. You need to call UniKey_Find function at first, and then call UniKey_Find_Next function to find more UniKey dongles. As long as you find these UniKey dongles, you can let them work for your project.

UniKey_User_Logon For the UniKey_User_Logon function, it is used when you want to logon the UniKey dongle as an end user. When you implement this API, you can aquire the permission as a user to logon the UniKey dongle. However your permission is limited as a user. You can not implement those APIs intended for the vender. If you do call the APIs intended for the vender, you will not get the result that you expected.

UniKey_Vender_Logon For the UniKey_Vender_Logon function, it is used when you want to logon the UniKey dongle as a vender. It can not be used together with the UniKey_User_Logon. Only one can be formally implemented into your project. And if you use UniKey_Vender_Logon, you will have to aquire a vender's permission. In vender logon mode, you can implement all the APIs.

UniKey_Logoff For the UniKey_Logoff function, it is used when you want to logoff the UniKey dongle. When you finish operating the UniKey dongle, you can implement this API. It will let you logoff the UniKey dongle. After you call this function, you don't have any permission to use any functions.

The Advantages of Basic Level of Protection

There are nine APIs for primitive level of protection:

long UniKey_Find(WORD* pHandle, DWORD* pSetting1, DWORD* pSetting2);

long UniKey_Find_Next(WORD* pHandle, DWORD* pSetting1, DWORD* pSetting2);

long UniKey_User_Logon(WORD* pHandle, WORD* pPassword1, WORD* pPassword2);

long UniKey_Vender_Logon(WORD* pHandle, WORD* pPassword1, WORD* pPassword2, WORD* pPassword3, WORD* pPassword4);

long UniKey_Write_Memory(WORD* pHandle, WORD* pStartAddress, WORD* pBufferLength, BYTE* pBuffer);

long UniKey_Read_Memory(WORD* pHandle, WORD* pStartAddress, WORD* pBufferLength, BYTE* pBuffer);

long UniKey_Write_SoftID(WORD* pHandle, DWORD* pSoftID);

long UniKey_Read_SoftID(WORD* pHandle, DWORD* pSoftID);

long UniKey_Logoff(WORD* pHandle);

The advantage of basic protection

Besides the basic identification by HID, you can write your own phrases into the 4K memory of your UniKey dongle that will make a much safer protection for your software. If you prefer a serial number for your software, you can use the softID provided by the library of UniKey. It will prove a quick way for you to assign a serial code for your UniKey dongle.

In this part you will learn how to apply a basic protection to your software. You can refer to the following picture to have a quick understanding of it.


This method enables you to have a quick and easy protection for your software. All you need to do is to call serveral functions in your project. The main usage of the APIs is offered below.

UniKey_Find The first API you need to use is UniKey_Find. It enables you to find your UniKey dongle and return a code number to show you the UniKey dongle’s HID (Hardware ID) as well. HID is important since it helps you decide whether or not a dongle belongs to you when you check it.

When you use the UniKey_Find function, it will return a code. The return code will show you whether or not the call is successful. For example, if it returns a 0 code, it means the UniKey_Find function works fine. If it returns a 200 code, it means it failed to find your dongle. At this time, you need to check whether or not your UniKey dongle is properly connected to your computer.

UniKey_Find_Next The UniKey_Find_Next function, it is used for finding the next UniKey dongle. There are times when you want two or more UniKey dongles to work together. You need to call UniKey_Find function at first, and then call UniKey_Find_Next function to find more UniKey dongles. As long as you find these UniKey dongles, you can let them work for your project.


UniKey_User_Logon For the UniKey_User_Logon function, it is used when you want to logon the UniKey dongle as an end user. When you implement this API, you can aquire the permission as a user to logon the UniKey dongle. However your permission is limited as a user. You can not implement those APIs intended for the vender. If you do call the APIs intended for the vender, you will not get the result that you expected.

UniKey_Vender_Logon For the UniKey_Vender_Logon function, it is used when you want to logon the UniKey dongle as a vender. It can not be used together with the UniKey_User_Logon. Only one can be formally implemented into your project. And if you use UniKey_Vender_Logon, you will have to aquire a vender's permission. In vender logon mode, you can implement all the APIs.

UniKey_Write_Memory For the UniKey_Write_Memory, it is used when you wantt to write data into the memory. This API needs to be called after you logon a UniKey dongle. To write the last 2k memory (for 2048 – 4096), you need to verify all the 4 passwords (vendor mode) to obtain full permission to the dongle.

UniKey_Read_Memory and UniKey_Write_Memory provide basic reading and writing functions to the dongle. You can store general information via such functions. And various levels of security can be applied too.

UniKey_Read_Memory For the UniKey_Read_Memory, you can call the API to read the contents of the memory. You need to logon a UniKey dongle before calling the API. The size of the basic memory is up to 4K. All memory is encrypted and CRC checked when communicating with applications. You only need to have the user’s permission to read the 4K memory.

UniKey_Write_SoftID For the UniKey_Write_SoftID, you need to verify all 4 passwords (vendor mode) to write the SoftID.When you call this API, if you set UniKey ID wrong, an error message will be returned. UniKey_Read_SoftID

For UniKey_Write_SoftID and UniKey_Read_SoftID provide a means to make a soft (write-able) ID for each software. You can write different software ID for each UniKey and call UNIKEY_READ_SOFTID to check if the software ID is correct.

UniKey_Logoff For the UniKey_Logoff function, it is used when you want to logoff the UniKey dongle. When you finish operating the UniKey dongle, you can implement this API. It will let you logoff the UniKey dongle. After you call this function, you don't have any permission to use any functions.