Data synchronization method and device, storage medium and electronic equipment
By splitting the data to be synchronized into data fragments and using encryption and zero-knowledge proof, the risk of data leakage during data transmission is solved, and privacy and security protection during data synchronization is achieved.
Patent Information
- Application Number
- CN202410989420.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-22
AI Technical Summary
The prior art has the risk of data leakage during data transmission, which affects data privacy.
By dividing the data to be synchronized into data fragments, encrypted data blocks are generated, and zero-knowledge proof is used to prove that the data blocks meet preset attributes, avoid directly revealing the data content and reduce the risk of data leakage.
It effectively protects the privacy and security of the data synchronization process, reduces the risk of data leakage, and does not need to disclose the actual data content to the recipient.
Smart Images

Figure CN119003654A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data synchronization method, device, storage medium and electronic device. Background Art
[0002] Many application systems on the Internet need to share and synchronize data to achieve collaborative work, information exchange and integration of business processes.
[0003] At present, related technologies use the transmission protocol agreed upon between application systems to transmit the data content to be synchronized. However, related technologies disclose the actual data content during the data transmission process, which poses a risk of data leakage and affects data privacy. Summary of the invention
[0004] In view of this, the present application provides a data synchronization method, device, storage medium and electronic device, the main purpose of which is to improve the current technical problem that the actual data content is disclosed during the data transmission process, there is a risk of data leakage, and affects the privacy of the data.
[0005] In a first aspect, the present application provides a data synchronization method, applied to a sender, comprising:
[0006] Divide the data to be synchronized into data segments, and obtain a first data block corresponding to the data to be synchronized;
[0007] Encrypting the first data block to obtain a second data block encrypted from the first data block;
[0008] Generate a zero-knowledge proof corresponding to the second data block according to the data synchronization requirement of the data to be synchronized, wherein the zero-knowledge proof is used to prove that the second data block satisfies a preset attribute corresponding to the data synchronization requirement;
[0009] The second data block and the zero-knowledge proof are sent to a receiver, and the receiver is configured to perform data synchronization according to a verification result of the zero-knowledge proof.
[0010] In a second aspect, the present application provides a data synchronization method, applied to a receiving party, comprising:
[0011] Receive a first data block corresponding to the data to be synchronized sent by the sender, and a zero-knowledge proof corresponding to the first data block, where the zero-knowledge proof is used to prove that the first data block meets a preset attribute corresponding to a data synchronization requirement;
[0012] Verify whether the zero-knowledge proof is valid according to the data synchronization requirement of the data to be synchronized;
[0013] If the zero-knowledge proof is valid, decrypting the first data block to obtain a second data block obtained by decrypting the first data block;
[0014] The second data block is merged to obtain the data to be synchronized sent by the sender.
[0015] In a third aspect, the present application provides a data synchronization device, applied to a sender, comprising:
[0016] an acquisition module, configured to divide the data to be synchronized into a plurality of data segments, and generate a first data block corresponding to the data to be synchronized according to the data segments;
[0017] an acquisition module, configured to encrypt the first data block and acquire a second data block encrypted from the first data block;
[0018] A generating module, configured to generate a zero-knowledge proof corresponding to the second data block according to a data synchronization requirement of the data to be synchronized, wherein the zero-knowledge proof is used to prove that the second data block satisfies a preset attribute corresponding to the data synchronization requirement;
[0019] The sending module is configured to send the second data block and the zero-knowledge proof to a receiver, and the receiver is used to perform data synchronization according to the verification result of the zero-knowledge proof.
[0020] In a fourth aspect, the present application provides a data synchronization device, applied to a receiving party, comprising:
[0021] A receiving module, configured to receive a first data block corresponding to the data to be synchronized sent by a sender, and a zero-knowledge proof corresponding to the first data block, wherein the zero-knowledge proof is used to prove that the first data block meets a preset attribute corresponding to a data synchronization requirement;
[0022] A verification module, configured to verify whether the zero-knowledge proof is valid according to the data synchronization requirement of the data to be synchronized;
[0023] an acquisition module, configured to decrypt the first data block if the zero-knowledge proof is valid, and acquire a second data block obtained by decrypting the first data block;
[0024] The acquisition module is configured to merge the second data block and acquire the data to be synchronized sent by the sender.
[0025] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the data synchronization method described in the first aspect is implemented.
[0026] In a sixth aspect, the present application provides an electronic device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the data synchronization method described in the first aspect when executing the computer program.
[0027] By means of the above technical scheme, the present application provides a data synchronization method, device, storage medium and electronic device, wherein the sender first divides the data to be synchronized into data segments, and obtains a first data block corresponding to the data to be synchronized; then encrypts the first data block, and obtains a second data block after the first data block is encrypted; then, based on the data synchronization requirement of the data to be synchronized, a zero-knowledge proof corresponding to the second data block is generated, and the zero-knowledge proof is used to prove that the second data block meets the preset attributes corresponding to the data synchronization requirement; finally, the second data block and the zero-knowledge proof are sent to the receiver, and the receiver is used to synchronize data according to the verification result of the zero-knowledge proof. Compared with the current existing technology, in the present application, the sender first divides the data to be synchronized into data segments, obtains the first data block corresponding to the data to be synchronized, then obtains the second data block encrypted by the first data block, and generates a zero-knowledge proof corresponding to the second data block, and sends the second data block and the zero-knowledge proof to the receiver, so that the receiver synchronizes the data according to the verification result of the zero-knowledge proof. The sender proves to the receiver that the second data block meets the preset attributes corresponding to the data synchronization requirements without revealing the actual data content to the receiver, thereby reducing the risk of data leakage and protecting the privacy during the data synchronization process.
[0028] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0031] Figure 1 A schematic diagram of a data synchronization method provided in an embodiment of the present application is shown;
[0032] Figure 2A schematic diagram of a data synchronization method provided in an embodiment of the present application is shown;
[0033] Figure 3 A schematic diagram of the structure of a data synchronization device provided in an embodiment of the present application is shown;
[0034] Figure 4 A schematic diagram of the structure of a data synchronization device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0035] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0036] In order to improve the current technical problem that the actual data content is disclosed during the data transmission process, there is a risk of data leakage and affects the data privacy. This embodiment provides a data synchronization method, which can be applied to the sender, such as Figure 1 As shown, the method includes:
[0037] Step 101: The sender divides the data to be synchronized into data segments and obtains a first data block corresponding to the data to be synchronized.
[0038] Among them, the first data block may include multiple data fragments (data blocks), and the data block is the smallest unit used to divide data in the process of data segmentation; the data to be synchronized may be data that needs to be synchronized between the sender and the receiver, such as: system synchronization data, user privacy data, etc.; the sender and the receiver may be application systems.
[0039] In this embodiment, the sender can divide the data to be synchronized to the receiver according to data synchronization requirements (for example, privacy protection requirements), obtain multiple data blocks, use the divided multiple data blocks as the first data block, process the first data block, and transmit the data after dividing, thereby improving the security of data transmission.
[0040] For example, when the data to be synchronized includes user privacy data, the sender can split the data to be synchronized according to data fields. To protect customer privacy, the sender can select publicly available data for direct synchronization, perform privacy protection processing on data involving user privacy, and then synchronize it to the receiver.
[0041] Step 102: The sender encrypts the first data block and obtains a second data block obtained by encrypting the first data block.
[0042] In this embodiment, an encryption algorithm may be used to encrypt the first data block. The encryption algorithm may include but is not limited to a hash algorithm, a symmetric encryption algorithm, an asymmetric encryption algorithm, etc. For example, the Advanced Encryption Standard (AES) symmetric encryption algorithm may be used to encrypt each data fragment in the first data block, and an appropriate key may be selected for encryption operations to ensure that the encrypted data is not easily obtained by unauthorized personnel during transmission, thereby protecting data privacy.
[0043] Step 103: The sender generates a zero-knowledge proof corresponding to the second data block according to the data synchronization requirement of the data to be synchronized. The zero-knowledge proof is used to prove that the second data block meets the preset attributes corresponding to the data synchronization requirement.
[0044] Among them, zero-knowledge proof may include but is not limited to proof statements (declarative information of proof), verification information required for proof (proof information), etc., and preset attributes may include but are not limited to preset attributes of the data to be synchronized, such as: consistency, integrity, legality, access rights, ownership, specific rules, etc.
[0045] In this embodiment, the sender generates a corresponding zero-knowledge proof for each data block using a zero-knowledge proof algorithm. The zero-knowledge proof generation process ensures that the sender has data that meets preset attributes (specific conditions) without revealing the details of the specific data to the receiver. A zero-knowledge proof is generated to prove the preset attributes of data synchronization without directly revealing the details of sensitive data, thereby reducing the risk of data leakage or tampering, improving the reliability and accuracy of data synchronization, and effectively protecting the privacy of data.
[0046] Step 104: The sender sends the second data block and the zero-knowledge proof to the receiver, and the receiver performs data synchronization according to the verification result of the zero-knowledge proof.
[0047] In this embodiment, after generating the zero-knowledge proof corresponding to the second data block, the second data block and the zero-knowledge proof can be sent to the recipient for verification. By generating the zero-knowledge proof corresponding to the second data block by the sender and then verifying the zero-knowledge proof by the recipient, there is no need to disclose the actual data content during the data synchronization process, thereby protecting the privacy and security of the data synchronization process.
[0048] Compared with the current existing technology, in this embodiment, the sender first divides the data to be synchronized into data segments, obtains the first data block corresponding to the data to be synchronized, then obtains the second data block encrypted by the first data block, and generates a zero-knowledge proof corresponding to the second data block, and sends the second data block and the zero-knowledge proof to the receiver, so that the receiver synchronizes the data according to the verification result of the zero-knowledge proof. The sender proves to the receiver that the second data block meets the preset attributes corresponding to the data synchronization requirements without revealing the actual data content to the receiver, thereby reducing the risk of data leakage and protecting the privacy during the data synchronization process.
[0049] To further illustrate the specific implementation process of the method of this embodiment, optionally, step 101 may specifically include: determining a data segmentation method according to data synchronization requirements; segmenting the data to be synchronized into data segments according to the data segmentation method, and generating a first data block corresponding to the data to be synchronized.
[0050] For example, the data to be synchronized is a customer order database, which contains the following fields: order number, customer name, product name, quantity, and amount. Data synchronization requirements: When synchronizing customer order data with suppliers, customer privacy needs to be protected. Only the customer name and product name fields can be synchronized, and other fields need to be processed for privacy protection.
[0051] Correspondingly, the data partitioning process is as follows:
[0052] Data block definition: define a data block that contains customer name and product name fields;
[0053] Data block division: divide each order into a data block. The specific steps are as follows:
[0054] (1) Traverse the customer order database to be synchronized, processing one order at a time;
[0055] (2) For each order, extract field information such as order number, customer name, product name, quantity, and amount;
[0056] (3) Create a data block and fill the order number, customer name, and product name fields into the data block;
[0057] (4) Add the data block to the data block set;
[0058] (5) Continue to traverse the next order and repeat the above steps until all orders have been processed.
[0059] The division of data blocks can be flexibly adjusted based on the size, type, content, etc. of the data to meet specific data synchronization requirements.
[0060] Optionally, step 102 may specifically include: determining a key for encrypting the first data block; symmetrically encrypting the first data block using an AES algorithm according to the key to obtain a second data block, wherein the second data block includes an identifier for data block sorting and reorganization.
[0061] In this embodiment, the AES symmetric encryption algorithm is applied to each data block in the first data block, and an appropriate key is selected for encryption operation to obtain the second data block. The AES algorithm is a safe and efficient symmetric encryption algorithm that can meet the needs of data encryption. In the specific encryption process, the sender can encrypt each data block using the same key to ensure that the encrypted data is not easily obtained by unauthorized personnel during the transmission process.
[0062] Specifically, for key management, the sender and the receiver may share a key to ensure that the receiver can decrypt the received data block, and the generation and distribution of the key may use the Diffie-Hellman key exchange negotiation protocol.
[0063] Accordingly, in order to be able to identify and reassemble data blocks during data transmission, the sender can assign a unique identifier (serial number) to each data block, and the identifier can be attached to the encrypted data block to ensure that the receiver can correctly sort and reassemble the data blocks.
[0064] Exemplarily, the content of a text file that needs to be segmented and encrypted is: "Hello, World! This is a sample text." The text file is segmented according to a predetermined rule (for example, a fixed length, a specific separator, etc.), and the following segmented data blocks are obtained: "Hello," "World!", "This", "is", "a", "sample", "text." Then, an encryption algorithm is applied to each segmented data block for encryption. The same key can be used to encrypt each data block. Assuming that the selected key is "SecretKey123", the AES encryption algorithm is applied to each data block, and the following encrypted data blocks are obtained accordingly. Data block: "x7OWz9 / 8UBKnbA7nS+YYWw==", "BHTgTlLgNLWKvq45O2Rb0A==", "Rjveg+72G1C6FLB8uJPjwQ==", "v6x2NfdiW4 nwY6IT8aB8+Q==", "GL8tLHk8F7n / QXrLcNKy2A==", "72uCxybSioo / lKc8zQz6NA==", "wbNPyxQGVCuqSc4KkZxqYg==".
[0065] Optionally, step 103 may specifically include: determining the proof statement and proof information corresponding to the second data block based on data synchronization requirements, the proof statement being used to describe preset attributes of the second data block; and calculating the proof statement and proof information using a zero-knowledge proof algorithm to generate a zero-knowledge proof corresponding to the second data block.
[0066] First, the sender selects the proof statement to be proved. The proof statement can be used to describe the preset attributes of data synchronization. For example, if you want to prove that sender A owns the second data blocks D1 and D2, you can choose the proof statement to prove: "A owns D1 and D2, and has access rights and ownership.", which describes A's ownership and access rights to D1 and D2, that is, A claims to own these data blocks and has the right to access them. By selecting this statement as the statement to be proved, A can prove its control over D1 and D2 to the receiver (verifier) without revealing the specific data content.
[0067] Accordingly, the selected proof statement should be consistent with the privacy protection requirements of data synchronization to ensure that the receiver can verify the correctness and compliance of data synchronization. The receiver (verifier) can use the corresponding verification algorithm to verify the correctness of the zero-knowledge proof to confirm that A does indeed own D1 and D2.
[0068] Specifically, the sender may use a zero-knowledge proof algorithm to calculate the selected proof statement to generate a corresponding zero-knowledge proof. The zero-knowledge proof generation process may include but is not limited to the generation, calculation, and interaction of random numbers to ensure the validity and security of the zero-knowledge proof.
[0069] For example, A has D1 and D2, and wants to prove to the recipient B that A has these two data blocks without directly revealing the content of the data. A can first select two random numbers r1 and r2, and calculate the proof information Y1 and Y2 corresponding to D1 and D2 respectively according to the following formula:
[0070] Y1=r1⊕H(D1)
[0071] Y2=r2⊕H(D2)
[0072] Where H represents the hash function, ⊕ represents the XOR operation, r1 and r2 are random numbers, and D1 and D2 are data blocks.
[0073] Next, A needs to generate proof information V1 and V2, the formula is as follows:
[0074] V1=r1⊕H(D1⊕D2)
[0075] V2=r2⊕H(D1⊕D2)
[0076] Where V1 and V2 are proof information, and A can pass Y1, Y2, V1 and V2 to B for verification.
[0077] Optionally, the method of this embodiment may further include: providing the hash value H' calculated by A to the receiver B. During data integrity verification, B calculates the hash value H of the received data block and compares it with the provided hash value H', thereby performing integrity verification of the data block. The calculation formula of the hash value H' is as follows:
[0078] H'=H(D1⊕D2⊕r1⊕r2)
[0079] Where H represents the hash function, ⊕ represents the XOR operation, r1 and r2 are random numbers, D1 and D2 are data blocks, and H' is the hash value after the XOR operation.
[0080] Compared with the current existing technology, this embodiment can use data encryption technology to encrypt the first data block, and determine the proof statement and proof information corresponding to the second data block based on the data synchronization requirements, and provide the recipient with proof of data verification, thereby effectively protecting the privacy of the data and preventing sensitive information from being accessed and leaked.
[0081] To illustrate the processing process of the receiving party, further, this embodiment also provides a data synchronization method, which is applied to the receiving party, such as Figure 2 As shown, the method includes:
[0082] Step 201: A receiver receives a first data block corresponding to the data to be synchronized sent by a sender, and a zero-knowledge proof corresponding to the first data block, where the zero-knowledge proof is used to prove that the first data block meets a preset attribute corresponding to a data synchronization requirement.
[0083] Exemplarily, the receiver receives a first data block and a zero-knowledge proof corresponding to the first data block from a data transmission channel, and checks the zero-knowledge proof to ensure that complete zero-knowledge proof data is received so as to perform subsequent synchronization operations.
[0084] Step 202: The receiver verifies whether the zero-knowledge proof is valid based on the data synchronization requirements of the data to be synchronized.
[0085] For example, the receiver can verify whether the zero-knowledge proof is valid and confirm whether the first data block meets the preset attributes such as correctness, compliance, and integrity without obtaining access to the original data or understanding the actual data content, thereby protecting the privacy and security of the data synchronization process. Specifically, after receiving the data block and the zero-knowledge proof, the receiver uses the same zero-knowledge proof algorithm for verification. The verification process can be completed by verifying the signature of the proof, checking the consistency of the proof, etc.
[0086] Step 203: If the zero-knowledge proof is valid, the receiver decrypts the first data block to obtain a second data block obtained by decrypting the first data block.
[0087] In this embodiment, the zero-knowledge proof verification module can verify the validity of the zero-knowledge proof provided by the sender and perform data integrity verification to ensure the authenticity and integrity of the data and achieve privacy protection of data synchronization between application systems. After successful verification, the first data block can be decrypted using a decryption algorithm that corresponds to the encryption algorithm of the sender to obtain the decrypted second data block, thereby ensuring the readability of the data.
[0088] Step 204: The receiver merges the second data block and obtains the data to be synchronized sent by the sender.
[0089] In this embodiment, the receiver may merge the decrypted second data blocks to restore the original data content, thereby ensuring the integrity of the data.
[0090] Compared with the current existing technology, the receiver can determine whether the first data block meets the preset attributes by verifying whether the zero-knowledge proof is valid. If the zero-knowledge proof is valid, the first data block is decrypted to obtain the second data block, and the second data block is merged to obtain the data to be synchronized sent by the sender. There is no need to obtain the actual data content, which reduces the risk of data leakage and protects the privacy during the data synchronization process.
[0091] Optionally, step 202 may specifically include: parsing the zero-knowledge proof, extracting the proof statement and proof information corresponding to the zero-knowledge proof, the proof statement being used to describe the preset attributes of the first data block; and using a zero-knowledge proof algorithm to verify whether the zero-knowledge proof is valid based on the proof statement and the proof information.
[0092] Exemplarily, the receiver receives an encrypted first data block and a zero-knowledge proof from a data transmission channel, parses the zero-knowledge proof, and obtains the proof statement and proof information (related information). The parsing process may be performed according to the format and protocol of the zero-knowledge proof to ensure that the receiver can correctly obtain the proof statement and related information of the zero-knowledge proof. The receiver then uses the same zero-knowledge proof algorithm to perform verification operations. Specifically, the receiver may use the parameters and public information agreed with the sender to verify the received zero-knowledge proof to confirm its validity and compliance.
[0093] For example, the receiver B parses the data transmitted by the sender A, extracts the encrypted first data block and the corresponding zero-knowledge proof, and then performs zero-knowledge proof verification to verify the proof information Y1 and Y2: B randomly generates challenge values c1 and c2; B uses the challenge value, public parameters, Y1, Y2 and the corresponding proof to calculate two response values r1 and r2. Among them, r1=c1⊕Y1, r2=c2⊕Y2; B checks whether r1 and r2 meet the verification conditions, that is, whether they are consistent with the proof provided by A; compares whether the calculated r1 is equal to the r1 provided by A, and compares whether the calculated r2 is equal to the r2 provided by A. If the calculated r1 is equal to the r1 provided by A, and the calculated r2 is equal to the r2 provided by A, it means that r1 and r2 are consistent with the proof provided by A, and the verification is passed.
[0094] Correspondingly, after verifying the proof information Y1 and Y2, the proof information V1 and V2 can be verified: B randomly generates challenge values c3 and c4; B uses the challenge value and public parameters, as well as V1, V2 and the corresponding proof from A, to calculate two response values s1 and s2. Among them, s1=c3⊕V1, s2=c4⊕V2; B checks whether s1 and s2 meet the verification conditions, that is, whether they are consistent with the proof provided by A. Compare whether the calculated s1 is equal to V1 provided by A, and compare whether the calculated s2 is equal to V2 provided by A. If the calculated s1 is equal to V1 provided by A, and the calculated s2 is equal to V2 provided by A, then s1 and s2 are consistent with the proof provided by A, and the verification is passed.
[0095] Optionally, data integrity verification can also be performed: B uses the SHA-256 hash function to perform hash calculation on the received data block to obtain a hash value H; B compares the hash value H' provided by A. If H and H' are equal, the data integrity verification passes, otherwise the verification fails.
[0096] Correspondingly, if all the verifications in the above verification steps are successful and the data integrity verification is also passed, then B can confirm that the zero-knowledge proof is valid, that is, A has the corresponding data block and can perform subsequent data synchronization operations without directly understanding the content of the data.
[0097] It adopts a zero-knowledge proof algorithm, which does not disclose the specific data content during the data transmission process. It only provides proof of the legitimacy of the data, effectively protects the privacy of the data, and prevents unauthorized access and leakage of sensitive information. It can verify the consistency and integrity of the data, ensure that the data is not tampered with or damaged during transmission, enhance the reliability and accuracy of the data synchronization process, confirm the legitimacy of the data and the credibility of the privacy protection measures, and can also be customized and adapted according to different application scenarios and needs to meet the privacy protection needs of data synchronization between various application systems. It has high flexibility and scalability.
[0098] Optionally, decrypting the first data block and obtaining a second data block after the decryption of the first data block may specifically include: obtaining a key for encrypting the first data block; decrypting the first data block using an AES algorithm based on the key to obtain a second data block, wherein the second data block includes an identifier for data block sorting and reorganization.
[0099] Specifically, the receiving party uses the corresponding key and encryption algorithm to decrypt the received encrypted data block, and converts the encrypted first data block into original plaintext data, that is, the second data block.
[0100] Exemplary: Decrypt each data block using the AES decryption algorithm and the key "SecretKey123";
[0101] Decrypt data block 1 and decrypt the ciphertext "x7OWz9 / 8UBKnbA7nS+YYWw==" into plaintext "Hello,";
[0102] Decrypt data block 2, decrypt the ciphertext "BHTgTlLgNLWKvq45O2Rb0A==" into the plaintext "World!";
[0103] Decrypt data block 3, decrypt the ciphertext "Rjveg+72G1C6FLB8uJPjwQ==" into the plaintext "This is";
[0104] Decrypt data block 4, decrypt the ciphertext "v6x2NfdiW4nwY6IT8aB8+Q==" into the plaintext "a sampl";
[0105] Decrypt data block 5 and decrypt the ciphertext "GL8tLHk8F7n / QXrLcNKy2A==" into plaintext "e text.".
[0106] Decrypt data block 6 and decrypt the ciphertext "72uCxybSioo / lKc8zQz6NA==" into an empty string "". This is because there may be empty data blocks filled in the data segmentation process.
[0107] Decrypt data block 7 and decrypt the ciphertext "wbNPyxQGVCuqSc4KkZxqYg==" into an empty string "".
[0108] Optionally, step 204 may specifically include: obtaining a data segmentation method corresponding to the data synchronization requirement; merging the second data blocks according to the data segmentation method and the identifier to generate the data to be synchronized sent by the sender.
[0109] Specifically, the receiver merges the decrypted second data blocks according to the segmentation method corresponding to the data synchronization requirement or the segmentation method of the sender. The data merging process can be performed according to the identifier or other relevant information corresponding to the second data block to ensure the correct order of the second data block and the integrity of the data to be synchronized. Exemplarily, the decrypted second data blocks are merged according to the order corresponding to the identifier to obtain the original data: "Hello, World! This is a sample text.".
[0110] Compared with current existing technologies, zero-knowledge proof only focuses on the validity of the proof without involving the specific data content, thus achieving privacy protection for data synchronization between application systems and ensuring that sensitive information will not be leaked or tampered with during transmission.
[0111] Further, as Figure 1 The specific implementation of the method shown in the embodiment provides a data synchronization device, which is applied to the sender, such as Figure 3 As shown, the device includes: an acquisition module 31, a generation module 32, and a sending module 33.
[0112] The acquisition module 31 is configured to divide the data to be synchronized into a plurality of data segments, and generate a first data block corresponding to the data to be synchronized according to the data segments;
[0113] The acquisition module 31 is configured to encrypt the first data block and acquire a second data block encrypted from the first data block;
[0114] A generating module 32 is configured to generate a zero-knowledge proof corresponding to the second data block according to the data synchronization requirement of the data to be synchronized, where the zero-knowledge proof is used to prove that the second data block satisfies a preset attribute corresponding to the data synchronization requirement;
[0115] The sending module 33 is configured to send the second data block and the zero-knowledge proof to the recipient.
[0116] In some examples of this embodiment, the acquisition module 31 is specifically configured to determine a data segmentation method according to data synchronization requirements; segment the data to be synchronized into data segments according to the data segmentation method, and generate a first data block corresponding to the data to be synchronized.
[0117] In some examples of this embodiment, the acquisition module 31 is specifically configured to determine a key for encrypting a first data block; based on the key, the first data block is symmetrically encrypted using an AES algorithm to obtain a second data block, wherein the second data block includes an identifier for data block sorting and reorganization.
[0118] In some examples of this embodiment, the generation module 32 is specifically configured to determine the proof statement corresponding to the second data block based on the data synchronization requirements, and the proof statement is used to describe the preset attributes of the second data block; use the zero-knowledge proof algorithm to calculate the proof statement to generate a zero-knowledge proof corresponding to the second data block.
[0119] It should be noted that for other corresponding descriptions of the functional units involved in the data synchronization device provided in this embodiment, reference can be made to Figure 1 The corresponding description in will not be repeated here.
[0120] Further, as Figure 2 The specific implementation of the method shown in the embodiment provides a data synchronization device, which is applied to the receiving party, such as Figure 4 As shown, the device includes: a receiving module 41, a verification module 42, and an acquisition module 43.
[0121] The receiving module 41 is configured to receive a first data block corresponding to the data to be synchronized sent by the sender, and a zero-knowledge proof corresponding to the first data block, where the zero-knowledge proof is used to prove that the first data block meets the preset attribute corresponding to the data synchronization requirement;
[0122] A verification module 42, configured to verify whether the zero-knowledge proof is valid according to the data synchronization requirements of the data to be synchronized;
[0123] The acquisition module 43 is configured to decrypt the first data block and obtain a second data block after decrypting the first data block if the zero-knowledge proof is valid;
[0124] The acquisition module 43 is configured to merge the second data block and acquire the data to be synchronized sent by the sender.
[0125] In some examples of this embodiment, the verification module 42 is specifically configured to parse the zero-knowledge proof, extract the proof statement and proof information corresponding to the zero-knowledge proof, and the proof statement is used to describe the preset attributes of the first data block; according to the proof statement, use the zero-knowledge proof algorithm to verify whether the zero-knowledge proof is valid.
[0126] In some examples of this embodiment, the acquisition module 43 is further configured to obtain a key for encrypting a first data block; based on the key, the first data block is decrypted using an AES algorithm to obtain a second data block, wherein the second data block includes an identifier for data block sorting and reorganization.
[0127] In some examples of this embodiment, the acquisition module 43 is specifically configured to acquire a data segmentation method corresponding to a data synchronization requirement; merge the second data blocks according to the data segmentation method and the identifier, and generate data to be synchronized sent by the sender.
[0128] It should be noted that the data synchronization device provided in this embodiment and other corresponding descriptions of the functional units involved can be referred to in Figure 2 The corresponding description in will not be repeated here.
[0129] Based on the above Figure 1 to Figure 2 The method shown in the embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned Figure 1 to Figure 2 The method shown.
[0130] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.
[0131] Based on the above Figure 1 to Figure 2 The method shown, and Figure 3 and Figure 4 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides an electronic device, such as a personal computer, a server, a laptop computer, a smart phone, an intelligent robot or other intelligent terminal, which includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 to Figure 2 The method shown.
[0132] Optionally, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0133] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.
[0134] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.
[0135] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware. By applying the solution of this embodiment, compared with the current prior art, this embodiment does not need to disclose the actual data content to the recipient, reduces the risk of data leakage, and protects the privacy of the data synchronization process.
[0136] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0137] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features applied for herein.
Claims
1. A data synchronization method, It is characterized in that include: Divide the data to be synchronized into data segments, and obtain a first data block corresponding to the data to be synchronized; Encrypting the first data block to obtain a second data block encrypted from the first data block; Generate a zero-knowledge proof corresponding to the second data block according to the data synchronization requirement of the data to be synchronized, wherein the zero-knowledge proof is used to prove that the second data block satisfies a preset attribute corresponding to the data synchronization requirement; The second data block and the zero-knowledge proof are sent to a receiver, and the receiver is configured to perform data synchronization according to a verification result of the zero-knowledge proof.
2. The method according to claim 1, It is characterized in that The step of dividing the data to be synchronized into data segments and obtaining a first data block corresponding to the data to be synchronized includes: Determine a data segmentation method according to the data synchronization requirements; The data to be synchronized is divided into data segments according to the data segmentation method, and a first data block corresponding to the data to be synchronized is generated.
3. The method according to claim 1, It is characterized in that The step of encrypting the first data block to obtain a second data block encrypted from the first data block includes: determining a key for encrypting the first data block; The first data block is symmetrically encrypted using an AES algorithm according to the key to obtain the second data block, where the second data block includes an identifier for data block sorting and reorganization.
4. The method according to claim 1, It is characterized in that The generating, according to the data synchronization requirement of the data to be synchronized, a zero-knowledge proof corresponding to the second data block includes: Determine, according to the data synchronization requirement, a proof statement and proof information corresponding to the second data block, wherein the proof statement is used to describe the preset attribute of the second data block; The proof statement and the proof information are calculated using a zero-knowledge proof algorithm to generate a zero-knowledge proof corresponding to the second data block.
5. A data synchronization method, It is characterized in that include: Receive a first data block corresponding to the data to be synchronized sent by the sender, and a zero-knowledge proof corresponding to the first data block, where the zero-knowledge proof is used to prove that the first data block meets a preset attribute corresponding to a data synchronization requirement; Verify whether the zero-knowledge proof is valid according to the data synchronization requirement of the data to be synchronized; If the zero-knowledge proof is valid, decrypt the first data block to obtain a second data block after decryption of the first data block; The second data block is merged to obtain the data to be synchronized sent by the sender.
6. The method according to claim 5, It is characterized in that Verifying whether the zero-knowledge proof is valid includes: Parsing the zero-knowledge proof, extracting a proof statement and proof information corresponding to the zero-knowledge proof, wherein the proof statement is used to describe the preset attribute of the first data block; Based on the proof statement and the proof information, a zero-knowledge proof algorithm is used to verify whether the zero-knowledge proof is valid.
7. The method according to claim 5, It is characterized in that The decrypting the first data block to obtain a second data block after decrypting the first data block includes: Obtaining a key for encrypting the first data block; The first data block is decrypted using an AES algorithm according to the key to obtain the second data block, where the second data block includes an identifier used for data block sorting and reorganization.
8. The method according to claim 7, It is characterized in that The merging the second data block to obtain the to-be-synchronized data sent by the sender includes: Obtaining a data segmentation method corresponding to the data synchronization requirement; The second data blocks are merged according to the data segmentation method and the identifier to generate the data to be synchronized sent by the sender.
9. A data synchronization device, It is characterized in that include: an acquisition module, configured to divide the data to be synchronized into a plurality of data segments, and generate a first data block corresponding to the data to be synchronized according to the data segments; an acquisition module, configured to encrypt the first data block and acquire a second data block encrypted from the first data block; A generating module, configured to generate a zero-knowledge proof corresponding to the second data block according to a data synchronization requirement of the data to be synchronized, wherein the zero-knowledge proof is used to prove that the second data block satisfies a preset attribute corresponding to the data synchronization requirement; The sending module is configured to send the second data block and the zero-knowledge proof to a receiver, and the receiver is used to perform data synchronization according to the verification result of the zero-knowledge proof.
10. A data synchronization device, It is characterized in that include: A receiving module, configured to receive a first data block corresponding to the data to be synchronized sent by a sender, and a zero-knowledge proof corresponding to the first data block, wherein the zero-knowledge proof is used to prove that the first data block meets a preset attribute corresponding to a data synchronization requirement; A verification module, configured to verify whether the zero-knowledge proof is valid according to the data synchronization requirement of the data to be synchronized; an acquisition module, configured to decrypt the first data block if the zero-knowledge proof is valid, and acquire a second data block obtained by decrypting the first data block; The acquisition module is configured to merge the second data block and acquire the data to be synchronized sent by the sender.
11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
13. A computer program product having a computer program stored thereon, It is characterized in that When the computer program product is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
