Key data synchronization method, device, equipment and medium

By defining the secure channel protocol and certificate exchange mechanism in the key management system and negotiating the session key, the uncontrollable and unsafe problem of key data transmission in the multi-center and cross-machine room deployment scenario of the traditional key management system is solved. It provides real-time synchronization and backup of key data and meets security compliance requirements.

CN118713837APending Publication Date: 2024-09-27CETC CYBERSPACE SECURITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410712859.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

Traditional key management systems have problems with key data transmission in multi-center, cross-computer room, active/standby and cluster deployment scenarios, such as uncontrollable technical implementation, unsafe data transmission, and failure to meet security compliance requirements.

Method used

By pre-defining a secure channel protocol, public key exchange is realized based on the offline exchange of signature certificates and encryption certificates, and session keys are negotiated through random numbers to establish a secure channel for encryption, decryption and identity authentication of key data, realizing online key data Real-time synchronization.

Benefits of technology

It achieves independent controllability, lightweight, easy-to-use, and safe and compliant real-time synchronization of key data between multiple nodes, and solves the security and compliance issues of key data transmission channels.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118713837A
    Figure CN118713837A
Patent Text Reader

Abstract

The invention discloses a key data synchronization method and device, equipment and a medium, and relates to the technical field of information security. The method is applied to a first key management service node and comprises the following steps: pre-defining a secure channel protocol and establishing a secure channel with a second key management service node based on the secure channel protocol; the secure channel protocol manages signature certificates and encryption certificates among service nodes through offline exchange of secret keys so as to realize respective public key exchange, and performs channel session secret key negotiation through random numbers so as to realize encryption and decryption of transmission data and identity authentication; receiving a key data operation instruction sent by the service system through the management page, and obtaining a change data packet according to the key data operation instruction; and the change data packet is sent to the second key management service node through the secure channel, so that the second key management service node synchronously updates local key data according to the change data packet. Through the technical scheme of the invention, the availability of the service system and the security of the key data are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security technology, and in particular to a key data synchronization method, device, equipment and medium. Background Art

[0002] In recent years, cryptographic technology has been used as the most economical, effective and reliable means to solve the problems of data confidentiality, integrity, authenticity and non-repudiation in information security, data security and network security in various fields such as government and enterprises, finance, energy, electricity, Internet and Internet of Things. It has penetrated into various aspects of various industries such as application security, network security, data security and infrastructure security. As the basis of cryptographic technology, key management technology ensures the security of keys in the whole life cycle of keys, such as key generation, storage, distribution, use, update, destruction, backup, recovery, archiving, import and export. In cryptographic technology, keys are the core, cryptographic algorithms can be made public, but keys must be kept confidential. Traditional key management products or services rely on dedicated data storage devices (such as databases) to encrypt and centrally store the managed key data. In high-availability application scenarios such as master-slave and cluster, the synchronization and backup of key data depends on the data synchronization and backup solutions provided by the selected dedicated data storage devices. The data synchronization and backup solutions provided by different data storage devices are different and vary greatly in terms of technical implementation, functional support, external dependence, ease of use, reliability and security. There are problems such as uncontrollable technical implementation, insecure data transmission, and failure to meet security compliance requirements when transmitting key data in multi-center, cross-computer room, master-slave and cluster deployment and application scenarios.

[0003] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a key data synchronization method, device, equipment and medium, which can solve the problems faced by traditional key management system products or service key data transmission in multi-center, cross-computer room, master-slave and cluster deployment and application scenarios, such as uncontrollable technical implementation, unsafe data transmission, and failure to meet security compliance requirements, and realize the autonomous controllability, lightweight, easy-to-use, and security compliance of online real-time synchronization of key data. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses a key data synchronization method, which is applied to a first key management service node, comprising:

[0006] A secure channel protocol for establishing and maintaining a session connection is predefined, and a secure channel is established with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to exchange their respective public keys, and negotiates a channel session key through a random number to encrypt and decrypt transmission data and authenticate identity;

[0007] Receive a key data operation instruction sent by the business system through the management page, and obtain a change data packet according to the key data operation instruction;

[0008] The change data packet is sent to the second key management service node through the secure channel, so that the second key management service node synchronously updates the local key data according to the change data packet.

[0009] Optionally, the secure channel protocol includes a protocol version, a channel security mode, a message unique identifier, a peer key management system identifier, a sender key management system identifier, a message type, a message protocol data unit length, a key management identifier, a data check value length, and a data check value. The secure channel protocol predefined for establishing and maintaining a session connection includes:

[0010] The protocol version, the channel security mode, the message unique identifier, the peer key management system identifier, the sender key management system identifier, the message type, and the message protocol data unit length are used as a message header, the key management identifier is used as a message protocol data unit, and the data check value length and the data check value are used as a message tail;

[0011] The message header, the message protocol data unit and the message tail are concatenated to obtain an initialization protocol message so as to determine the secure channel protocol according to the initialization protocol message.

[0012] Optionally, establishing a secure channel with a second key management service node based on the secure channel protocol includes:

[0013] Based on the secure channel protocol, offline certificate exchange and channel session key negotiation are performed in sequence with the second key management service node.

[0014] Optionally, performing offline certificate exchange with the second key management service node based on the secure channel protocol includes:

[0015] Generate a first key pair for signing and a second key pair for encryption using a preset encryption algorithm, and use the first key pair and the second key pair to sign and encrypt the first public key respectively to obtain a corresponding first signature certificate and a first encryption certificate;

[0016] The first signature certificate and the first encryption certificate are sent to the second key management service node, and the second signature certificate and the second encryption certificate sent by the second key management service node are obtained to realize the exchange of respective public keys; wherein, the second signature certificate and the second encryption certificate are generated by the second key management service node using the preset encryption algorithm to generate a third key pair for signing and a fourth key pair for encryption, and the third key pair and the fourth key pair are used to sign and encrypt the second public key respectively to obtain the signature certificate and encryption certificate.

[0017] Optionally, performing channel session key negotiation with a second key management service node based on the secure channel protocol includes:

[0018] Obtaining a first random number generated by the first key management service node;

[0019] Encrypt the first random number using the second public key in the second encryption certificate to obtain a first encryption result, and sign the first random number using the held signature private key to obtain a first signature result;

[0020] After connecting the first encryption result and the first signature result, they are packaged in a secure channel establishment request protocol format and sent to the second key management service node, so that the second key management service node decrypts the first encryption result using the encryption private key it holds after unpacking to obtain the first random number; verifies the first signature result using the first public key in the first signature certificate and generates a second random number after the verification is passed; encrypts the first random number and the second random number using the first public key in the first encryption certificate to obtain a second encryption result, and signs the second random number using the signature private key it holds to obtain a second signature result; connects the second encryption result and the second signature result, packages them in a secure channel establishment response protocol format and sends them to the first key management service node;

[0021] After unpacking according to the secure channel establishment response protocol format, the second encryption result is decrypted using the held encryption private key to obtain the first random number and the second random number; the second public key in the second signature certificate is used to verify the second signature result.

[0022] Optionally, the process of negotiating a channel session key with the second key management service node based on the secure channel protocol further includes:

[0023] Using the first random number to perform an encryption operation on the second random number to obtain a session key;

[0024] Correspondingly, sending the change data packet to the second key management service node through the secure channel includes:

[0025] The change data packet is encrypted using the session key and the encrypted change data packet is sent to the second key management service node through the secure channel.

[0026] Optionally, the message protocol data unit in the secure channel establishment request protocol format includes a key length of the first random number, a ciphertext value of the first random number, a signature value length of the first random number, and a signature value of the first random number;

[0027] The message protocol data unit in the secure channel establishment response protocol format includes the key length of the first random number and the second random number, the ciphertext value of the first random number and the second random number, the signature value length of the second random number, and the signature value of the second random number.

[0028] Optionally, sending the change data packet to the second key management service node through the secure channel includes:

[0029] The change data packet is sent to the second key management service node through the secure channel in accordance with the secure channel data sending protocol format; wherein, in the secure channel data sending protocol format, the message protocol data unit includes the key management identifier and the key change message corresponding to the change data packet.

[0030] Optionally, the receiving of the key data operation instruction sent by the business system through the management page includes:

[0031] Receive key addition instructions, key update instructions, key disable instructions, key enable instructions, and key destruction instructions triggered by the business system through the management page or by calling the application programming interface;

[0032] Correspondingly, sending the change data packet to the second key management service node through the secure channel so that the second key management service node synchronously updates the local key data according to the change data packet, includes:

[0033] The change data packet is sent to the second key management service node through the secure channel, so that the second key management service node performs operations of adding, updating, disabling, enabling and destroying local key data according to the change data packet.

[0034] In a second aspect, the present application discloses a key data synchronization device, which is applied to a first key management service node, comprising:

[0035] A channel establishment module, used to predefine a secure channel protocol for establishing and maintaining a session connection, and to establish a secure channel with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to exchange their respective public keys, and negotiates channel session keys through random numbers to encrypt and decrypt transmitted data and authenticate identities;

[0036] An instruction receiving module is used to receive a key data operation instruction sent by the business system through the management page, and obtain a change data packet according to the key data operation instruction;

[0037] The key synchronization module is used to send the change data packet to the second key management service node through the secure channel, so that the second key management service node synchronously updates the local key data according to the change data packet.

[0038] In a third aspect, the present application discloses an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the key data synchronization method as described above.

[0039] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the key data synchronization method as described above.

[0040] The present application provides a key data synchronization method, which is applied to a first key management service node, including: pre-defining a secure channel protocol for establishing and maintaining a session connection, and establishing a secure channel with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to realize the exchange of their respective public keys, and negotiates the channel session key through random numbers to realize the encryption and decryption of transmission data and identity authentication; receiving the key data operation instruction sent by the business system through the management page, and obtaining the change data packet according to the key data operation instruction; sending the change data packet to the second key management service node through the secure channel, so that the second key management service node synchronizes and updates the local key data according to the change data packet. The beneficial technical effects of the present application are: first, a secure channel protocol specification that can realize real-time synchronization of key data between multiple nodes of the key management service is established at the application layer, and the key data is synchronized and backed up between multiple nodes, so that the key data synchronization does not depend on the selected specific data storage device, so that the technology is controllable, lightweight, easy to use and maintainable. Secondly, the synchronization of key data between key management service nodes is completed with the help of a secure channel, solving the security problem of the key data transmission channel. Finally, by exchanging public keys offline and negotiating session keys through random number challenges, we can establish an application-layer secure channel between key management services based on commercial cryptographic technology for secure transmission of key synchronization data. This solves the problem of real-time synchronization and backup of key data between multiple nodes of the key management service in master-slave and cluster application scenarios, and addresses product security and compliance issues.

[0041] In addition, the present application provides a key data synchronization device, equipment and storage medium, which correspond to the above-mentioned key data synchronization method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0043] Figure 1 A flow chart of a key data synchronization method disclosed in this application;

[0044] Figure 2 A schematic diagram of a key data synchronization mechanism between a first key management service node and a second key management service node disclosed in the present application;

[0045] Figure 3 A schematic diagram of a key data synchronization process disclosed in this application;

[0046] Figure 4 A schematic diagram of a secure channel protocol format definition disclosed in this application;

[0047] Figure 5 A schematic diagram of a key synchronization protocol format disclosed in this application;

[0048] Figure 6 A schematic diagram of a key update synchronization protocol format disclosed in this application;

[0049] Figure 7 A schematic diagram of a key disabling, enabling, and destroying synchronization protocol format disclosed in this application;

[0050] Figure 8 A schematic diagram of key data synchronization disclosed in this application;

[0051] Fig. 9 A flowchart of a specific key data synchronization method disclosed in this application;

[0052] Fig.10 A flowchart of a specific key data synchronization method disclosed in this application;

[0053] Fig.11 A schematic diagram of a secure channel establishment request protocol format disclosed in this application;

[0054] Fig.12 A schematic diagram of a secure channel establishment response protocol format disclosed in this application;

[0055] Fig.13 A schematic diagram of a secure channel data transmission protocol format disclosed in this application;

[0056] Fig.14 A schematic diagram of a secure channel negotiation process disclosed in this application;

[0057] Fig.15 A schematic diagram of the structure of a key data synchronization device disclosed in this application;

[0058] Fig.16 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] Currently, the transmission of key data of key management system products or services in multi-center, cross-computer room, master-slave and cluster deployment and application scenarios faces problems such as uncontrollable technical implementation, insecure data transmission, and failure to meet security compliance requirements:

[0061] 1. The key data synchronization between multiple key management service nodes is strongly dependent on the data storage device, such as the data synchronization mechanism of the database. The data synchronization solutions provided by different data storage devices vary greatly in terms of technical implementation, external dependence, ease of use, reliability and security. The key data synchronization capability implemented by the key management service through this mechanism faces problems such as high technical complexity, uncontrollable technology, high maintenance cost, and limited product application scenarios;

[0062] 2. When multiple key management service nodes are deployed in different computer rooms across regions, key data needs to be transmitted on the Internet. In order to ensure the security of the data transmission channel, it is necessary to set up a dedicated network in different computer rooms, such as VPN (Virtual Private Network) equipment to ensure the security of key data transmission and synchronization. This method will increase the dependence of key management service products on external networks and construction costs, and limit the application scenarios of key management services;

[0063] 3. The data synchronization technology provided by the data storage device itself does not use commercial encryption technology for identity authentication, and has problems in security and compliance, and does not meet the compliance requirements of commercial encryption products.

[0064] To this end, the present application provides a key data synchronization solution that can solve the problems faced by traditional key management system products or service key data in multi-center, cross-computer room, master-slave and cluster deployment and application scenarios, such as uncontrollable technical implementation, insecure data transmission, and failure to meet security compliance requirements. It can realize the autonomous controllability, lightweight, easy-to-use, and security compliance of online real-time synchronization of key data.

[0065] The embodiment of the present invention discloses a key data synchronization method, see Figure 1 As shown, applied to a first key management service node, the method includes:

[0066] Step S11: predefine a secure channel protocol for establishing and maintaining a session connection, and establish a secure channel with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to achieve the exchange of their respective public keys, and negotiates channel session keys through random numbers to achieve encryption and decryption of transmitted data and identity authentication.

[0067] In the embodiment of the present application, it is applied to the first key management service node. Assume that the first key management service node is key management service A. Figure 2 As shown, the second key management service node can not only represent the key management service B corresponding to one key management service node, to achieve key data synchronization between the two nodes; at the same time, the second key management service node can also represent multiple key management service nodes, for example, corresponding to key management service B, key management service C, ..., key management service N, etc., to achieve key data synchronization between three or more key management service nodes.

[0068] In the embodiment of the present application, a secure channel for application layer data transmission is established on the TCP protocol (Transmission Control Protocol) through negotiation between the first key management service node and the second key management service node, and the synchronization of key data between nodes is completed with the help of the secure channel, thereby solving the security problem of the key data transmission channel. It can be understood that when synchronizing key data between multiple nodes, it is only necessary to establish a secure channel between two nodes in the same way as establishing a secure channel between two nodes, and when synchronizing key data, the data can be sent to multiple peer key management service nodes.

[0069] It should be noted that the secure channel is established based on a predefined secure channel protocol and is an initialization protocol message for establishing and maintaining a secure session connection between two key management service nodes. Requests, responses, and data transmission through the secure channel are all based on the secure channel protocol.

[0070] Step S12: receiving the key data operation instruction sent by the business system through the management page, and obtaining the change data packet according to the key data operation instruction.

[0071] like Figure 3The diagram shows a schematic diagram of the overall key synchronization workflow. In the embodiment of the present application, when the key executes the data synchronization workflow, the key management service administrator triggers key addition, update, disablement, enablement, and destruction operations through the business system using the WEB management page or calling the application programming interface (API). Therefore, the first key management service node (A) receives the key addition instruction, key update instruction, key disablement instruction, key enablement instruction, and key destruction instruction sent by the business system, completes the change of the key data in the first key management service node according to the above instructions, and obtains the change data packet.

[0072] It should be noted that after the first key management service node completes the key change, it persists the key information and status to the local node database. Then, the first key management service node checks whether the real-time key synchronization function is enabled and configured; if the real-time key synchronization function is enabled, it negotiates with the second key management service node (B) on the other end to establish a secure channel through the secure channel protocol. After the secure channel is established, the first key management service node assembles the data packets that need to be synchronized, such as the addition, update, disablement, activation, and destruction of the key according to the key data operation instructions to obtain the change data packet.

[0073] Step S13: Send the change data packet to the second key management service node through the secure channel, so that the second key management service node synchronously updates the local key data according to the change data packet.

[0074] In an embodiment of the present application, the first key management service node sends the obtained change data packet to the second key management service node at the opposite end through a secure channel. The second key management service node unpacks the change data packet, updates the key information and status to the local database to complete the synchronization. Specifically, the change data packet is sent to the second key management service node through the secure channel, so that the second key management service node performs the operations of adding, updating, disabling, enabling and destroying the local key data according to the change data packet.

[0075] In addition, when the second key management service node completes the synchronization of the local key data, it will send the key change synchronization result data packet obtained after the change data packet synchronization back to the first key management service node. Further, the first key management service node can unpack the key change synchronization result data packet and record the result of each key change synchronization.

[0076] The present application provides a key data synchronization method, which is applied to a first key management service node, including: pre-defining a secure channel protocol for establishing and maintaining a session connection, and establishing a secure channel with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to realize the exchange of their respective public keys, and negotiates the channel session key through random numbers to realize the encryption and decryption of transmission data and identity authentication; receiving the key data operation instruction sent by the business system through the management page, and obtaining the change data packet according to the key data operation instruction; sending the change data packet to the second key management service node through the secure channel, so that the second key management service node synchronizes and updates the local key data according to the change data packet. The beneficial technical effects of the present application are: first, a secure channel protocol specification that can realize real-time synchronization of key data between multiple nodes of the key management service is established at the application layer, and the key data is synchronized and backed up between multiple nodes, so that the key data synchronization does not depend on the selected specific data storage device, so that the technology is controllable, lightweight, easy to use and maintainable. Secondly, the synchronization of key data between key management service nodes is completed with the help of a secure channel, solving the security problem of the key data transmission channel. Finally, by exchanging public keys offline and negotiating session keys through random number challenges, we can establish an application-layer secure channel between key management services based on commercial cryptographic technology for secure transmission of key synchronization data. This solves the problem of real-time synchronization and backup of key data between multiple nodes of the key management service in master-slave and cluster application scenarios, and addresses product security and compliance issues.

[0077] In this embodiment, the secure channel protocol format definition is specifically described. The secure channel protocol is an initialization protocol message for establishing and maintaining a secure session connection between two key management service nodes. The protocol includes: protocol version, channel security mode, message unique identifier, peer key management system identifier, sender key management system identifier, message type, message protocol data unit length, key management identifier, data check value length, and data check value.

[0078] like Figure 4 The figure shows a schematic diagram of the secure channel protocol format definition. The protocol version, the channel security mode, the message unique identifier, the peer key management system identifier, the sender key management system identifier, the message type, and the message protocol data unit length are used as the message header, the key management identifier is used as the message protocol data unit, and the data check value length and the data check value are used as the message tail; the message header, the message protocol data unit, and the message tail are concatenated to obtain an initialization protocol message, so as to determine the secure channel protocol according to the initialization protocol message.

[0079] Specifically, protocol version: key synchronization module communication protocol version number.

[0080] Channel security mode: 0 means no encryption, 1 means encryption.

[0081] Message unique identifier (ID): used to prevent replay and uniquely identify a message request.

[0082] Peer key management system ID: Peer key management service unique ID

[0083] Sender key management system identifier: Sender key management service unique identifier

[0084] Message types: secure channel establishment request (0xA1), secure channel establishment response (0xA2), secure channel data transmission (0xA3).

[0085] Message Protocol Data Unit (PDU) length: Message PDU byte length.

[0086] Key management identifier: message PDU, fixed to 0XC0.

[0087] Data check value length: the length of the signature value or HMAC value.

[0088] Data checksum: The signature value of the message header and message PDU (value for establishing a secure channel) or the HMAC value (when sending data over a secure channel).

[0089] It should be pointed out that the business system can query the key data at any service node through the key unique identifier, thereby avoiding the risk of the entire business system being paralyzed due to the failure of a single key service node, and ensuring the availability of the business system and the security of the key data.

[0090] In the embodiment of the present application, the same key is shared and backed up between different key management service nodes through the synchronization of key data. Since the first key management service node obtains the change data packet according to the key addition instruction, key update instruction, key disable instruction, key enable instruction and key destruction instruction sent by the business system. Therefore, the key change message in the secure channel protocol corresponds to the change data packet, including key addition, key update, key disable, key enable, key destruction, etc.

[0091] like Figure 5 , Figure 6As shown in the figure, they are the synchronization protocol formats corresponding to the key addition and update instructions. When the first key management service node (A) creates or updates the key, the newly added key information data is synchronously sent to the second key management service node (B) on the other end through the secure channel through the above protocol; the key synchronization module of the B node parses the key-related information in the key encapsulation data structure according to the protocol format, completes the synchronization storage operation of the key in this node, and sends the key addition or update synchronization result response message to the key management service node A.

[0092] It should be pointed out that the key encapsulation data structure is defined by each service or system when it is implemented, but it should at least include: key owner identifier, key unique identifier, key alias, key type, key algorithm, key length, key version, key ciphertext value, key check code, key creation time, key expiration time and other information.

[0093] like Figure 7 The following is the synchronization protocol format corresponding to the key disable, enable, and destroy instructions. When the first key management service node (A) disables, enables, or destroys a key, the above protocol is used to synchronously send the disabled, enabled, or destroyed key information data to the second key management service node (B) at the opposite end through a secure channel; the key synchronization module of the B node parses the key-related information according to the protocol format, completes the corresponding key disable, enable, and destroy operations in this node, and sends a key disable, enable, and destroy synchronization result response message to the key management service node A.

[0094] Furthermore, in this embodiment, with respect to step S11, establishing a secure channel with the second key management service node based on the secure channel protocol includes: sequentially performing offline certificate exchange and channel session key negotiation with the second key management service node based on the secure channel protocol.

[0095] like Figure 8The figure shows a schematic diagram of a method for realizing data synchronization between a first key management service node (A) and a second key management service node (B). A data security transmission channel is established through negotiation between the key management service (A and B) nodes. The key management services on nodes A and B each generate a signature and encryption certificate; then the key management service of node A configures the signature and encryption certificate generated by the key management service of node B, and the key management service of node B configures the signature and encryption certificate generated by the key management service of node A, and the certificate exchange configuration is completed offline. Finally, the key synchronization modules of the key management services of nodes A and B negotiate to establish a key data security transmission channel through a security protocol. When the key of service node A changes, the key change data is securely transmitted to service node B through the application layer security channel protocol. After receiving the key change data, service node B updates the key information in the data storage device it manages. After processing, it sends a response message to node A to indicate that the key change synchronization is completed, completing the real-time key synchronization.

[0096] In a first specific embodiment, Fig. 9 As shown, performing offline certificate exchange with the second key management service node based on the secure channel protocol includes:

[0097] Step S21: Generate a first key pair for signing and a second key pair for encryption using a preset encryption algorithm, and use the first key pair and the second key pair to sign and encrypt the first public key respectively to obtain a corresponding first signature certificate and a first encryption certificate;

[0098] Step S22: Send the first signature certificate and the first encryption certificate to the second key management service node, and obtain the second signature certificate and the second encryption certificate sent by the second key management service node to implement respective public key exchange.

[0099] In the embodiment of the present application, the key management services of the first key management service node and the second key management service node each generate two pairs of key pairs. For example, when the SM2 algorithm is used, the first key management service node will generate two pairs of SM2 asymmetric key pairs. The first key pair is used for signature, and the second key pair is used for encryption. Similarly, the second key management service node will also generate two pairs of SM2 asymmetric key pairs. The third key pair is used for signature, and the fourth key pair is used for encryption.

[0100] Furthermore, the SM2 signature and encryption key pair public key is used to generate a signature X509 certificate and an encryption X509 certificate respectively, and the signature certificate and encryption certificate exchange between the key synchronization modules of the key management service nodes A and B is completed through offline configuration, thereby realizing the SM2 public key exchange through offline exchange of X509 certificates.

[0101] In a second specific embodiment, Fig.10 As shown, performing channel session key negotiation with the second key management service node based on the secure channel protocol includes:

[0102] Step S31: Obtain a first random number generated by the first key management service node;

[0103] Step S32: using the second public key in the second encryption certificate to encrypt the first random number to obtain a first encryption result, and using the held signature private key to sign the first random number to obtain a first signature result;

[0104] In the embodiment of the present application, the key synchronization module in the first key management service node (A) generates a random number ra; uses the SM2 public key in the encrypted X509 certificate of the second key management service node (B) Encrypt it to get , and use your own signature private key Sign the random number ra to get .

[0105] Step S33: After connecting the first encryption result and the first signature result, the first encryption result is packaged in a secure channel establishment request protocol format and sent to the second key management service node, so that the second key management service node decrypts the first encryption result using the encryption private key it holds after unpacking to obtain the first random number; verifies the first signature result using the first public key in the first signature certificate and generates a second random number after the verification is passed; encrypts the first random number and the second random number using the first public key in the first encryption certificate to obtain a second encryption result, and signs the second random number using the signature private key it holds to obtain a second signature result; connects the second encryption result and the second signature result, packages them in a secure channel establishment response protocol format and sends them to the first key management service node;

[0106] In the present application embodiment, After the connection is established, the packet is packaged according to the secure channel establishment request protocol format and sent to key management service B.

[0107] The message protocol data unit in the secure channel establishment request protocol format includes the key length of the first random number, the ciphertext value of the first random number, the signature value length of the first random number, and the signature value of the first random number. Fig.11 The figure shows a schematic diagram of the secure channel establishment request protocol format. The message PDU includes the key length of random number A, the ciphertext value of random number A, the signature value length of random number A, and the signature value of random number A.

[0108] Further, when the key synchronization module of the key management service B receives the channel establishment request data, it unpacks it according to the secure channel establishment request protocol format to obtain and ; Use your own encryption private key Decryption Get ra and use the SM2 public key in the key management service A to sign the X509 certificate Verify the ra signature value After verification, a random number ra is generated; the SM2 public key in the X509 certificate is encrypted using the key management service A Encrypted random numbers get , and use your own signature private key Sign the random number rb to get ,Will After the connection is established, the data is packaged in the secure channel establishment response protocol format and sent to key management service A.

[0109] The message protocol data unit in the secure channel establishment response protocol format includes the key length of the first random number and the second random number, the ciphertext value of the first random number and the second random number, the signature value length of the second random number, and the signature value of the second random number. Fig.12 The figure shows the format of the secure channel establishment response protocol. The message PDU includes the key length of random numbers A and B, the ciphertext value of random numbers A and B, the signature value length of random number B, and the signature value of random number B.

[0110] Step S34: After unpacking according to the secure channel establishment response protocol format, use the held encryption private key to decrypt the second encryption result to obtain the first random number and the second random number; use the second public key in the second signature certificate to verify the second signature result.

[0111] In the embodiment of the present application, the key synchronization module of the key management service A receives the channel establishment response data and unpacks it according to the secure channel establishment response protocol format to obtain ; Use your own encryption private key Decryption get ; Use key management service B to sign the SM2 public key in the X509 certificate Verify the signature value of rb .

[0112] It should be noted that in the above steps, the key management service B will After the secure channel establishment response protocol format is packaged and sent to the key management service A, the key management service A verifies the signature value of rb Afterwards, ra is used to perform SM4 ECB encryption operation on rb to obtain the session key sk, which is used as the channel protection key to protect the confidentiality and integrity of the data transmitted on the channel.

[0113] Specifically, the first random number is used to perform an encryption operation on the second random number to obtain a session key; correspondingly, the change data packet is sent to the second key management service node through the secure channel, including: using the session key to encrypt the change data packet and sending the encrypted change data packet to the second key management service node through the secure channel. It can be seen that the SM2 algorithm is used to encrypt and decrypt the challenge random number and verify the signature, the SM4 algorithm is used to protect the confidentiality and integrity of the transmitted data, and commercial cryptographic technology is used for identity authentication and data encryption and decryption, solving product safety and compliance issues.

[0114] Furthermore, after the negotiation of the channel session key sk is completed, when a key change occurs at any key management service node A or B, the application packages a key change synchronization data packet in the secure channel data transmission protocol format and sends it to the peer node for real-time synchronization of the key change. That is, the change data packet is sent to the second key management service node through the secure channel in the secure channel data transmission protocol format; wherein, in the secure channel data transmission protocol format, the message protocol data unit includes the key management identifier and the key change message corresponding to the change data packet.

[0115] like Fig.13 The figure shows the format of the secure channel data transmission protocol. The message PDU contains a key management identifier and a key change synchronization message data PDU package. The key management identifier is fixed to 0XC0; the key change synchronization message data PDU includes key addition, key update, key disablement, key enablement, key destruction and other change data packets. It should be pointed out that in the protocol message, the key change message is encapsulated in the channel message PDU and is encrypted and protected by the sk key. The message tail is a 32-byte HMAC_SM3, which uses sk to perform HMAC on the message header and the message PDU ciphertext, and the value is stored in the message tail.

[0116] like Fig.14As shown, it is a schematic diagram of the overall secure channel negotiation process. Among them, for more specific content in each of the above processes, please refer to the corresponding content disclosed in the aforementioned steps, which will not be repeated here. It can be seen that through the embodiments of the present application, the key management service can realize the real-time synchronization of key data in multi-node application scenarios such as master-slave and cluster by itself, without relying on the data synchronization of the selected specific data storage device, so as to achieve technical controllability, lightweight, easy to use and maintainable. The data synchronization between key management services is based on a secure channel that meets the requirements of national secret specifications for transmission, and commercial cryptographic technology is used for identity authentication and data encryption and decryption to meet security and compliance requirements.

[0117] Correspondingly, the embodiment of the present application also discloses a key data synchronization device, which is applied to the first key management service node, see Fig.15 As shown, the device comprises:

[0118] The channel establishment module 11 is used to predefine a secure channel protocol for establishing and maintaining a session connection, and to establish a secure channel with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to exchange their respective public keys, and negotiates a channel session key through a random number to encrypt and decrypt transmission data and authenticate identity;

[0119] The instruction receiving module 12 is used to receive the key data operation instruction sent by the business system through the management page, and obtain the change data packet according to the key data operation instruction;

[0120] The key synchronization module 13 is used to send the change data packet to the second key management service node through the secure channel, so that the second key management service node synchronously updates the local key data according to the change data packet.

[0121] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0122] It can be seen that, through the above scheme of this embodiment, it is applied to the first key management service node, including: pre-defining a secure channel protocol for establishing and maintaining a session connection, and establishing a secure channel with the second key management service node based on the secure channel protocol; wherein, the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to realize the exchange of their respective public keys, and negotiates the channel session key through random numbers to realize the encryption and decryption of the transmission data and identity authentication; receiving the key data operation instruction sent by the business system through the management page, and obtaining the change data packet according to the key data operation instruction; sending the change data packet to the second key management service node through the secure channel, so that the second key management service node can synchronize and update the local key data according to the change data packet. The beneficial technical effects of this application are: first, a secure channel protocol specification that can realize real-time synchronization of key data between multiple nodes of the key management service is established at the application layer, and the key data is synchronized and backed up between multiple nodes, so that the key data synchronization does not depend on the selected specific data storage device, so as to achieve technical controllability, light weight, ease of use and maintainability. Secondly, the synchronization of key data between key management service nodes is completed with the help of a secure channel, solving the security problem of the key data transmission channel. Finally, by exchanging public keys through offline exchange of certificates and negotiating session keys through random number challenges, an application layer secure channel is established between key management services based on commercial cryptographic technology for secure transmission of key synchronization data, solving the problem of real-time synchronization and backup of key data between multiple nodes of key management services in master-slave and cluster application scenarios, and solving product security and compliance issues.

[0123] Furthermore, the present application also discloses an electronic device. Fig.16 This is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram cannot be considered as any limitation on the scope of use of the present application.

[0124] Fig.16 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the key data synchronization method disclosed in any of the aforementioned embodiments.

[0125] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0126] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and data 223, etc. The data 223 may include various data. The storage method may be temporary storage or permanent storage.

[0127] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the key data synchronization method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0128] Furthermore, the embodiment of the present application also discloses a computer-readable storage medium, wherein the computer-readable storage medium mentioned here includes random access memory (Raccess Memory, RAM), memory, read-only memory (Read-Only Memory, ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, magnetic disk or optical disk or any other form of storage medium known in the technical field. Wherein, when the computer program is executed by the processor, the aforementioned key data synchronization method is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiment, and no further description will be given here.

[0129] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0130] The steps of the key data synchronization method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0131] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0132] The above is a detailed introduction to a key data synchronization method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A key data synchronization method, characterized in that: Applied to the first key management service node, comprising: A secure channel protocol for establishing and maintaining a session connection is predefined, and a secure channel is established with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to exchange their respective public keys, and negotiates a channel session key through a random number to encrypt and decrypt transmission data and authenticate identity; Receive a key data operation instruction sent by the business system through the management page, and obtain a change data packet according to the key data operation instruction; The change data packet is sent to the second key management service node through the secure channel, so that the second key management service node synchronously updates the local key data according to the change data packet.

2. The key data synchronization method according to claim 1, characterized in that: The secure channel protocol includes a protocol version, a channel security mode, a message unique identifier, a peer key management system identifier, a sender key management system identifier, a message type, a message protocol data unit length, a key management identifier, a data check value length, and a data check value. The secure channel protocol predefined for establishing and maintaining a session connection includes: The protocol version, the channel security mode, the message unique identifier, the peer key management system identifier, the sender key management system identifier, the message type, and the message protocol data unit length are used as a message header, the key management identifier is used as a message protocol data unit, and the data check value length and the data check value are used as a message tail; The message header, the message protocol data unit and the message tail are concatenated to obtain an initialization protocol message so as to determine the secure channel protocol according to the initialization protocol message.

3. The key data synchronization method according to claim 2, characterized in that: The establishing a secure channel with the second key management service node based on the secure channel protocol includes: Based on the secure channel protocol, offline certificate exchange and channel session key negotiation are performed in sequence with the second key management service node.

4. The key data synchronization method according to claim 3, characterized in that: Performing offline certificate exchange with the second key management service node based on the secure channel protocol includes: Generate a first key pair for signing and a second key pair for encryption using a preset encryption algorithm, and use the first key pair and the second key pair to sign and encrypt the first public key respectively to obtain a corresponding first signature certificate and a first encryption certificate; The first signature certificate and the first encryption certificate are sent to the second key management service node, and the second signature certificate and the second encryption certificate sent by the second key management service node are obtained to realize the exchange of respective public keys; wherein, the second signature certificate and the second encryption certificate are generated by the second key management service node using the preset encryption algorithm to generate a third key pair for signing and a fourth key pair for encryption, and the third key pair and the fourth key pair are used to sign and encrypt the second public key respectively to obtain the signature certificate and encryption certificate.

5. The key data synchronization method according to claim 4, characterized in that: Performing channel session key negotiation with the second key management service node based on the secure channel protocol includes: Obtaining a first random number generated by the first key management service node; Encrypt the first random number using the second public key in the second encryption certificate to obtain a first encryption result, and sign the first random number using the held signature private key to obtain a first signature result; After connecting the first encryption result and the first signature result, they are packaged in a secure channel establishment request protocol format and sent to the second key management service node, so that the second key management service node decrypts the first encryption result using the encryption private key it holds after unpacking to obtain the first random number; verifies the first signature result using the first public key in the first signature certificate and generates a second random number after the verification is passed; encrypts the first random number and the second random number using the first public key in the first encryption certificate to obtain a second encryption result, and signs the second random number using the signature private key it holds to obtain a second signature result; connects the second encryption result and the second signature result, packages them in a secure channel establishment response protocol format and sends them to the first key management service node; After unpacking according to the secure channel establishment response protocol format, the second encryption result is decrypted using the held encryption private key to obtain the first random number and the second random number; the second public key in the second signature certificate is used to verify the second signature result.

6. The key data synchronization method according to claim 5, characterized in that: The process of negotiating a channel session key with the second key management service node based on the secure channel protocol also includes: Using the first random number to perform an encryption operation on the second random number to obtain a session key; Correspondingly, sending the change data packet to the second key management service node through the secure channel includes: The change data packet is encrypted using the session key and the encrypted change data packet is sent to the second key management service node through the secure channel.

7. The key data synchronization method according to claim 5, characterized in that: The message protocol data unit in the secure channel establishment request protocol format includes the key length of the first random number, the ciphertext value of the first random number, the signature value length of the first random number, and the signature value of the first random number; The message protocol data unit in the secure channel establishment response protocol format includes the key length of the first random number and the second random number, the ciphertext value of the first random number and the second random number, the signature value length of the second random number, and the signature value of the second random number.

8. The key data synchronization method according to claim 2, characterized in that: The sending the change data packet to the second key management service node through the secure channel includes: The change data packet is sent to the second key management service node through the secure channel in accordance with the secure channel data sending protocol format; wherein, in the secure channel data sending protocol format, the message protocol data unit includes the key management identifier and the key change message corresponding to the change data packet.

9. The key data synchronization method according to any one of claims 1 to 8, characterized in that: The receiving of the key data operation instruction sent by the business system through the management page includes: Receive key addition instructions, key update instructions, key disable instructions, key enable instructions, and key destruction instructions triggered by the business system through the management page or by calling the application programming interface; Correspondingly, sending the change data packet to the second key management service node through the secure channel so that the second key management service node synchronously updates the local key data according to the change data packet, includes: The change data packet is sent to the second key management service node through the secure channel, so that the second key management service node performs operations of adding, updating, disabling, enabling and destroying local key data according to the change data packet.

10. A key data synchronization device, characterized in that: Applied to the first key management service node, comprising: A channel establishment module, used to predefine a secure channel protocol for establishing and maintaining a session connection, and to establish a secure channel with a second key management service node based on the secure channel protocol; wherein the secure channel protocol exchanges the signature certificates and encryption certificates of the first key management service node and the second key management service node offline to exchange their respective public keys, and negotiates channel session keys through random numbers to encrypt and decrypt transmitted data and authenticate identities; An instruction receiving module is used to receive a key data operation instruction sent by the business system through the management page, and obtain a change data packet according to the key data operation instruction; The key synchronization module is used to send the change data packet to the second key management service node through the secure channel, so that the second key management service node synchronously updates the local key data according to the change data packet.

11. An electronic device, characterized in that: The electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the key data synchronization method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein the computer program, when executed by a processor, implements the key data synchronization method as described in any one of claims 1 to 9.