Key synchronization method, server, storage medium and program product

By generating and verifying synchronization key tokens, the security and granularity control issues in the key synchronization process are resolved, ensuring the security and reliability of the target key during cross-regional data synchronization.

CN120979636APending Publication Date: 2025-11-18ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410619762.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Existing key synchronization schemes are inadequate in terms of security and granular control, making it difficult to effectively protect the security of user keys during cross-regional data backup and disaster recovery processes, and there is a risk that temporary synchronization keys may be misused.

Method used

By generating a temporary synchronization key, using its private key and the verification information of the target key to generate a synchronization key token, and verifying it on the destination device, the security of key transmission is ensured, while limiting the scope of use of the temporary synchronization key to avoid abuse.

Benefits of technology

It enables secure transmission of the target key during cross-regional data synchronization, ensuring that the temporary synchronization key is used only for the specified key synchronization, thereby improving the security and reliability of key synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120979636A_ABST
    Figure CN120979636A_ABST
Patent Text Reader

Abstract

The invention provides a key synchronization method, a server, a storage medium and a program product. According to the method, when a target key is synchronized from a source device to a target device, the source device provides verification information of the target key for the target device; the destination device generates a temporary synchronization key ERK, generates a synchronization key token RT based on an ERK private key and verification information, and provides an ERK public key and the RT for the source device; the source device generates ciphertext data of the target key by using the ERK public key, and transmits the ciphertext data and the RT to the target device; after the target device verifies the verification information in the RT, the target secret key is determined according to the ERK private key and the ciphertext data, the safety of the target secret key can be protected, and through verification of the target secret key verification information in the RT, the use range of the ERK can be limited, abuse of the ERK is avoided, and the safety of secret key synchronization is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the computer technology field, and in particular to a key synchronization method, a server, a storage medium and a program product. BACKGROUND

[0002] With the development of cloud technology, many customers store their data on cloud devices. Some cloud customers need to encrypt data using user keys to protect data security due to data security requirements. In order to ensure high availability of customer data, there are requirements for data backup and cross-regional disaster recovery, which requires a reliable key synchronization scheme to safely synchronize user keys of a source device to another target device. SUMMARY

[0003] The present application provides a key synchronization method, a server, a storage medium and a program product to solve the security problem of key synchronization.

[0004] In a first aspect, the present application provides a key synchronization method applied to a target device, the method comprising:

[0005] receiving verification information of a target key to be synchronized sent by a source device;

[0006] generating a temporary synchronization key, generating a synchronization key token according to a private key of the temporary synchronization key and the verification information of the target key, and returning a public key of the temporary synchronization key and the synchronization key token to the source device;

[0007] receiving ciphertext data of the target key and the synchronization key token sent by the source device;

[0008] in a case where the verification information in the received synchronization key token is verified to be correct, determining the target key according to the private key of the temporary synchronization key and the ciphertext data of the target key.

[0009] In an optional embodiment, the target device is associated with a first cryptographic machine, and the generating of the synchronization key token according to the private key of the temporary synchronization key and the verification information of the target key comprises:

[0010] calling the first cryptographic machine based on a standard interface, encrypting the private key of the temporary synchronization key using a persistent key to obtain private key ciphertext of the temporary synchronization key;

[0011] calling the first cryptographic machine based on a standard interface, signing the verification information of the target key using the private key of the temporary synchronization key to obtain a digital signature of the target key verification information;

[0012] generate a token containing private key cipher text of the temporary synchronization key, verification information of the target key, and the digital signature, as a synchronization key token.

[0013] In an optional embodiment, before determining the target key according to the private key of the temporary synchronization key and the cipher text data of the target key, the method further comprises:

[0014] decrypt, based on a standard interface, the private key cipher text of the temporary synchronization key in the synchronization key token using the persistent key, to obtain the private key of the temporary synchronization key.

[0015] In an optional embodiment, determining the target key according to the private key of the temporary synchronization key and the cipher text data of the target key comprises:

[0016] In a case where the target key is a symmetric key, the cipher text data of the target key comprises cipher text of the target key, and the cipher text of the target key is unpacked using the private key of the temporary synchronization key to obtain the target key.

[0017] In an optional embodiment, determining the target key according to the private key of the temporary synchronization key and the cipher text data of the target key comprises:

[0018] In a case where the target key is an asymmetric key, the cipher text data of the target key comprises cipher text of the target key and cipher text of a temporary symmetric key, and the cipher text of the temporary symmetric key is unpacked using the private key of the temporary synchronization key to obtain the temporary symmetric key.

[0019] The cipher text of the target key is unpacked using the temporary symmetric key to obtain the target key.

[0020] In an optional embodiment, the verification of the verification information in the received synchronization key token comprises:

[0021] The first cryptographic machine is invoked based on a standard interface, and the digital signature of the verification information of the target key is verified using the public key of the temporary synchronization key.

[0022] In an optional embodiment, the method further comprises: receiving metadata of the target key sent by the source device.

[0023] The verification of the verification information in the received synchronization key token comprises:

[0024] The verification information in the synchronization key token comprises a key identifier, and consistency of the key identifier in the received synchronization key token with the key identifier in the metadata of the target key is verified.

[0025] and / or,

[0026] The verification information in the synchronization key token includes a key verification value, and consistency of the key verification value in the received synchronization key token and the key verification value in the metadata of the target key is verified.

[0027] In an optional embodiment, the method further comprises:

[0028] Importing the target key into the first cryptographic machine;

[0029] Calling the first cryptographic machine based on a standard interface to generate a verification value according to the target key;

[0030] Verifying consistency of the generated verification value with the key verification value in the synchronization key token, and / or verifying consistency of the generated verification value with the key verification value in the metadata of the target key;

[0031] In the case of verification failure, calling the first cryptographic machine based on a standard interface to delete the imported target key.

[0032] In an optional embodiment, the method further comprises:

[0033] Receiving target data ciphertext sent by the source device, and storing the target data ciphertext;

[0034] In response to receiving a data analysis request, decrypting the target data ciphertext using the target key to obtain target data plaintext, performing data analysis according to the target data plaintext, and obtaining a data analysis result.

[0035] In a second aspect, the application provides a key synchronization method applied to a source device, the method comprising:

[0036] Sending verification information of a target key to be synchronized to a destination device;

[0037] Receiving a public key of a temporary synchronization key and a synchronization key token returned by the destination device, the synchronization key token containing verification information of the target key;

[0038] Generating ciphertext data of the target key based on the public key of the temporary synchronization key;

[0039] Sending the ciphertext data of the target key and the synchronization key token to the destination device.

[0040] In an optional embodiment, the source device is associated with a second cryptographic machine, and the generating of the ciphertext data of the target key based on the public key of the temporary synchronization key comprises:

[0041] In a case that the target key is a symmetric key, the second cryptographic machine is invoked based on the standard interface, the target key is encrypted using the public key of the temporary synchronization key to obtain ciphertext of the target key as ciphertext data of the target key.

[0042] In an optional embodiment, the generating the ciphertext data of the target key based on the public key of the temporary synchronization key comprises:

[0043] In a case that the target key is an asymmetric key, the second cryptographic machine is invoked based on the standard interface to generate a temporary symmetric key.

[0044] The second cryptographic machine is invoked based on the standard interface, the target key is encrypted using the temporary symmetric key to obtain ciphertext of the target key, and the temporary symmetric key is encrypted using the public key of the temporary synchronization key to obtain ciphertext of the temporary symmetric key, the ciphertext data of the target key comprising the ciphertext of the target key and the ciphertext of the temporary symmetric key.

[0045] In an optional embodiment, the method further comprises:

[0046] The metadata of the target key is sent to the destination device.

[0047] In an optional embodiment, the method further comprises:

[0048] In response to a data synchronization request, target data ciphertext encrypted using the target key is obtained from a database, and the target data ciphertext is sent to the destination device.

[0049] In a third aspect, the present application provides a server, comprising:

[0050] at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the server to perform the method provided in any one of the preceding aspects.

[0051] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method provided in any one of the preceding aspects is implemented.

[0052] In a fifth aspect, the present application provides a computer program product, comprising a computer program, and when a processor executes the computer program, the method provided in any one of the preceding aspects is implemented.

[0053] The key synchronization method, the server, the storage medium and the program product provided by the application, when synchronizing the target key from the source device to the destination device, the source device provides the check information of the target key to be synchronized to the destination device, the destination device generates a temporary synchronization key for synchronizing the target key, and generates a synchronization key token based on the private key of the temporary synchronization key and the check information of the target key, and the destination device provides the public key of the temporary synchronization key and the synchronization key token to the source device; the source device generates the ciphertext data of the target key using the public key of the temporary synchronization key, and transmits the ciphertext data of the target key and the synchronization key token to the destination device; the destination device determines the target key according to the private key of the temporary synchronization key and the ciphertext data of the target key in the case that the check information in the received synchronization key token is verified, and completes the key synchronization process, the security of the target key can be protected through the ciphertext transmission of the target key, and the private key of the temporary synchronization key and the check information of the target key are encapsulated into the synchronization key token, and the use granularity / use range of the temporary synchronization key can be limited through the verification of the check information of the target key in the synchronization key token, so that the temporary synchronization key is only used for synchronizing the specified target key, the temporary synchronization key is prevented from being abused for synchronizing other keys, and the security of the key synchronization is improved. BRIEF DESCRIPTION OF DRAWINGS

[0054] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.

[0055] Figure 1 A schematic diagram of an example system architecture suitable for use with the present application;

[0056] Figure 2 A flowchart of a key synchronization method provided by an example embodiment of the present application;

[0057] Figure 3 A signaling interaction diagram of key synchronization provided by an example embodiment of the present application;

[0058] Figure 4 A flowchart of a key synchronization method based on a standard cryptographic machine interface provided by an example embodiment of the present application;

[0059] Figure 5 A flowchart of a data synchronization method based on key synchronization provided by an example embodiment of the present application;

[0060] Figure 6 A structural schematic diagram of a server provided by an embodiment of the present application.

[0061] The specific embodiments of the application have been shown and described in the above drawings and text. These drawings and text are not meant to limit the scope of the inventive concept in any way but are merely meant to illustrate the inventive concept to one of ordinary skill in the art by reference to a particular embodiment. DETAILED DESCRIPTION

[0062] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The description of the exemplary embodiments is intended to apply to any embodiment of the application, unless specified otherwise. Accordingly, when the description of the exemplary embodiments contains language reciting means such as specific integer claims, such means shall be interpreted not as limitations of the specific embodiments but as broad descriptions of the application.

[0063] It should be noted that the user information (including but not limited to user equipment information, user attribute information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards, and provide corresponding operation portal for user to choose authorization or refusal.

[0064] First, the terms involved in the present application are explained:

[0065] Cryptographic machine: also known as cryptographic device, hardware security module (HSM), a special hardware device for securely storing encryption keys and providing cryptographic computing interface.

[0066] Ephemeral replication key (ERK): a non-symmetric key generated temporarily in the key synchronization process, used to ensure the security of the key to be synchronized. The ephemeral replication key ERK includes a pair of private key and public key, ERK.priv represents the private key of the ephemeral replication key ERK, and ERK.pub represents the public key of the ephemeral replication key.

[0067] Ephemeral symmetric key (ESK): a symmetric key generated temporarily in the key synchronization process, used to encrypt the asymmetric user master key when the user master key to be synchronized is a non-symmetric key.

[0068] Customer Master Key (CMK): A key created by a user or cloud service through a key management service, which is a symmetric key or an asymmetric key. The user can use this key to encrypt and decrypt data. In this embodiment, the user master key refers to the key material of the user master key (CMKM). The user master key also has metadata (also known as Meta data).

[0069] Metadata of the user master key: Metadata of the key material of the user master key, denoted as CMK.Meta or CMKM.Meta. The metadata of the user master key includes but is not limited to the key identification (such as key ID) of the user master key, the key type, the key length, the creation time, the last use time, the key use state, the access control information, the key description information, etc.

[0070] Encryption and packaging: Wrap operation, the process of encrypting and packaging one key or data with another key. This process can protect the security of the key during transmission, preventing it from being stolen or tampered with by attackers.

[0071] Decapsulation: Unwrap operation, which is the inverse process of Wrap operation. In the Unwrap operation process, the receiver will use its own key to decrypt the wrapped data, check the metadata to ensure the integrity of the data, and use the decrypted key for subsequent data processing or communication.

[0072] With the development of cloud technology, many customers store their data on cloud devices. Some cloud customers need to use user keys to encrypt data due to data security requirements, to protect data security. In order to ensure the high availability of data, there are needs for data backup, cross-regional disaster recovery, etc., which requires a reliable key synchronization scheme to safely synchronize the user keys used by the password machine associated with the source device to the password machine of another target device.

[0073] The application provides a key synchronization method and system for synchronizing a key from a source device to a destination device. Specifically, the source device provides the destination device with verification information of a target key to be synchronized. The destination device generates a temporary synchronization key for synchronizing the target key, and generates a synchronization key token based on a private key of the temporary synchronization key and the verification information of the target key. The destination device provides the source device with a public key of the temporary synchronization key and the synchronization key token. The source device generates ciphertext data of the target key using the public key of the temporary synchronization key, and transmits the ciphertext data of the target key and the synchronization key token to the destination device. The destination device determines the target key according to the private key of the temporary synchronization key and the ciphertext data of the target key in the case that the verification information in the received synchronization key token is verified. The security of the target key can be protected through the ciphertext transmission of the target key, and the private key of the temporary synchronization key and the verification information of the target key are encapsulated into the synchronization key token, and the verification of the verification information of the target key in the synchronization key token can ensure that the temporary synchronization key is only used for synchronizing the specified target key, so that the use granularity / use range of the temporary synchronization key can be limited, the temporary synchronization key can be prevented from being abused for synchronizing other keys, and the security of key synchronization is improved.

[0074] Figure 1 A schematic diagram of an example system architecture applicable to the application. As shown in the figure, the system architecture includes a source device and a destination device, and a first cryptographic machine associated with the destination device and a second cryptographic machine associated with the source device. The destination device can call the first cryptographic machine through a cryptographic machine interface to perform key generation, encryption, decryption, key import, key export, digital signature, key management, and the like. The source device can call the second cryptographic machine through the cryptographic machine interface to perform key generation, encryption, decryption, key import, key export, digital signature, key management, and the like. The source device and the destination device have a communicable communication link, and can realize communication connection between the source device and the destination device. Figure 1

[0075] The source device is a device with computing capability deployed in the cloud or locally, such as a cloud cluster. The source device is associated with the second cryptographic machine, and the target key has been imported into the second cryptographic machine. The destination device is a device with computing capability deployed in the cloud or locally, such as a cloud cluster. The destination device is associated with the first cryptographic machine. The method of the embodiment aims to synchronize the target key from the first cryptographic machine to the second cryptographic machine, so that the second cryptographic machine imports the target key and can use the target key for encryption, decryption, and other related operations.

[0076] ​In a cross-region disaster recovery scenario, the source device can be a cloud server located in region A and stores user system data. In order to ensure the security of the user data, the source device stores the user system data in an encrypted manner. The source device is associated with a second password machine, and the second password machine imports a user master key customized by a user. The user master key can be used to generate a key, encrypt data, decrypt data, and the like. The destination device can be a cloud server located in region B and is associated with a first password machine. In order to meet the disaster recovery requirements, it is necessary to synchronize the user data stored by the source device to the destination device. In order to ensure the security of the user data, the user data needs to be transmitted in a ciphertext manner. A preferred solution is to synchronize the user master key in the second password machine to the first password machine, so that the first password machine imports the same user master key. In this way, the user data ciphertext encrypted by the user master key on the source device can be directly transmitted to the destination device, and the destination device can normally access the user data ciphertext by calling the second password machine.

[0077] In a distributed key management system, multiple password machines are combined into a whole to provide services to the outside in the form of a resource pool, which can solve the demand for large-scale password services in an open environment such as cloud computing. This requires the same key to be synchronized or migrated from one password machine to another password machine.

[0078] It should be noted that, Figure 1 For an example of the applicable architecture of the present application, the scheme of the present application can also be applied to other system architectures for synchronizing keys from a source device to a destination device. In some scenarios, the source device and the destination device are not necessarily bound to the password machine, but can be replaced by other components or algorithms to call the password machine to implement the corresponding processing, and the scheme of the present application can also be implemented.

[0079] The method of the present application can be applied to key synchronization between different devices in various scenarios, and can be applied to cloud computing, Internet, finance, transportation, energy, and other fields such as cloud computing, disaster recovery, and distributed key services. The present embodiment is not limited in detail.

[0080] The technical scheme of the present application and how the technical scheme of the present application solves the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in detail in some embodiments. The embodiments of the present application will be described below with reference to the drawings.

[0081] Figure 2 A flowchart of a key synchronization method provided for an exemplary embodiment of the present application. The method of the present embodiment is used to synchronize a target key from a source device to a destination device. As shown in Figure 2 The specific steps of the method are as follows:

[0082] Step S201, the source device sends the check information of the target key to be synchronized to the destination device.

[0083] Step S202, the destination device receives the check information of the target key to be synchronized sent by the source device.

[0084] The target key refers to the key to be synchronized, which can be a user-defined user master key (CMKM) or other user key, or a system-configured other key, which is not limited in the embodiment. For the convenience of description, CMKM is used to represent the target key to be synchronized in the embodiment, but the target key is not limited to the user master key.

[0085] The check information of the target key includes at least one item of information in the metadata of the target key, including but not limited to key identification (such as key ID) and key check value. In addition, the check information of the target key can also include other information that can be used to verify the consistency of the key, such as the key type and key length in the metadata of the target key, which is not limited in the embodiment.

[0086] The source device refers to a server that owns the target key. In order to improve data security, the source device that owns the target key can be associated with a password machine (referred to as a second password machine), and the second password machine is called through a password machine interface to perform password-related operations, including but not limited to importing keys, encryption, decryption, exporting keys, digital signature, and key management. In the embodiment, the target key has been imported into the second password machine associated with the source device, and the target key can be used for encryption, decryption, digital signature, key management and other operations.

[0087] The destination device refers to a server that needs to synchronize the target key. The destination device can be associated with another password machine (referred to as a first password machine), and the first password machine is called through a password machine interface to perform password-related calculations, including but not limited to importing keys, generating keys, encryption, decryption, exporting keys, digital signature, and key management. In the embodiment, the target key needs to be synchronized from the second password machine to the first password machine, so that the destination device can use the same target key to generate keys, encryption, decryption, digital signature, key management and other password operations by calling the first password machine.

[0088] Exemplarily, in a cross-region disaster recovery scenario, the source device can be a cloud server located in region A, storing user system data, and the user system data is stored after being encrypted using a custom user master key (as a target key). The user master key has been imported into a second cryptomachine associated with the source device. Based on the disaster recovery requirement, it is necessary to synchronize the user system data stored by the source device in region A to the target device in region B, and to synchronize the user master key from the second cryptomachine to the first cryptomachine associated with the target device, so that the target device in region B can implement normal encryption, decryption, digital signature, key management and other cryptographic operations on the user system data using the same user master key.

[0089] Exemplarily, in a distributed key management system, the source device is a computing node associated with a second cryptomachine that has imported a target key, and the target device is a first cryptomachine that needs to import the target key. The method of the embodiment can synchronize the target key from the second cryptomachine to the first cryptomachine.

[0090] Step S203, the target device generates a temporary synchronization key.

[0091] In order to realize the secure synchronization of the target key, in this step, a set of asymmetric keys is generated by the target device as a temporary synchronization key (ERK) for synchronizing the target key, including a public key (denoted as ERK.pub) and a private key (denoted as ERK.Priv).

[0092] Exemplarily, the target device calls the first cryptomachine to generate an asymmetric key as a temporary synchronization key for synchronizing the target key. In some scenarios, the target device can generate an asymmetric key as a temporary synchronization key for synchronizing the target key by running a key generation algorithm or calling other components.

[0093] Optionally, the cryptomachine interfaces used by different models or different manufacturers can be different, but all cryptomachines support the use of standard cryptomachine interfaces, including but not limited to the Public-Key Cryptography Standards #11 (PKCS11 or PKCS#11) interface, the Cryptographic Service Provider (CSP) interface, and the national standard interface.

[0094] Exemplarily, the target device can call the first cryptomachine to generate an asymmetric key as a temporary synchronization key ERK through the PKCS11 interface. Exemplarily, the target device can call the first cryptomachine to generate an asymmetric key as a temporary synchronization key ERK through the national standard interface.

[0095] In this embodiment, the destination device can be configured to call the first cryptographic machine through a standard interface according to the actual application scenario, which is not limited here.

[0096] In step S204, the destination device generates a synchronization key token according to the private key of the temporary synchronization key and the verification information of the target key.

[0097] After generating the temporary synchronization key, the destination device needs to transmit the generated temporary synchronization key ERK to the source device, so that the source device can use the temporary synchronization key ERK to realize the secure transmission of the target key.

[0098] In order to ensure the secure transmission of the temporary synchronization key ERK, the destination device encrypts the private key ERK.Priv of the temporary synchronization key using the persistent key, and obtains the private key ciphertext of the temporary synchronization key, denoted as ERK.Priv.encrypted. By transmitting the private key ciphertext ERK.Priv.encrypted of the temporary synchronization key to the source device instead of directly transmitting the private key ERK.Priv of the temporary synchronization key in plaintext, the security of the private key ERK.Priv of the temporary synchronization key can be ensured.

[0099] In addition, in order to limit the generated temporary synchronization key ERK to be used only for the synchronization of the target key, and to ensure that the temporary synchronization key ERK is not misused for the synchronization of other keys, the destination device encapsulates the verification information of the target key into the same replication token (RT) as the private key of the temporary synchronization key, and obtains a synchronization key token RT. Subsequently, the destination device verifies whether the verification information of the target key in the synchronization key token RT is consistent with the key currently transmitted by the source device, to determine whether the temporary synchronization key ERK is used for transmitting a specific target key or misused for other keys, which can prevent the misuse of the temporary synchronization key ERK and improve the security of key synchronization.

[0100] Exemplarily, in this step, the destination device can call the first cryptographic machine to encrypt the private key ERK.Priv of the temporary synchronization key using the persistent key, and obtain the private key ciphertext ERK.Priv.encrypted of the temporary synchronization key. Further, the destination device generates a replication token RT containing the private key ciphertext ERK.Priv.encrypted of the temporary synchronization key and the verification information of the target key, and obtains the synchronization key token RT.

[0101] In an optional embodiment, the destination device can also use the private key ERK.Priv of the temporary synchronization key to digitally sign the verification information of the target key, to obtain a digital signature of the verification information of the target key. The destination device can verify whether the verification information of the target key is tampered by verifying the digital signature of the verification information of the target key, thereby preventing the verification information of the target key from being tampered, further preventing the abuse of the temporary synchronization key ERK, and improving the security of the key synchronization.

[0102] Specifically, in this step, the destination device calls the first cryptographic machine to encrypt the private key ERK.Priv of the temporary synchronization key using the persistent key, to obtain the private key ciphertext ERK.priv.encrypted of the temporary synchronization key; and the destination device calls the first cryptographic machine to sign the verification information of the target key using the private key ERK.Priv of the temporary synchronization key, to obtain a digital signature of the verification information of the target key. Further, the destination device generates a replication token RT containing the private key ciphertext ERK.priv.encrypted of the temporary synchronization key, the verification information of the target key, and the digital signature, as the synchronization key token RT.

[0103] For example, the destination device calls the first cryptographic machine to perform an abstract calculation on the verification information of the target key using a pre-configured hash function, to convert the verification information of the target key into a fixed-length hash value, which is used as a unique identifier of the verification information of the target key. Further, the destination device calls the first cryptographic machine to encrypt the generated hash value using the private key ERK.Priv of the temporary synchronization key, to obtain the digital signature of the verification information of the target key.

[0104] It should be noted that the persistent key used to encrypt the private key ERK.Priv of the temporary synchronization key is the persistent key used by the destination device (also referred to as a persistent key). The persistent key has been imported into the first cryptographic machine associated with the destination device, and the first cryptographic machine can use the persistent key for encryption, decryption, and other operations. The persistent key can be generated by the destination device calling the first cryptographic machine, or the persistent key can be configured on the destination device by a related technical person and imported into the persistent key by the destination device calling the first cryptographic machine.

[0105] In addition, the persistent key can be a symmetric key or an asymmetric key. In the case where the persistent key is an asymmetric key, the private key of the temporary synchronization key ERK.priv is encrypted using the public key of the persistent key to obtain the private key ciphertext of the temporary synchronization key ERK.priv.encrypted. In the subsequent step, when the private key ciphertext of the temporary synchronization key ERK.priv.encrypted needs to be decrypted, the private key of the persistent key is used to decrypt the private key ciphertext of the temporary synchronization key ERK.priv.encrypted, and the private key of the temporary synchronization key ERK.priv is obtained.

[0106] In the case where the persistent key is a symmetric key, the private key of the temporary synchronization key ERK.priv is encrypted using the persistent key to obtain the private key ciphertext of the temporary synchronization key ERK.priv.encrypted. In the subsequent step, the private key ciphertext of the temporary synchronization key ERK.priv.encrypted is still decrypted using the persistent key, and the private key of the temporary synchronization key ERK.priv is obtained.

[0107] In addition, the encapsulation format of the synchronization key token RT can be configured and adjusted according to the actual application scenario, and different encapsulation formats will not affect the role and technical effects of the synchronization key token RT in the present scheme, and the encapsulation format of the synchronization key token RT is not limited here.

[0108] Step S205, the destination device returns the public key of the temporary synchronization key and the synchronization key token to the source device.

[0109] After generating the synchronization key token RT containing the private key ciphertext of the temporary synchronization key ERK.priv.encrypted and the verification information of the target key, the destination device transmits the public key of the temporary synchronization key ERK.pub and the synchronization key token RT to the source device.

[0110] Step S206, the source device receives the public key of the temporary synchronization key and the synchronization key token returned by the destination device.

[0111] The source device receives the public key of the temporary synchronization key ERK.pub and the synchronization key token RT transmitted by the destination device to obtain the public key of the temporary synchronization key ERK.pub used for synchronizing the target key. The synchronization key token RT contains the verification information of the target key.

[0112] Step S207, the source device generates ciphertext data of the target key based on the public key of the temporary synchronization key.

[0113] To ensure the security of the transmission of the target key (denoted as CMKM), the source device encrypts and wraps (Wrap operation) the target key using the public key ERK.pub of the temporary synchronization key provided by the destination device, to obtain the ciphertext data of the target key, denoted as CMKM.Wrapped.

[0114] Specifically, in the case where the target key CMKM is a symmetric key, the source device encrypts and wraps (Wrap operation) the target key using the public key ERK.pub of the temporary synchronization key, to obtain the ciphertext CMKM.Wrapped ERK.pub of the target key as the ciphertext data CMKM.Wrapped of the target key. Illustratively, the source device can call the second cryptographic engine to encrypt and wrap (Wrap operation) the target key using the public key ERK.pub of the temporary synchronization key, to obtain the ciphertext CMKM.Wrapped ERK.pub of the target key as the ciphertext data CMKM.Wrapped of the target key.

[0115] In this case, the ciphertext data CMKM.Wrapped of the target key only contains the ciphertext CMKM.Wrapped ERK.pub of the target key (encrypted and wrapped using the public key ERK.pub of the temporary synchronization key).

[0116] In the case where the target key CMKM is an asymmetric key, the source device needs to generate a temporary symmetric key ESK, encrypt and wrap (Wrap operation) the asymmetric target key CMKM using the temporary symmetric key ESK to obtain the ciphertext CMKM.Wrapped ESK of the target key, and encrypt and wrap (Wrap operation) the temporary symmetric key ESK using the public key ERK.pub of the temporary synchronization key to obtain the ciphertext of the temporary symmetric key ESK, denoted as ESK.Wrapped.

[0117] Specifically, in the case where the target key CMKM is an asymmetric key, the source device calls the second cryptographic engine to generate a temporary symmetric key ESK; the source device calls the second cryptographic engine to encrypt and wrap the target key CMKM using the temporary symmetric key ESK to obtain the ciphertext CMKM.Wrapped ESK of the target key, and encrypt and wrap the temporary symmetric key ESK using the public key ERK.pub of the temporary synchronization key to obtain the ciphertext ESK.Wrapped of the temporary symmetric key.

[0118] In this case, the ciphertext data CMKM.Wrapped of the target key includes the ciphertext CMKM.Wrapped ESK of the target key (encrypted and wrapped using the temporary symmetric key ESK) and the ciphertext ESK.Wrapped of the temporary symmetric key ESK (encrypted and wrapped using the public key ERK.pub of the temporary synchronization key).

[0119] Optionally, in the case that the target key CMKM is an asymmetric key, for the target key of the asymmetric key, only the private key of the target key can be encrypted in this step, and the public key of the target key can be transmitted in plaintext to the destination device.

[0120] Specifically, in the case that the target key CMKM is an asymmetric key, the source device invokes the second cryptographic machine to generate a temporary symmetric key ESK; the source device invokes the second cryptographic machine to encrypt the private key (denoted as CMKM.priv) of the target key using the temporary symmetric key ESK to obtain the private key ciphertext (denoted as CMKM.priv.Wrapped_ESK) of the target key, and encrypt the temporary symmetric key ESK using the public key ERK.pub of the temporary synchronization key to obtain the ciphertext ESK.Wrapped of the temporary symmetric key. The ciphertext data CMKM.Wrapped of the target key includes: the private key ciphertext CMKM.priv.Wrapped_ESK of the target key and the ciphertext ESK.Wrapped of the temporary symmetric key, and the public key CMKM.pub of the target key.

[0121] In actual applications, the cryptographic machine interfaces used by cryptographic machines of different models or produced by different manufacturers can be different, but all cryptographic machines support the use of standard cryptographic machine interfaces, including but not limited to the Public-Key Cryptography Standards #11 (PKCS11 or PKCS#11) interface, the Cryptographic Service Provider (CSP) interface, and the national cryptographic interface.

[0122] Exemplarily, the source device can invoke the second cryptographic machine to perform operations such as generating a temporary symmetric key ESK, encryption, decryption, etc. through the PKCS11 interface. Exemplarily, the source device can invoke the second cryptographic machine to perform operations such as generating a temporary symmetric key ESK, encryption, decryption, etc. through the national cryptographic interface.

[0123] In this embodiment, the source device invokes the second cryptographic machine through which standard interface can be configured according to the needs of actual application scenarios, which is not specifically limited here.

[0124] In a preferred embodiment, the destination device invokes the first cryptographic machine and the source device invokes the second cryptographic machine using the same standard interface, for example, both use the PKCS11 interface, and the present solution can be used to realize the synchronization of the passwords even if the first cryptographic machine and the second cryptographic machine are of different models or generated by different manufacturers, and the synchronization of the keys between the cryptographic machines of different models is feasible, and the data security is ensured, the operation efficiency is improved, and the compatibility and expansibility of the system are improved.

[0125] In step S208, the source device sends the ciphertext data of the target key and the synchronization key token to the destination device.

[0126] After obtaining the ciphertext data of the target key, the source device sends the synchronization key token RT to the destination device together with the ciphertext data of the target key.

[0127] In step S209, the destination device receives the ciphertext data of the target key and the synchronization key token sent by the source device.

[0128] In step S210, if the verification of the verification information in the received synchronization key token is passed, the destination device determines the target key according to the private key of the temporary synchronization key and the ciphertext data of the target key.

[0129] After receiving the ciphertext data CMKM.Wrapped of the target key and the synchronization key token RT sent by the source device, the destination device verifies the verification information of the target key in the synchronization key token RT, and if the verification is passed, the private key of the temporary synchronization key is used to unwrap the ciphertext data of the target key (Unwrap operation) to obtain the target key.

[0130] In an optional embodiment, after obtaining the target key, the destination device invokes the first cryptographic machine to import the target key to import the target key into the first cryptographic machine.

[0131] In the present embodiment, the verification of the verification information in the received synchronization key token by the destination device includes:

[0132] In the case where the synchronization key token RT contains the digital signature of the verification information of the target key, the destination device invokes the first cryptographic machine to verify the digital signature of the verification information of the target key using the public key ERK.pub of the temporary synchronization key.

[0133] Exemplarily, the destination device invokes the first cryptographic machine to use the pre-configured hash function to perform digest calculation on the check information of the target key contained in the synchronization key token RT, and convert the check information of the target key into a hash value of fixed length. The destination device invokes the first cryptographic machine to use the public key ERK.pub of the temporary synchronization key to decrypt the digital signature of the check information of the target key contained in the synchronization key token RT, and verify whether the decryption result is consistent with the generated hash value. If the decryption result is consistent with the generated hash value, the digital signature verification of the check information of the target key is passed. Otherwise, if the decryption result is inconsistent with the generated hash value, the digital signature verification of the check information of the target key is failed. Wherein, the destination device verifies the digital signature using the same hash function as that used for generating the digital signature.

[0134] If the digital signature verification of the check information of the target key is failed, it is determined that the verification of the check information in the received synchronization key token is failed, and the subsequent operations of unwrapping the ciphertext data of the target key and importing the target key are not performed.

[0135] In the embodiment, the source device also sends the metadata of the target key to the destination device. The destination device receives the metadata of the target key sent by the source device to obtain the complete data of the target key, including the key material (i.e. the target key itself) and the metadata of the target key. The metadata of the key includes but is not limited to the key identification (such as key ID) of the key, the key type, the key length, the creation time, the last use time, the key use state, the access control information, the key description information, etc.

[0136] The metadata of the target key contains at least one check information of the target key. For example, the key ID, the key check value, etc. metadata can be used as the check information. The verification of the check information in the received synchronization key token can also include at least one of the following:

[0137] The check information in the synchronization key token contains the key identification, and the consistency of the key identification in the received synchronization key token and the key identification in the metadata of the target key is verified;

[0138] The check information in the synchronization key token contains the key check value, and the consistency of the key check value in the received synchronization key token and the key check value in the metadata of the target key is verified.

[0139] Exemplarily, in the case that the verification information of the target key contained in the received synchronization key token RT contains the key identifier, it is verified whether the key identifier in the verification information of the target key contained in the received synchronization key token RT is consistent with the key identifier in the metadata of the received target key. If the key identifier in the verification information of the target key contained in the received synchronization key token RT is inconsistent with the key identifier in the metadata of the received target key, it is determined that the verification of the verification information in the received synchronization key token fails.

[0140] Exemplarily, in the case that the verification information of the target key contained in the received synchronization key token RT contains the key verification value, it is verified whether the key verification value in the verification information of the target key contained in the received synchronization key token RT is consistent with the key verification value in the metadata of the received target key. If the key verification value in the verification information of the target key contained in the received synchronization key token RT is inconsistent with the key verification value in the metadata of the received target key, it is determined that the verification of the verification information in the received synchronization key token fails.

[0141] The above several verification manners of the verification information in the received synchronization key token can be used in combination. When the verification passes in each verification manner, it is determined that the verification of the verification information in the received synchronization key token passes. When the verification fails in any verification manner, it is determined that the verification of the verification information in the received synchronization key token fails.

[0142] In the embodiment, after receiving the ciphertext data of the target key and the synchronization key token sent by the source device, the destination device can obtain the target key by decapsulating the ciphertext data of the target key according to the private key of the temporary synchronization key.

[0143] In an optional embodiment, the destination device can store the private key ciphertext ERK.priv.encrypted of the temporary synchronization key. In this step, the destination device can obtain the private key ERK.priv of the temporary synchronization key by calling the first cryptographic machine to decrypt the locally stored private key ciphertext ERK.priv.encrypted of the temporary synchronization key using the persistent key.

[0144] In another optional embodiment, the destination device does not store the private key ciphertext ERK.priv.encrypted of the temporary synchronization key to reduce the possibility of leakage of the private key of the temporary synchronization key and improve the security of the key synchronization process. In this step, the destination device calls the first cryptographic machine to decrypt the private key ciphertext ERK.priv.encrypted of the temporary synchronization key in the synchronization key token RT using the persistent key to obtain the private key ERK.priv of the temporary synchronization key.

[0145] Further, the destination device can use the private key ERK.priv of the temporary synchronization key to unwrap the wrapped data CMKM.Wrapped of the target key (an Unwrap operation) to obtain the target key CMKM.

[0146] In particular, in the case that the target key CMKM is a symmetric key, the wrapped data CMKM.Wrapped of the target key includes a wrapped ciphertext CMKM.Wrapped ERK.pub of the target key (encrypted using the public key ERK.pub of the temporary synchronization key). In this step, the destination device invokes the first crypto engine to unwrap (i.e., an Unwrap operation) the wrapped ciphertext CMKM.Wrapped ERK.pub of the target key using the private key ERK.priv of the temporary synchronization key to obtain the target key CMKM.

[0147] In the case that the target key CMKM is an asymmetric key, the wrapped data CMKM.Wrapped of the target key includes a wrapped ciphertext CMKM.Wrapped ESK of the target key (encrypted using the temporary symmetric key ESK) and a wrapped ciphertext ESK.Wrapped of the temporary symmetric key. In this step, the destination device invokes the first crypto engine to unwrap (an Unwrap operation) the wrapped ciphertext ESK.Wrapped of the temporary symmetric key using the private key ERK.priv of the temporary synchronization key to obtain the temporary symmetric key ESK; and then unwrap the wrapped ciphertext CMKM.Wrapped ESK of the target key using the temporary symmetric key ESK to obtain the target key CMKM.

[0148] Optionally, in an optional embodiment, in the case that the target key CMKM is an asymmetric key, the wrapped data CMKM.Wrapped of the target key includes a wrapped private key CMKM.priv.Wrapped ESK of the target key (encrypted using the temporary symmetric key ESK) and a wrapped ciphertext ESK.Wrapped of the temporary symmetric key, and a public key CMKM.pub of the target key. In this step, the destination device invokes the first crypto engine to unwrap (an Unwrap operation) the wrapped ciphertext ESK.Wrapped of the temporary symmetric key using the private key ERK.priv of the temporary synchronization key to obtain the temporary symmetric key ESK; and then unwrap the wrapped private key CMKM.priv.Wrapped ESK of the target key using the temporary symmetric key ESK to obtain the private key CMKM.priv of the target key. Thus, the private key CMKM.priv and the public key CMKM.pub of the target key can be obtained.

[0149] Further, after obtaining the target key CMKM, the destination device calls the first cryptographic machine to import the target key CMKM, and completes synchronization of the target key.

[0150] The method of the embodiment, when the target key needs to be synchronized and imported from the second cryptographic machine to the first cryptographic machine, the source device associated with the second cryptographic machine provides the destination device associated with the first cryptographic machine with the verification information of the target key to be synchronized, the destination device generates an asymmetric temporary synchronization key for synchronizing the target key, and generates a synchronization key token based on the private key of the temporary synchronization key and the verification information of the target key, and the destination device provides the source device with the public key of the temporary synchronization key and the synchronization key token; the source device uses the public key of the temporary synchronization key to generate the ciphertext data of the target key, and transmits the ciphertext data of the target key and the synchronization key token to the destination device; the destination device determines the target key according to the private key of the temporary synchronization key and the ciphertext data of the target key in the case that the verification information in the received synchronization key token passes the verification, and imports the target key into the first cryptographic machine, and completes the key synchronization process. The ciphertext transmission of the target key can protect the security of the target key, and the private key of the temporary synchronization key and the verification information of the target key are encapsulated into the synchronization key token, and the verification of the verification information of the target key in the synchronization key token can ensure that the temporary synchronization key is only used for synchronizing the specified target key, can limit the use granularity / use range of the temporary synchronization key, avoid the temporary synchronization key being abused for synchronizing other keys, and improve the security of key synchronization.

[0151] In an optional embodiment, after the target key is imported into the first cryptographic machine, the destination device can also verify the verification information in the received synchronization key token in the following manner:

[0152] The destination device calls the first cryptographic machine to generate a verification value according to the target key. Further, the destination device verifies the consistency of the generated verification value with the key verification value in the synchronization key token RT, and / or verifies the consistency of the generated verification value with the key verification value in the metadata of the target key.

[0153] In the case that the generated verification value is inconsistent with the key verification value in the synchronization key token RT, it is determined that the verification fails. In the case that the generated verification value is inconsistent with the key verification value in the metadata of the target key, it is determined that the verification fails. In the case that all the verifications pass, it is determined that the verification of the verification information in the received synchronization key token passes.

[0154] Further, in the case that the verification fails, the destination device calls the first cryptographic machine to delete the imported target key, which can further ensure the authenticity, integrity and accuracy of the target key, and prompt the security of the target synchronization.

[0155] Figure 3 The signaling interaction diagram of key synchronization provided for an exemplary embodiment of the present application is as shown in FIG. 3. Figure 3 As shown in FIG. 3, the interaction flow between the source device and the destination device in the key synchronization process is as follows:

[0156] Step S301, the source device sends the verification information of the target key CMKM to the destination device.

[0157] Step S302, the destination device invokes the first cryptographic machine to generate a temporary synchronization key ERK, encrypts the private key of the temporary synchronization key using the persistent key, and generates a key synchronization token RT, which contains the verification information of the target key and the private key ciphertext ERK.priv.encrypted of the temporary synchronization key.

[0158] Step S303, the destination device returns the public key ERK.pub of the temporary synchronization key and the RT to the source device.

[0159] Step S304, the source device invokes the second cryptographic machine to encrypt and encapsulate CMKM using ERK.pub to generate CMKM.Wrapped.

[0160] Step S305, the source device sends the RT, CMKM.Wrapped and the metadata CMKM.Meta of CMKM to the destination device.

[0161] Step S306, the destination device invokes the first cryptographic machine to verify the RT and CMKM.Meta, unencapsulate CMKM.Wrapped and import CMKM.

[0162] The implementation principle and technical effects of the present embodiment are described above, and will not be repeated here.

[0163] In practical applications, key synchronization between different models of cryptographic machines also has important value. This mainly reflects in the following aspects: 1) data security: it can ensure that different models of cryptographic machines use the same key to encrypt and decrypt data, thereby ensuring the security of the data. This means that even when data is transmitted or shared between different models of cryptographic machines, there is no risk of data leakage or damage due to inconsistent keys. 2) Improve operational efficiency: it can ensure that different models of cryptographic machines can quickly and accurately synchronize keys, making the operation of the cryptographic machine more efficient and smooth. This helps to improve user experience, reduce the likelihood of operational errors and failures. 3) Compatibility and scalability: it can improve the compatibility and scalability of different models of cryptographic machines. Even if new cryptographic machine models are introduced in the future, they can be easily added to the key synchronization scheme without the need to redesign the entire key management system. Therefore, the key synchronization scheme for different models of cryptographic machines has important value in ensuring data security, improving operational efficiency, and improving the compatibility and scalability of the system.

[0164] In an optional embodiment, based on any of the foregoing key synchronization schemes, in this embodiment, the source device and the destination device use a unified standard cryptographic machine interface to call the cryptographic machine. Even if the second cryptographic machine associated with the source device and the first cryptographic machine associated with the destination device are different models or different manufacturers, password transmission can be achieved, and multiple different cryptographic machines can be compatible, with stronger compatibility and scalability.

[0165] Figure 4 A flowchart of the key synchronization method based on the standard cryptographic machine interface provided for an exemplary embodiment of the present application is shown in FIG. 4. As shown in FIG. 4, the specific steps of the key synchronization based on the standard cryptographic machine interface are as follows: Figure 4

[0166] Step S401, the source device sends the verification information of the target key to be synchronized to the destination device.

[0167] Step S402, the destination device receives the verification information of the target key to be synchronized sent by the source device.

[0168] Step S403, the destination device calls the first cryptographic machine based on the PKCS11 interface to generate an asymmetric temporary synchronization key ERK.

[0169] In this embodiment, the unified standard cryptographic machine interface used by the source device and the destination device in the key synchronization process is taken as an example of the PKCS11 interface. The unified standard cryptographic machine interface can also be a CSP interface or a national cryptographic interface, which is not specifically limited in this embodiment.

[0170] ​Step S404, the destination device calls the first cryptographic machine based on the PKCS11 interface, encrypts the private key of the temporary synchronization key ERK.Priv using the persistent key, to obtain the private key ciphertext of the temporary synchronization key ERK.priv.encrypted.

[0171] Step S405, the destination device calls the first cryptographic machine based on the PKCS11 interface, generates a digital signature of the verification information of the target key using the private key of the temporary synchronization key ERK.Priv.

[0172] Step S406, the destination device encapsulates the private key ciphertext of the temporary synchronization key ERK.priv.encrypted, the verification information of the target key, and the digital signature into a synchronization key token RT.

[0173] Step S407, the destination device returns the public key of the temporary synchronization key ERK.pub and the synchronization key token RT to the source device.

[0174] Step S408, the source device receives the public key of the temporary synchronization key ERK.pub and the synchronization key token RT returned by the destination device.

[0175] Step S409, the source device calls the second cryptographic machine based on the PKCS11 interface, and generates the ciphertext data CMKM.Wrapped of the target key based on the public key of the temporary synchronization key ERK.pub.

[0176] Step S410, the source device sends the synchronization key token RT, the ciphertext data CMKM.Wrapped of the target key, and the metadata CMKM.Meta to the destination device.

[0177] Step S411, the destination device receives the synchronization key token RT, the ciphertext data CMKM.Wrapped of the target key, and the metadata CMKM.Meta sent by the source device.

[0178] Step S412, in the case where the verification information in the synchronization key token RT is verified, the destination device calls the second cryptographic machine based on the PKCS11 interface, unpacks the ciphertext data CMKM.Wrapped of the target key, and imports the CMKM.

[0179] In an optional embodiment, after the target key is imported into the first cryptographic machine, the destination device can also verify the verification information in the received synchronization key token in the following manner:

[0180] The destination device calls the first cryptographic machine based on the PKCS11 interface, and generates a check value according to the target key. Further, the destination device verifies the consistency of the generated check value with the key check value in the synchronization key token RT, and / or verifies the consistency of the generated check value with the key check value in the metadata of the target key.

[0181] In the case where the generated check value is inconsistent with the key check value in the synchronization key token RT, it is determined that the verification fails. In the case where the generated check value is inconsistent with the key check value in the metadata of the target key, it is determined that the verification fails. In the case where all the verifications pass, it is determined that the verification of the check information in the received synchronization key token passes.

[0182] Further, in the case where the verification fails, the destination device calls the first cryptographic machine based on the PKCS11 interface, and deletes the imported target key, which can further ensure the authenticity, integrity and accuracy of the target key, and prompt the security of the target synchronization.

[0183] The specific implementation principles and technical effects of the embodiment can be referred to the foregoing embodiments, which will not be described here.

[0184] The method of the embodiment can call the associated cryptographic machine based on the unified standard cryptographic machine interface when the target key needs to be synchronized from the second cryptographic machine to the first cryptographic machine, and implement the foregoing key synchronization scheme. Even in the case where the second cryptographic machine associated with the source device and the first cryptographic machine associated with the destination device are cryptographic machines of different models or produced by different manufacturers, the cryptographic transmission can be implemented, and multiple different cryptographic machines can be compatible, which has stronger compatibility and expansibility.

[0185] On the basis of any of the foregoing key synchronization schemes, the destination device and the source device can use the same target key after completing the key synchronization. When the source device performs data synchronization to the destination device, the source device acquires target data ciphertext encrypted by the target key from the database in response to the data synchronization request, and sends the target data ciphertext to the destination device. The destination device receives the target data ciphertext sent by the source device, and stores the ciphertext of the target data to the local database. Thus, the data synchronization from the source device to the destination device can be completed, which not only ensures data security, but also improves the efficiency of data synchronization and the compatibility and expansibility of the system.

[0186] Figure 5 A flowchart of a data synchronization method based on key synchronization provided by an exemplary embodiment of the present application is shown in FIG. 5. Figure 5 As shown in FIG. 5, the process of data synchronization based on the foregoing key synchronization scheme is as follows:

[0187] In step S501, the source device sends check information of a target key to be synchronized to the destination device.

[0188] Step S502, the destination device calls the first cryptographic machine to generate an asymmetric temporary synchronization key, and generates a synchronization key token according to the private key of the temporary synchronization key and the verification information of the target key.

[0189] Step S503, the destination device returns the public key of the temporary synchronization key and the synchronization key token to the source device.

[0190] Step S504, the source device calls the second cryptographic machine to generate the ciphertext data of the target key based on the public key of the temporary synchronization key.

[0191] Step S505, the source device sends the ciphertext data of the target key and the synchronization key token to the destination device.

[0192] Step S506, in the case where the verification information in the received synchronization key token is verified, the destination device calls the first cryptographic machine to determine the target key according to the private key of the temporary synchronization key and the ciphertext data of the target key, and imports the target key into the first cryptographic machine.

[0193] The foregoing steps S501-S506 are the process of key synchronization, and the specific implementation principle and technical effects can be referred to the foregoing embodiments, which will not be described here again.

[0194] Step S507, the source device obtains the target data ciphertext encrypted by the target key from the database.

[0195] Step S508, the source device sends the target data ciphertext to the destination device.

[0196] Step S509, the destination device stores the target data ciphertext.

[0197] In the embodiment, after the key synchronization is completed, the destination device and the source device can use the same target key. When the source device performs data synchronization to the destination device, the source device directly obtains the target data ciphertext encrypted by the target key from the database, and sends the target data ciphertext to the destination device, so that the data synchronization from the source device to the destination device is completed. Not only the data security can be guaranteed, but also the efficiency of data synchronization can be improved, and the compatibility and expansibility of the system can be improved.

[0198] After the data synchronization is completed, the destination device can decrypt the target data ciphertext based on the synchronized target key to obtain the target data plaintext, and perform subsequent processing logic based on the target data plaintext, such as data analysis, query, statistics, display, storage, etc.

[0199] Exemplarily, in response to receiving the data analysis request sent by the end-side device, the target device decrypts the target data ciphertext using the target key to obtain target data plaintext; further, data analysis is performed according to the target data plaintext to obtain a data analysis result. The target device returns the data analysis result to the end-side device.

[0200] Figure 6 A structural schematic diagram of a server is provided in the embodiments of the present application. As shown in the figure, the server includes a memory 601 and a processor 602. The memory 601 is configured to store computer execution instructions and can be configured to store various other data to support operations on the server. The processor 602 is in communication connection with the memory 601 and is configured to execute the computer execution instructions stored in the memory 601 to implement the technical solutions provided by any of the method embodiments described above, and the specific functions and technical effects that can be achieved are similar, and will not be described here. Figure 6

[0201] Optionally, as shown in the figure, the server further includes a firewall 603, a load balancer 604, a communication component 605, a power supply component 606 and other components. Figure 6 Figure 6 Only part of the components are shown in the figure, and it does not mean that the server only includes the components shown in the figure. Figure 6 Figure 6 Only the server is exemplarily illustrated as a cloud server deployed in the cloud in the embodiments, and the server can also be deployed locally, which is not limited here.

[0202] The embodiments of the present application further provide a computer readable storage medium, and the computer readable storage medium stores computer execution instructions. When the processor executes the computer execution instructions, the method of any of the preceding embodiments is implemented, and the specific functions and technical effects that can be achieved will not be described here.

[0203] The embodiments of the present application further provide a computer program product, which includes a computer program. When the computer program is executed by a processor, the method of any of the preceding embodiments is implemented. The computer program is stored in a readable storage medium, and at least one processor of the server can read the computer program from the readable storage medium. The at least one processor executes the computer program to make the server execute the technical solutions provided by any of the method embodiments described above, and the specific functions and technical effects that can be achieved will not be described here.

[0204] ​​​The embodiment of the present application provides a chip, comprising: a processing module and a communication interface, the processing module can execute the technical solution of the server in the foregoing method embodiment. Optionally, the chip further comprises a storage module (such as a memory), the storage module is used for storing instructions, the processing module is used for executing the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to execute the technical solution provided by any of the foregoing method embodiments.

[0205] The integrated module in the form of the software function module can be stored in a computer readable storage medium. The software function module is stored in a storage medium, and includes a plurality of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute part of steps of the method of each embodiment of the present application.

[0206] It should be understood that the processor can be a central processing unit (CPU), a graphics processing unit (GPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the application can be directly embodied as hardware processor execution or combined execution by hardware and software modules in at least one processor.

[0207] The memory can include a high-speed random access memory (RAM), and can also include a nonvolatile storage, for example, at least one disk memory, and can also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0208] The memory can be object storage (OSS).

[0209] The aforementioned memory can be implemented by any type of volatile or nonvolatile memory devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0210] The aforementioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access wireless networks based on communication standards, such as mobile hotspots (WiFi), second generation (2G), third generation (3G), fourth generation (4G) / long term evolution (LTE), fifth generation (5G) mobile communication networks, or a combination thereof. In an example embodiment, the communication component receives broadcast signals or broadcast related information from an external broadcast managing system via a broadcast channel. In an example embodiment, the communication component further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared technology, ultra wideband (UWB) technology, Bluetooth technology, and other technologies.

[0211] The aforementioned power component provides power to various components of the device where the power component is located. The power component can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device where the power component is located.

[0212] The storage medium can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read only memory (EEPROM), an erasable programmable read only memory (EPROM), a programmable read only memory (PROM), a read only memory (ROM), a magnetic storage, a flash memory, a magnetic disk or a compact disk.

[0213] An exemplary storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium. Of course, the storage medium can be a part of the processor. Consistent with the teachings provided herein, the processor and storage medium can be located in a single component or distributed across multiple components. The storage medium can be embodied in a computer-readable medium.

[0214] It is important to note that the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0215] The sequence of the above-mentioned embodiments is only for description, and does not represent the advantages and disadvantages of the embodiments. In addition, some of the processes described in the above embodiments and the accompanying drawings contain a plurality of operations appearing in a specific order, but it should be clearly understood that these operations can be executed in the order appearing in this text or in parallel, only to distinguish different operations. The sequence number itself does not represent any execution order. In addition, these processes can include more or fewer operations, and these operations can be executed in sequence or in parallel. It should be noted that the "first", "second", etc. in this text are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence. "Multiple" means more than two, unless otherwise specifically limited.

[0216] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, also can be through hardware, but in many cases the former is the better embodiment. Based on such understanding, the technical solutions of the present application essentially or say the part of the prior art to make contributions can be embodied in the form of software products, the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), including a number of instructions to make a terminal device (may be a mobile phone, computer, server, air conditioner, or network equipment, etc.) executes the method of each embodiment of the present application.

[0217] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the present application cover any and all variations of the application that come within the scope of the present application along with its general principles and features. This application is intended to cover any adaptations or variations of the application.

[0218] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, any equivalent structure or equivalent process transformation using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A key synchronization method, characterized in that, Applied to a target device, the method includes: Receive verification information of the target key to be synchronized sent by the source device; Generate a temporary synchronization key, generate a synchronization key token based on the private key of the temporary synchronization key and the verification information of the target key, and return the public key of the temporary synchronization key and the synchronization key token to the source device; Receive the encrypted data of the target key and the synchronization key token sent by the source device; If the verification information in the received synchronization key token passes, the target key is determined based on the private key of the temporary synchronization key and the ciphertext data of the target key.

2. The method according to claim 1, characterized in that, The target device is associated with a first cryptographic machine, and the step of generating a synchronization key token based on the private key of the temporary synchronization key and the verification information of the target key includes: The first cryptographic machine is called based on the standard interface, and the private key of the temporary synchronization key is encrypted using the persistent key to obtain the ciphertext of the private key of the temporary synchronization key; The first cryptographic machine is called based on the standard interface, and the verification information of the target key is signed using the private key of the temporary synchronization key to obtain the digital signature of the target key verification information; Generate a token containing the private key ciphertext of the temporary synchronization key, the verification information of the target key, and the digital signature, as a synchronization key token.

3. The method according to claim 2, characterized in that, Before determining the target key based on the private key of the temporary synchronization key and the ciphertext data of the target key, the method further includes: The first cryptographic machine is called based on the standard interface, and the private key ciphertext of the temporary synchronization key in the synchronization key token is decrypted using the persistent key to obtain the private key of the temporary synchronization key.

4. The method according to any one of claims 1-3, characterized in that, Determining the target key based on the private key of the temporary synchronization key and the ciphertext data of the target key includes: When the target key is a symmetric key, the ciphertext data of the target key includes the ciphertext of the target key. The ciphertext of the target key is decapsulated using the private key of the temporary synchronization key to obtain the target key.

5. The method according to any one of claims 1-3, characterized in that, Determining the target key based on the private key of the temporary synchronization key and the ciphertext data of the target key includes: When the target key is an asymmetric key, the ciphertext data of the target key includes the ciphertext of the target key and the ciphertext of the temporary symmetric key. The ciphertext of the temporary symmetric key is decapsulated using the private key of the temporary synchronization key to obtain the temporary symmetric key. The target key is obtained by decrypting the ciphertext of the target key using the temporary symmetric key.

6. The method according to claim 2, characterized in that, The verification of the verification information in the received synchronization key token includes: The first cryptographic machine is invoked based on a standard interface, and the public key of the temporary synchronization key is used to verify the digital signature of the verification information of the target key.

7. The method according to claim 2, characterized in that, Also includes: Receive metadata of the target key sent by the source device; The verification of the verification information in the received synchronization key token includes: The verification information in the synchronization key token includes a key identifier, which verifies the consistency between the key identifier in the received synchronization key token and the key identifier in the metadata of the target key. And / or, The verification information in the synchronization key token includes a key verification value, which verifies the consistency between the key verification value in the received synchronization key token and the key verification value in the metadata of the target key.

8. The method according to claim 2, characterized in that, Also includes: Import the target key into the first cryptographic machine; The first cryptographic machine is invoked based on a standard interface to generate a verification value according to the target key; Verify the consistency between the generated verification value and the key verification value in the synchronization key token, and / or verify the consistency between the generated verification value and the key verification value in the metadata of the target key; If the verification fails, the first cryptographic machine is called via a standard interface to delete the imported target key.

9. The method according to claim 1, characterized in that, Also includes: Receive the target data ciphertext sent by the source device and store the target data ciphertext; In response to receiving a data analysis request, the target data ciphertext is decrypted using the target key to obtain the target data plaintext, and data analysis is performed based on the target data plaintext to obtain the data analysis results.

10. A key synchronization method, characterized in that, Applied to a source device, the method includes: Send the verification information of the target key to be synchronized to the destination device; Receive the public key and synchronization key token of the temporary synchronization key returned by the target device, wherein the synchronization key token contains the verification information of the target key; The ciphertext data of the target key is generated based on the public key of the temporary synchronization key; Send the encrypted data of the target key and the synchronization key token to the target device.

11. The method according to claim 10, characterized in that, The source device is associated with a second cryptographic machine, and the generation of ciphertext data for the target key based on the public key of the temporary synchronization key includes: If the target key is a symmetric key, the second cryptographic machine is called based on the standard interface, and the target key is encrypted and encapsulated using the public key of the temporary synchronization key to obtain the ciphertext of the target key, which serves as the ciphertext data of the target key.

12. The method according to claim 10, characterized in that, The process of generating the ciphertext data of the target key based on the public key of the temporary synchronization key includes: If the target key is an asymmetric key, a temporary symmetric key is generated by calling a second cryptographic machine based on a standard interface. The second cryptographic machine is called based on the standard interface. The target key is encrypted and encapsulated using the temporary symmetric key to obtain the ciphertext of the target key. The temporary symmetric key is then encrypted and encapsulated using the public key of the temporary synchronization key to obtain the ciphertext of the temporary symmetric key. The ciphertext data of the target key includes the ciphertext of the target key and the ciphertext of the temporary symmetric key.

13. The method according to any one of claims 10-12, characterized in that, Also includes: Send the metadata of the target key to the target device.

14. The method according to any one of claims 10-12, characterized in that, Also includes: In response to a data synchronization request, the target data ciphertext encrypted with the target key is retrieved from the database and sent to the target device.

15. A server, characterized in that, include: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, cause the server to perform the method according to any one of claims 1-14.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1-14.

17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-14.