Data distribution method and device and data receiving method and device

By pre-processing and encryption processing on the server, cache and distribute the data required by the client, the inefficiency of transactions and slow application response caused by the client pulling data from the server multiple times is solved, and the client start-up is improved Speed ​​and ensure data security and integrity.

CN119210862AActive Publication Date: 2024-12-27CHINA CONSTRUCTION BANK +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411374596.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-27
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

Under the server/client architecture model, the client needs to pull a large amount of business data from the server when it is initially started, and the method of obtaining data through multiple transactions and paging results in inefficient transactions, especially in containerized scenarios, thousands of units When the client is started at the same time, the application startup time is significantly increased, affecting the user experience.

Method used

The server reads the required data from the client from the database through the preset data preprocessing timing task, and preprocesses and encrypts the data, caches it in the local cache space, and directly distributes encrypted data in response to the client's data download request. , the client can obtain the required data through one transaction.

Benefits of technology

It greatly saves the number of transactions and data readiness time required when the client is officially started, ensures the security and integrity of data between multiple clients, and solves the problems of inefficient transactions and slow application response.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119210862A_ABST
    Figure CN119210862A_ABST
Patent Text Reader

Abstract

The invention provides a data distribution method and device and a data receiving method and device, and relates to the technical field of big data, and the method comprises the steps: reading data required by at least one client from a database according to a preset data preprocessing timed task, and preprocessing the data required by each client, the data pre-processing timed task is used for indicating the server side to regularly extract the data and pre-process the data; according to a preset encryption algorithm, encrypting the processing data of each client to obtain encrypted data of each client, and caching the encrypted data in a local cache space; and in response to a data downloading request initiated by any one or more clients, extracting the corresponding encrypted data from the local cache space, and distributing the encrypted data to the clients. According to the method, the problem that the transaction efficiency is low or the application response is slow due to the fact that the client pulls data from the server for multiple times can be effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a data distribution method, a data receiving method and a device. Background Art

[0002] In the client / server (C / S) architecture mode, the client usually needs to initiate a transaction to obtain the required data (such as configuration data, business data, etc.) from the server. Currently, the client mainly uses multiple transactions and paging to obtain data to synchronize data with the server.

[0003] With the promotion and application of cloud native technology, the number of clients has exploded. When a client is started for the first time, it usually needs to pull a large amount of business data from the server. The amount of data pulled at a time by using multiple transactions and paging data is small, and the transaction efficiency is low. In a containerized scenario, there is a possibility that thousands or even tens of thousands of clients will be started at the same time, and the client needs to wait for multiple data pulls to complete, resulting in a significant increase in the startup time of the application, which has a significant negative impact on the user experience, especially in application scenarios that require fast response. Summary of the invention

[0004] The present application provides a data distribution method, a data receiving method and a device to solve at least one of the above technical problems.

[0005] In a first aspect, the present application provides a data distribution method, applied to a server, the method comprising:

[0006] According to a preset data preprocessing scheduled task, data required by at least one client is read from a database, and the data required by each client is preprocessed to obtain processed data of each client after preprocessing; wherein the data preprocessing scheduled task is used to instruct the server to extract and preprocess data at a regular interval, and the data includes business data and / or configuration data;

[0007] According to a preset encryption algorithm, the processed data of each client is encrypted to obtain the encrypted data of each client, and the encrypted data is cached in a local cache space;

[0008] In response to a data download request initiated by any one or more clients, corresponding encrypted data is extracted from the local cache space, and the encrypted data is distributed to the clients.

[0009] In one implementation, preprocessing the data required by each client to obtain processed data of each client after preprocessing includes:

[0010] For the data required by each client, the data is arranged and processed according to the data version characteristics to obtain the processed data of each client after preprocessing;

[0011] The data version feature is determined according to a data extraction batch when the server extracts corresponding data from the database.

[0012] In one implementation, the preset encryption algorithm includes the national secret algorithm SM2 and the national secret algorithm SM4; the method further includes:

[0013] For each client's processed data, randomly generate an SM4 encryption key for the processed data;

[0014] The method of encrypting the processed data of each client according to a preset encryption algorithm to obtain the encrypted data of each client includes:

[0015] Encrypt the processed data of each client according to the SM4 encryption key to obtain data ciphertext;

[0016] Encrypting the SM4 encryption key according to the pre-acquired SM2 public key of the client to obtain a key ciphertext;

[0017] The data ciphertext and the key ciphertext are assembled into a digital envelope file to obtain the encrypted data.

[0018] In one implementation, the data download request carries the SM2 private key signature of the client;

[0019] The step of extracting corresponding encrypted data from the local cache space in response to a data download request initiated by any one or more clients includes:

[0020] In response to a data download request initiated by any one or more clients, the identity information of the client is verified according to the SM2 private key signature, and when the identity authentication of the client is passed, the corresponding encrypted data is extracted from the local cache space.

[0021] In one embodiment, in response to a data download request initiated by any one or more clients, extracting corresponding encrypted data from the local cache space and distributing the encrypted data to the clients includes:

[0022] In response to data download requests initiated by multiple clients, if the multiple clients in the data download requests belong to the same client cluster, extracting encrypted data corresponding to any one of the multiple clients from the local cache space;

[0023] The encrypted data is synchronously distributed to the multiple clients.

[0024] In one embodiment, the method further comprises:

[0025] Processing the encrypted data based on the national secret algorithm SM3 to generate a hash value about the encrypted data, wherein the hash value is used to indicate the consistency of the encrypted data during transmission;

[0026] Encapsulating the encrypted data and the hash value to obtain encapsulated encrypted data;

[0027] Distributing the encrypted data to the client includes: distributing the encapsulated encrypted data to the client.

[0028] In a second aspect, the present application provides a data receiving method, applied to a client, the method comprising:

[0029] Send a data download request to the server, the data download request carries the national secret algorithm SM2 private key signature of the client, and the SM2 private key signature is used to instruct the server to verify the identity of the client;

[0030] receiving encrypted data about the client distributed by the server in response to the data download request;

[0031] The encrypted data is decrypted to obtain processing data about the client, and relevant business processing is performed according to the processing data.

[0032] In one embodiment, the encrypted data includes a data ciphertext and a key ciphertext, the data ciphertext is obtained by encrypting the processed data based on the national secret algorithm SM4 encryption key, and the key ciphertext is obtained by encrypting the national secret algorithm SM4 encryption key based on the SM2 public key;

[0033] The decrypting the encrypted data to obtain processed data about the client includes:

[0034] Decrypting the key ciphertext based on the pre-stored SM2 private key to obtain the decryption key;

[0035] The data ciphertext is decrypted according to the SM4 encryption key to obtain processing data about the client.

[0036] In a third aspect, the present application provides a data distribution device, applied to a server, the device comprising:

[0037] A reading and processing module, which is configured to read data required by at least one client from a database according to a preset data preprocessing timed task, and preprocess the data required by each client to obtain processed data of each client after preprocessing; wherein the data preprocessing timed task is used to instruct the server to extract and preprocess data at a regular interval, and the data includes business data and / or configuration data;

[0038] An encryption module is configured to encrypt the processed data of each client according to a preset encryption algorithm, obtain the encrypted data of each client, and cache the encrypted data in a local cache space;

[0039] The extraction and distribution module is configured to respond to a data download request initiated by any one or more clients, extract the corresponding encrypted data from the local cache space, and distribute the encrypted data to the clients.

[0040] In one embodiment, the reading and processing module includes:

[0041] An arrangement unit is configured to arrange the data required by each client according to the data version characteristics to obtain the processed data of each client after preprocessing;

[0042] The data version feature is determined according to a data extraction batch when the server extracts corresponding data from the database.

[0043] In one implementation, the preset encryption algorithm includes the national secret algorithm SM2 and the national secret algorithm SM4; the device further includes:

[0044] A key generation module, which is configured to randomly generate an SM4 encryption key for the processed data of each client;

[0045] The encryption module comprises:

[0046] A data encryption unit, configured to encrypt the processed data of each client according to the SM4 encryption key to obtain a data ciphertext;

[0047] A key encryption unit, configured to encrypt the SM4 encryption key according to the pre-acquired SM2 public key of the client to obtain a key ciphertext;

[0048] The encrypted data generating unit is configured to assemble the data ciphertext and the key ciphertext into a digital envelope file to obtain the encrypted data.

[0049] In one implementation, the data download request carries the SM2 private key signature of the client;

[0050] The extraction and distribution module comprises:

[0051] A data extraction unit is configured to respond to a data download request initiated by any one or more clients, verify the identity information of the client according to the SM2 private key signature, and extract the corresponding encrypted data from the local cache space when the identity authentication of the client passes.

[0052] In one implementation, the extraction and distribution module is specifically configured as:

[0053] In response to data download requests initiated by multiple clients, if the multiple clients in the data download requests belong to the same client cluster, extracting encrypted data corresponding to any one of the multiple clients from the local cache space;

[0054] The encrypted data is synchronously distributed to the multiple clients.

[0055] In one embodiment, the device further comprises:

[0056] A hash value generation module, which is configured to process the encrypted data based on the national encryption algorithm SM3 to generate a hash value for the encrypted data, wherein the hash value is used to indicate the consistency of the encrypted data during transmission;

[0057] an encapsulation module, configured to encapsulate the encrypted data and the hash value to obtain encapsulated encrypted data;

[0058] The extraction and distribution module includes: a data distribution unit, which is configured to distribute the encapsulated encrypted data to the client.

[0059] In a fourth aspect, the present application provides a data receiving device, applied to a client, the device comprising:

[0060] A request module, configured to send a data download request to a server, wherein the data download request carries a national secret algorithm SM2 private key signature of the client, and the SM2 private key signature is used to instruct the server to verify the identity of the client;

[0061] A receiving module, configured to receive encrypted data about the client distributed by the server in response to the data download request;

[0062] The decryption module is configured to decrypt the encrypted data to obtain processing data about the client and perform relevant business processing according to the processing data.

[0063] In one embodiment, the encrypted data includes a data ciphertext and a key ciphertext, the data ciphertext is obtained by encrypting the processed data based on the national secret algorithm SM4 encryption key, and the key ciphertext is obtained by encrypting the national secret algorithm SM4 encryption key based on the SM2 public key;

[0064] The decryption module is specifically configured to: decrypt the key ciphertext based on the pre-stored SM2 private key to obtain the decryption key; decrypt the data ciphertext according to the SM4 encryption key to obtain processing data about the client.

[0065] In a fifth aspect, the present application provides a server, including: a memory and a processor;

[0066] The memory stores computer-executable instructions;

[0067] The processor executes the computer-executable instructions stored in the memory, so that the server executes the data distribution method provided in any one of the first aspects above.

[0068] In a sixth aspect, the present application provides a client, comprising: a memory and a processor;

[0069] The memory stores computer-executable instructions;

[0070] The processor executes the computer-executable instructions stored in the memory, so that the client executes the data receiving method provided in any one of the second aspects above.

[0071] In the seventh aspect, the present application provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed by a processor, they are used to implement the data distribution method provided in any one of the first aspects above, or to implement the data receiving method provided in any one of the second aspects above.

[0072] In an eighth aspect, the present application provides a computer program product, which includes a computer program code. When the computer program code runs on a computer, it enables the computer to execute a data distribution method as provided in any one of the first aspects above, or is used to implement a data receiving method as provided in any one of the second aspects above.

[0073] The data distribution method, data receiving method and device provided by the present application are to read the data (including business data and / or configuration data) required by at least one client from the database according to the preset data preprocessing timing task at the server end, and preprocess the data required by each client to obtain the processed data of each client after preprocessing. The data preprocessing timing task is used to instruct the server end to extract data regularly and preprocess it, and encrypt the processed data of each client according to the preset encryption algorithm to obtain the encrypted data of each client, and cache the encrypted data in the local cache space, and extract the corresponding encrypted data from the local cache space in response to the data download request initiated by any one or more clients, and distribute the encrypted data to the client. In this process, the server end pre-queries and processes the corresponding data file for the client, and the client can pull down a large amount of data through a single transaction, which greatly saves the number of transactions and the data ready time required when the client is officially started, and through the form of data encryption, the data security and integrity of the data can be guaranteed during the distribution process between multiple clients. In this way, the problem of the client pulling data from the server end multiple times, low transaction efficiency or slow application response can be effectively solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] 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.

[0075] Figure 1 A possible scenario diagram provided for an embodiment of the present application;

[0076] Figure 2 A flowchart of a data distribution method provided in an embodiment of the present application;

[0077] Figure 3 This is a flowchart of the encrypted data generation process in an embodiment of the present application;

[0078] Figure 4 This is a flowchart of the encrypted data decryption process in an embodiment of the present application;

[0079] Figure 5 for Figure 2 Schematic diagram of the process of step S203;

[0080] Figure 6 A flowchart of another data distribution method provided in an embodiment of the present application;

[0081] Figure 7 A flowchart of a data receiving method provided in an embodiment of the present application;

[0082] Figure 8A schematic diagram of the structure of a data distribution device provided in an embodiment of the present application;

[0083] Fig. 9 A schematic diagram of the structure of a data receiving device provided in an embodiment of the present application;

[0084] Fig.10 A schematic diagram of the structure of a server provided in an embodiment of the present application;

[0085] Fig.11 A schematic diagram of the structure of a client provided in an embodiment of the present application.

[0086] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0087] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0088] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of financial data or user data and other information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals. It should be noted that in the embodiments of this application, some existing solutions in the industry such as certain software, components, models, etc. may be mentioned, and they should be considered as exemplary. Their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0089] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are 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 may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0090] Figure 1 The following schematically shows an application scenario diagram of the technical solution of the embodiment of the present application. Figure 1As shown, the application scenario includes: a server 110, a database 120 and a plurality of clients 130 electrically connected to the server 110. Optionally, the database can be a relational database (RDBMS), which can be used to store structured business data and configuration data, and support complex queries and transaction processing. In practical applications, the specific database selection can be determined according to the application requirements and the relevant technology stack. Optionally, the server 110 can predetermine the data required by the client 130 based on the historical request data of each client 130, or the pre-request of the client 130 (carrying information such as the required data type), and can read the data required by each terminal device from the database 120 by means of a data preprocessing scheduled task, and perform corresponding processing, such as removing duplicate and invalid data, and data arrangement processing, etc., and then encrypt the processed data through the national secret algorithm. When the client 130 has a data download request, the data required by the client 130 can be provided to the client 130 at one time. The client may include, but is not limited to, computers, smart phones, tablet computers, e-book readers, portable computers, car computers, wearable devices, desktop computers, set-top boxes, smart TVs, etc. Optionally, the server may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0091] In the alternative related art, when the client has a download demand, the client uses multiple transactions and paging to obtain data to download data from the server. In the embodiment of the present application, the server reads the data (including business data and / or configuration data) required by at least one client from the database according to the preset data preprocessing timer task, and preprocesses the data required by each client to obtain the processed data of each client after preprocessing. The data preprocessing timer task is used to instruct the server to extract data regularly and preprocess, and encrypt the processed data of each client according to the preset encryption algorithm to obtain the encrypted data of each client, and cache the encrypted data in the local cache space. In response to the data download request initiated by any one or more clients, the corresponding encrypted data is extracted from the local cache space, and the encrypted data is distributed to the client. In this process, the server pre-queries and processes the corresponding data file for the client, and the client can pull down a large amount of data through a single transaction, which greatly saves the number of transactions and data ready time required when the client is officially started, and through the form of data encryption, the data security and integrity of the data can be guaranteed during the distribution process between multiple clients. In this way, the problem of the client pulling data from the server multiple times, low transaction efficiency or slow application response can be effectively solved.

[0092] based on Figure 1 In the application scenario shown, the present application embodiment provides a data distribution method. Applied to the server, Figure 2 The following is a flow chart of the data distribution method provided in the embodiment of the present application. Figure 2 The method may include steps S201-S203:

[0093] Step S201: according to a preset data preprocessing timing task, read the data required by at least one client from the database, and preprocess the data required by each client to obtain the processed data of each client after preprocessing; wherein the data preprocessing timing task is used to instruct the server to extract and preprocess data at a regular interval, and the data includes business data and / or configuration data.

[0094] In this embodiment, by setting a data preprocessing scheduled task on the server side, the scheduled task can be set at different time intervals according to business needs, such as once every hour, every day or every week. The setting of the scheduled task can be implemented through programming, and a scheduled task scheduler (such as Quartz, Cron, etc.) is usually used to manage the execution time and frequency of the task.

[0095] When the scheduled task is triggered, the server starts to perform data extraction operations. Specifically, the server connects to the database and can use structured query language to read the corresponding data, such as client-related business data and / or configuration data, depending on the client's needs. During the data extraction process, the server can use different query conditions or filter conditions to extract the corresponding data from the database according to the needs of different clients.

[0096] After reading the relevant data, the server can preprocess the data. The preprocessing methods can be one or more of the following: data cleaning, removing noise, duplicate data or incomplete data in the data to ensure the quality of the data; data conversion, converting the data into a unified format or structure to facilitate subsequent processing and analysis. For example, unifying the date format, converting data from different units to the same unit, etc.; data aggregation, summarizing or grouping the data according to business needs. For example, summarizing sales data by day, week, and month, grouping statistical data by region, product category, etc. In addition, the data can also be arranged and processed according to the data version characteristics, so that the client can obtain the corresponding version (such as the latest version) of the data in sequence.

[0097] Exemplarily, in the above steps, the data required by each client is preprocessed to obtain the processed data of each client after preprocessing, which can be done in the following way: for the data required by each client, the data is arranged and processed according to the data version characteristics to obtain the processed data of each client after preprocessing; wherein the data version characteristics are determined according to the data extraction batch when the server extracts the corresponding data from the database.

[0098] Optionally, when the server extracts data from the database, the extracted batch of data will be recorded. This batch information can be used as a data version feature, where each batch of data has a unique version feature for identifying the batch of data. According to the needs of each client and the data version feature, the extracted data is arranged and processed to facilitate the arrangement and conversion of the data into a format and content suitable for each client. Through the arrangement process, pre-processed data is generated. This data is customized for each client to ensure that each client can obtain data that meets its needs.

[0099] Through the above method, the server regularly collects and generates necessary configuration information, business data, etc. for the client, and arranges them reasonably according to the data version characteristics, which can effectively ensure the order and integrity of the data.

[0100] Step S202: Encrypt the processed data of each client according to a preset encryption algorithm to obtain the encrypted data of each client, and cache the encrypted data in a local cache space.

[0101] In this embodiment, the preset encryption algorithm can use a national secret algorithm with higher security, and the national secret algorithm includes SM1-SM4 algorithms. The SM4 algorithm can be used to encrypt the processed data. The SM4 algorithm is a block symmetric encryption algorithm, and the plaintext, ciphertext and key length are all 128 bits. In some embodiments, in addition to using the national secret algorithm data for encryption, other encryption algorithms can also be used for encryption, and this embodiment does not specifically limit this.

[0102] In one example, SM2 and SM4 can be used simultaneously to encrypt data to improve data security. Specifically, the preset encryption algorithm can be the national secret algorithm SM2 and the national secret algorithm SM4; the method can also include the following steps: for each client's processed data, randomly generate an SM4 encryption key for the processed data.

[0103] In this example, a random number generator or other security algorithm can be used to generate a random SM4 encryption key (a symmetric key, SM4 is a symmetric encryption algorithm, which means that the same key is used for encryption and decryption of data). That is, the generated encryption key is also the decryption key.

[0104] Next, the above-mentioned step S202 encrypts the processed data of each client according to a preset encryption algorithm, specifically as follows: according to the SM4 encryption key, the processed data of each client is encrypted to obtain a data ciphertext; according to the pre-acquired SM2 public key of the client, the SM4 encryption key is encrypted to obtain a key ciphertext; the data ciphertext and the key ciphertext are assembled into a digital envelope file to obtain the encrypted data.

[0105] It can be understood that the SM2 algorithm is a public key cryptographic algorithm based on elliptic curve cryptography, which is an asymmetric encryption algorithm in the national secret algorithm, including a public key and a private key, where the public key is used for encryption and the private key is used for decryption. The SM2 public key and SM2 private key can be generated by an encryption machine. The specific generation process can refer to the existing technology and will not be repeated here. The encrypted data generation process is as follows: Figure 3 As shown, the server can encrypt the data using the national encryption SM4 algorithm through data interaction with the encryption machine, and then use the client SM2 public key to encrypt the symmetric key. Finally, the data ciphertext and the key ciphertext are assembled into a digital envelope file and stored on the disk.

[0106] Through the above technical solution, a digital envelope file corresponding to symmetric encryption and asymmetric encryption is combined. The digital envelope file contains the encrypted data and encryption key information, so that only authorized recipients can decrypt and access the data, effectively ensuring the security of the data. Even if the data ciphertext is intercepted during the transmission process, a client with the corresponding SM2 private key is required to decrypt the key ciphertext and thus decrypt the data ciphertext.

[0107] In some embodiments, when caching encrypted data in a local cache space, each client encrypted data may also be identified to facilitate rapid response to the client's data download request and efficient provision of corresponding data to the client.

[0108] Continue to see Figure 2 , step S203, in response to a data download request initiated by any one or more clients, extract the corresponding encrypted data from the local cache space, and distribute the encrypted data to the client.

[0109] When the client starts or in other states where data needs to be requested from the server, the client sends a data download request to the server. The server can extract the encrypted data prepared and cached in advance from the local cache space based on the client's identification or other client information, and distribute it to one or more clients at one time, so that the client can pull down a large amount of data through a single transaction, greatly saving the number of transactions and data readiness time required when the client officially starts. In some scenarios, for the same group of client clusters, the encrypted data can also be distributed to these client clusters at one time to further improve data distribution efficiency.

[0110] It can be understood that in response to the conditions or states on which the executed operations depend, when the dependent conditions or states are met, one or more operations executed can be in real time or have a set delay; unless otherwise specified, there is no restriction on the order of execution of the multiple operations executed.

[0111] In one example, in order to improve the security of data transmission, the data download request in this embodiment carries the SM2 private key signature of the client. In the above step S203, in response to the data download request initiated by any one or more clients, extracting the corresponding encrypted data from the local cache space may include the following steps:

[0112] In response to a data download request initiated by any one or more clients, the identity information of the client is verified according to the SM2 private key signature, and when the identity authentication of the client is passed, the corresponding encrypted data is extracted from the local cache space.

[0113] Specifically, the client can use the SM2 private key to calculate the signature of the client's identity information, compare the calculated signature with the SM2 private key signature provided by the client, and verify their consistency. If the verification is consistent, the client's identity authentication is passed. The server extracts the corresponding encrypted data from the local cache space and distributes it to the corresponding client.

[0114] As a further description, for a data download request initiated by a client, the process by which the server provides data to the client is as follows: Figure 4 As shown in the figure, when the client initiates a download request, the server first reads data from the cache. If the cache is empty, it reads data from the disk file and caches it, then signs the data and responds to the client. After the client receives the response, it first verifies the server signature. If the verification is successful, it decrypts the data with the private key to obtain the symmetric key, then uses the symmetric key to decrypt the data and assemble the data. Similarly, the encryption machine can be used to sign the private key during the data decryption process.

[0115] In this way, by signing the message and / or data, the client identity can be verified, thereby providing access-level security conditions for data distribution.

[0116] In another example, the above step S203 extracts the corresponding encrypted data from the local cache space in response to a data download request initiated by any one or more clients, and distributes the encrypted data to the clients, such as Figure 5 As shown, the following steps may be included:

[0117] Step S2031: When responding to data download requests initiated by multiple clients, if the multiple clients in the data download requests belong to the same client cluster, extracting encrypted data corresponding to any one of the multiple clients from the local cache space.

[0118] In scenarios such as real-time data update or data configuration, the server data requested by the same client cluster is the same data. In the current data distribution method, when the client initiates a data download request, the server temporarily prepares the data of the client for data distribution. For clients in the same client cluster, the server also prepares and distributes data separately, which greatly affects the data distribution efficiency. This embodiment realizes one-time data distribution by identifying clients in the same cluster and extracting corresponding data from the cache space, which greatly improves the data distribution efficiency.

[0119] For the same client cluster, these clients usually carry the same cluster ID, and this embodiment can use the same cluster ID to identify whether the client belongs to the same client cluster. In addition, it is also possible to identify whether the client belongs to the same client cluster based on network topology, IP address, etc.

[0120] Step S2032: synchronously distribute the encrypted data to the multiple clients.

[0121] In some examples, during the data reading phase, data required by clients of the same cluster may be uniformly read and processed to improve the data processing efficiency of the server.

[0122] Through the above technical solution, unified data distribution is achieved for clients of the same client cluster, thereby improving data distribution efficiency.

[0123] Figure 6 This is a flow chart of another data distribution method provided by an embodiment of the present application. Based on the above embodiment, considering the data integrity problem that may occur during data transmission, this embodiment combines the national secret SM3 algorithm to generate a hash value to further improve data security. Specifically, in addition to the above steps S201-S203, the method provided by this embodiment may also include the following steps S601 and S602, and step S203 is further divided into step S2033.

[0124] Step S601: Process the encrypted data based on the national encryption algorithm SM3 to generate a hash value for the encrypted data, where the hash value is used to indicate the consistency of the encrypted data during transmission.

[0125] The national secret SM3 algorithm is a cryptographic hash function that accepts input data of any length and generates a fixed-length hash value of 256 bits (32 bytes). The hash value is unique, and any slight input change will result in a completely different output. It is similar to SHA-256 and is mainly used to generate a fixed-length hash value to ensure the integrity and security of the data. This embodiment uses the SM3 algorithm to calculate the encrypted data to obtain the corresponding hash value, which indicates the original data state of the server before the data is transmitted. If there is no data loss during the transmission process, the hash value calculated corresponding to the encrypted data received by the client is consistent with the hash value calculated on the server.

[0126] Step S602: encapsulate the encrypted data and the hash value to obtain encapsulated encrypted data, and replace the encrypted data in the cache space with the encapsulated encrypted data.

[0127] Encapsulation can be understood as a simple concatenation or combination of data, that is, the encrypted data carries its corresponding hash value. It can also be a new data structure formed between data. The encapsulated data can contain a combination of encrypted data and hash values ​​for subsequent transmission or storage.

[0128] In some embodiments, after generating the encrypted data, the server may not store the encrypted data, but directly calculate the hash value and encapsulate it, and store the encapsulated data of the response, so there is no need to replace the data.

[0129] Step S603: In response to a data download request initiated by any one or more clients, extract the corresponding encapsulated encrypted data from the local cache space, and distribute the encapsulated encrypted data to the clients.

[0130] After receiving the encapsulated encrypted data, the client calculates the hash value of the received encrypted data and compares it with the received hash value. If they are consistent, it means that the encrypted data has not been attacked or has not been incompletely transmitted. The client can continue to decrypt and subsequently process the encrypted data, effectively improving data security and integrity.

[0131] Figure 7 : is a flow chart of a data receiving method provided in an embodiment of the present application, which is applied to a client. The method includes steps S701-S703:

[0132] Step S701: Send a data download request to the server, where the data download request carries the national secret algorithm SM2 private key signature of the client, where the SM2 private key signature is used to instruct the server to verify the identity of the client;

[0133] Step S702: receiving encrypted data about the client distributed by the server in response to the data download request;

[0134] Step S703: decrypt the encrypted data to obtain processing data about the client, and perform relevant business processing according to the processing data.

[0135] In one embodiment, the encrypted data includes a data ciphertext and a key ciphertext, the data ciphertext is obtained by encrypting the processed data based on the national secret algorithm SM4 encryption key, and the key ciphertext is obtained by encrypting the national secret algorithm SM4 encryption key based on the SM2 public key;

[0136] The above step S703 decrypts the encrypted data to obtain processed data about the client, which may include the following steps:

[0137] Decrypting the key ciphertext based on the pre-stored SM2 private key to obtain the decryption key;

[0138] The data ciphertext is decrypted according to the SM4 encryption key to obtain processing data about the client.

[0139] It should be noted that the above method provided in the embodiment of the present application is an execution method of the opposite end of the above server, and its implementation principle and technical effect are similar to the above data distribution method, which will not be repeated here.

[0140] Figure 8 is a structural diagram of a data distribution device provided in an embodiment of the present application, which is applied to a server, such as Figure 8 As shown, the device 800 includes a reading and processing module 801, an encryption module 802 and an extraction and distribution module 803; wherein,

[0141] The reading and processing module 801 is configured to read data required by at least one client from the database according to a preset data preprocessing timed task, and preprocess the data required by each client to obtain processed data of each client after preprocessing; wherein the data preprocessing timed task is used to instruct the server to extract and preprocess data at a regular interval, and the data includes business data and / or configuration data;

[0142] The encryption module 802 is configured to encrypt the processed data of each client according to a preset encryption algorithm, obtain the encrypted data of each client, and cache the encrypted data in a local cache space;

[0143] The extraction and distribution module 803 is configured to respond to a data download request initiated by any one or more clients, extract the corresponding encrypted data from the local cache space, and distribute the encrypted data to the clients.

[0144] In one implementation, the reading and processing module 801 includes:

[0145] An arrangement unit, which is configured to arrange the data required by each client according to the data version characteristics to obtain the processed data of each client after preprocessing;

[0146] The data version feature is determined according to a data extraction batch when the server extracts corresponding data from the database.

[0147] In one implementation, the preset encryption algorithm includes the national secret algorithm SM2 and the national secret algorithm SM4; the device further includes:

[0148] A key generation module, which is configured to randomly generate an SM4 encryption key for the processed data of each client;

[0149] The encryption module 802 includes:

[0150] A data encryption unit, configured to encrypt the processed data of each client according to the SM4 encryption key to obtain a data ciphertext;

[0151] a key encryption unit, configured to encrypt the SM4 encryption key according to the pre-acquired SM2 public key of the client to obtain a key ciphertext;

[0152] The encrypted data generating unit is configured to assemble the data ciphertext and the key ciphertext into a digital envelope file to obtain the encrypted data.

[0153] In one implementation, the data download request carries the SM2 private key signature of the client;

[0154] The extraction and distribution module 803 includes:

[0155] A data extraction unit is configured to respond to a data download request initiated by any one or more clients, verify the identity information of the client according to the SM2 private key signature, and extract the corresponding encrypted data from the local cache space when the identity authentication of the client passes.

[0156] In one implementation, the extraction and distribution module 803 is specifically configured as follows:

[0157] In response to data download requests initiated by multiple clients, if the multiple clients in the data download requests belong to the same client cluster, extracting encrypted data corresponding to any one of the multiple clients from the local cache space;

[0158] The encrypted data is synchronously distributed to the multiple clients.

[0159] In one embodiment, the device further comprises:

[0160] A hash value generation module, which is configured to process the encrypted data based on the national encryption algorithm SM3 to generate a hash value for the encrypted data, wherein the hash value is used to indicate the consistency of the encrypted data during transmission;

[0161] an encapsulation module, configured to encapsulate the encrypted data and the hash value to obtain encapsulated encrypted data;

[0162] The extraction and distribution module 803 includes: a data distribution unit, which is configured to distribute the encapsulated encrypted data to the client.

[0163] It should be noted that the above-mentioned device provided in the embodiment of the present application can be used to execute the technical solution of the data distribution method in the above-mentioned embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0164] Fig. 9 A data receiving device provided in an embodiment of the present application is applied to a client, such as Fig. 9 As shown, the device includes a request module 901, a receiving module 902 and a decryption module 903, wherein:

[0165] A request module 901 is configured to send a data download request to a server, wherein the data download request carries a national secret algorithm SM2 private key signature of the client, and the SM2 private key signature is used to instruct the server to verify the identity of the client;

[0166] A receiving module 902, configured to receive encrypted data about the client distributed by the server in response to the data download request;

[0167] The decryption module 903 is configured to decrypt the encrypted data to obtain processing data about the client and perform relevant business processing according to the processing data.

[0168] In one embodiment, the encrypted data includes a data ciphertext and a key ciphertext, the data ciphertext is obtained by encrypting the processed data based on the national secret algorithm SM4 encryption key, and the key ciphertext is obtained by encrypting the national secret algorithm SM4 encryption key based on the SM2 public key;

[0169] The decryption module 903 is specifically configured to: decrypt the key ciphertext based on the pre-stored SM2 private key to obtain the decryption key; decrypt the data ciphertext according to the SM4 encryption key to obtain processing data about the client.

[0170] It should be noted that the above-mentioned device provided in the embodiment of the present application can be used to execute the technical solution of the data receiving method in the above-mentioned embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0171] It should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the decryption module 903 can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above decryption module 903. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0172] Fig.10 This is a schematic diagram of the structure of the server provided in the embodiment of the present application. Fig.10 As shown, the server may include: a transceiver 101 , a processor 102 , and a memory 103 .

[0173] The processor 102 executes the computer execution instructions stored in the memory, so that the processor 102 executes the data distribution scheme in the above embodiment. The processor 102 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0174] The memory 103 is connected to the processor 102 via a system bus and implements communication therebetween. The memory 103 is used to store computer program instructions.

[0175] The transceiver 101 may be used to perform data transmission with an external device.

[0176] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0177] Fig.11 This is a schematic diagram of the structure of the server provided in the embodiment of the present application. Fig.11 As shown, the server may include: a transceiver 111 , a processor 112 , and a memory 113 .

[0178] The processor 112 executes the computer execution instructions stored in the memory, so that the processor 112 executes the data receiving scheme in the above embodiment. The processor 112 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0179] The memory 113 is connected to the processor 112 via a system bus and completes communication between them. The memory 113 is used to store computer program instructions.

[0180] The transceiver 111 may be used to perform data transmission with an external device.

[0181] A client provided in an embodiment of the present application includes: a memory and a processor;

[0182] The memory stores computer-executable instructions;

[0183] The processor executes the computer-executable instructions stored in the memory, so that the client executes the data receiving method provided in any one of the second aspects above.

[0184] An embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solution of the data distribution method or the data receiving method in the above embodiment.

[0185] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the data distribution method or the technical solution for data reception in the above-mentioned embodiment.

[0186] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, it can implement the technical solution of the data distribution method or the data receiving method in the above-mentioned embodiment.

[0187] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0188] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0189] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0190] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0191] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0192] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0193] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0194] The above storage medium can be implemented by any type of volatile or non-volatile storage device 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. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0195] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0196] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

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

Claims

1. A data distribution method, characterized in that: Applied to the server, the method includes: According to a preset data preprocessing scheduled task, data required by at least one client is read from a database, and the data required by each client is preprocessed to obtain processed data of each client after preprocessing; wherein the data preprocessing scheduled task is used to instruct the server to extract and preprocess data at a regular interval, and the data includes business data and / or configuration data; According to a preset encryption algorithm, the processed data of each client is encrypted to obtain the encrypted data of each client, and the encrypted data is cached in a local cache space; In response to a data download request initiated by any one or more clients, corresponding encrypted data is extracted from the local cache space, and the encrypted data is distributed to the clients.

2. The method according to claim 1, characterized in that: The preprocessing of the data required by each client to obtain the processed data of each client after preprocessing includes: For the data required by each client, the data is arranged and processed according to the data version characteristics to obtain the processed data of each client after preprocessing; The data version feature is determined according to a data extraction batch when the server extracts corresponding data from the database.

3. The method according to claim 1 or 2, characterized in that: The preset encryption algorithm includes the national secret algorithm SM2 and the national secret algorithm SM4; the method also includes: For each client's processed data, randomly generate an SM4 encryption key for the processed data; The method of encrypting the processed data of each client according to a preset encryption algorithm to obtain the encrypted data of each client includes: Encrypt the processed data of each client according to the SM4 encryption key to obtain data ciphertext; Encrypting the SM4 encryption key according to the pre-acquired SM2 public key of the client to obtain a key ciphertext; The data ciphertext and the key ciphertext are assembled into a digital envelope file to obtain the encrypted data.

4. The method according to claim 3, characterized in that The data download request carries the SM2 private key signature of the client; The step of extracting corresponding encrypted data from the local cache space in response to a data download request initiated by any one or more clients includes: In response to a data download request initiated by any one or more clients, the identity information of the client is verified according to the SM2 private key signature, and when the identity authentication of the client is passed, the corresponding encrypted data is extracted from the local cache space.

5. The method according to any one of claims 1 to 4, characterized in that: The step of extracting corresponding encrypted data from the local cache space in response to a data download request initiated by any one or more clients, and distributing the encrypted data to the clients includes: In response to data download requests initiated by multiple clients, if the multiple clients in the data download requests belong to the same client cluster, extracting encrypted data corresponding to any one of the multiple clients from the local cache space; The encrypted data is synchronously distributed to the multiple clients.

6. The method according to any one of claims 1 to 4, characterized in that: Also includes: Processing the encrypted data based on the national secret algorithm SM3 to generate a hash value about the encrypted data, wherein the hash value is used to indicate the consistency of the encrypted data during transmission; Encapsulating the encrypted data and the hash value to obtain encapsulated encrypted data; The distributing the encrypted data to the client includes: distributing the encapsulated encrypted data to the client.

7. A data receiving method, characterized in that: Applied to a client, the method comprises: Send a data download request to the server, the data download request carries the national secret algorithm SM2 private key signature of the client, and the SM2 private key signature is used to instruct the server to verify the identity of the client; receiving encrypted data about the client distributed by the server in response to the data download request; The encrypted data is decrypted to obtain processing data about the client, and relevant business processing is performed according to the processing data.

8. The method according to claim 7, characterized in that The encrypted data includes data ciphertext and key ciphertext, the data ciphertext is obtained by encrypting the processed data based on the national secret algorithm SM4 encryption key, and the key ciphertext is obtained by encrypting the national secret algorithm SM4 encryption key based on the SM2 public key; The decrypting the encrypted data to obtain processed data about the client includes: Decrypting the key ciphertext based on the pre-stored SM2 private key to obtain the decryption key; The data ciphertext is decrypted according to the SM4 encryption key to obtain processing data about the client.

9. A data distribution device, characterized in that: Applied to the server, the device comprises: A reading and processing module, which is configured to read data required by at least one client from a database according to a preset data preprocessing timed task, and preprocess the data required by each client to obtain processed data of each client after preprocessing; wherein the data preprocessing timed task is used to instruct the server to extract and preprocess data at a regular interval, and the data includes business data and / or configuration data; An encryption module is configured to encrypt the processed data of each client according to a preset encryption algorithm, obtain the encrypted data of each client, and cache the encrypted data in a local cache space; The extraction and distribution module is configured to respond to a data download request initiated by any one or more clients, extract the corresponding encrypted data from the local cache space, and distribute the encrypted data to the clients.

10. A data receiving device, characterized in that: Applied to a client, the device comprises: A request module, configured to send a data download request to a server, wherein the data download request carries a national secret algorithm SM2 private key signature of the client, and the SM2 private key signature is used to instruct the server to verify the identity of the client; A receiving module, configured to receive encrypted data about the client distributed by the server in response to the data download request; The decryption module is configured to decrypt the encrypted data to obtain processing data about the client and perform relevant business processing according to the processing data.

11. A server, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the server executes the data distribution method described in any one of claims 1-6.

12. A client, characterized in that: include: Memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the client executes the data receiving method described in any one of claims 7 or 8.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the data distribution method as described in any one of claims 1 to 6, or to implement the data receiving method as described in any one of claims 7 or 8.

14. A computer program product, characterized in that The computer program product comprises a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the data distribution method according to any one of claims 1 to 6, or to implement the data receiving method according to any one of claims 7 or 8.

Citation Information

Patent Citations

  • Secret key management method, device and system

    CN106712932A

  • Processing method and system for differentiated secondary caching and synchronization of data of multiple clients

    CN113645309A

  • Data distribution method and device and storage medium

    CN114510643A

  • Data security guarantee method based on password identifier

    CN117749353A

  • Secure provisioning of data to client device

    IN202037019256A