Data sending method, data receiving method, system and device and storage medium
Through the combination of MD5 encryption and DSA algorithm, the plaintext data to be transmitted is cut and randomly scrambled to generate digital signatures, which solves the problems of original text leakage and insufficient security in data transmission of digital signature algorithms, and achieves efficient data transmission security. Sexual security.
Patent Information
- Application Number
- CN202310288327.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2024-09-24
AI Technical Summary
Existing digital signature algorithms have the risk of leaking the original text during data transmission, and common encryption algorithms are insecure on some systems and cannot effectively guarantee the security of data transmission.
Using a combination of MD5 encryption and DSA algorithms, the plaintext data to be transmitted is encrypted, cut, randomly shuffled, generated digital signatures, and decrypted and compared at the receiving end to ensure the security of data transmission.
It improves the security of data transmission, prevents tampering and leakage, and ensures data integrity and confidentiality through the irreversibility of the MD5 algorithm and the speed of the DSA algorithm.
Smart Images

Figure CN118694545A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data sending method, a data receiving method, a system, a device and a storage medium. Background Art
[0002] With the rapid development of informatization, as the Internet of Everything becomes a trend and information islands are gradually eliminated, the importance and strategic position of data encryption transmission in protecting the legitimate rights and interests of citizens and personal privacy will become more prominent.
[0003] Although the Digital Signature Algorithm (DSA) can provide a good digital signature function in data encryption, the DSA algorithm transmission process requires the transmission of the summary and the original text, which inevitably leads to the leakage of the original text, and the security of data transmission is relatively low. In addition, the common algorithms on the market all have a unified algorithm package, and the encryption and decryption methods are generally well known. It is extremely unsafe to use a general encryption scheme on some special systems, and it is easy for the outside world to guess its encryption principle, thus failing to effectively guarantee the security of data transmission. Summary of the invention
[0004] Based on this, the object of the present invention is to provide a data sending method, a data receiving method, a system, a device and a storage medium for improving the security of data transmission to effectively ensure the security of data transmission.
[0005] In a first aspect, the present invention provides a data sending method, comprising:
[0006] Perform MD5 encryption on the plaintext data to be transmitted, obtain and put the first MD5 code corresponding to the plaintext data to be transmitted into the hash table;
[0007] Cut the plaintext data to be transmitted into a plurality of first plaintext data, perform MD5 encryption on the plurality of first plaintext data respectively according to the cutting order and mark the order, obtain and put the second MD5 code of each pair of the plurality of first plaintext data into the hash table according to the marking order;
[0008] Randomly disrupting the order of the plurality of first plaintext data, and then splicing the plurality of first plaintext data into new target transmission data;
[0009] Perform DSA encryption on the hash table using a private key to generate a digital signature;
[0010] The target transmission data and the digital signature are sent to the server.
[0011] In a possible design, the to-be-transmitted plaintext data is cut into a plurality of first plaintext data, including:
[0012] The plaintext data to be transmitted is cut into the plurality of first plaintext data according to 2 to the power of n; wherein n≧1.
[0013] In a possible design, randomly disrupting the order of the plurality of first plaintext data and then splicing the plurality of first plaintext data into new target transmission data includes:
[0014] Performing Base64 encryption on the plurality of first plaintext data respectively to obtain a plurality of first encrypted data;
[0015] The order of the plurality of first encrypted data is randomly disrupted, and then the plurality of first encrypted data are spliced into the target transmission data.
[0016] In a second aspect, the present invention further provides a data receiving method, comprising:
[0017] Receive target transmission data and digital signature sent by the client; the target transmission data is obtained by the client cutting the plaintext data to be transmitted into a plurality of first plaintext data, randomly disrupting the order of the plurality of first plaintext data and then splicing them together; the digital signature is generated by the client performing DSA encryption on a hash table using a private key; the content of the hash table includes a first MD5 code obtained by the client performing MD5 encryption on the plaintext data to be transmitted, and a second MD5 code corresponding to each of the plurality of first plaintext data obtained by the client performing MD5 encryption on the plurality of first plaintext data, wherein the second MD5 codes corresponding to each of the plurality of first plaintext data are sorted in the order of the marks;
[0018] Use the public key to perform DSA decryption on the digital signature, and parse out the first MD5 code in the hash table and the second MD5 codes corresponding to the plurality of first plaintext data and their marking sequence;
[0019] Cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data, and performing MD5 encryption on the plurality of second plaintext data to obtain third MD5 codes corresponding to the plurality of second plaintext data respectively;
[0020] Rearranging the order of the plurality of second plaintext data according to the mark order corresponding to each of the plurality of first plaintext data, splicing the plurality of second plaintext data into the target plaintext data, and performing MD5 encryption on the target plaintext data to obtain a fourth MD5 code corresponding to the target plaintext data;
[0021] After comparing the fourth MD5 code with the first MD5 code, and the third MD5 codes corresponding to the plurality of second plaintext data with the second MD5 codes corresponding to the plurality of first plaintext data, and finding that they are consistent, it is determined that the target plaintext data is consistent with the plaintext data to be transmitted, and the plaintext data to be transmitted is transmitted securely.
[0022] In one possible design, the number of the plurality of first plaintext data is equal to 2 n , n≧1; cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data, including:
[0023] The target transmission data is cut into the plurality of second plaintext data according to a number L-1; wherein L is equal to the number of rows of the hash table.
[0024] In one possible design, before cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data, the method further includes:
[0025] It is determined that the total number of MD5 codes in the hash table is an odd number.
[0026] In a possible design, the target transmission data is composed of a plurality of first encrypted data spliced in random order, wherein the plurality of first encrypted data are obtained by Base64 encryption of the plurality of first plaintext data respectively; the target transmission data is cut into a plurality of second plaintext data corresponding to the plurality of first plaintext data, including:
[0027] Cutting the target transmission data into a plurality of second encrypted data corresponding to the plurality of first encrypted data;
[0028] The plurality of second encrypted data are respectively decrypted using Base64 to obtain the plurality of second plaintext data.
[0029] In a third aspect, the present invention further provides a data transmission system, comprising: a client and a server communicating with the client;
[0030] The client is used in the method involved in any possible design of the first aspect above;
[0031] The server is used for the method involved in any possible design of the second aspect mentioned above.
[0032] In a fourth aspect, the present invention further provides a computer device, comprising: at least one memory and at least one processor;
[0033] The at least one memory is used to store one or more programs;
[0034] When the one or more programs are executed by the at least one processor, the method involved in any possible design of the first aspect or the method involved in any possible design of the second aspect is implemented.
[0035] In a fifth aspect, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one program; when the at least one program is executed by a processor, the method involved in any possible design of the above-mentioned first aspect, or the method involved in any possible design of the above-mentioned second aspect is implemented.
[0036] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings.
[0037] The beneficial effects of the present invention are as follows:
[0038] In the present invention, the client first performs MD5 encryption on the plaintext data to be transmitted, obtains and puts the first MD5 code corresponding to the plaintext data to be transmitted into a hash table; then cuts the plaintext data to be transmitted into several first plaintext data, performs MD5 encryption on the several first plaintext data respectively according to the cutting order and marks the order, obtains and puts the second MD5 code of the several first plaintext data respectively into the hash table according to the marking order; then randomly scrambles the order of the several first plaintext data, and then splices the several first plaintext data into new target transmission data; then uses the private key to perform DSA encryption on the hash table to generate a digital signature; finally, sends the target transmission data and the digital signature to the server; the server performs DSA decryption on the digital signature by using the public key, parses out the first MD5 code in the hash table and the second MD5 codes and their marking order corresponding to the several first plaintext data respectively; then cuts the target transmission data into several second plaintext data corresponding to the several first plaintext data, and encrypts the several first plaintext data respectively according to the cutting order, obtains and puts the second MD5 code of the several first plaintext data respectively into the hash table according to the marking order; then randomly scrambles the order of the several first plaintext data, and then splices the several first plaintext data into new target transmission data; MD5 is performed on the two plaintext data to obtain the third MD5 codes corresponding to the several second plaintext data respectively; then the order of the several second plaintext data is reordered according to the tag order corresponding to the several first plaintext data respectively, the several second plaintext data are spliced into the target plaintext data, and the target plaintext data is encrypted with MD5 to obtain the fourth MD5 code corresponding to the target plaintext data; finally, after the fourth MD5 code is compared with the first MD5 code, the third MD5 codes corresponding to the several second plaintext data respectively, and the second MD5 codes corresponding to the several first plaintext data respectively, it is determined that the target plaintext data is consistent with the plaintext data to be transmitted, and the plaintext data to be transmitted is transmitted safely, so that the irreversible, stable and fast characteristics of the MD5 algorithm can be fully utilized, and the received first target data and the fragment data of the first target data are compared and judged in terms of the whole, quantity and sorting, with high security and strong anti-tampering ability, thereby improving the security of data transmission and effectively ensuring the security of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flow chart of a data sending method provided by the present invention;
[0040] Figure 2 A schematic diagram of a process of data transmission using an improved DSA algorithm provided by the present invention;
[0041] Figure 3 A schematic diagram of the process of encapsulating, encrypting, unpacking and decrypting plaintext data to be transmitted provided by the present invention;
[0042] Figure 4a A schematic diagram of a program code for executing MD5 encryption on plaintext data to be transmitted by a client provided by the present invention;
[0043] Figure 4b A schematic diagram of a first MD5 code provided by the present invention;
[0044] Figure 5 A schematic diagram of determining the total number of MD5s of a hash table provided by the present invention
[0045] Figure 6 A schematic diagram of the contents of a hash table after a plurality of first plaintext data are encrypted and scrambled provided by the present invention;
[0046] Figure 7a A schematic diagram of a program code executed in step S13 provided by the present invention;
[0047] Figure 7b A schematic diagram of a Base64 encrypted ciphertext provided by the present invention;
[0048] Figure 8a A schematic diagram of a program code executed in a process of making a public key and a private key provided by the present invention;
[0049] Figure 8b A schematic diagram of a public key and a private key provided by the present invention;
[0050] Figure 9a A schematic diagram of a program code provided by the present invention for executing a digital signature by using a private key to perform DSA encryption on a hash table by a client;
[0051] Figure 9b A schematic diagram of a digital signature provided by the present invention;
[0052] Fig.10 A flow chart of a data receiving method provided by the present invention;
[0053] Fig.11aA schematic diagram of a program code for executing a server end provided by the present invention to re-order the order of a plurality of second plaintext data according to the mark order corresponding to each of the plurality of first plaintext data;
[0054] Fig.11b A schematic diagram of a Base64 decrypted ciphertext provided by the present invention;
[0055] Fig.12a A schematic diagram of a program code for executing MD5 encryption on target plaintext data by a server provided by the present invention;
[0056] Figure 12b A schematic diagram of a fourth MD5 code corresponding to target plaintext data provided by the present invention;
[0057] Fig.13 A schematic diagram of a program code for comparing a fourth MD5 code with a first MD5 code and determining execution by a server provided by the present invention;
[0058] Fig.14 A schematic diagram of the architecture of a data transmission system provided by the present invention;
[0059] Fig.15 A schematic diagram of the structure of a computer device provided by the present invention. DETAILED DESCRIPTION
[0060] The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of embodiments consistent with some aspects of the present invention.
[0061] The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms of "a", "the" and "the" used in this specification are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0062] Unless otherwise specified, ordinal numbers such as "first" and "second" mentioned in this specification are used to distinguish multiple objects and are not used to limit the order, timing, priority or importance of multiple objects.
[0063] As mentioned above, the DSA algorithm can only be used for digital signatures, but not for encryption. It can also be understood that the DSA algorithm is mainly used to prevent content tampering. If only the DSA algorithm is used for data transmission, the original text may be leaked, and the security of data transmission is low. In addition, the RSA algorithm (i.e., an asymmetric encryption algorithm) can be used as a data signature algorithm or as an encryption algorithm. Although it is more commonly used in data encryption, when the RSA algorithm is used as an encryption algorithm, the performance will drop sharply as the key length increases.
[0064] Based on the problems existing in the above-mentioned DSA algorithm and RSA algorithm, the present invention proposes a reliable, secure, and stable asymmetric content encryption transmission and reception scheme based on the HASH function, MD5 algorithm, and DSA algorithm, which is used to improve the security of data transmission to effectively ensure the security of data transmission. Specifically, in order to make the data in the entire transmission process more concealed, the present invention adopts the HASH function and MD5 algorithm to strengthen the DSA algorithm based on the principles that the encryption algorithm should be fast, the encryption algorithm occupies a small storage space, the communication overhead of the encryption algorithm should be small, the encryption algorithm should be easy to implement, and the encryption algorithm needs to be diversified, so as to avoid the confidentiality of the data transmission process, make it safer, more reliable, and more efficient, thereby improving the security of data transmission to effectively ensure the security of data transmission.
[0065] To further illustrate the data transmission and data reception solutions provided by the embodiments of the present invention, a detailed description is given below in conjunction with the accompanying drawings and specific implementation methods.
[0066] It should be understood that the present invention takes the data sending end as the client and the data receiving end as the server as an example. Of course, in specific implementation, the client may also be the data receiving end, and the server may also be the data sending end.
[0067] The following will be combined Figure 1-3 And specific implementation methods First, the data sending method provided by the present invention is described in detail.
[0068] Combination Figure 1-3 As shown, the data sending method provided by the present invention may include the following steps:
[0069] S11, perform MD5 encryption on the plaintext data to be transmitted, obtain and put the first MD5 code corresponding to the plaintext data to be transmitted into a hash table.
[0070] In specific implementation, after the client obtains the plaintext data to be transmitted, it can perform MD5 encryption on the plaintext data to be transmitted to obtain the first MD5 code corresponding to the plaintext data to be transmitted. Afterwards, the client can put the first MD5 code into the hash table, which can also be understood as storing the first MD5 in the hash table.
[0071] As an example, the client can use MD5 encryption to encrypt plain text data to be transmitted. Figure 4a The first MD5 code can be as follows: Figure 4b The MD5 code shown.
[0072] In the present invention, by performing MD5 encryption on the plaintext data to be transmitted and then putting the first MD5 code obtained by encryption into the hash table, the subsequent server can judge whether the received data has been tampered with based on the first MD5, which helps to ensure the security of data transmission.
[0073] S12, cutting the plaintext data to be transmitted into a plurality of first plaintext data, performing MD5 encryption on the plurality of first plaintext data respectively according to the cutting order and marking the order, obtaining and putting the second MD5 code of each pair of the plurality of first plaintext data into a hash table according to the marking order.
[0074] In the specific implementation, the client can cut the plaintext data to be transmitted into a plurality of first plaintext data according to the power of 2, that is, the number of the plurality of first plaintext data is equal to 2. n , where n≧1. Afterwards, the client can perform MD5 encryption on the plurality of first plaintext data respectively according to the switching sequence and mark the sequence to obtain the second MD5 codes corresponding to the plurality of first plaintext data respectively.
[0075] For example, taking n as 3, the second MD5 codes corresponding to the first plaintext data can be as follows: Figure 5-6 Shown are fragment MD5-1, fragment MD5-2, fragment MD5-3, fragment MD5-4, fragment MD5-5, fragment MD5-6, fragment MD5-7 and fragment MD5-8.
[0076] In specific implementation, the upper limit of n can be set according to actual needs, and the present invention does not limit this. For example, when the upper limit is set to 5, the number of the first plaintext data will not exceed 32.
[0077] In a specific implementation, the client may put the second MD5 codes corresponding to the plurality of first plaintext data into a hash table according to the marking order.
[0078] For example, taking n as 3, after the second MD5 codes corresponding to the plurality of first plaintext data are placed in the hash table in the order of marking, the hash table can be as follows: Figure 5-6 As shown in the table on the left.
[0079] In the present invention, by cutting the plaintext data to be transmitted into several first plaintext data, and then MD5 encrypting and marking the several first plaintext data respectively according to the cutting order, the second MD5 codes of the several first plaintext data are obtained and put into a hash table according to the marking order. This can facilitate the subsequent restoration of the plaintext data to be transmitted on the server through the marking order of the second MD5 codes corresponding to the several first plaintext data, and determine whether the plaintext data to be transmitted has been tampered with, which helps to improve the security of data transmission to ensure the security of data transmission.
[0080] S13. Randomly disrupt the order of a number of first plaintext data, and then splice the number of first plaintext data into new target transmission data.
[0081] In the present invention, by randomly disrupting the order of several first plaintext data and then splicing the several first plaintext data into new target transmission data, the content of the plaintext data to be transmitted can be obfuscated, and the confidentiality of the data during the transmission process can be further increased to prevent the appearance of plaintext, which helps to improve the security of data transmission and ensure the security of data transmission.
[0082] In a scenario to which the present invention is applicable, in order to avoid the phenomenon of garbled characters due to encoding problems during transmission, the specific implementation process of step S13 may be:
[0083] Base64 is performed on a plurality of first plaintext data to obtain a plurality of first encrypted data. Then, the order of the plurality of first encrypted data is randomly disrupted, and the plurality of first encrypted data are then concatenated into target transmission data. Figure 6 The key1, key2, key3, key4, key5, key6, key7 and key8 shown are the order of a number of first encrypted data.
[0084] As an example, after randomly disrupting the order of a plurality of first encrypted data, the plurality of first encrypted data may be as follows: Figure 6 As shown in the table on the right.
[0085] As an example, the specific implementation process of step S13 can be adopted Figure 7a The program code shown is executed. Among them, the Base64 encrypted ciphertext can be as follows Figure 7b shown.
[0086] S14. Use the private key to perform DSA encryption on the hash table to generate a digital signature.
[0087] As an example, the process of creating public and private keys can be done using Figure 8a The public and private keys can be Figure 8b shown.
[0088] As an example, the client uses the private key to perform DSA encryption on the hash table, and the process of generating a digital signature can be as follows: Figure 9a The program code shown is executed. The digital signature can be as follows Figure 9b shown.
[0089] In the present invention, by using a private key to perform DSA encryption on the hash table and generate a digital signature, it is possible to prevent the content of the hash table from being tampered with during data transmission, and further improve the security of data transmission to ensure the security of data transmission.
[0090] S15. Send the target transmission data and digital signature to the server.
[0091] From the above description, it can be seen that in the present invention, the client first performs MD5 encryption on the plaintext data to be transmitted, obtains and puts the first MD5 code corresponding to the plaintext data to be transmitted into a hash table; then cuts the plaintext data to be transmitted into several first plaintext data, encrypts the several first plaintext data with MD5 according to the cutting order and marks the order, obtains and puts the second MD5 code of the several first plaintext data into the hash table according to the marking order; then randomly scrambles the order of the several first plaintext data, and then splices the several first plaintext data into new target transmission data; then uses the private key to perform DSA encryption on the hash table to generate a digital signature; finally, the target transmission data and the digital signature are sent to the server, so that the irreversible, stable, and fast characteristics of the MD5 algorithm can be fully utilized, and the plaintext data to be transmitted and the fragments of the plaintext data to be transmitted are confidentially processed in terms of overall, quantity, and sorting, with high security and strong anti-tampering, thereby improving the security of data transmission and effectively ensuring the security of data transmission.
[0092] In addition, the present invention adopts the MD5 algorithm and improves the DSA algorithm at the encryption level. Since the MD5 algorithm has a fast encryption speed and the DSA algorithm has a fast digital signature operation speed, data encryption processing can be performed efficiently.
[0093] The following will be combined Figure 1-10 And the specific implementation method provides a detailed description of the data receiving method provided by the present invention.
[0094] Combination Figure 1-10 As shown, the data receiving method provided by the present invention may include the following steps:
[0095] S21. Receive the target transmission data and digital signature sent by the client.
[0096] In the specific implementation, the target transmission data is cut into several first plaintext data by the client based on the plaintext data to be transmitted, and then the order of the several first plaintext data is randomly disrupted and then spliced. The digital signature is generated after the client uses the private key to DSA encrypt the hash table. The content of the hash table includes the first MD5 code obtained by the client after MD5 encryption of the plaintext data to be transmitted, and the second MD5 codes corresponding to the several first plaintext data obtained by the client after MD5 encryption of the several first plaintext data in the cutting order and marking the order, wherein the second MD5 codes corresponding to the several first plaintext data are sorted in the marking order.
[0097] It should be understood that the target transmission data and digital signature are the same as above Figure 1 The target transmission data and digital signature shown are the same.
[0098] S22. Use the public key to perform DSA decryption on the digital signature, and parse out the first MD5 code in the hash table and the second MD5 codes corresponding to the plurality of first plaintext data and their marking sequence.
[0099] As an example, the server can use Figure 8b The digital signature is shown to be decrypted using DSA using the public key.
[0100] In the present invention, the server uses the public key to perform DSA decryption on the digital signature, and parses out the first MD5 code in the hash table and the second MD5 codes and their marking order corresponding to each of the several first plaintext data. This allows the server to subsequently restore the plaintext data to be transmitted through the marking order of the second MD5 codes corresponding to each of the several first plaintext data, and determine whether the plaintext data to be transmitted has been tampered with, which helps to improve the security of data transmission to ensure the security of data transmission.
[0101] S23, cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data, and performing MD5 encryption on the plurality of second plaintext data to obtain third MD5 codes corresponding to the plurality of second plaintext data respectively.
[0102] In the specific implementation, when the number of the first plaintext data is equal to 2 n When (n≧1), the server can cut the target transmission data into a number of second plaintext data according to L-1 numbers, where L is equal to the number of rows in the hash table.
[0103] In an applicable scenario provided by an embodiment of the present invention, since the total number of MD5 codes in the hash table transmitted by the client must be an odd number, the server can determine whether the total number of MD5 codes in the hash table is an odd number before executing step S23 to determine whether there is a problem in the transmission of the target transmission data. This is because, combined with Figure 5-6 As shown, the first position in the hash table has stored the first MD5 code corresponding to the plaintext data to be transmitted, and starting from the second position of the hash table, the second MD5 codes corresponding to several first plaintext data are stored, and the total number of second MD5 codes corresponding to several second plaintext data is an even number.
[0104] like Figure 5 As shown, when the server determines that the total number of MD5 codes in the hash table is an even number, it means that there is a problem with the target transmission data during the transmission process, and it can be determined that the target transmission data has a security problem, such as being tampered with. When the server determines that the total number of MD5 codes in the hash table is an odd number, it means that the target transmission data is correct during the transmission process, and it can be determined that the target transmission data is transmitted normally, and step S23 is executed.
[0105] In the specific implementation, when the target transmission data is composed of several first encrypted data concatenated in random order, and the several first encrypted data are obtained by Base64 encryption of several first plaintext data, the server can first cut the target transmission data into several second encrypted data corresponding to the several first encrypted data, and then perform Base64 decryption on the several second encrypted data respectively to obtain several second plaintext data.
[0106] In the present invention, the server cuts the target transmission data into a number of second plaintext data corresponding to a number of first plaintext data, and then performs MD5 encryption on the number of second plaintext data to obtain a third MD5 code corresponding to each of the second plaintext data. This allows the server to subsequently compare the third MD5 code corresponding to each of the second plaintext data with the first MD5 code corresponding to each of the first plaintext data to determine whether the received target transmission data has been tampered with, which helps to improve the security of data transmission to ensure the security of data transmission.
[0107] S24. Rearrange the order of the plurality of second plaintext data according to the mark order corresponding to each of the plurality of first plaintext data, concatenate the plurality of second plaintext data into target plaintext data, and perform MD5 encryption on the target plaintext data to obtain a fourth MD5 code corresponding to the target plaintext data.
[0108] In the specific implementation, if the content of the first target data is tampered with, the order of several second plaintext data and their corresponding third MD5 codes will be inconsistent or missing from the marking order of several first plaintext data and their corresponding first MD5 codes, and the fourth MD5 code will also be inconsistent with the first MD5 code.
[0109] As an example, the process of reordering the order of the plurality of second plaintext data according to the tag order corresponding to each of the plurality of first plaintext data can be as follows: Fig.11a The program code shown in the figure is executed. Among them, the decrypted ciphertext of Base64 can be as follows Fig.11b shown.
[0110] As an example, the server can use the following method to encrypt the target plaintext data using MD5: Fig.12a The program code shown is executed. Among them, the fourth MD5 code corresponding to the target plaintext data can be as follows Figure 12b shown.
[0111] In the present invention, the server reorders the order of several second plaintext data according to the mark order corresponding to each of the several first plaintext data, and then splices the several second plaintext data into target plaintext data. This makes it convenient for the server to subsequently compare the fourth MD5 code corresponding to the target plaintext data with the first MD5 code corresponding to the plaintext data to be transmitted, so as to determine whether the received target transmission data has been tampered with, which helps to improve the security of data transmission to ensure the security of data transmission.
[0112] S25. After comparing the fourth MD5 code with the first MD5 code, and the third MD5 codes corresponding to the plurality of second plaintext data with the second MD5 codes corresponding to the plurality of first plaintext data, and finding that they are consistent, it is determined that the target plaintext data is consistent with the plaintext data to be transmitted, and the plaintext data to be transmitted is transmitted safely.
[0113] As an example, the server may compare the fourth MD5 code with the first MD5 code in the following manner: Fig.13 The program code shown is executed.
[0114] In the specific implementation, if the fourth MD5 code is compared with the first MD5 code, and the third MD5 codes corresponding to several second plaintext data are compared with the second MD5 codes corresponding to several first plaintext data, and they are inconsistent, it means that the target plaintext data is inconsistent with the plaintext data to be transmitted, and there is a security problem in the transmission process of the plaintext data to be transmitted, such as tampering.
[0115] From the above description, it can be known that in the present invention, the server receives the target transmission data and digital signature sent by the client; then uses the public key to perform DSA decryption on the digital signature, parses out the first MD5 code in the hash table and the second MD5 codes and their marking order corresponding to the several first plaintext data; then cuts the target transmission data into several second plaintext data corresponding to the several first plaintext data, and performs MD5 encryption on the several second plaintext data to obtain the third MD5 codes corresponding to the several second plaintext data; then reorders the order of the several second plaintext data according to the marking order corresponding to the several first plaintext data, and splices the several second plaintext data into the target plaintext data. And perform MD5 encryption on the target plaintext data to obtain the fourth MD5 code corresponding to the target plaintext data; finally, after comparing the fourth MD5 code with the first MD5 code, the third MD5 codes corresponding to several second plaintext data with the second MD5 codes corresponding to several first plaintext data, and finding that they are consistent, it is determined that the target plaintext data is consistent with the plaintext data to be transmitted, and the plaintext data to be transmitted is transmitted safely, thereby making full use of the irreversible, stable, and fast characteristics of the MD5 algorithm, and comparing and judging the received first target data and the fragment data of the first target data in terms of the whole, quantity, and sorting, with high security and strong anti-tampering ability, thereby improving the security of data transmission and effectively ensuring the security of data transmission.
[0116] In addition, the present invention adopts the MD5 algorithm and improves the DSA algorithm at the encryption level. Since the MD5 algorithm has a fast decryption speed and the DSA algorithm has a fast digital signature operation speed, data decryption processing can be performed efficiently.
[0117] Based on the same inventive concept, an embodiment of the present invention also provides a data transmission system. Fig.14 As shown, the data transmission system 30 includes a client 31 and a server 32 communicating with the client. The client 31 is used to implement the above Figure 1 The data transmission method shown in FIG. 3 is used to implement the above Fig.10 The data receiving method shown.
[0118] Based on the same inventive concept, an embodiment of the present invention further provides a computer device. Fig.15 As shown, the computer device 40 may include: at least one memory 41 and at least one processor 42. Among them:
[0119] At least one memory 41 is used to store one or more programs.
[0120] When one or more programs are executed by at least one processor 42, the above Figure 1 The data transmission method shown in Fig.10The data receiving method shown.
[0121] The computer device 40 may also optionally include a communication interface, and the communication interface is used to communicate with external devices and exchange data.
[0122] It should be noted that the memory 41 may include a high-speed RAM memory, and may also include a nonvolatile memory (nonvolatile memory), such as at least one disk memory.
[0123] In a specific implementation process, if the memory 41, the processor 42 and the communication interface are integrated on a chip, the memory 41, the processor 42 and the communication interface can communicate with each other through an internal interface. If the memory 41, the processor 42 and the communication interface are implemented independently, the memory 41, the processor 42 and the communication interface can be connected to each other through a bus and communicate with each other.
[0124] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium, which can store at least one program. When the at least one program is executed by a processor, the above Figure 1 The data transmission method shown in Fig.10 The data receiving method shown.
[0125] It should be understood that a computer-readable storage medium is any data storage device that can store data or programs, which can then be read by a computer system. Examples of computer-readable storage media include read-only memory, random access memory, CD-ROM, HDD, DVD, magnetic tape, and optical data storage devices, etc.
[0126] The computer readable storage medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.
[0127] The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
[0128] The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.
Claims
1. A data transmission method, characterized in that: include: Perform MD5 encryption on the plaintext data to be transmitted, obtain and put the first MD5 code corresponding to the plaintext data to be transmitted into the hash table; Cut the plaintext data to be transmitted into a plurality of first plaintext data, perform MD5 encryption on the plurality of first plaintext data respectively according to the cutting order and mark the order, obtain and put the second MD5 code of each pair of the plurality of first plaintext data into the hash table according to the marking order; Randomly disrupting the order of the plurality of first plaintext data, and then splicing the plurality of first plaintext data into new target transmission data; Perform DSA encryption on the hash table using a private key to generate a digital signature; The target transmission data and the digital signature are sent to the server.
2. The method according to claim 1, characterized in that Cutting the plaintext data to be transmitted into a plurality of first plaintext data includes: The plaintext data to be transmitted is cut into the plurality of first plaintext data according to 2 to the power of n; wherein n≧1.
3. The method according to claim 1 or 2, characterized in that Randomly disrupting the order of the plurality of first plaintext data, and then splicing the plurality of first plaintext data into new target transmission data, comprises: Performing Base64 encryption on the plurality of first plaintext data respectively to obtain a plurality of first encrypted data; The order of the plurality of first encrypted data is randomly disrupted, and then the plurality of first encrypted data are spliced into the target transmission data.
4. A data receiving method, characterized in that: include: Receive target transmission data and digital signature sent by the client; The target transmission data is obtained by cutting the client into a number of first plaintext data based on the plaintext data to be transmitted, and then randomly disrupting the order of the first plaintext data and then splicing them together. The digital signature is generated by the client using a private key to perform DSA encryption on a hash table. The content of the hash table includes a first MD5 code obtained by the client performing MD5 encryption on the plaintext data to be transmitted, and a second MD5 code corresponding to each of the first plaintext data obtained by the client performing MD5 encryption on the first plaintext data, wherein the second MD5 codes corresponding to each of the first plaintext data are sorted in the order of the mark; Use the public key to perform DSA decryption on the digital signature, and parse out the first MD5 code in the hash table and the second MD5 codes corresponding to the plurality of first plaintext data and their marking sequence; Cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data, and performing MD5 encryption on the plurality of second plaintext data to obtain third MD5 codes corresponding to the plurality of second plaintext data respectively; Rearranging the order of the plurality of second plaintext data according to the mark order corresponding to each of the plurality of first plaintext data, splicing the plurality of second plaintext data into the target plaintext data, and performing MD5 encryption on the target plaintext data to obtain a fourth MD5 code corresponding to the target plaintext data; After comparing the fourth MD5 code with the first MD5 code, and the third MD5 codes corresponding to the plurality of second plaintext data with the second MD5 codes corresponding to the plurality of first plaintext data, and finding that they are consistent, it is determined that the target plaintext data is consistent with the plaintext data to be transmitted, and the plaintext data to be transmitted is transmitted securely.
5. The method according to claim 4, characterized in that The number of the first plaintext data is equal to 2 n , n≧1; Cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data comprises: The target transmission data is cut into the plurality of second plaintext data according to a number L-1; wherein L is equal to the number of rows of the hash table.
6. The method according to claim 5, characterized in that Before cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data, the method further includes: It is determined that the total number of MD5 codes in the hash table is an odd number.
7. The method according to claim 4, characterized in that The target transmission data is composed of a plurality of first encrypted data spliced in random order, and the plurality of first encrypted data are obtained by respectively performing Base64 encryption on the plurality of first plaintext data; Cutting the target transmission data into a plurality of second plaintext data corresponding to the plurality of first plaintext data comprises: Cutting the target transmission data into a plurality of second encrypted data corresponding to the plurality of first encrypted data; The plurality of second encrypted data are respectively decrypted using Base64 to obtain the plurality of second plaintext data.
8. A data transmission system, characterized in that: include: A client and a server communicating with the client; The client is used to implement the method according to any one of claims 1 to 3; The server is used to implement the method according to any one of claims 4 to 7.
9. A computer device, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, the method according to any one of claims 1 to 3 is implemented, or the method according to any one of claims 4 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one program; when the at least one program is executed by a processor, the method according to any one of claims 1 to 3 is implemented, or the method according to any one of claims 4 to 7 is implemented.
Citation Information
Cited By
Data security storage and verification method based on block chain
CN120150937A
A blockchain-based method for secure data storage and verification
CN120150937B
