Control method and device of intelligent card time controller and electronic equipment

By calling the time counter interface in the power equipment to calculate and control the effective time of the temporary session key, the problem of lack of time control interface in the prior art is solved, and the effective control of the smart card time controller is realized.

CN119088167APending Publication Date: 2024-12-06BEIJING SMARTCHIP MICROELECTRONICS TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411007661.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing standard Java smart card API interface package does not have a standard time control interface, which makes it impossible to implement the control method of the smart card time controller in power equipment.

Method used

By calling the start time counter interface, obtaining time interface and stopping time counter interface, calculate and control the effective time of the temporary session key, determine its usage status, and clear the time count value.

Benefits of technology

The calculation and control of the effective time of the temporary session key in the power equipment is realized, the problem of lack of time control interface is solved, and the effective use of the smart card time controller is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088167A_ABST
    Figure CN119088167A_ABST
Patent Text Reader

Abstract

The invention provides a control method and device of an intelligent card time controller and electronic equipment, and belongs to the technical field of power equipment. The method comprises the following steps: calling a starting time counter interface and starting a time counter under the condition that a temporary session needs to be used; under the condition that the temporary session key is generated, calling a time acquisition interface, and acquiring first time of a time counter; under the condition that the temporary session key is used, calling a time acquisition interface, and acquiring second time of the time counter; determining a use state of the temporary session key based on a comparison result of a difference value between the second time and the first time and a set effective time threshold value of the temporary session key; and calling a stop time counter interface, and resetting the time count value of the time counter. The invention solves the problem that the control method of the time controller of the intelligent card cannot be realized in power equipment due to the fact that an API (Application Program Interface) packet of the existing standard java intelligent card does not have a standard time control interface for use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electric power equipment, and in particular to a control method of a smart card time controller, a control device of a smart card time controller, an electronic device, a machine-readable storage medium and a computer program product. Background Art

[0002] Java smart card technology is a technology that supports the development of Java applications in embedded devices. It can provide a secure and interoperable execution platform to help enterprises store and update multiple applications on a resource-constrained device, while meeting strict certification and compatibility requirements. Users can add and delete Java applications as needed. With the rapid development of the power Internet of Things, there are more and more terminals in the power field, and Java smart card technology has begun to be applied to the field of power security.

[0003] In power equipment, temporary session keys are often used, and the temporary session keys have a validity period and can only be used within a fixed time. The existing standard Java smart card API (Application Programming Interface) interface package does not have a standard time control interface for use, resulting in the inability to implement a control method for a smart card time controller in power equipment. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a control method, device and electronic device for a smart card time controller, so as to solve the defect that the existing standard Java smart card API interface package does not have a standard time control interface for use, resulting in the inability to implement the control method of the smart card time controller in power equipment.

[0005] In order to achieve the above object, an embodiment of the present invention provides a control method of a smart card time controller, which is applied to power equipment, and the method includes:

[0006] If a temporary session is needed, call the start time counter interface to start the time counter;

[0007] When a temporary session key is generated, calling a time acquisition interface to acquire a first time of the time counter;

[0008] In the case of using the temporary session key, calling the time acquisition interface to acquire the second time of the time counter;

[0009] Determine the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key;

[0010] Call the stop time counter interface to clear the time count value of the time counter.

[0011] Optionally, when a temporary session is needed, calling a start time counter interface, before starting the time counter, further includes:

[0012] In response to the time counter unit configuration instruction, the time counter configuration interface is called to configure the counting unit of the time counter.

[0013] Optionally, the counting unit of the time counter includes any one of milliseconds, seconds and minutes.

[0014] Optionally, before determining the usage status of the temporary session key based on a comparison result of the difference between the second time and the first time with a set validity time threshold of the temporary session key, the method further includes:

[0015] Determine the magnitude relationship between the second time and the first time;

[0016] When the second time is less than or equal to the first time, the usage status of the temporary session key is determined based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key.

[0017] Optionally, the determining the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time, and the set valid time threshold of the temporary session key includes:

[0018] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)>timeGate, determining that the usage status of the temporary session key is an expired state;

[0019] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)≤timeGate, determining that the usage state of the temporary session key is a usable state;

[0020] Among them, 0xFFFFFFFF represents the maximum count value of the time counter, timeCounter1 represents the first time, timeCounter2 represents the second time, and timeGate represents the set effective time threshold of the temporary session key.

[0021] Optionally, the determining the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key includes:

[0022] In a case where the difference between the second time and the first time is less than or equal to a set validity time threshold of the temporary session key, determining that the usage state of the temporary session key is a usable state;

[0023] When the difference between the second time and the first time is greater than a set validity time threshold of the temporary session key, it is determined that the usage status of the temporary session key is an expired status.

[0024] On the other hand, an embodiment of the present invention further provides a control device of a smart card time controller, comprising:

[0025] A startup module is used to call a startup time counter interface to start a time counter when a temporary session is needed;

[0026] A first acquisition module, configured to call a time acquisition interface to acquire a first time of the time counter when a temporary session key is generated;

[0027] A second acquisition module, configured to call the time acquisition interface to acquire a second time of the time counter when using the temporary session key;

[0028] a comparison module, configured to determine the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key;

[0029] The stop module is used to call the stop time counter interface to clear the time count value of the time counter.

[0030] Optionally, the device further comprises:

[0031] The configuration module is used to call the time counter configuration interface in response to the time counter unit configuration instruction to configure the counting unit of the time counter.

[0032] Optionally, the counting unit of the time counter includes any one of milliseconds, seconds and minutes.

[0033] Optionally, the device further comprises:

[0034] A judgment module is used to judge the size relationship between the second time and the first time; when the second time is less than or equal to the first time, the use status of the temporary session key is determined based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key.

[0035] Optionally, the determining the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time, and the set valid time threshold of the temporary session key includes:

[0036] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)>timeGate, determining that the usage status of the temporary session key is an expired state;

[0037] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)≤timeGate, determining that the usage state of the temporary session key is a usable state;

[0038] Among them, 0xFFFFFFFF represents the maximum count value of the time counter, timeCounter1 represents the first time, timeCounter2 represents the second time, and timeGate represents the set effective time threshold of the temporary session key.

[0039] Optionally, the determining the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key includes:

[0040] In a case where the difference between the second time and the first time is less than or equal to a set validity time threshold of the temporary session key, determining that the usage state of the temporary session key is a usable state;

[0041] When the difference between the second time and the first time is greater than a set validity time threshold of the temporary session key, it is determined that the usage status of the temporary session key is an expired status.

[0042] On the other hand, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the control method of the smart card time controller when executing the program.

[0043] On the other hand, the present invention further provides a machine-readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the control method of the smart card time controller.

[0044] On the other hand, the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the control method of the smart card time controller is implemented.

[0045] Through the above technical solution, the embodiment of the present invention starts the time counter by calling the start time counter interface; obtains the difference between the second time and the first time by calling the get time interface, and compares the result with the set effective time threshold of the temporary session key, thereby determining the use status of the temporary session key; and clears the time count value of the time counter by calling the stop time counter interface. The embodiment of the present invention calculates and controls the effective time of the temporary session key by calling the start time counter interface, the get time interface and the stop time counter interface, thereby solving the problem that the existing standard java smart card API interface package does not have a standard time control interface for use, resulting in the inability to implement the control method of the smart card time controller in the power equipment.

[0046] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0048] Figure 1 This is one of the flow charts of the control method of the smart card time controller provided by the present invention;

[0049] Figure 2 This is a second flow chart of the control method of the smart card time controller provided by the present invention;

[0050] Figure 3 This is a third flow chart of the control method of the smart card time controller provided by the present invention;

[0051] Figure 4 This is a fourth flow chart of the control method of the smart card time controller provided by the present invention;

[0052] Figure 5 It is a structural schematic diagram of a control device of a smart card time controller provided by the present invention;

[0053] Figure 6It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0054] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.

[0055] Method Embodiment

[0056] Please refer to Figure 1 The embodiment of the present invention provides a control method of a smart card time controller, which is applied to power equipment, and the method includes:

[0057] Step 200: When a temporary session is needed, call the start time counter interface to start the time counter.

[0058] Step 400: When a temporary session key is generated, a time acquisition interface is called to acquire a first time of the time counter.

[0059] Step 600: When using the temporary session key, call the time acquisition interface to acquire the second time of the time counter.

[0060] Step 800: Determine the usage status of the temporary session key based on a comparison result between the difference between the second time and the first time and a set validity time threshold of the temporary session key.

[0061] Step 1000: call the stop time counter interface to clear the time count value of the time counter.

[0062] The embodiment of the present invention is applied to power equipment. The power equipment may be an electric energy meter, such as a voltmeter, an ammeter, and a power meter. The power equipment may interact with a background server based on security chip encryption (temporary session). In order to solve the problem that the existing standard java smart card API interface package does not have a standard time control interface for use, resulting in the inability to implement the control method of the smart card time controller in the power equipment, the embodiment of the present invention designs a set of java layer time control interface APIs and a set of code layer time control functions. When the power equipment needs to use a temporary session, the java layer time control interface can be called, and the java layer time control interface calls the code layer time control function. Among them, the time control interface includes a start time counter interface startTimeCounter(), a time acquisition interface getTimeCounter(byte[]timeMinu, short boff), and a stop time counter interface stopTimeCounter().

[0063] The start time counter interface startTimeCounter() is used to start the time counter. In the embodiment of the present invention, the time counter value of the time counter can be represented by 4 bytes, and increases by 1 every minute. The stop time counter interface stopTimeCounter() is used to stop the time counter. That is, clear the previous time counter value. The get time interface getTimeCounter(byte[]timeMinu, short boff) obtains the current 4-byte time counter value.

[0064] The control method of the smart card time controller cannot be implemented in the power equipment. The embodiment of the present invention designs a 4-byte array to store the value of the time counter, sets the timer TC01 to generate an interrupt every 1 time unit, and each time an interrupt is generated, the time counter value is increased by 1. At the same time, the corresponding code layer time control functions are provided for the time control interface of the java layer, namely c_startTimeCounter(), c_stopTimeCounter(), c_getTimeCounter(u8*timeMinu, short boff), and TC01_IRQHandler().

[0065] Among them, c_startTimeCounter() is used to initialize the 4-byte time counter value to 0 and set the TC01 interrupt start flag. c_stopTimeCounter() is used to set the TC01 interrupt stop flag. c_getTimeCounter(u8*timeMinu, short boff) is used to pass the current 4-byte counter value back to the Java layer. TC01_IRQHandler(): TC01 interrupt function, each time an interrupt occurs, the time counter value increases by 1.

[0066] In the case of needing to use a temporary session, the power equipment of the embodiment of the present invention calls the start time counter interface startTimeCounter() to call c_startTimeCounter() to start the time counter. When the temporary session key is generated, the time acquisition interface getTimeCounter(byte[]timeMinu, short boff) is called to call c_getTimeCounter(u8*timeMinu, short boff) to obtain the current time counter value (i.e., the first time). When the temporary session key is used, the time acquisition interface getTimeCounter(byte[]timeMinu, short boff) is called to call c_getTimeCounter(u8*timeMinu, short boff) to obtain the current time counter value (i.e., the second time). The difference between the latter and the former, i.e., the second time and the first time, is the generation time of the temporary session key, which is then compared with the set effective time threshold of the temporary session key to determine whether the temporary session key can continue to be used. Wherein, step 800, based on the comparison result of the difference between the second time and the first time and the set effective time threshold of the temporary session key, determines the use state of the temporary session key, including: when the difference between the second time and the first time is less than or equal to the set effective time threshold of the temporary session key, determines that the use state of the temporary session key is a usable state. When the difference between the second time and the first time is less than or equal to the set effective time threshold of the temporary session key, it means that the temporary session key is within the set effective time threshold of the temporary session key, so the use state of the temporary session key is a usable state. When the difference between the second time and the first time is greater than the set effective time threshold of the temporary session key, determines that the use state of the temporary session key is an expired state. When the difference between the second time and the first time is greater than the set effective time threshold of the temporary session key, it means that the temporary session key is not within the set effective time threshold of the temporary session key, so the use state of the temporary session key is an expired state. Finally, the time counter is used up, and the power equipment calls the stop time counter interface stopTimeCounter() to implement calling c_stopTimeCounter() to clear the time count value of the time counter.

[0067] The control device of the smart card time controller of the embodiment of the present invention starts the time counter by calling the start time counter interface; obtains the difference between the second time and the first time by calling the get time interface, and compares the result with the set effective time threshold of the temporary session key, thereby determining the use status of the temporary session key; and clears the time count value of the time counter by calling the stop time counter interface. The embodiment of the present invention calculates and controls the effective time of the temporary session key by calling the start time counter interface, the get time interface and the stop time counter interface, thereby solving the problem that the existing standard java smart card API interface package does not have a standard time control interface for use, resulting in the inability to implement the control method of the smart card time controller in power equipment.

[0068] For other aspects of the embodiments of the present invention, please refer to Figure 2 Step 200: When a temporary session is required, the start time counter interface is called. Before the start time counter, the following steps are also included:

[0069] Step 100: In response to a time counter unit configuration instruction, call a time counter configuration interface to configure the counting unit of the time counter.

[0070] In one embodiment, the power device displays a configuration interface for the time counter unit, and the user configures the time counter unit for the power device through an input device (keyboard, touch screen, etc.). The power device responds to the time counter unit configuration instruction and calls the time counter configuration interface to configure the counting unit of the time counter. In order to allow the user to flexibly configure the time counting unit, the counting unit of the time counter includes any one of milliseconds, seconds, and minutes.

[0071] The Java layer time control interface API of the embodiment of the present invention also includes calling the time counter configuration interface setTimeMeter(byte[]timeMinu,short boff). The time counter configuration interface setTimeMeter(byte[]timeMinu,short boff) is used to configure the unit of the time counter. The minimum unit of the time counter is ms. For example, if the incoming data is 1, it means that the time counter increases by 1 every millisecond. If the incoming data is 1000, it means that the time counter increases by 1 per second. If the incoming data is 60000, it means that the time counter increases by 1 every minute. Correspondingly, the time counter configuration interface is provided with a corresponding code layer time control function c_setTimeMeter(u8*data,short boff). c_setTimeMeter(u8*data,short boff) is used to set the interrupt interval of TC01 according to the unit of the time counter configured by the user.

[0072] Therefore, the embodiment of the present invention configures the counting unit of the time counter by calling the time counter configuration interface, which facilitates the user to flexibly configure the time counting unit and improves the flexibility of the control method of the smart card time controller in the power equipment.

[0073] For other aspects of the embodiments of the present invention, please refer to Figure 3 , before step 800, based on the comparison result of the difference between the second time and the first time and the set effective time threshold of the temporary session key, determining the use status of the temporary session key, the method further includes:

[0074] Step 710: Determine the magnitude relationship between the second time and the first time;

[0075] Step 720: When the second time is less than or equal to the first time, determine the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key.

[0076] Normally, since the time counter value of the time counter is cumulative, the second time is greater than the first time. However, if the time counter value reaches the maximum value 0xFFFFFFFF, the next time counter value will be 0, and the next time counter value will be 1. In this case, the second time will be less than the first time. At this time, it is necessary to determine the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time, and the set effective time threshold of the temporary session key.

[0077] For details, please refer to Figure 4 The determining of the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key comprises:

[0078] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)>timeGate, determining that the usage status of the temporary session key is an expired state;

[0079] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)≤timeGate, determining that the usage state of the temporary session key is a usable state;

[0080] Among them, 0xFFFFFFFF represents the maximum count value of the time counter, timeCounter1 represents the first time, timeCounter2 represents the second time, and timeGate represents the set effective time threshold of the temporary session key.

[0081] When (0xFFFFFFFF-timeCounter1+timeCounter2)>timeGate, and the time difference between the second time and the first time is greater than the set valid time threshold of the temporary session key, it means that the temporary session key is not within the set valid time threshold of the temporary session key, and therefore the usage status of the temporary session key is expired.

[0082] When (0xFFFFFFFF-timeCounter1+timeCounter2)≤timeGate, and the time difference between the second time and the first time is less than or equal to the set valid time threshold of the temporary session key, it means that the temporary session key is within the set valid time threshold of the temporary session key, and therefore the usage status of the temporary session key is a usable status.

[0083] In the embodiment of the present invention, when the second time is less than or equal to the first time, the use status of the temporary session key is determined based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key. This avoids the problem of incorrect judgment of the use status of the temporary session key due to recounting when the time counter reaches the maximum count value, and improves the integrity and accuracy of the control method for implementing the smart card time controller in the power equipment.

[0084] Device Embodiment

[0085] Please refer to Figure 5 On the other hand, an embodiment of the present invention further provides a control device of a smart card time controller, comprising:

[0086] The start module 501 is used to call the start time counter interface to start the time counter when a temporary session is needed;

[0087] A first acquisition module 502 is used to call a time acquisition interface to acquire a first time of the time counter when a temporary session key is generated;

[0088] A second acquisition module 503 is used to call the time acquisition interface to acquire the second time of the time counter when using the temporary session key;

[0089] A comparison module 504 is configured to determine the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key;

[0090] The stop module 505 is used to call the stop time counter interface to clear the time count value of the time counter.

[0091] The control device of the smart card time controller of the embodiment of the present invention starts the time counter by calling the start time counter interface; obtains the difference between the second time and the first time by calling the get time interface, and compares the result with the set effective time threshold of the temporary session key, thereby determining the use status of the temporary session key; and clears the time count value of the time counter by calling the stop time counter interface. The embodiment of the present invention calculates and controls the effective time of the temporary session key by calling the start time counter interface, the get time interface and the stop time counter interface, thereby solving the problem that the existing standard java smart card API interface package does not have a standard time control interface for use, resulting in the inability to implement the control method of the smart card time controller in power equipment.

[0092] Optionally, the device further comprises:

[0093] The configuration module is used to call the time counter configuration interface in response to the time counter unit configuration instruction to configure the counting unit of the time counter.

[0094] Optionally, the counting unit of the time counter includes any one of milliseconds, seconds and minutes.

[0095] Optionally, the device further comprises:

[0096] A judgment module is used to judge the size relationship between the second time and the first time; when the second time is less than or equal to the first time, the use status of the temporary session key is determined based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key.

[0097] Optionally, the determining the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time, and the set valid time threshold of the temporary session key includes:

[0098] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)>timeGate, determining that the usage status of the temporary session key is an expired state;

[0099] In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)≤timeGate, determining that the usage state of the temporary session key is a usable state;

[0100] Among them, 0xFFFFFFFF represents the maximum count value of the time counter, timeCounter1 represents the first time, timeCounter2 represents the second time, and timeGate represents the set effective time threshold of the temporary session key.

[0101] Optionally, the determining the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key includes:

[0102] In a case where the difference between the second time and the first time is less than or equal to a set validity time threshold of the temporary session key, determining that the usage state of the temporary session key is a usable state;

[0103] When the difference between the second time and the first time is greater than a set validity time threshold of the temporary session key, it is determined that the usage status of the temporary session key is an expired status.

[0104] The control device of the smart card time controller includes a processor and a memory. The above-mentioned start module 501, the first acquisition module 502, the second acquisition module 503, the comparison module 504 and the stop module 505 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.

[0105] The processor includes a kernel, which calls the corresponding program unit from the memory. There can be one or more kernels.

[0106] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0107] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 complete mutual communication through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the control method of the smart card time controller, the method comprising: calling the start time counter interface to start the time counter when a temporary session is needed; calling the get time interface to get the first time of the time counter when a temporary session key is generated; calling the get time interface to get the second time of the time counter when the temporary session key is used; determining the use status of the temporary session key based on the difference between the second time and the first time and the comparison result with the set effective time threshold of the temporary session key; calling the stop time counter interface to clear the time count value of the time counter.

[0108] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0109] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a machine-readable storage medium. When the computer program is executed by a processor, the computer can execute a control method for a smart card time controller, which method includes: when a temporary session needs to be used, calling a start time counter interface to start the time counter; when a temporary session key is generated, calling a get time interface to obtain a first time of the time counter; when the temporary session key is used, calling the get time interface to obtain a second time of the time counter; based on the difference between the second time and the first time, and the comparison result with the set effective time threshold of the temporary session key, determining the usage status of the temporary session key; calling a stop time counter interface to clear the time count value of the time counter.

[0110] On the other hand, the present invention also provides a machine-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute a control method for a smart card time controller, the method comprising: when a temporary session needs to be used, calling a start time counter interface to start the time counter; when a temporary session key is generated, calling a get time interface to obtain a first time of the time counter; when the temporary session key is used, calling the get time interface to obtain a second time of the time counter; based on the difference between the second time and the first time, and the comparison result with the set effective time threshold of the temporary session key, determining the usage status of the temporary session key; calling a stop time counter interface to clear the time count value of the time counter.

[0111] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0112] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A control method for a smart card time controller, It is characterized in that Applied to electric power equipment, the method comprises: If a temporary session is needed, call the start time counter interface to start the time counter; When a temporary session key is generated, calling a time acquisition interface to acquire a first time of the time counter; In the case of using the temporary session key, calling the time acquisition interface to acquire the second time of the time counter; Determine the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key; Call the stop time counter interface to clear the time count value of the time counter.

2. The control method of the smart card time controller according to claim 1, It is characterized in that In the case where a temporary session is required, the start time counter interface is called, and before the start time counter, the following steps are also included: In response to the time counter unit configuration instruction, the time counter configuration interface is called to configure the counting unit of the time counter.

3. The control method of the smart card time controller according to claim 2, It is characterized in that The counting unit of the time counter includes any one of milliseconds, seconds and minutes.

4. The control method of the smart card time controller according to claim 1, It is characterized in that Before determining the usage status of the temporary session key based on a comparison result of the difference between the second time and the first time with a set validity time threshold of the temporary session key, the method further includes: Determine the magnitude relationship between the second time and the first time; When the second time is less than or equal to the first time, the usage status of the temporary session key is determined based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key.

5. The control method of the smart card time controller according to claim 4, It is characterized in that The determining the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key includes: In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)>timeGate, determining that the usage status of the temporary session key is an expired state; In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)≤timeGate, determining that the usage state of the temporary session key is a usable state; Among them, 0xFFFFFFFF represents the maximum count value of the time counter, timeCounter1 represents the first time, timeCounter2 represents the second time, and timeGate represents the set effective time threshold of the temporary session key.

6. The control method of the smart card time controller according to claim 1, It is characterized in that The determining the usage status of the temporary session key based on a comparison result of the difference between the second time and the first time with a set validity time threshold of the temporary session key includes: In a case where the difference between the second time and the first time is less than or equal to a set validity time threshold of the temporary session key, determining that the usage state of the temporary session key is a usable state; When the difference between the second time and the first time is greater than a set validity time threshold of the temporary session key, it is determined that the usage status of the temporary session key is an expired status.

7. A control device for a smart card time controller, It is characterized in that include: A startup module is used to call a startup time counter interface to start a time counter when a temporary session is needed; A first acquisition module, configured to call a time acquisition interface to acquire a first time of the time counter when a temporary session key is generated; A second acquisition module, configured to call the time acquisition interface to acquire a second time of the time counter when using the temporary session key; a comparison module, configured to determine the usage status of the temporary session key based on a comparison result of a difference between the second time and the first time and a set validity time threshold of the temporary session key; The stop module is used to call the stop time counter interface to clear the time count value of the time counter.

8. The control device of the smart card time controller according to claim 7, It is characterized in that The device also includes: The configuration module is used to call the time counter configuration interface in response to the time counter unit configuration instruction to configure the counting unit of the time counter.

9. The control device of the smart card time controller according to claim 8, It is characterized in that The counting unit of the time counter includes any one of milliseconds, seconds and minutes.

10. The control device of the smart card time controller according to claim 7, It is characterized in that The device also includes: A judging module, used for judging the magnitude relationship between the second time and the first time; When the second time is less than or equal to the first time, the usage status of the temporary session key is determined based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key.

11. The control device of the smart card time controller according to claim 10, It is characterized in that The determining the usage status of the temporary session key based on the maximum count value of the time counter, the second time, the first time and the set effective time threshold of the temporary session key includes: In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)>timeGate, determining that the usage status of the temporary session key is an expired state; In the case where (0xFFFFFFFF-timeCounter1+timeCounter2)≤timeGate, determining that the usage state of the temporary session key is a usable state; Among them, 0xFFFFFFFF represents the maximum count value of the time counter, timeCounter1 represents the first time, timeCounter2 represents the second time, and timeGate represents the set effective time threshold of the temporary session key.

12. The control device of the smart card time controller according to claim 7, It is characterized in that The determining the usage status of the temporary session key based on a comparison result of the difference between the second time and the first time with a set validity time threshold of the temporary session key includes: In a case where the difference between the second time and the first time is less than or equal to a set validity time threshold of the temporary session key, determining that the usage state of the temporary session key is a usable state; When the difference between the second time and the first time is greater than a set validity time threshold of the temporary session key, it is determined that the usage status of the temporary session key is an expired status.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the control method of the smart card time controller according to any one of claims 1 to 6 is implemented.

14. A machine-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the control method of the smart card time controller according to any one of claims 1 to 6 is implemented.

15. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the control method of the smart card time controller according to any one of claims 1 to 6 is implemented.