Abstract:
An operating method for a one-time password with an updatable seed. The method comprises: a one-time password entering a dormancy mode after being powered on and initialized; being woken up when an interrupt is detected; entering an interrupt processing flow; setting a wakeup flag; entering a key processing flow when a key wakeup flag is set; judging a system state and a key manner; and completing the functions of programming seed data and generating a password according to a judgment result. According to the present invention, on the premise of guaranteeing the security, a user is permitted to program and update seed data in a one-time password, thereby facilitating the use of the user.

Description:
FIELD OF THE INVENTION 
       [0001]    The present invention relates to a working method of a dynamic token in which a seed can be updated, which belongs to the information security field. 
       PRIOR ART 
       [0002]    In prior art, OTP (One-time password) is a safe and convenient technology which prevents an account number from being pilfered. A random combination of numbers, which is unpredictable, is generated as a one-time password according to a special algorithm, and each OTP can be used only once. When the user is authenticated by a system, he or she must enter an OTP associated with an account number and a static password, and the user can get access to the system and conduct a transaction when the account number, the static password and the OTP are authenticated successfully. In this way, legitimate and uniqueness of the user can be ensured. As the most important advantage of the dynamic token, each OTP used by a user is different from another ones. Therefore, the user&#39;s identity cannot be copied by hackers. It is acknowledged that the technology of authentication via an OTP is one of the most effective ways for authenticating user&#39;s identity. The technology can protect users from exposing to online scams such as account password being stolen by hackers or Trojan, fake website, which leads to monetary and proprietary damages. At present, the OTP technology is applied in multiple fields such as E-bank, online game, telecommunication operator, E-governance and enterprise. 
         [0003]    At present, seed data are usually installed inside dynamic tokens by token producers before the dynamic tokens leave factory. After being activated, the token cannot be updated by a user, and the token can only be used in single application. 
       SUMMARY OF THE INVENTION 
       [0004]    The object of the present invention is to provide a working method of a dynamic token in which a seed can be updated, in which seed data in a dynamic token can be programmed and updated by a user without lowering down security; in this way, a user can use the dynamic token conveniently. 
         [0005]    Thus, the present invention provides a working method of a dynamic token in which a seed can be updated, which includes: 
         [0006]    Step S 1 ), a dynamic token powering on and initializing, turning on a general interrupt, resetting a long-time pressing key flag, setting a system state as a third preset state, entering a suspend mode, and waiting for being waken; 
         [0007]    Step S 2 ), the dynamic token being waken when an interrupt is detected, entering an interrupt handling process, executing Step S 3  after the interrupt handling process is finished; 
         [0008]    the interrupt handling process includes: determining whether a key-interrupt flag is set; if yes, setting a key-waken flag, resetting the key-interrupt flag, and the interrupt handling process ending; otherwise, the interrupt handling process ending, in which, when a key of the dynamic token is pressed, a key interrupt is triggered, and the key-interrupt flag is set; 
         [0009]    Step S 3 ), checking, by the dynamic token, the key-waken flag, entering a key handling process in the case that the key-waken flag is set, re-entering the suspend mode when the key handling process is end, waiting for being waken, and returning to Step S 2 ; re-entering the suspend mode in the case that the key-waken flag is not set, waiting for being waken, and returning to Step S 2 ; 
         [0010]    the key handing process includes: 
         [0011]    Step A 0 ), timing, by the dynamic token, a duration, at which the key is pressed, determining whether the duration is longer than a preset duration; if yes, setting the long-time pressing key flag, and executing Step A 1 ; otherwise, executing Step A 1  directly; 
         [0012]    Step A 1 ), checking, by the dynamic token, the system state, executing Step A 2  in the case that the system state is the third preset state; executing Step A 3  in the case that the system state is a fourth preset state; executing Step A 4  in the case that the system state is a fifth preset state; executing Step A 5  in the case that the system state is a sixth preset state; otherwise, executing Step A 6 ; 
         [0013]    Step A 2 ), determining, by the dynamic token, whether the long-time pressing key flag is set, if yes, powering on the display screen, writing a serial number pre-stored in the dynamic token into a display buffer, setting the system state as the fourth preset state, executing Step A 6 ; otherwise, calculating to generate an OTP according to seed data stored in the dynamic token and a dynamic factor, powering on the display screen, writing a generated OTP into the display buffer, setting the system state as the sixth preset state, and executing Step A 6 ; 
         [0014]    Step A 3 ), determining, by the dynamic token, whether the long-time pressing key flag is set; if yes, setting the system state as the third preset state, powering down the display screen, and executing Step A 6 ; otherwise, collecting light sensation data, promoting that the light sensation data is collected; determining whether a serial number in a collected light sensation data matches the serial number pre-stored in the dynamic token, if matches, storing the seed data in the collected light sensation data, prompting that the seed data is programmed successfully, setting the system state as the fifth preset state, and executing Step A 6 ; if does not match, clearing the collected light sensation data, prompting that the seed data is programmed unsuccessfully, writing the serial number pre-stored in the dynamic token into the display buffer, setting the system state as the fourth preset state, and executing Step A 6 ; 
         [0015]    Step A 4 ), calculating, by the dynamic token, to generate an OTP according to the seed data stored in the dynamic token and the dynamic factor, writing the generated OTP into the display buffer, setting the system state as the sixth preset state, and executing Step A 6 ; 
         [0016]    Step A 5 ), determining, by the dynamic token, whether the long-time pressing key flag is set; if yes, writing the serial number pre-stored in the dynamic token into the display buffer, setting the system state as the fourth preset state, and executing Step A 6 ; otherwise, setting the system state as the third preset state, and executing Step A 6 ; and 
         [0017]    Step A 6 ), resetting the key-waken flag, and ending the key handling process. 
         [0018]    Preferably, in Step A 3 , after the light sensation data is collected, and before whether the serial number in the collected light sensation data matches the serial number pre-stored in the dynamic token is determined, the step further including: determining whether all of the light sensation data is collected, if yes, determining whether the serial number in the collected light sensation data matches the serial number pre-stored in the dynamic token; otherwise, determining whether the collection of the light sensation data is overtime, if the collection is overtime, stopping collecting the light sensation data, and prompting that the seed data is programmed overtime, writing the serial number pre-stored in the dynamic token into the display buffer, setting the system state as the fourth preset state, and executing Step A 6 ; if the collection is not overtime, continuing to collect the light sensation data. 
         [0019]    Preferably, in Step A 3 , when the duration at which the key is pressed is not longer than a preset duration, before the light sensation data is collected, the step further including: setting the system state as the first preset state; correspondingly, in the interrupt handling process, when the key flag is set, before the key-waken flag is set, the process further including: determining whether the system state is the first preset state, if yes, setting the system state as the second preset state, the interrupt handling process ending; otherwise, setting the key-waken flag; after the light sensation data is collected, and before whether the serial number in the collected light sensation data matches the serial number pre-stored in the dynamic token is determined, the step further including: determining whether all of the light sensation data is collected, if yes, determining whether the serial number in the collected light sensation data matches the serial number pre-stored in the dynamic token; otherwise, checking the system state, if the system state is the second preset state, stopping collecting the light sensation data, and prompting that programming the seed data is called off, writing the serial number pre-stored in the dynamic token into the display buffer, setting the system state as the fourth preset state, and executing Step A 6 ; if the system state is not the second preset state, continuing to collect the light sensation data. 
         [0020]    Preferably, in Step A 3 , when the serial number in the collected light sensation data matches the serial number pre-stored in the dynamic token, the step further including: storing mode information of the dynamic token in the collected light sensation data; correspondingly, that calculating to generate an OTP according to the seed data stored in the dynamic token and the dynamic factor specifically including: checking the mode information of the dynamic token stored in the dynamic token; calculating to generate an OTP according to the seed data stored in the dynamic token and an event factor in the case that the mode is an event mode; calculating to generate an OTP according to the seed data in the dynamic token and a first time factor in the case that the mode is a first time mode; calculating to generate an OTP according to the seed data stored in the dynamic token and a second time factor in the case that the mode is a second time mode. 
         [0021]    Preferably, when the key interrupt flag is not set, the interrupt handling process further including: determining whether a RTC interrupt flag is set, if yes, setting a RTC waken flag, resetting the RTC interrupt flag, the interrupt handling process ending; otherwise, the interrupt handling process ending; in which, RTC interrupt is triggered per second, when the RTC interrupt is triggered, the RTC interrupt flag is set; correspondingly, Step S 3  is replaced by: the dynamic token determining whether there exists a set waken flag, if yes, checking the RTC waken flag and the key-waken flag successively; entering the key handling process in the case that the key-waken flag is set, and executing Step S 3  when the key handling process is end; entering RTC handling process in the case that the RTC-waken flag is set, executing Step S 3  when the RTC handling process is end; if there is no set waken flag, the dynamic token entering suspend mode and waiting for being waken, and returning to Step S 2 ; in which the RTC handling process includes: 
         [0022]    Step B 1 ), updating, by the dynamic token, the number of times of RTC interrupt, determining whether the number of times of RTC interrupt is a preset number of times, if yes, resetting the RTC-waken flag, and executing Step B 2 ; otherwise, executing Step B 2  directly; 
         [0023]    Step B 2 ), updating, by the dynamic token, a first parameter and a second parameter, determining whether the first parameter and the second parameter reach a corresponding threshold respectively, setting the first parameter as its initial value and updating a first time factor stored in the dynamic token in the case that the first parameter reaches the threshold of the first parameter; setting the second parameter as its initial value and updating a second time factor stored in the dynamic token in the case that the second parameter reaches the threshold of the second parameter, and executing Step B 3 ; executing Step B 3  directly in the case that both the first parameter and the second parameter do not reach the threshold; 
         [0024]    Step B 3 ), updating, by the dynamic token, calibration counting value, and determining whether the first parameter equals a preset value, if yes, executing Step B 4 ; otherwise, ending the RTC handling process; and 
         [0025]    Step B 4 ), determining, by the dynamic token, whether the first parameter and the second parameter need to be calibrated according to the calibration counting value and a calibration value pre-stored in the dynamic token, if yes, updating the first parameter, the second parameter and the calibration counting value according to the calibration value and the calibration counting value, and the RTC handling process ending; otherwise, the RTC handling process ending. 
         [0026]    Preferably, when the serial number in the collected light sensation data matches the serial number pre-stored in the dynamic token, Step A 3  further including: storing an expiry data of the seed data which is in the collected light sensation data; correspondingly, when the second parameter reaches the threshold of the second parameter, Step B 2  further including: determining whether the seed data stored in the dynamic token is expired according to the expiry date of the seed data stored in the dynamic token, if yes, setting a seed data invalid flag; otherwise, updating the expiry date of the seed data stored in the dynamic token; when the duration at which the key is pressed is not longer than the preset duration, before calculating to generate an OTP according to the seed data stored in the dynamic token and the dynamic factor, Step A 2  further including: checking whether the seed data invalid flag is set, if yes, prompting that the seed data is invalid, and executing Step A 6 ; otherwise, calculating to generate an OTP according to the seed data stored in the dynamic token and the dynamic factor. 
         [0027]    Preferably, before whether the key interrupt flag is set is determined, the interrupt handling process further including: determining whether a process-equipment communication interrupt flag is set, if yes, setting a process-equipment communication waken flag, resetting the process-equipment communication interrupt flag, and the interrupt handling process ending; otherwise, determining whether the key interrupt flag is set; in which, when communication data sent by the process-equipment is received by the dynamic token, a process-equipment communication interrupt is triggered, and the process-equipment communication interrupt flag is set; correspondingly, Step S 3  is replaced by: the dynamic token determining whether there exists a set waken flag, if yes, checking the process-equipment communication waken flag and the key waken flag successively, entering a process-equipment communication handling process in the case that the process-equipment communication flag is set, and executing Step S 3  when the process is end; entering the key handling process in the case that the key waken flag is set, and executing Step S 3  when the process is end; the dynamic token entering a suspend mode in the case that no waken flag is set, waiting for being waken, and returning to Step S 2 ; in which the process-equipment communication handling process includes: 
         [0028]    Step C 1 ), turning down the general interrupt, determining whether data received currently is a waken signal sent by the process-equipment, if yes, returning a handshake signal to the process equipment, continuing to receive communicable data sent by the process-equipment, and executing Step C 2 ; otherwise, executing Step C 3 ; 
         [0029]    Step C 2 ), determining a type of the data received currently, in the case that the data is a command of obtaining hardware information of token, obtaining a random number in the command of obtaining hardware information of token, saving the random number, and returning the random number to the process-equipment, and executing Step C 3 ; in the case that the data is other command, decrypting a received process-equipment command according to the random number stored in the dynamic token, executing a decrypted command, and returning a result to the process-equipment, and executing Step C 3 ; otherwise, executing Step C 3 ; and 
         [0030]    Step C 3 ), resetting the process-equipment communication waken flag, enabling the general interrupt, then ending the process-equipment communication handling process. 
         [0031]    As an advantage of the present invention, a user can program and update seed data in a dynamic token without lowering down security, in this way, it is more convenient for a user to use. 
     
    
     
       BRIEF DESCRIPTION OF THE ACCOMPANYING DRAWINGS 
         [0032]    The technical solutions of the embodiments of the disclosure are described clearly and completely in conjunction with the accompanying drawings as follows. Apparently, the described drawings are merely a part of but not all of the embodiments according to the disclosure. Based on the described embodiments of the disclosure, other drawings obtained by those skilled in the art without any inventive work belong to the scope of the disclosure. 
           [0033]      FIG. 1  illustrates a flow diagram of a working method of a dynamic token in which a seed can be updated according to the present invention; 
           [0034]      FIG. 2  illustrates a flow diagram of an interrupt handling process according to the present invention; 
           [0035]      FIG. 3  illustrates a flow diagram of a process-equipment communication handling process according to the present invention; 
           [0036]      FIG. 4  illustrates a flow diagram of a RTC handling process according to the present invention; and 
           [0037]      FIG. 5  illustrates a flow diagram of a key handling process according to the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0038]    The technical solutions in the Embodiments of the present invention are further described more clearly and completely with the drawings in the Embodiments of the present invention. Apparently, Embodiments described are just a few of all Embodiments of the present invention. On the basis of Embodiments of the invention, all other related Embodiments made by those skilled in the art without inventive work belong to the scope of the invention. 
         [0039]    The present invention provides a working method of a dynamic token in which a seed can be updated, as shown in  FIG. 1 , the method includes: 
         [0040]    Step  101 , a dynamic token powers on and initializes, turns on a general interrupt, resets a long-time pressing key flag, sets a system state as a third preset state, enters a suspend mode, the dynamic token is waken when an interrupt is detected, Step  102  is executed. 
         [0041]    In the present embodiment 1, the interruption includes: a process-equipment communication interrupt, a RTC interrupt and a key interrupt. 
         [0042]    Step  102 , the dynamic token enters an interrupt handling process to handle the interrupt, sets a corresponding waken flag according to a type of the interruption; 
         [0043]    in the present embodiment 1, as shown in  FIG. 2 , the interrupt handling process specifically includes: 
         [0044]    Step A 1 , determine whether a process-equipment communication interrupt flag is set, if yes, execute Step A 2 ; otherwise, execute Step A 3 ; 
         [0045]    Step A 2 , reset the process-equipment communication interrupt flag, set a process-equipment communication waken flag, the interruption handling process is end; 
         [0046]    Step A 3 , determine whether a key interrupt flag is set, if yes, execute Step A 4 ; otherwise execute Step A 7 ; 
         [0047]    Step A 4 , determine whether the system state is a first preset state, if yes, execute Step A 5 ; otherwise, execute Step A 6 ; 
         [0048]    Step A 5 , set the system state as a second preset state, the interrupt handling process is end; 
         [0049]    Step A 6 , reset the key interrupt flag, set a key waken flag, the interrupt handling process is end; 
         [0050]    Step A 7 , determine whether a RTC interrupt flag is set, if yes, execute Step A 8 ; otherwise, the interrupt handling process is end; and 
         [0051]    Step A 8 , reset the RTC interrupt flag, update the number of times of the RTC interrupt, reset a RTC waken flag, the interrupt handling process is end. 
         [0052]    In the preset embodiment 1, the communication interrupt is triggered when communication data sent by the process-equipment is received by the token, the communication interrupt flag is set; the key interrupt is triggered when the key in the token is pressed, the key interrupt flag is set; the RTC interrupt is triggered per second, when the RTC interrupt is triggered, the RTC interrupt flag is set. 
         [0053]    In the interrupt handling process in the present embodiment 1, when the RTC interrupt flag is set, the number of times of the RTC interrupt is updated as a current number of times plus 1. 
         [0054]    Step  103 , the dynamic token determines whether there exists a set waken flag, if yes, execute Step  104 ; otherwise, the dynamic token enters a suspend mode, and the token is waken when an interrupt is detected, returns to Step  102 ; 
         [0055]    Step  104 , the dynamic token checks every waken flag successively, executes Step  105  in the case that the process-equipment communication waken flag is set; executes Step  106  in the case that the RTC waken flag is set; executes Step  107  in the case that the key waken flag is set; 
         [0056]    In the present embodiment 1, the waken flag includes: a process-equipment communication waken flag, a RTC waken flag and a key waken flag, preferably, the dynamic token checks the process-equipment communication waken flag, the RTC waken flag and the key waken flag successively. 
         [0057]    Step  105 , the dynamic token enters the process-equipment communication handling process, and returns to Step  103  when the process-equipment communication handling process is finished; 
         [0058]    In the present embodiment 1, as shown in  FIG. 3 , the process-equipment communication handling process specifically includes: 
         [0059]    Step B 1 , the general interrupt is turned off, whether data received currently is a waken signal sent by the process equipment is determined, if yes, Step B 2  is executed; otherwise, Step B 9  is executed; 
         [0060]    Step B 2 , a handshake signal is returned to the process-equipment, the communication data sent by the process-equipment is received; 
         [0061]    Step B 3 , determine whether a length of data in the data received currently is larger than a preset length, if yes, execute Step B 9 ; otherwise, execute B 4 ; 
         [0062]    In the present embodiment 1, the preset length is 50 bytes. 
         [0063]    Step B 4 , continue to receive the communication data sent by the process-equipment according to the length of data; 
         [0064]    Step B 5 , check whether the data received currently is correct, if yes, execute Step B 6 ; otherwise, execute Step B 9 ; 
         [0065]    Step B 6 , determine a type of the data received currently, execute Step B 7  in the case that the data is a preset process-equipment command; execute Step B 8  in the case that the data is other process-equipment command; execute Step B 9  in the case that the data is not a process-equipment command; 
         [0066]    In the present embodiment 1, the preset process-equipment command is a command of obtaining hardware information of token, which is sent by the process-equipment. 
         [0067]    Step B 7 , a random number in the preset process-equipment command is obtained, an obtained random number is saved and returned to the process-equipment, Step B 9  is executed; 
         [0068]    Step B 8 , the received process-equipment is decrypted according to a random number stored in the token, a decrypted command is executed, and a result is returned to the process-equipment, and Step B 9  is executed; 
         [0069]    In the present embodiment 1, other process-equipment command includes a command of writing time-factor; executing a decrypted command of writing time-factor specifically includes: a time factor in the command of writing time-factor is stored, in which, the time-factor includes a first time factor and a second time factor. 
         [0070]    Step B 9 , the process-equipment communication waken flag is reset, the general interrupt is enabled, and the process-equipment communication handling process is end. 
         [0071]    Step  106 , the dynamic token enters the RTC handling process, returns to Step  103  when the RTC handling process is finished; 
         [0072]    In the present embodiment 1, as shown in  FIG. 4 , the RTC handling process specifically includes: 
         [0073]    Step C 1 , the number of times of RTC interrupt is updated; in Step C 1  of the present embodiment 1, updating the number of times of RTC interrupt is that the current number of times minus 1; 
         [0074]    Step C 2 , determine whether a number of times of RTC interrupt is a preset number of times, if yes, execute Step C 3 ; otherwise, execute Step C 4 ; 
         [0075]    in the present embodiment 1, a preset number of times is 0. 
         [0076]    Step C 3 , the RTC waken flag is reset, and Step C 4  is executed; 
         [0077]    Step C 4 , a first parameter and a second parameter are updated; 
         [0078]    In the present embodiment 1, both an initial value of the first parameter and an initial value of the second parameter are 0, updating the first parameter in Step C 4  is that the current value of the first parameter plus 1; updating the second parameter is that the current value of the second parameter plus 1; 
         [0079]    Step C 5 , determine whether the first parameter reaches a threshold of the first parameter, if yes, execute Step C 6 ; otherwise, execute Step C 7 ; 
         [0080]    In the present embodiment 1, the threshold of the first parameter is 30. 
         [0081]    Step C 6 , the first parameter is set as the initial value of itself, the first time factor is updated, and Step C 7  is executed; 
         [0082]    In the present embodiment 1, updating the first time factor is that a current value of the first time factor plus 1; 
         [0083]    Step C 7 , determine whether the second parameter reaches a threshold of the second parameter, if yes, execute Step C 8 ; otherwise, execute Step C 9 ; 
         [0084]    In the present embodiment 1, the threshold of the second parameter is 60. 
         [0085]    Step C 8 , the second parameter is set as an initial value of itself, a second time factor is updated, and Step C 9  is executed; 
         [0086]    In the present embodiment 1, updating the second time factor is that the current value of the second time factor plus 1; 
         [0087]    Step C 9 , a calibration counting value is updated; 
         [0088]    In the present embodiment 1, updating the calibration counting value is that a current value of the calibration counting value plus 1; 
         [0089]    Step C 10 , determines whether the first parameter equals a preset value, if yes, execute Step C 11 ; otherwise, execute Step C 13 ; 
         [0090]    In the present embodiment 1, the preset value is 15; 
         [0091]    Step C 11 , determine whether the first parameter and the second parameter need to be calibrated according to the calibration counting value and a calibration value stored in the token, if yes, execute Step C 12 ; otherwise, execute Step C 13 ; 
         [0092]    In the present embodiment 1, Step C 11  specifically includes: determine whether the calibration value &amp;0x7F is less than the calibration counting value, if yes, the first parameter and the second parameter need to be calibrated, and Step C 12  is executed; otherwise, the first parameter and the second parameter need not to be calibrated, and Step C 13  is executed. 
         [0093]    Step C 12 , the first parameter, the second parameter and the calibration counting value are updated according to the calibration value and the calibration counting value, and Step C 13  is executed; 
         [0094]    In the present embodiment 1, updating the calibration counting value is that the current value of the calibration counting value minus the calibration value; checks the most significant digit of the calibration, the first parameter is updated as a value which is obtained by the current value of the first parameter minus 1, and the second parameter is updated as a value which is obtained by the current value of the second parameter minus 1 in the case that the most significant digit of the calibration value is 1; in the case that the most significant digit of the calibration value is 0, the first parameter is updated as a value which is obtained by the current value of the first parameter plus 1, and the second parameter is updated as a value which is obtained by the current value of the second parameter minus 1. 
         [0095]    Step C 13 , check whether a shell of the token has been opened, if yes, execute Step C 14 ; otherwise, execute Step C 15 ; 
         [0096]    Step C 14 , sensitive data stored in the token is cleared, an open-shell flag is set, and the RTC handling process is end; 
         [0097]    Step C 15 , check the system state, the RTC handling process is end in the case that the system state is a third preset state or a sixth preset state; otherwise, execute Step C 16 ; 
         [0098]    Step C 16 , time of auto power-off is updated, whether the time of auto power-off is a preset time is determined, if yes, Step C 17  is executed; otherwise, the RTC handling process is end; 
         [0099]    In the present embodiment 1, updating the time of auto power-off is that the current time minus 1, the preset time is 0; 
         [0100]    Step C 17 , a display screen is powered off, the system state is set as the third preset state, the RTC handling process is end. 
         [0101]    In the present embodiment 1, the sensitive data is data which is confidential, and may be bring security risk when the data is obtained illegally; the sensitive data includes seed data, etc. 
         [0102]    Step  107 , the dynamic token enters the key handling process, t and returns to Step  103  when the key handling process is end; 
         [0103]    In the present embodiment 1, as shown in  FIG. 5 , the key handling process specifically includes: 
         [0104]    Step D 0 , duration at which the key is pressed is timed, whether the duration at which the key is pressed is longer than a preset duration is determined, if yes, set the long-time pressing key flag, and execute Step D 1 ; otherwise, execute Step D 1 ; 
         [0105]    Specifically, Step D 0  includes: 
         [0106]    Step i, a count value of a timer is initialized, the timer is turned on to time; 
         [0107]    In the present embodiment 1, the count value of the timer is initialized as 0; 
         [0108]    Step ii, determine whether the count value of the timer reaches a preset duration, if yes, the time at which the key is pressed is longer than the preset duration, set the long-time pressing key flag, turn off the timer, and execute Step D 1 ; otherwise, execute Step iii; 
         [0109]    In the present embodiment 1, the preset duration is 1 second; 
         [0110]    Step iii, determine whether a state of the key is pressed, if yes, return to Step ii; otherwise, the duration at which the key is pressed is not longer than the preset duration, turn off the timer, and execute Step D 1 . 
         [0111]    Step D 1 , reset the time of auto power-off, check the system state, execute Step D 2  in the case that the system state is the third preset state; execute D 5  in the case that the system state is a fourth preset state; execute Step D 15  in the case that the system state is a fifth preset state; execute Step D 16  in the case that the system state is a sixth preset state; otherwise, execute Step D 19 ; 
         [0112]    Step D 2 , determine whether the long-time pressing key flag is set, if yes, execute Step D 3 ; otherwise, execute Step D 4 ; 
         [0113]    Step D 3 , the display screen is powered on, a serial number pre-stored in the dynamic token is written into a display buffer, the serial number is displayed by the display screen, the system state is set as the fourth preset state, and Step D 19  is executed; 
         [0114]    Step D 4 , calculate to generate an OTP according to seed data stored in the dynamic token and a dynamic factor, the display screen is powered on, a generated OTP is written into the display buffer, the OTP is displayed by the display screen, the system state is set as the sixth preset state, and Step D 19  is executed; 
         [0115]    Preferably, before calculating to generate the OTP, Step D 4  further includes: checking whether the dynamic token has saved seed data, if yes, calculate to generate an OTP; otherwise, prompt that there is no seed data, and execute Step D 19 . 
         [0116]    Step D 5 , determine whether the long-time pressing key flag is set, if yes, execute Step D 6 ; otherwise, execute Step D 7 ; 
         [0117]    Step D 6 , set the system state as the third preset state, the display screen is powered off, and Step D 19  is executed; 
         [0118]    Step D 7 , the system state is set as the first preset state; 
         [0119]    Step D 8 , the light sensation data is collected, and prompt that the light sensation data is collected, determine whether all of the light sensation data is collected, if yes, execute Step D 9 ; otherwise, execute Step D 12 ; 
         [0120]    In the present embodiment 1, prompting the light sensation data is collected may include that: the information that prompt the light sensation data is collected is written into the display buffer, the information is displayed on the display screen; or a speaker is triggered, and the speaker broadcasts the information that prompt the light sensation data is collected. 
         [0121]    Step D 9 , determine whether the serial number in the collected light sensation data matches the serial number pre-stored in the dynamic token, if yes, execute Step D 10 ; otherwise, execute Step D 11 ; 
         [0122]    In the present embodiment 1, Step D 9  may include: determining whether the serial number in the collected light sensation data is same as the serial number pre-stored in the dynamic token, if yes, execute Step D 10 ; otherwise, execute Step D 11 . 
         [0123]    Step D 10 , store seed data in the collected light sensation data, prompt that the seed data is programmed successfully, set the system state as the fifth preset state, and execute Step D 19 ; 
         [0124]    In the present embodiment 1, prompting that the seed data is programmed successfully may include that: information prompting that the seed data is programmed successfully is written into the display buffer, the information is displayed in the display screen; or the speaker is triggered, and the speaker broadcasts the information prompting the seed data is programmed successfully. 
         [0125]    Step D 11 , clear the collected light sensation data, prompt that the seed data is programmed unsuccessfully, write the serial number pre-stored in the dynamic token into the display buffer, the display screen displays the serial number, set the system state as the fourth preset state, and execute Step D 19 ; 
         [0126]    In the present embodiment 1, prompting the seed data is programmed unsuccessfully may include: information prompting that the seed data is programmed unsuccessfully is written into the display buffer, the information is displayed in the display screen; or the speaker is triggered, and the speaker broadcasts the information prompting that the seed data is programmed unsuccessfully. 
         [0127]    Step D 12 , determine whether the light sensation data is collected overtime, or whether the system state is the second preset state; execute Step D 13  in the case that the light sensation data is collected overtime; execute Step D 14  in the case that the system state is the second preset state; otherwise, return to Step D 8 ; 
         [0128]    Step D 13 , stop collecting the light sensation data, prompt the seed data is programmed overtime, write the serial number pre-stored in the dynamic token into the display buffer, the display screen displays the serial number, set the system state as the fourth preset state, and execute Step D 19 ; 
         [0129]    In the present embodiment 1, prompting the seed data is programmed overtime may include: information prompting that the seed data is programmed overtime is written into the display buffer, and the information is displayed in the display screen; or the speaker is triggered, and the speaker broadcasts the information that the seed data is programmed overtime. 
         [0130]    Step D 14 , stop collecting the light sensation data, prompt that programming of seed data is canceled, the serial number pre-stored in the dynamic token is written into the display buffer, and the serial number is displayed in the display screen, the system state is set as the fourth preset state, and Step D 19  is executed; 
         [0131]    In the present embodiment 1, prompting that the seed data is programmed successfully may include: the information prompting that the seed data is programmed successfully is written into the display buffer, the information is displayed in the display screen; or the speaker is triggered, the speaker broadcasts the information prompting the seed data is programmed successfully. 
         [0132]    Step D 15 , calculate to generate the OTP according to the seed data stored in the dynamic token and the dynamic factor, the generated OTP is written into the display buffer, the OTP is displayed in the display screen, the system state is set as the sixth preset state, and Step D 19  is executed; 
         [0133]    Step D 16 , determine whether the long-time pressing key flag is set, if yes, execute Step D 18 ; otherwise, execute Step D 17 ; 
         [0134]    Step D 17 , the system state is set as the third preset state, the display screen is powered off, and Step D 19  is executed; 
         [0135]    Step D 18 , the serial number pre-stored in the dynamic token is written into the display buffered, the serial number is displayed in the display screen, the system state is displayed in the display screen, and Step D 19  is executed; 
         [0136]    Step D 19 , the key waken flag is reset, the key handling process is end. 
         [0137]    Furthermore, in the present embodiment 1, 
         [0138]    the light sensation data may include: expiry date of the seed data, correspondingly, Step C 8  in the RTC handling process further includes determine whether the seed data stored in the dynamic token is expired according to the expiry date of the seed data stored in the dynamic token, if yes, set a flag that seed data is invalid, and execute Step C 9 ; otherwise, update the expiry date of the seed data stored in the dynamic token, and execute Step C 9 ; specifically, determine whether the seed data stored in the dynamic token is expired by determining whether the expiry date of the seed data stored in the dynamic token is 0, if the expiry of date is 0, the seed data is expired; if the expiry of date is not 0, the seed data is not expired, and updating the expiry date of the seed data stored in the dynamic token is the current value of the expiry date minus 1; 
         [0139]    in Step D 2  of the key handling process, when the long-time pressing key flag is not set, before Step D 4 , the step further includes: check whether an invalid flag of the seed data is set, if yes, prompt that the seed data is invalid, execute Step D 19 ; otherwise, execute Step D 4 ; Step D 10  further includes: store the expiry date of the seed data in the collected light sensation data; in which, prompting that the seed data is invalid may include: the information prompting that the seed data is invalid is written into the display buffer, the information is displayed in the display screen; or the speaker is triggered, and the speaker broadcasts the information that the seed data is invalid; 
         [0140]    the light sensation data further includes number of bits of a displayed OTP, correspondingly, Step D 10  in the key handling process further includes: store the number of bits of the displayed OTP in the collected light sensation data; writing the generated OTP into the display buffer, and display screen displaying the OTP in Step D 4  and Step D 15  are replaced by: intercept the generated OTP according to the number of the displayed OTP stored in the dynamic token, write intercepted data into the display buffer, the display screen displays the intercepted data; for instance, the number of bits of the displayed OTP is 6, write the last six bits of the OTP generated by intercepting into the display buffer, the display screen displays the last six bits of the generated OTP; and 
         [0141]    the light sensation data further includes mode information of the dynamic token, in which, the mode information of the dynamic token includes: an event mode, a first time mode and a second time mode, correspondingly, Step D 10  in the key handling process further includes store the mode information of the dynamic token; in Step D 4  and Step D 15 , calculating to generate the OTP according to the seed data stored in the dynamic token and the dynamic factor specifically includes: check the mode information of the dynamic token stored in the dynamic token, calculate to generate the OTP according to the seed data stored in the dynamic token and an event factor in the case that the mode information is the event mode; calculate to generate the OTP according to the seed data stored in the dynamic token and the first time factor; calculated to generate the OTP according to the seed data stored in the dynamic token and the second time factor in the case that the mode information is the second time mode; in which, when generating the OTP according to the seed data and the event factor, before or after the OTP is generated, the step further includes: update the event factor stored in the dynamic token. 
         [0142]    While the preferred Embodiments of the present invention have been shown and described herein, any changes and substitutions will be covered by the scope of protection of the present invention.