UniKey RTC API Protection Solution

From SecuTech Wiki
Revision as of 20:39, 17 April 2012 by Cloud (talk | contribs)
Jump to navigationJump to search


Introduction

UniKey Time provides Real Time Clock feature and this article will introduce how to integrate UniKey Time APIs with your own projects and how to use the features UniKey Time provides for us.



Each Unikey Time has a real battery embedded; this provides the UniKey Time dongle the Real Time Clock feature. This means that clock inside of the UniKey is unique and independent from the computer’s system time. The protected software will be expired on time and even the user changes his system time, the protected software still won’t work for him.



Each UniKey Time has 16 Time Modules; each UniKey Time Module can be used for setting the duration time of the protected software.


For example, I could set start time and end time for Time Module No.0. Then binding my software with Time Module No.0, after this step, my software will be limited within the start time and end time. If the time inside of the dongle reaches the expired date, that is end time, the software will not work again.



Setting Expired Date for Software

Users could refer the following steps on integrating UniKey Time APIs.



Set Module Start Time & End Time

In order to use the start time and end time to set the limit time period, we need to use two UniKey APIs.


UniKey_Set_Time_Module_Start_Time(Handle, Module, Year, Month, Day, Hour);


And


UniKey_Set_Time_Module_End_Time(Handle, Module, Year, Month, Day, Hour);


After setting the start time and end time for a specific UniKey Time Module(one of its 16 Time Modules), our protected software is limited within this time period.


Set Module Start Time & Duration Period

In order to use the start time and duration period to set the limit time period, we need to use two UniKey APIs.


UniKey_Set_Time_Module_Start_Time(Handle, Module, Year, Month, Day, Hour);


And


UniKey_Set_Time_Module_Duration(Handle, Module, Days, Hours);


After setting the start time and duration period for a specific UniKey Time Module(one of its 16 Time Modules), our protected software is limited within this time period. This is another way besides setting an end time directly.


Checking If The Software Expired or not

We need to use one UniKey Time API to check if the software expired or not, that is


UniKey_Check_Time_Module_Now(Handle, Module, RemainDays, RemainHours);


This API will use the current time inside of the UniKey Time dongle to compare with the expired date stored within the specific Time Module and then return the RemainDays and RemainHours for us. So we could know if our protected software is expired or not, how many days and hours left.


UniKey TIME APIs explanations


UniKey_Set_Time(Handle, Year, Month, Day, Hour, Minute, Second);


UniKey_Set_Time is used for setting a specific time for the UniKey Time dongle.


UniKey_Set_Time_Now(pHandle);


UniKey_Set_Time_Now is used for setting the current system time to the UniKey Time dongle.


UniKey_Get_Time(Handle, Year, Month, Day, Hour, Minute, Second);


UniKey_Get_Time is used for getting the current date and time stored within UniKey Time dongle.


UniKey_Erase_Time_Module(Handle, Module);


UniKey_Erase_Time_Module is used for erasing a UniKey Time Module; this can be used after we configured one UniKey Time Module.


UniKey_Set_Time_Module_Start_Time (Handle, Module, Year, Month, Day, Hour);
UniKey_Set_Time_Module_Start_Time (Handle, Module);
UniKey_Set_Time_Module_Start_Time_Now_PC (Handle, Module);


UniKey_Set_Time_Module_Start_Time is used for setting the start time for one UniKey Time Module; it has three formats, you can define the specific date by yourself, or use the current time stored within the UniKey Time dongle, or use the current computer’s system time.


UniKey_Set_Time_Module_End_Time(Handle, Module, Year, Month, Day, Hour);


UniKey_Set_Time_Module_End_Time is used for setting the end time for one UniKey Time Module.


UniKey_Set_Time_Module_Duration(Handle, Module, Days, Hours);


UniKey_Set_Time_Module_Duration is used for setting the duration period for one UniKey Time Module.


UniKey_Check_Time_Module(Handle, Module, RemainDays, Year, Month, Day, Hour);
UniKey_Check_Time_Module_Now(Handle, Module, RemainDays, RemainHours);
UniKey_Check_Time_Module_Now_PC(Handle, Module, RemainDays, RemainHours);


UniKey_Check_Time_Module is used for checking if the protected software is expired or not; it has three formats, you can define the specific date by yourself, or use the current time stored within the UniKey Time dongle, or use the current computer’s system time.