Task synchronization method and device, equipment and storage medium

By introducing a task synchronization mechanism in the resource pool scenario of multiple cryptographic devices, the problem of mutual influence during concurrent operations of multiple objects is solved, and efficient synchronization efficiency is improved.

CN119356899APending Publication Date: 2025-01-24CHINA TELECOM NETWORK SECURITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411573522.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the scenario where multiple password devices provide services to the outside world in the form of resource pools, how to avoid the mutual influence of multiple objects in concurrent operations and improve synchronization efficiency.

Method used

By introducing the mission synchronization mechanism in the password equipment cluster, when the main password device is used to perform writing operation tasks, the relevant synchronization tasks are added to the synchronous task table, and the target synchronization tasks that have not been successfully synchronized regularly will be obtained. The batch task is synchronized and the batch laziness synchronizes.

Benefits of technology

It effectively avoids the mutual influence of multiple objects in concurrent operations, improves synchronization efficiency, and reduces computing and communication overhead through batch processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356899A_ABST
    Figure CN119356899A_ABST
Patent Text Reader

Abstract

The invention provides a task synchronization method and device, equipment and a storage medium, relates to the technical field of information security, in particular to network information security and digital information security, is applied to a password service system, and is used for avoiding mutual influence during multi-object concurrent operation in a scene that multiple password devices provide services externally in a resource pool manner, so that the security of the password devices is improved. And synchronization efficiency is improved. In the application, when a main password device in a password device cluster is called to execute a write operation task submitted by a target object, a synchronization task related to the write operation task is added in a synchronization task table; obtaining at least one target synchronization task associated with the main password device from a synchronization task table; the synchronization state of the target synchronization task represents that synchronization is not successful currently; calling target equipment in the password equipment cluster, and executing task synchronization for at least one target synchronization task; the target device is at least one of a master password device and a slave password device in the password device cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the development of the Internet and cloud computing, the exclusive use of traditional cryptographic devices no longer meets new needs. Cryptographic devices need to realize new features such as clustering, service-oriented, and virtualization. To this end, the prior art proposes a method of combining multiple cryptographic devices into a whole and providing services to the outside world in the form of a resource pool.

[0003] When multiple cryptographic devices provide external services in the form of a resource pool (or cluster), it is necessary to achieve object (such as tenant) level synchronization between multiple cryptographic devices, for example, synchronizing the key generated for an object on the master cryptographic device in the cryptographic device cluster to the slave cryptographic device in the cryptographic device cluster. However, when object-level synchronization is achieved between multiple cryptographic devices, there are situations where multiple objects are operated concurrently, and there will be operation interference, that is, the operations between multiple objects affect each other, further affecting the synchronization efficiency.

[0004] Therefore, in a scenario where multiple cryptographic devices provide external services in the form of a resource pool, how to avoid mutual influence during concurrent operations of multiple objects and improve synchronization efficiency is a technical problem that needs to be solved at present. Summary of the invention

[0005] The embodiments of the present application provide a task synchronization method, apparatus, electronic device, and storage medium, which are used to avoid mutual influence during concurrent operations on multiple objects and improve synchronization efficiency in a scenario where multiple cryptographic devices provide external services in the form of a resource pool.

[0006] In a first aspect, an embodiment of the present application provides a task synchronization method, the method comprising:

[0007] When calling the master cryptographic device in the cryptographic device cluster to execute the write operation task submitted by the target object, add the synchronization task related to the write operation task in the synchronization task table;

[0008] Obtain at least one target synchronization task associated with the master password device from the synchronization task table; the synchronization state of the target synchronization task indicates that the synchronization is not successful at present;

[0009] A target device in the cryptographic device cluster is called to perform task synchronization for at least one target synchronization task; the target device is at least one of a master cryptographic device and a slave cryptographic device in the cryptographic device cluster.

[0010] In a possible implementation, obtaining at least one target synchronization task associated with the master password device from the synchronization task table includes:

[0011] After the scheduled task expires, based on the synchronization status recorded in the synchronization task table, the target synchronization task currently not synchronized with the master password device in the current timing period is obtained from the synchronization task table.

[0012] In a possible implementation, if the synchronization state is a pending backup state, it is determined that the current synchronization is unsuccessful; or

[0013] If the synchronization status is that the master password device backup is successful, it is determined that the current synchronization is not successful.

[0014] In a possible implementation, if the synchronization state is in a to-be-backed-up state, calling a target device in the cryptographic device cluster to perform task synchronization for at least one target synchronization task includes:

[0015] The master password device is called, and the master password device is used to perform: a backup operation of a task result of a write operation task associated with at least one target synchronization task.

[0016] In a possible implementation, if the synchronization state is that the backup of the master cryptographic device is successful, calling the target device in the cryptographic device cluster to perform task synchronization for at least one target synchronization task includes:

[0017] Calling a slave cryptographic device, and executing on the slave cryptographic device: an import operation of a task result of a write operation task associated with at least one target synchronization task.

[0018] In a possible implementation, calling a slave cryptographic device, and executing, by the slave cryptographic device: an import operation of a task result of a write operation task associated with at least one target synchronization task, including:

[0019] Calling the slave password device, and sending the encrypted backup file and the first message authentication code to the slave password device; the encrypted backup file is obtained by the master password device encrypting the successfully backed up backup file using the file encryption key in the key pair;

[0020] By executing from the cryptographic device: using the file decryption key in the key pair to decrypt the encrypted backup file to obtain the backup file, determining the second message authentication code of the backup file by the file encryption key, and when the first message authentication code successfully matches the second message authentication code, performing an import operation based on the backup file.

[0021] In one possible implementation, the key pair is obtained by a master cryptographic device in a cryptographic device cluster through random generation, and the key pair is encrypted by a communication key and transmitted to a slave cryptographic device in the cryptographic device cluster; the communication key is obtained by the master cryptographic device and the slave cryptographic device through key negotiation.

[0022] In a second aspect, an embodiment of the present application provides a task synchronization device, the device comprising:

[0023] An adding unit, used for adding a synchronization task related to the write operation task in the synchronization task table when calling the master password device in the password device cluster to execute the write operation task submitted by the target object;

[0024] An acquisition unit, configured to acquire at least one target synchronization task associated with the master password device from the synchronization task table; wherein the synchronization state of the target synchronization task indicates that the synchronization is not successful at present;

[0025] The calling unit is used to call a target device in the cryptographic device cluster to perform task synchronization for at least one target synchronization task; the target device is at least one of a master cryptographic device and a slave cryptographic device in the cryptographic device cluster.

[0026] In a possible implementation, the acquiring unit is specifically configured to:

[0027] After the scheduled task expires, based on the synchronization status recorded in the synchronization task table, the target synchronization task currently not synchronized with the master password device in the current timing period is obtained from the synchronization task table.

[0028] In a possible implementation, if the synchronization state is a pending backup state, it is determined that the current synchronization is unsuccessful; or

[0029] If the synchronization status is that the master password device backup is successful, it is determined that the current synchronization is not successful.

[0030] In a possible implementation, if the synchronization state is a pending backup state, the calling unit is specifically configured to:

[0031] The master password device is called, and the master password device is used to perform: a backup operation of a task result of a write operation task associated with at least one target synchronization task.

[0032] In a possible implementation, if the synchronization state is that the backup of the master cryptographic device is successful, the calling unit is specifically used to:

[0033] Calling a slave cryptographic device, and executing on the slave cryptographic device: an import operation of a task result of a write operation task associated with at least one target synchronization task.

[0034] In a possible implementation, the calling unit is specifically used for:

[0035] Calling the slave password device, and sending the encrypted backup file and the first message authentication code to the slave password device; the encrypted backup file is obtained by the master password device encrypting the successfully backed up backup file using the file encryption key in the key pair;

[0036] By executing from the cryptographic device: using the file decryption key in the key pair to decrypt the encrypted backup file to obtain the backup file, determining the second message authentication code of the backup file by the file encryption key, and when the first message authentication code successfully matches the second message authentication code, performing an import operation based on the backup file.

[0037] In one possible implementation, the key pair is obtained by a master cryptographic device in a cryptographic device cluster through random generation, and the key pair is encrypted by a communication key and transmitted to a slave cryptographic device in the cryptographic device cluster; the communication key is obtained by the master cryptographic device and the slave cryptographic device through key negotiation.

[0038] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the steps of the task synchronization method provided in the embodiment of the present application.

[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the task synchronization method provided in the embodiment of the present application are implemented.

[0040] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when the processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of the task synchronization method provided in the embodiment of the present application.

[0041] The above solution of the present application has at least the following beneficial effects:

[0042] The task synchronization method, device, electronic device and storage medium provided in the embodiments of the present application relate to the field of information security technology, especially to the fields of network information security and digital information security, and are applied to a cryptographic service system to avoid the mutual influence of concurrent operations on multiple objects and improve synchronization efficiency in a scenario where multiple cryptographic devices provide services to the outside in the form of a resource pool. In the embodiments of the present application:

[0043] When calling the master password device in the password device cluster to execute the write operation task submitted by the target object, add the synchronization task related to the write operation task to the synchronization task table; then obtain at least one synchronization state associated with the master password device from the synchronization task table to represent the target synchronization task that has not been successfully synchronized; finally, call at least one of the master password device and the slave password device in the password device cluster to perform task synchronization for at least one target synchronization task. In the embodiment of the present application, task synchronization will only be performed when there is an interactive operation with the master password device, and when performing task synchronization, at least one target synchronization task that has not been successfully synchronized can be batched and performed in the cluster, and a batch lazy synchronization task synchronization mechanism is proposed, which can avoid the mutual influence of multiple objects during concurrent operations, and batch processing can improve synchronization efficiency.

[0044] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0046] Figure 1 A cryptographic service system provided in an embodiment of the present application;

[0047] Figure 2 A schematic diagram of determining a file encryption key when managing a cryptographic device provided by an embodiment of the present application;

[0048] Figure 3 A flowchart of a task synchronization implementation method provided in an embodiment of the present application;

[0049] Figure 4 A schematic diagram of an import operation cycle provided in an embodiment of the present application;

[0050] Figure 5 A flowchart of a task synchronization method provided in an embodiment of the present application;

[0051] Figure 6 A structural diagram of a task synchronization device provided in an embodiment of the present application;

[0052] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0054] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.

[0055] Tenant: It is a logical concept. After a person or an enterprise registers an account on a service platform, the service platform considers this person or enterprise as a tenant and allocates resources based on the tenant as the basic unit. A tenant is a user who uses the system or computing resources, including all data that can be identified as a designated user in the system, such as the accounts and statistical information (Accounting Data) created in the system, as well as various data set in the system and the customized application environment set by the user, all of which belong to the scope of tenants.

[0056] Cryptographic device: An independent device that provides users with cryptographic services such as symmetric / asymmetric encryption and decryption of data, data integrity check, digital signature and verification, key generation and storage, etc. The cryptographic device has two major components: a cryptographic operation component and a key storage component. In the embodiment of the present application, the cryptographic device can be a cryptographic machine or a Sign & Verify Server (SVS).

[0057] Signature verification server: The main functions are concentrated on digital signature and verification, digital envelope, hashing, true random number generation, etc. Compared with the cipher machine, the signature verification server is better at signature calculation and certificate management related operations.

[0058] Lazy synchronization: Cluster synchronization is performed only when there is an operation to interact with the device. Different from scheduled synchronization, lazy synchronization has the characteristics of saving computing and communication overhead.

[0059] High Availability (HA): refers to reducing the time that the system cannot provide services through design, ensuring that when users call password services, the business can maintain basic normal external services. It is usually achieved by setting up a service cluster in a redundant manner, combined with automatic failover and cluster synchronization.

[0060] Hash-based Message Authentication Code (HMAC): It can map input of any length to a fixed output, and only the same key can calculate the same result. It is used to achieve authentication and integrity.

[0061] Locking mechanism: In multi-threaded or concurrent operations, when a thread wants to access a shared resource, it first obtains a lock to prevent other threads from accessing the resource at the same time. The purpose of locking is to protect the contributed resources and avoid data corruption and inconsistency caused by multiple threads modifying the same resource at the same time.

[0062] The term “exemplary” hereafter means “serving as an example, example, or illustration.” Any embodiment described as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0063] The terms "first" and "second" in the following text are used for descriptive purposes only and should not be understood as explicitly or implicitly indicating relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "plurality" is two or more.

[0064] The term "and / or" in the following text describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0065] Hereinafter, the term "at least one" means one or more, and "plurality" means two or more; the term "at least one" means one or more, and "multiple" means two or more.

[0066] The terms "comprises," "comprising," and "having," and their variations, hereinbelow, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or apparatus.

[0067] The following is a brief introduction to the design concept of the embodiment of the present application:

[0068] With the development of the Internet and cloud computing, the exclusive use of traditional cryptographic devices no longer meets new needs. Cryptographic devices need to realize new features such as clustering, service-oriented, and virtualization. To this end, the prior art proposes a method of combining multiple cryptographic devices into a whole and providing services to the outside world in the form of a resource pool.

[0069] When multiple cryptographic devices provide external services in the form of a resource pool (or cluster), it is necessary to achieve object (such as tenant) level synchronization between multiple cryptographic devices, for example, synchronizing the key generated for an object on the master cryptographic device in the cryptographic device cluster to the slave cryptographic device in the cryptographic device cluster. However, when object-level synchronization is achieved between multiple cryptographic devices, there are situations where multiple objects are operated concurrently, and there will be operation interference, that is, the operations between multiple objects affect each other, further affecting the synchronization efficiency.

[0070] Therefore, in a scenario where multiple cryptographic devices provide external services in the form of a resource pool, how to avoid mutual influence during concurrent operations of multiple objects and improve synchronization efficiency is a technical problem that needs to be solved at present.

[0071] In view of this, the task synchronization method, device, electronic device and storage medium provided in the embodiments of the present application relate to the field of information security technology, especially to the fields of network information security, digital information security, etc., and are applied to cryptographic service systems to avoid mutual influence during concurrent operations of multiple objects and improve synchronization efficiency in scenarios where multiple cryptographic devices provide services to the outside world in the form of a resource pool.

[0072] In an embodiment of the present application, task synchronization is performed only when there is an interactive operation with the master password device, and when executing task synchronization, at least one target synchronization task that has not been successfully synchronized can be batched and executed in the cluster, and a batch lazy synchronization task synchronization mechanism is proposed, which can avoid mutual influence during concurrent operations of multiple objects, and batch processing can improve synchronization efficiency.

[0073] The task synchronization method of the present application is described in detail below with reference to the accompanying drawings.

[0074] See also Figure 1 , Figure 1 A cryptographic service system is provided in an embodiment of the present application, and the cryptographic service system includes: a terminal device 100, a service device 101, a cryptographic device cluster 102 and a database 103; wherein:

[0075] The terminal device 100 is a terminal device used by the target object, and interacts with the cryptographic device cluster 102 indirectly through the service device 101; the target object may be an administrator or a tenant.

[0076] In a possible implementation, the interactive operation includes but is not limited to: write operation tasks, cryptographic operations and other related read operation tasks.

[0077] The service device 101 includes a resource management module and a cryptographic service module; the resource management module is used to manage cryptographic devices, task synchronization operations, root certificate management and other operations, where task synchronization operations include but are not limited to: master cryptographic device backup operations, import operations from key devices; the cryptographic service module is used to provide operations such as creating keys and importing certificates.

[0078] In the embodiment of the present application, the service device manages cryptographic devices of multiple manufacturers in the resource management module based on the cryptographic device cluster. Each cryptographic device cluster corresponds to one manufacturer, and one manufacturer can correspond to multiple cryptographic device clusters. This realizes a cryptographic service platform or system that is compatible with multiple manufacturers and allows multiple target objects to share cryptographic devices. It has good feasibility in actual business and further achieves high availability.

[0079] When the service device manages the cryptographic devices, it first manages the master cryptographic device in the resource management module, and then manages multiple slave cryptographic devices from the same manufacturer as the master cryptographic device, that is, the master cryptographic device and the slave cryptographic devices from the same manufacturer are associated to form a cryptographic device cluster.

[0080] When the service device is managed by the master password device, it calls the master password device to generate a file encryption key pair by randomly generating a key. The file encryption key pair includes: a file encryption key and a file decryption key; wherein, the file encryption key is used by the master password device to encrypt the backup file generated by the backup operation to generate an encrypted backup file and calculate the HMAC value to ensure the confidentiality and integrity of the backup file; the file decryption key is used to decrypt the encrypted backup file from the password device to obtain the plaintext backup file, so as to perform further operations based on the plaintext backup file, and use the file encryption key to calculate the HMAC value.

[0081] In one possible implementation, in order to enable the master cryptographic device and the slave cryptographic devices in the cryptographic device cluster to use the same file encryption key to ensure the accuracy and security of file transmission, that is, to ensure that the file comes from within the cryptographic device cluster, will not be tampered with, and there is no risk of data leakage, the service device, after obtaining the file encryption key pair generated by the master cryptographic device, informs all slave cryptographic devices in the cryptographic device cluster of the file encryption key pair.

[0082] In order to ensure that the file encryption key pair is not leaked, when the file encryption key pair is notified to all slave cryptographic devices in the cryptographic device cluster, the file encryption key pair is encrypted by the communication key, and the file encryption key encrypted by the communication key is transmitted to the slave device; wherein the communication key is determined by the master cryptographic device and the slave cryptographic device in the cryptographic device cluster through multi-party key negotiation (Diffie-Hellman).

[0083] Multi-party key negotiation supports multiple parties to establish a shared key over an insecure channel. For example, cryptographic devices A, B, and C first publicly negotiate the generator g and modulus n, and then each generates a secret random number x, y, and z. Cryptographic device A sends X=g to cryptographic device B. x modn, cryptographic device B sends to cryptographic device CY=g y modn, cryptographic device C sends to cryptographic device AZ = g z modn. Then the cryptographic device A sends Z′=Z to the cryptographic device B. x modn, cryptographic device B sends to cryptographic device CX′=X y modn, cryptographic device C sends to cryptographic device AY′=Y z modn. Finally, the cryptographic device A calculates k = Y′ x modn, cryptographic device A calculates k = Z′ y modn, A calculates k = X' z modn. k is the negotiated key, and the protocol can be extended to more parties by increasing the number of rounds.

[0084] It should be noted that each time a service device manages a new slave cryptographic device, a new round of multi-party key negotiation will be carried out within the cryptographic device cluster. The negotiated communication key will be used as the common communication key of the cryptographic device cluster and used for mutual communication between cryptographic devices. The master cryptographic device uses the communication key to synchronize the file encryption key pair to the slave cryptographic device via the service device.

[0085] For example, see Figure 2 , Figure 2 A schematic diagram of determining a file encryption key when managing a password device provided by an embodiment of the present application; Figure 2 It can be seen that the service device first manages the signature verification server A, which is recorded as the main cryptographic device, and then manages the signature verification servers B and C of the same manufacturer (more signature verification servers can be expanded) as slave cryptographic devices, and associates them with the signature verification server A to form a cryptographic device cluster.

[0086] The service device calls the signature verification server A to generate a file encryption key pair, and calls the signature verification servers A, B, and C for multi-party key negotiation according to the key negotiation protocol, so that each signature verification server obtains the communication key sk cluster , call the signature verification server A to obtain the file encryption key pair encrypted with the communication key, call the signature verification servers B and C to import the ciphertext of the file encryption key pair, so that all the cryptographic devices in the cryptographic device cluster obtain the same file encryption key pair.

[0087] In an embodiment of the present application, when the service device receives a write operation task triggered by the target object through the terminal device, it calls the master cryptographic device in the cryptographic device cluster to perform the write operation task, and when the master cryptographic device executes the write operation task submitted by the target object, it automatically triggers the addition of a synchronization task related to the write operation task in the synchronization task table, and records the operations performed by this task.

[0088] It should be noted that the synchronization task table is stored in the database. Therefore, when the master password device executes the write operation task submitted by the target object, it interacts with the database through the service device, adds a synchronization task to the synchronization task table in the database, and records the operation performed by this task; for example, see Table 1, which is an example diagram of a synchronization task table:

[0089] Table 1

[0090]

[0091] From Table 1, we can see that: sequence numbers 4 and 5 are tasks in the same batch, sequence number 5 is the latest added synchronization task, and sequence numbers 1, 2, and 3 are the first batch of tasks that have been successfully synchronized.

[0092] In an embodiment of the present application, the service device periodically scans the latest batch of synchronization tasks to trigger the synchronization of the cryptographic device cluster; at this time, the service device, based on the set timed scanning cycle, obtains from the synchronization task table the synchronization status associated with the master cryptographic device within the current timing period when the timed task expires, based on the synchronization status recorded in the synchronization task table in the database, all target synchronization tasks that are not currently synchronized; and after obtaining all target synchronization tasks, calls the target devices in the cryptographic device cluster to perform batch task synchronization for all target synchronization tasks.

[0093] When the synchronization state is a state to be backed up, it is determined that the current synchronization is not successful; or when the synchronization state is a state in which the master password device is backed up successfully, it is determined that the current synchronization is not successful.

[0094] As shown in Table 1 above, it is determined that within the current timing period, the synchronization tasks associated with the master password device are tasks with sequence numbers 4 and 5, and the synchronization states corresponding to the tasks with sequence numbers 4 and 5 are both in the state to be backed up. Then, the tasks with sequence numbers 4 and 5 are determined to be the target synchronization tasks, and batch synchronization is performed on the tasks with sequence numbers 4 and 5.

[0095] In a possible implementation, when the synchronization state is in the to-be-backed-up state, the service device calls the master password device to perform: a backup operation of the task result of the write operation task associated with the target synchronization task;

[0096] When the synchronization status is that the backup of the master password device is successful, the service device calls the slave password device and executes the import operation of the task result of the write operation task associated with the target synchronization task through the slave password device.

[0097] In this application, scanning is performed in the form of a scheduled task. If there is no interaction with the device within the current scheduled period, synchronization will not be performed. If there are several interactions with the device, they will be synchronized in batches to improve synchronization efficiency. Batch synchronization can avoid the situation where the machine is frequently in a non-ready state during backup due to frequent operations on one target object, affecting the operations of other target objects, so that the operations between target objects do not affect each other.

[0098] For example, a synchronization operation is performed on a target synchronization task 5 whose synchronization state is to be backed up as shown in Table 1. Figure 3 , Figure 3 A flowchart of a task synchronization implementation method provided in an embodiment of the present application includes the following steps:

[0099] Step S300: The service device queries the synchronization task table stored in the database to obtain the synchronization status of the synchronization task associated with the master password device in the current timing period.

[0100] Step S301, the service device determines that the synchronization state of the synchronization task is in the state to be backed up, triggers the master password device to perform a backup operation, and calls the database to modify the synchronization state in the synchronization task table to be in the master password device backup.

[0101] Step S302, the service device determines that the synchronization status of the synchronization task is in the master password device backup, checks the master password device backup status, and determines whether the master password device backup is successful. If successful, execute step S303, otherwise execute step S307.

[0102] In a possible implementation, the master password device backup status may also be still being backed up, and at this time the master password device backup status will be continuously checked until it is determined that the master password device backup succeeds or fails.

[0103] It should be noted that the backup operation is a time-consuming operation and needs to wait for the master password device to call back. When the service device receives the master password device callback, it determines that the master password device has been successfully backed up, associates all the tasks that are not currently synchronized with the master password device with the backup file, implements batch backup, and changes the synchronization task status to the master password device backup success.

[0104] In a possible implementation, after the master password device successfully backs up, the backup file is encrypted using the file encryption key to obtain an encrypted backup file, and the encrypted backup file and the first message authentication code are called back to the service device; wherein the first message authentication code is the HMAC value calculated by the master password device for the backup file using the file encryption key. Exemplarily, the callback message sent by the master password device to the service device can be expressed as: message = enc (m, sk file )||hmac(m,sk file ), where m is the backup file, sk file is the file encryption key, enc() is the encryption process, and hmac() is the HMAC algorithm.

[0105] Step S303: The service device determines that the backup of the master password device is successful, calls the database, and modifies the synchronization status in the synchronization task table to indicate that the backup of the master password device is successful.

[0106] Step S304, the service device determines that the synchronization status is that the backup of the master cryptographic device is successful, traverses and triggers each slave cryptographic device in the cryptographic device cluster to perform an import operation, and calls the database to modify the synchronization status in the synchronization task table to import from the cryptographic device.

[0107] It should be noted that traversing and triggering each slave cryptographic device in the cryptographic device cluster to perform the import operation means that the service device sequentially calls the slave cryptographic devices to perform the import operation.

[0108] In one possible implementation, when the service device calls the slave cryptographic device to perform an import operation, the callback message received from the master cryptographic device is sent to the slave cryptographic device, that is, the encrypted backup file and the first message authentication code are sent to the slave cryptographic device; correspondingly, after the slave cryptographic device receives the callback message sent by the service device, the import operation is performed based on the backup file in the callback message.

[0109] Specifically, after receiving the encrypted backup file and the first message authentication code, the cryptographic device first uses the file decryption key in the file encryption key pair to decrypt the encrypted backup file to obtain the plaintext backup file, and then determines the second message authentication code of the backup file through the file encryption key. When the first message authentication code and the second message authentication code match successfully, the import operation is performed based on the backup file.

[0110] For example, see Figure 4 , Figure 4 A schematic diagram of an import operation cycle provided by an embodiment of the present application; wherein, if the scheduled task execution cycle is τ seconds, then the shortest time for a master-slave synchronization operation to complete is 2τ, that is, one cycle is used to wait for the master password device to be successfully backed up, and one cycle is used to wait for the slave password device to be successfully imported. Figure 4 As shown, in the optimal case, the value of τ1 is 0, and if the import operation is performed from the cryptographic device in a timely manner, the shortest time to complete is 2τ.

[0111] It should be noted that when the backup time of the master password device or the import time of the slave password device is too long, it will be judged as a backup or import failure. Let the timeout limit be t, then the maximum number of times the timeout period is cycles, i.e. the maximum time taken within the timeout period Therefore, the maximum time for synchronization to complete is

[0112] Through multi-party key negotiation, combined with message authentication codes and symmetric encryption technology, the confidentiality and integrity of the synchronized content are guaranteed, and secure synchronization of keys and secure storage of backup files are achieved. In addition, key management complies with national standards and keys do not leave the device in plain text.

[0113] Step S305, the service device determines that the synchronization state is being imported from the password device, traverses and checks the import state of each slave password device, and determines whether the import of each slave password device is successful. If successful, execute step S306, otherwise execute step S308.

[0114] In a possible implementation, the import status from the cryptographic device may also be still importing, and at this time, the import status from the cryptographic device will be continuously checked until it is determined that all imports from the cryptographic device succeed or fail.

[0115] It should be noted that the import operation is a time-consuming operation and needs to wait for the callback from the password device. When the service device receives the callback from all the password devices, it determines that all the password devices are backed up successfully and changes the synchronization task status to synchronization success.

[0116] Step S306, the service device determines that all slave password devices are imported successfully, calls the database, binds all target tasks that are not currently associated with backup identifiers to the backup identifier of the master password device backup file, and modifies the synchronization status of the synchronization task table to synchronization success.

[0117] Step S307: the service device determines that the backup of the master password device fails, calls the database, and modifies the synchronization status of the synchronization task table to synchronization failure.

[0118] Step S308: The service device determines that all imports from the password device have failed, calls the database, and modifies the synchronization status of the synchronization task table to synchronization failure.

[0119] In an embodiment of the present application, in order to save costs and increase the utilization rate of cryptographic devices in a cryptographic device group, a method for implementing the simultaneous use of the same cryptographic device by multiple target objects is proposed for a cryptographic service system. At this time, the service device calls the management interface of the same cryptographic device through a locking mechanism to ensure that the interface calls do not affect each other, and further ensure that the operations of the target objects do not affect each other.

[0120] In an embodiment of the present application, when the service device receives a read operation task related to cryptographic calculations triggered by the target object through a terminal device, it performs load balancing through a reverse proxy server and distributes the read operation task to each master and slave cryptographic device in the cryptographic device cluster.

[0121] The cryptographic device cluster 102 includes multiple cryptographic devices. The cryptographic devices may be signature verification servers. The underlying layer of the signature verification server has some functions of an encryption machine.

[0122] The database 103 is used to store the service information required by the service device 101 .

[0123] The password service system provided by the embodiment of the present application only requires the manufacturer to provide a backup and import interface, which is used to backup the master password device and import the key information such as keys and certificates from the password device. It does not need to be a system-level backup of the entire device. It has the characteristics of small backup files, fast backup import speed, hot backup and hot import without system restart, no additional synchronization interface, small manufacturer modification, and can be supported by most manufacturers. In addition, a batch lazy synchronization mechanism is proposed to avoid the problem of mutual influence when multiple target objects are operated concurrently to manage keys.

[0124] See also Figure 5 , Figure 5 A task synchronization method flow chart provided in an embodiment of the present application includes the following steps:

[0125] Step S500, when calling the master cryptographic device in the cryptographic device cluster to execute the write operation task submitted by the target object, add a synchronization task related to the write operation task in the synchronization task table;

[0126] Step S501, obtaining at least one target synchronization task associated with the master password device from the synchronization task table; the synchronization state of the target synchronization task indicates that the synchronization is not successful at present;

[0127] Step S502, calling a target device in the cryptographic device cluster to perform task synchronization for at least one target synchronization task; the target device is at least one of a master cryptographic device and a slave cryptographic device in the cryptographic device cluster.

[0128] In a possible implementation, obtaining at least one target synchronization task associated with the master password device from the synchronization task table includes:

[0129] After the scheduled task expires, based on the synchronization status recorded in the synchronization task table, the target synchronization task currently not synchronized with the master password device in the current timing period is obtained from the synchronization task table.

[0130] In a possible implementation, if the synchronization state is a pending backup state, it is determined that the current synchronization is unsuccessful; or

[0131] If the synchronization status is that the master password device backup is successful, it is determined that the current synchronization is not successful.

[0132] In a possible implementation, if the synchronization state is in a to-be-backed-up state, calling a target device in the cryptographic device cluster to perform task synchronization for at least one target synchronization task includes:

[0133] The master password device is called, and the master password device is used to perform: a backup operation of a task result of a write operation task associated with at least one target synchronization task.

[0134] In a possible implementation, if the synchronization state is that the backup of the master cryptographic device is successful, calling the target device in the cryptographic device cluster to perform task synchronization for at least one target synchronization task includes:

[0135] Calling a slave cryptographic device, and executing on the slave cryptographic device: an import operation of a task result of a write operation task associated with at least one target synchronization task.

[0136] In a possible implementation, calling a slave cryptographic device, and executing, by the slave cryptographic device: an import operation of a task result of a write operation task associated with at least one target synchronization task, including:

[0137] Calling the slave password device, and sending the encrypted backup file and the first message authentication code to the slave password device; the encrypted backup file is obtained by the master password device encrypting the successfully backed up backup file using the file encryption key in the key pair;

[0138] By executing from the cryptographic device: using the file decryption key in the key pair to decrypt the encrypted backup file to obtain the backup file, determining the second message authentication code of the backup file by the file encryption key, and when the first message authentication code successfully matches the second message authentication code, performing an import operation based on the backup file.

[0139] In one possible implementation, the key pair is obtained by a master cryptographic device in a cryptographic device cluster through random generation, and the key pair is encrypted by a communication key and transmitted to a slave cryptographic device in the cryptographic device cluster; the communication key is obtained by the master cryptographic device and the slave cryptographic device through key negotiation.

[0140] In the present application, when calling the master password device in the password device cluster to execute the write operation task submitted by the target object, add the synchronization task related to the write operation task to the synchronization task table; then obtain at least one synchronization state associated with the master password device from the synchronization task table to represent the target synchronization task that has not been successfully synchronized; finally, call at least one of the master password device and the slave password device in the password device cluster to perform task synchronization for at least one target synchronization task. In the embodiment of the present application, task synchronization will only be performed when there is an interactive operation with the master password device, and when performing task synchronization, at least one target synchronization task that has not been successfully synchronized can be batched and performed in the cluster, and a batch lazy synchronization task synchronization mechanism is proposed, which can avoid the mutual influence of multiple objects during concurrent operations, and batch processing can improve synchronization efficiency.

[0141] It should be noted that the embodiments described above are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0142] Based on the same inventive concept, an embodiment of the present application also provides a task synchronization device, the principle of which is similar to the method of the above embodiment. Therefore, the implementation of the device can refer to the implementation of the above task synchronization method, and the repeated parts will not be repeated.

[0143] See also Figure 6 , Figure 6 A structure diagram of a task synchronization device provided in an embodiment of the present application, the task synchronization device 600 includes:

[0144] An adding unit 601 is used to add a synchronization task related to the write operation task in the synchronization task table when calling the master password device in the password device cluster to execute the write operation task submitted by the target object;

[0145] The acquisition unit 602 is used to acquire at least one target synchronization task associated with the master password device from the synchronization task table; wherein the synchronization state of the target synchronization task indicates that the synchronization is not successful at present;

[0146] The calling unit 603 is used to call a target device in the cryptographic device cluster to perform task synchronization for at least one target synchronization task; the target device is at least one of a master cryptographic device and a slave cryptographic device in the cryptographic device cluster.

[0147] In a possible implementation, the acquiring unit 602 is specifically configured to:

[0148] After the scheduled task expires, based on the synchronization status recorded in the synchronization task table, the target synchronization task currently not synchronized with the master password device in the current timing period is obtained from the synchronization task table.

[0149] In a possible implementation, if the synchronization state is a pending backup state, it is determined that the current synchronization is unsuccessful; or

[0150] If the synchronization status is that the master password device backup is successful, it is determined that the current synchronization is not successful.

[0151] In a possible implementation, if the synchronization state is a state to be backed up, the calling unit 603 is specifically configured to:

[0152] The master password device is called, and the master password device is used to perform: a backup operation of a task result of a write operation task associated with at least one target synchronization task.

[0153] In a possible implementation, if the synchronization state is that the primary cryptographic device backup is successful, the calling unit 603 is specifically used to:

[0154] Calling a slave cryptographic device, and executing on the slave cryptographic device: an import operation of a task result of a write operation task associated with at least one target synchronization task.

[0155] In a possible implementation, the calling unit 603 is specifically configured to:

[0156] Calling the slave password device, and sending the encrypted backup file and the first message authentication code to the slave password device; the encrypted backup file is obtained by the master password device encrypting the successfully backed up backup file using the file encryption key in the key pair;

[0157] By executing from the cryptographic device: using the file decryption key in the key pair to decrypt the encrypted backup file to obtain the backup file, determining the second message authentication code of the backup file by the file encryption key, and when the first message authentication code successfully matches the second message authentication code, performing an import operation based on the backup file.

[0158] In one possible implementation, the key pair is obtained by a master cryptographic device in a cryptographic device cluster through random generation, and the key pair is encrypted by a communication key and transmitted to a slave cryptographic device in the cryptographic device cluster; the communication key is obtained by the master cryptographic device and the slave cryptographic device through key negotiation.

[0159] It should be noted that although several units (or modules) of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units (or modules) described above can be concretized in one unit (or module). Conversely, the features and functions of one unit (or module) described above can be further divided into multiple units (or modules) for concretization. Of course, when implementing the present application, the functions of each unit (or module) can also be implemented in the same one or more software or hardware.

[0160] In the embodiments of the present application, the term unit (or module) refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of the module or unit.

[0161] After introducing the task synchronization method and device according to an exemplary embodiment of the present application, another exemplary embodiment of the present application, an electronic device, is introduced next.

[0162] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.

[0163] In a possible implementation, the electronic device provided in the embodiment of the present application may include at least a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes any step of the task synchronization method in various exemplary implementations of the present application.

[0164] In this embodiment, the structure of the electronic device can be as follows Figure 7 As shown, it includes a memory 701 , a communication module 703 and one or more processors 702 .

[0165] The memory 701 is used to store computer programs executed by the processor 702. The memory 701 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0166] The memory 701 may be a volatile memory, such as a random-access memory (RAM); the memory 701 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 701 may be any other medium that can be used to carry or store a desired computer program in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 701 may be a combination of the above memories.

[0167] The processor 702 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 702 is used to implement the above-mentioned task synchronization method when calling the computer program stored in the memory 701 .

[0168] The communication module 703 is used to communicate with the target device and other servers.

[0169] The specific connection medium between the memory 701, the communication module 703 and the processor 702 is not limited in the embodiment of the present application. Figure 7 In the embodiment, the memory 701 and the processor 702 are connected via a bus 704. The bus 704 is connected to the processor 702 via a bus 704. Figure 7 The connections between the other components are only for illustration and are not intended to be limiting. The bus 704 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Figure 7 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or only one type of bus.

[0170] The memory 701 stores a computer storage medium, and the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the task synchronization method of the embodiment of the present application. The processor 702 is used to execute the above-mentioned task synchronization method.

[0171] In some possible implementations, various aspects of the task synchronization method provided by the present application may also be implemented in the form of a program product, which includes a computer program. When the program product is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of the task synchronization method according to various exemplary implementations of the present application described above in this specification.

[0172] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0173] The program product of the embodiment of the present application can adopt a portable compact disk read-only memory (CD-ROM) and include a computer program, and can be run on a computing device. However, the program product of the present application is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with a command execution system, device or device.

[0174] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.

[0175] The computer program embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0176] Computer programs for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The computer program may be executed entirely on the user computing device, partially on the user equipment, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any variety of models including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0177] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain a computer-usable computer program.

[0178] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program commands. These computer program commands can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the commands executed by the processor of the computer or other programmable device generate commands for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that specifies functions in one or more boxes.

[0179] These computer program commands may also be stored in a computer-readable memory capable of directing a computer or other programmable device to operate in a specific manner, so that the commands stored in the computer-readable memory produce an article of manufacture comprising a command device, the command device implementing the process Figure 1 A process or multiple processes and / or boxes Figure 1 Specify the function in one or more boxes.

[0180] These computer program commands can also be loaded onto a computer or other programmable device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the commands executed on the computer or other programmable device provide the instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0181] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0182] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A task synchronization method, characterized in that: The method comprises: When calling the master cryptographic device in the cryptographic device cluster to execute the write operation task submitted by the target object, a synchronization task related to the write operation task is added to the synchronization task table; Acquire at least one target synchronization task associated with the master password device from the synchronization task table; the synchronization state of the target synchronization task indicates that the synchronization is not successful at present; A target device in the cryptographic device cluster is called to perform task synchronization for the at least one target synchronization task; the target device is at least one of a master cryptographic device and a slave cryptographic device in the cryptographic device cluster.

2. The method according to claim 1, characterized in that The acquiring at least one target synchronization task associated with the master password device from the synchronization task table includes: After the timed task expires, based on the synchronization status recorded in the synchronization task table, the target synchronization task currently not synchronized with the master password device in the current timing period is obtained from the synchronization task table.

3. The method according to claim 1 or 2, characterized in that If the synchronization state is a pending backup state, it is determined that the current synchronization is unsuccessful; or If the synchronization status is that the master password device is successfully backed up, it is determined that the current synchronization is not successful.

4. The method according to claim 3, characterized in that If the synchronization state is a to-be-backed-up state, calling a target device in the cryptographic device cluster to perform task synchronization for the at least one target synchronization task includes: The master password device is called, and the master password device is used to perform: a backup operation of a task result of a write operation task associated with the at least one target synchronization task.

5. The method according to claim 3, characterized in that If the synchronization state is that the backup of the master cryptographic device is successful, calling the target device in the cryptographic device cluster to perform task synchronization for the at least one target synchronization task includes: The slave cryptographic device is called, and the slave cryptographic device is used to perform: an import operation of a task result of a write operation task associated with the at least one target synchronization task.

6. The method according to claim 5, characterized in that The calling of the slave cryptographic device to perform, through the slave cryptographic device: an import operation of a task result of a write operation task associated with the at least one target synchronization task, includes: Calling the slave cryptographic device, and sending an encrypted backup file and a first message authentication code to the slave cryptographic device; the encrypted backup file is obtained by the master cryptographic device encrypting the successfully backed-up backup file using the file encryption key in the key pair; The slave cryptographic device executes: using the file decryption key in the key pair to decrypt the encrypted backup file to obtain the backup file, determining the second message authentication code of the backup file by using the file encryption key, and when the first message authentication code successfully matches the second message authentication code, performing an import operation based on the backup file.

7. The method according to claim 6, characterized in that The key pair is obtained by the master cryptographic device in the cryptographic device cluster through random generation, and the key pair is encrypted by a communication key and transmitted to the slave cryptographic device in the cryptographic device cluster; the communication key is obtained by the master cryptographic device and the slave cryptographic device through key negotiation.

8. A task synchronization device, characterized in that: The device comprises: An adding unit, used for adding a synchronization task related to the write operation task in the synchronization task table when calling the master password device in the password device cluster to execute the write operation task submitted by the target object; An acquisition unit, configured to acquire at least one target synchronization task associated with the master password device from the synchronization task table; wherein the synchronization state of the target synchronization task indicates that the synchronization is not successful at present; The calling unit is used to call the target device in the cryptographic device cluster to perform task synchronization for the at least one target synchronization task; the target device is at least one of a master cryptographic device and a slave cryptographic device in the cryptographic device cluster.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods of claims 1-7.

10. A computer-readable storage medium, characterized in that: It comprises a computer program. When the computer program is run on an electronic device, the computer program is used to make the electronic device execute the steps of any one of the methods of claims 1-7.

11. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the steps of any one of the methods as claimed in claims 1 to 7.