Data information encryption verification method, system and computer readable storage medium
Through secret key exchange and data signature encryption between the user terminal and the management server, the problem of low reliability of data information transmission consistency verification in the existing technology is solved, and high reliability of data information during Internet transmission is achieved. sex check.
Patent Information
- Application Number
- CN202011443116.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-12-08
AI Technical Summary
In the existing technology, the reliability of the consistency check of data information transmitted via the Internet is not high and it is easily interfered by the outside world, making it difficult to effectively protect the data information during the transmission process.
By exchanging secret keys between the user terminal and the management server, the terminal negotiation secret key and the server negotiation secret key are generated, the data information to be sent is signed and encoded, and the management server performs reverse encoding verification to ensure the consistency of the data signature.
It significantly improves the reliability of data information consistency verification, enhances the security of data during transmission, and avoids the impact of external interference.
Smart Images

Figure CN112491549B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information encryption technology, and belongs to an application scenario of encrypting and verifying data information in a smart city, and in particular to a data information encryption and verification method, system and computer-readable storage medium. Background Art
[0002] The user terminal can send a service request to the management server to process the service request. After processing the service request, the management server obtains the return data and feeds it back to the user terminal. The data information transmitted between the user terminal and the management server is usually implemented through the HTTP protocol. The data information corresponding to the HTTP protocol can be easily obtained through the browser's debugging tool or data crawling tool. The data information transmitted by the user terminal and the management server through the Internet is difficult to be hidden. In order to avoid external interference in the transmission process of data information, it is necessary to verify the consistency of the transmitted data information. The traditional technical method adopts the method of directly matching and verifying the data information. Although this method can simply and quickly verify the consistency of data information, it has the problem of insufficient confidentiality and easy to be interfered by the outside world, which affects the reliability of the consistency verification of data information. Therefore, there is a problem of low reliability in the traditional technical method for consistency verification of data information transmitted via the Internet. Summary of the invention
[0003] The embodiments of the present invention provide a data information encryption verification method, system and computer-readable storage medium, aiming to solve the problem of low reliability of consistency verification of data information transmitted via the Internet existing in the prior art methods.
[0004] In a first aspect, an embodiment of the present invention provides a data information encryption verification method, which includes:
[0005] If the user terminal receives the data information to be sent input by the user, it sends a transmission request information to the management server;
[0006] The management server receives the transmission request information from the user terminal, generates first secret key information according to a preset secret key generation rule, and sends the first public key in the first secret key information to the user terminal;
[0007] If the user terminal receives the first public key, it generates second key information according to the key generation rule, and feeds back the second public key in the second key information to the management server;
[0008] The user terminal generates a corresponding terminal negotiation key according to a preset negotiation key generation rule, the first public key and the second key information;
[0009] The user terminal generates a data signature corresponding to the data information to be sent according to the terminal negotiated secret key and a preset signature rule;
[0010] The user terminal encodes and encrypts the data information to be sent and the data signature according to a preset encoding rule to obtain encrypted data information and sends the encrypted data information to the management server;
[0011] The management server receives the second public key and the encrypted data information from the user terminal, and generates a corresponding server negotiation key according to the negotiation key generation rule, the second public key and the first key information;
[0012] The management server reversely encodes the encrypted data information according to the encoding rule to obtain reversely encoded data information;
[0013] The management server generates a target data signature corresponding to the target data information in the reverse-encoded data information according to the server negotiated secret key and the signature rule;
[0014] The management server verifies whether the target data signature is consistent with the signature information in the reverse-encoded data information to obtain a data verification result.
[0015] In a second aspect, an embodiment of the present invention provides a data information encryption verification system, which includes a user terminal and a management server, wherein the user terminal includes a transmission request information sending unit, a second key generation unit, a terminal negotiation key generation unit, a data signature generation unit, and an encrypted data information sending unit, and the management server includes a first key generation unit, a server negotiation key generation unit, a reverse encoding data information acquisition unit, a target data signature generation unit, and a data verification result acquisition unit:
[0016] A transmission request information sending unit, configured to send transmission request information to the management server upon receiving data information to be sent input by a user;
[0017] A first key generation unit, configured to receive a transmission request message from a user terminal, generate first key information according to a preset key generation rule, and send a first public key in the first key information to the user terminal;
[0018] A second key generating unit is configured to generate second key information according to the key generating rule upon receiving the first public key, and feed back the second public key in the second key information to the management server;
[0019] A terminal negotiation key generation unit, configured to generate a corresponding terminal negotiation key according to a preset negotiation key generation rule, the first public key and the second key information;
[0020] A data signature generating unit, configured to generate a data signature corresponding to the data information to be sent according to the terminal negotiated secret key and a preset signature rule;
[0021] An encrypted data information sending unit, used to encode and encrypt the data information to be sent and the data signature according to a preset encoding rule to obtain encrypted data information and send it to the management server;
[0022] A server negotiation key generation unit, configured to receive the second public key and the encrypted data information from the user terminal, and generate a corresponding server negotiation key according to the negotiation key generation rule, the second public key and the first key information;
[0023] a reverse-coded data information acquisition unit, configured to reverse-code the encrypted data information according to the coding rule to obtain reverse-coded data information;
[0024] A target data signature generating unit, configured to generate a target data signature corresponding to the target data information in the reverse-encoded data information according to the server negotiated secret key and the signature rule;
[0025] The data verification result acquisition unit is used to verify whether the target data signature is consistent with the signature information in the reverse-encoded data information to obtain a data verification result.
[0026] In the third aspect, an embodiment of the present invention further provides a data information encryption and verification system, which includes a user terminal and a management server, the user terminal includes a first memory, a first processor, and a first computer program stored in the first memory and executable on the first processor, the management server includes a second memory, a second processor, and a second computer program stored in the second memory and executable on the second processor, the first processor executes the first computer program and the second processor executes the second computer program to jointly implement the data information encryption and verification method described in the first aspect above.
[0027] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores a first computer program and / or a second computer program, and when the first computer program is executed by a first processor and the second computer program is executed by a second processor, the data information encryption and verification method described in the first aspect above is jointly implemented.
[0028] The embodiment of the present invention provides a method, system and computer-readable storage medium for data information encryption verification. The management server receives the transmission request information from the user terminal, generates the first secret key information and sends the first public key therein to the user terminal. After receiving the first public key, the user terminal generates the second secret key information and sends the second public key therein to the management server. The user terminal generates the terminal negotiation key and signs the data information to be sent. After generating the data signature, the data information to be sent and the data signature are encoded and encrypted to obtain the encrypted data information and sent to the management server. The management server reverse encodes the encrypted data information and generates the target data signature according to the corresponding generated server negotiation key, verifies whether the target data signature is consistent with the signature information in the reverse encoded data information, and obtains the data verification result. Through the above method, by generating a data signature corresponding to the data information to be sent and encoding and encrypting it for transmission, the reliability of consistency verification of the data information can be greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0030] Figure 1 A schematic diagram of a flow chart of a data information encryption verification method provided by an embodiment of the present invention;
[0031] Figure 2 A schematic diagram of an application scenario of the data information encryption verification method provided by an embodiment of the present invention;
[0032] Figure 3 A schematic diagram of a sub-process of a data information encryption verification method provided by an embodiment of the present invention;
[0033] Figure 4 A schematic diagram of another sub-process of the data information encryption verification method provided by an embodiment of the present invention;
[0034] Figure 5 A schematic diagram of another sub-process of the data information encryption verification method provided by an embodiment of the present invention;
[0035] Figure 6 A schematic diagram of another sub-process of the data information encryption verification method provided by an embodiment of the present invention;
[0036] Figure 7 Another schematic diagram of a flow chart of a data information encryption verification method provided by an embodiment of the present invention;
[0037] Figure 8Another schematic diagram of a flow chart of a data information encryption verification method provided by an embodiment of the present invention;
[0038] Fig. 9 A schematic block diagram of a data information encryption verification system provided by an embodiment of the present invention;
[0039] Fig.10 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0042] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0043] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0044] See also Figure 1 and Figure 2 , Figure 1 is a flow chart of a data information encryption verification method provided by an embodiment of the present invention, Figure 2Schematic diagram of application scenario of the data information encryption and verification method provided in the embodiment of the present invention; the data information encryption and verification method is applied to a data information encryption and verification system, the data information encryption and verification system includes a user terminal 20 or a management server 30, the data information encryption and verification method is executed by application software installed in the user terminal 20 and the management server 30, the management server 30 is connected to the user terminal 20 through a network to realize data information transmission, the user terminal 20 is a terminal device that encrypts the data information to be sent and sends it to the management server 30, the user terminal 20 can also decrypt and verify the encrypted data information sent by the management server 30, such as a desktop computer, a laptop computer, a tablet computer or a mobile phone, the management server 30 is a server end that decrypts and verifies the encrypted data information sent by the user terminal 20, the management server 30 can also encrypt the data information to be sent and send it to the user terminal 20, the management server 30 can be a server established by an enterprise, a government agency or other unit. Figure 1 As shown, the method includes steps S110 to S200.
[0045] S110: If the user terminal receives data information to be sent input by the user, it sends a transmission request message to the management server.
[0046] The user can input the data information to be sent through the user terminal. After the user terminal receives the data information to be sent, it sends a transmission request information to the management server. Before the user terminal officially sends the data information to the management server, it first needs to send a transmission request information to the management server for key exchange. After the key exchange, the user terminal can encrypt the data information to be sent and send it to the management server.
[0047] S120: The management server receives a transmission request message from a user terminal, generates first key information according to a preset key generation rule, and sends a first public key in the first key information to the user terminal.
[0048] The management server receives the transmission request information from the user terminal, generates the first key information according to the preset key generation rule, and sends the first public key in the first key information to the user terminal. The key generation rule is the rule for generating the first key information. The first key information includes the first public key and the first private key. The public key and the private key appear in pairs. The generated public key can be sent to other terminals for use, and the generated private key needs to be stored locally to prevent leakage. Specifically, the key generation rule includes the curve equation, base point coordinates and order threshold. The curve equation can be an elliptic curve equation: y 2 =x 3+ax+b, where a and b are parameter values in the elliptic curve equation, the base point coordinates are the coordinate values of any point on the curve equation, and the base point coordinates can be expressed as G=(Gx, Gy); the order threshold is the threshold for limiting the value range of the order, and the order threshold can be expressed as n-2, where n is a prime number.
[0049] In one embodiment, if Figure 3 As shown, step S120 includes sub-steps S121, S122 and S123.
[0050] S121. Randomly generate a server order that is less than the order threshold; S122. Calculate the target point coordinates based on the server order and the base point coordinates; S123. Use the server order as the first private key and the target point coordinates as the first public key.
[0051] A server order k less than the order threshold is randomly generated. The server order k is a positive integer and the value range of the server order k is k∈(0, n-2]. Specifically, the coordinates of the target point can be expressed as P=[k]×G. Point P is a point on the curve equation. A tangent can be drawn along point G to obtain a tangent with point G as the tangent point. A vertical line perpendicular to the tangent is drawn through point G. The intersection of the vertical line and the k-th order elliptic curve equation is point P. The first private key can be obtained by converting the server order k into a string expressed in hexadecimal. The first public key can be obtained by converting the coordinates of the target point into a string expressed in hexadecimal. The string lengths of the first public key and the first private key can be expressed in bytes. 1 byte=8 bits, and 1 bit is a data represented by a binary number.
[0052] For example, the first private key may be 32 bytes and the first public key may be 65 or 33 bytes.
[0053] S130: If the user terminal receives the first public key, it generates second key information according to the key generation rule, and feeds back the second public key in the second key information to the management server.
[0054] If the user terminal receives the first public key, it generates the second key information according to the key generation rule, and feeds back the second public key in the second key information to the management server. If the user terminal receives the first public key, it generates the second key information corresponding to the user terminal according to the key generation rule for generating the first key information. The generated second key information includes the second public key and the second private key. After the user terminal generates the second key information locally, it can feed back the second public key in the second key information to the management server for key exchange. During the key exchange process, the first public key and the second public key are only transmitted via the Internet, and the first private key is stored locally on the management server and the second private key is stored locally on the user terminal. Therefore, the first private key and the second private key are not transmitted via the Internet, which can greatly increase the security and reliability of consistency verification of data information.
[0055] In one embodiment, if Figure 4 As shown, step S130 includes sub-steps S131, S132, S133 and S134.
[0056] S131. Randomly generate a terminal order that is less than the order threshold; S132. Calculate the terminal target point coordinates based on the terminal order and the base point coordinates; S133. Determine whether the terminal target point coordinates are equal to the first public key; S134. If the terminal target point coordinates are not equal to the first public key, use the terminal order as the second private key and the target point coordinates as the second public key.
[0057] A terminal order k' is randomly generated which is less than the order threshold. The terminal order k' is a positive integer and the value range of the terminal order k' is k'∈(0, n-2], then the terminal target point coordinates can be expressed as P'=[k']×G, point P' is a point on the curve equation, and a tangent can be drawn along point G to obtain a tangent with point G as the tangent point. A vertical line perpendicular to the tangent is drawn through point G, and the intersection of the vertical line and the k'th order elliptic curve equation is point P'. The terminal target point coordinates are converted into a string represented in hexadecimal, and it is determined whether the string is equal to the first public key. If they are equal, a terminal order less than the order threshold is randomly generated again until the string corresponding to the generated terminal target point coordinates is not equal to the first public key; if they are not equal, the string is used as the second public key, and the terminal order k' is converted into a string represented in hexadecimal as the second private key. The string lengths of the second public key and the second private key can be expressed in bytes.
[0058] S140: The user terminal generates a corresponding terminal negotiation key according to a preset negotiation key generation rule, the first public key and the second key information.
[0059] The user terminal generates a corresponding user terminal negotiation key according to a preset negotiation key generation rule, the first public key, and the second key information. The user terminal generates a corresponding user terminal negotiation key according to the negotiation key generation rule, and the second key information includes a second public key and a second private key. Specifically, the negotiation key generation rule is rule information for generating a negotiation key. The user terminal negotiation key can be generated according to the negotiation key generation rule and the first public key and the second private key to generate a user terminal negotiation key. The generated user terminal negotiation key is 32 bytes.
[0060] The negotiation key generation rule can be a calculation formula based on the first public key and the second private key. For example, the calculation formula can be expressed as S'k=k'P mod r, r is the preset parameter value in the calculation formula, S'k is the generated user terminal negotiation key, and the generated user terminal negotiation key can be expressed as: clientkey=350cce5aa3a608fd60d2b2b9fc35cd19.
[0061] S150: The user terminal generates a data signature corresponding to the data information to be sent according to the terminal negotiated secret key and a preset signature rule.
[0062] The user terminal generates a data signature corresponding to the data information to be sent according to the terminal negotiated secret key and the preset signature rule. The signature rule is the specific rule for signing the data information to be sent according to the terminal negotiated secret key, and the signature rule includes parameter name sorting rules, character screening rules and signature algorithms. The data signature can be used as feature information for verifying the data information to be sent, and the data signature contains multiple characters.
[0063] In one embodiment, if Figure 5 As shown, step S150 includes sub-steps S151, S152, S153 and S154.
[0064] S151. Sort and combine multiple parameter information in the data information to be sent according to the parameter name sorting rule to obtain parameter combination information.
[0065] The data information to be sent may be composed of multiple parameter information, each of which is composed of a parameter name and a parameter value. The parameter name sorting rule is a specific rule for sorting the parameter information according to the parameter name of each parameter information.
[0066] For example, the specific content of the data information to be sent may include: appid: "anod0981782312"; message: "hello_world"; nonce_str: "sccEbNquakddKjA"; device_info: "9999".
[0067] Specifically, the parameter name sorting rule can be to sort the parameter information in ASCII coding order, then sort the parameter information according to the parameter name of each parameter information in ASCII coding order, and combine multiple parameter information according to the sorting result to obtain parameter combination information. During the splicing process, "&" can be used to separate two data information.
[0068] For example, the parameter combination information obtained after sorting and combining the above data information to be sent is: "appid=anod0981782312&device_info=9999&message=hello_world&nonce_str=sccEbNquakddKjA".
[0069] S152: Screen characters included in the parameter combination information according to the character screening rule to obtain valid character information.
[0070] The parameter combination information is composed of multiple characters. The character screening rule contains at least one illegal character. The characters corresponding to the illegal characters in the parameter combination information can be obtained and screened according to the character screening rule to obtain valid character information that does not contain the illegal characters.
[0071] For example, illegal characters configured in the character filtering rule can be characters such as space and "+".
[0072] S153, concatenating the valid character information with the terminal negotiated secret key to obtain concatenated character information; S154, generating a data signature corresponding to the concatenated character information according to the signature algorithm.
[0073] The acquired valid character information is concatenated with the terminal negotiation key to obtain the concatenated character information.
[0074] For example, the process of splicing valid character information with the terminal negotiation key can be represented by the following formula: stringTemp=stringA+“^”+“&clientkey=350cce5aa3a608fd60d2b2b9fc35cd19, stringA represents valid character information, and stringTemp represents spliced character information.
[0075] By signing the concatenated character information according to the signature algorithm, a data signature corresponding to the concatenated character information can be generated. The signature algorithm is a function method for signing the concatenated character information, and the signature algorithm can be implemented based on the MD5 information digest algorithm. For the input message to be signed, the MD5 signature algorithm will generate a 32-byte hash value, which is a string represented in hexadecimal. The calculated hash value is the data signature of the message to be signed. If two different messages to be signed are input, the same hash value will not be obtained. The hash value is uniquely corresponding to the message to be signed. Therefore, the hash value can be used to verify whether the message to be signed has been modified, that is, to verify the integrity of the message to be signed. If the two hash values calculated using the same MD5 signature algorithm are equal, it indicates that the message to be signed has not been modified. If the two hash values calculated using the same MD5 signature algorithm are not equal, it indicates that the message to be signed has been modified.
[0076] For example, the process of signing the above-mentioned concatenated character information using the MD5 signature algorithm can be expressed as: sign = MD5 (stringTemp).toUpperCase () = "F0AAF93E2A7D78D5EDB69D0843D8B41A", then "F0AAF93E2A7D78D5EDB69D0843D8B41A" is the obtained data signature.
[0077] S160: The user terminal encodes and encrypts the data information to be sent and the data signature according to a preset encoding rule to obtain encrypted data information and sends the encrypted data information to the management server.
[0078] The user terminal encodes and encrypts the data information to be sent and the data signature according to the preset encoding rules to obtain encrypted data information and sends it to the management server. In order to increase the security of the data information to be sent and the data signature during transmission, the data information can be encoded and encrypted according to the encoding rules, and the encrypted data information obtained by encoding and encrypting can be sent to the management server, wherein the encoding rules are the rule information for encoding the data, and the encoding rules can be Base64 encoding.
[0079] In one embodiment, if Figure 6 As shown, step S160 includes sub-steps S161 and S162.
[0080] S161. Combine the data information to be sent with the data signature to obtain combined information. S162. Encode and encrypt the combined information according to the encoding rule to obtain the encrypted data information.
[0081] Specifically, the data signature is added to the data information to be sent and then combined to obtain corresponding combined information.
[0082] For example, the obtained combined information can be expressed as: {appid: "anod0981782312"; message: "hello_world"; nonce_str: "sccEbNquakddKjA"; device_info: "9999"; sign: "F0AAF93E2A7D78D5EDB69D0843D8B41A"}.
[0083] By performing Base64 encoding and encryption on the combined information according to the encoding rules, the encrypted data information can be obtained. Base64 is an encoding method based on 64 printable characters to represent binary data. The 3-byte data in the combined information can be converted into 4-byte data through Base64 encoding and encryption. After Base64 encoding and encryption, the encrypted data information obtained only contains 64 characters: az, AZ, 0-9, "+" and " / ". The encrypted data information obtained is different from the original combined information. The above encoding and encryption can be used to avoid leakage of sensitive field information in the combined information during data transmission.
[0084] S170. The management server receives the second public key and the encrypted data information from the user terminal, and generates a corresponding server negotiation key according to the negotiation key generation rule, the second public key and the first key information.
[0085] According to the second public key and the encrypted data information received from the user terminal by the management server, the corresponding server negotiation key is generated according to the negotiation key generation rule, the second public key and the first key information. The management server receives the second public key and the encrypted data information from the user terminal, and can generate the corresponding server negotiation key according to the above-mentioned negotiation key generation rule. Specifically, the second public key and the first private key in the first key information are obtained, and the server negotiation key can be generated according to the negotiation key generation rule. The specific process of generating the server negotiation key is the same as the specific process of generating the terminal negotiation key. The length of the obtained server negotiation key is equal to that of the terminal negotiation key, that is, the generated server negotiation key is also 32 bytes, and the specific contents contained in the two are also the same.
[0086] S180. The management server de-encodes the encrypted data information according to the encoding rule to obtain de-encoded data information.
[0087] The management server performs reverse encoding on the encrypted data information according to the encoding rule to obtain reverse encoded data information. The encoding rule may be Base64 encoding, and the process of reverse encoding the encrypted data information is the opposite of the process of encoding and encrypting, that is, the encrypted data information containing only 64 characters of az, AZ, 0-9, "+" and " / " is reverse encoded and decrypted to restore the reverse encoded data information corresponding to the encrypted data information.
[0088] S190. The management server generates a target data signature corresponding to the target data information in the reverse-encoded data information according to the server negotiated key and the signature rule.
[0089] The management server generates a target data signature corresponding to the target data information in the reverse-coded data information according to the server negotiation secret key and the signature rule. The reverse-coded data information contains signature information and target data information. The part of the reverse-coded data information corresponding to the data information to be sent is the target data information, and the part of the coded data information corresponding to the data signature is the signature information, wherein the signature information is the parameter value corresponding to the parameter name "sign" in the reverse-coded data information, the target data information is the data information in the reverse-coded data information that needs to be verified for consistency when transmitted to the management server, and the other information in the reverse-coded data information except the signature information is the target data information; then, during the transmission of the reverse-coded data information, external interference may cause the target data information to change relative to the data information to be sent, and may also cause the signature information to change relative to the data signature. The target data signature corresponding to the target data information can be generated using the same signature rule as that for generating the data signature, wherein the signature rule includes parameter name sorting rules, character screening rules, and signature algorithms.
[0090] For example, in this embodiment, the signature information is the parameter value corresponding to "sign", and the target data information is the parameter values corresponding to "appid", "message", "nonce_str" and "device_info".
[0091] The specific steps include: (1) sorting and combining multiple parameter information in the target data information according to the parameter name sorting rule to obtain target combination information; (2) filtering the characters contained in the target combination information according to the character filtering rule to obtain target valid character information; (3) splicing the target valid character information with the server negotiated key to obtain target spliced character information; (4) generating a target data signature corresponding to the target spliced character information according to the signature algorithm.
[0092] According to the above steps, a target data signature corresponding to the target data information can be generated.
[0093] S200. The management server verifies whether the target data signature is consistent with the signature information in the reverse-encoded data information to obtain a data verification result.
[0094] The management server verifies whether the target data signature is consistent with the signature information in the reverse-encoded data information to obtain a data verification result. Whether the target data signature is consistent with the signature information in the reverse-coded data information can be verified to obtain the corresponding data verification result. Specifically, if the target data information is only changed relative to the data information to be sent due to external interference, while the signature information is not changed relative to the data signature, then the target data signature generated according to the target data information and the server negotiated key must be inconsistent with the signature information in the reverse-coded data information; if the target data information is only changed relative to the data signature due to external interference, while the target data information is not changed relative to the data information to be sent, then the target data signature generated according to the target data information and the server negotiated key is consistent with the data signature, and the target data signature must be inconsistent with the data signature; if the signature information is changed relative to the data signature and the target data information is changed relative to the data information to be sent due to external interference, since the terminal negotiated key or the server negotiated key is not known to the outside, and the signature information in the reverse-coded data information is generated by the outside according to the target data information and the non-server negotiated key, then the target data signature calculated according to the target data information and the server negotiated key must also be inconsistent with the signature information in the reverse-coded data information. Then, the target data signature is verified to see if it is consistent with the signature information in the reverse-coded data information, and the encrypted data information received by the management server can be verified to see if it has been changed, and a data verification result is obtained. Specifically, if the target data signature is consistent with the signature information in the reverse-coded data information, the obtained data verification result is a passed verification; if the target data signature is inconsistent with the signature information in the reverse-coded data information, it indicates that the encrypted data information has been changed due to external interference during the transmission process, and the obtained data verification result is a failed verification.
[0095] In one embodiment, if Figure 7 As shown, step S200 further includes steps S210 and S220.
[0096] S210, the management server generates a verification signature corresponding to the data verification result according to the server negotiated key and the signature rule; S220, the management server encodes and encrypts the data verification result and the verification signature according to the encoding rule to obtain encrypted verification information and feeds it back to the user terminal.
[0097] The management server can generate a verification signature that matches the data verification result according to the signature rules. The specific method for generating the verification signature is the same as the specific method for generating the target data signature. The obtained data verification result and the verification signature are encoded and encrypted to obtain encrypted verification information and feed it back to the user terminal. After receiving the encrypted verification information, the user terminal uses the same method to decrypt it to obtain the data verification result. In the process of the user terminal obtaining the data verification result, the encrypted verification information can also be verified based on the same method as the above-mentioned verification of the encrypted data information to ensure that the encrypted verification information has not been changed.
[0098] In one embodiment, if Figure 8 As shown, step S200 also includes step S200a after step S200.
[0099] S200a. Synchronously upload the data verification result to the blockchain for storage.
[0100] The data verification result is uploaded to the blockchain for storage, and the corresponding summary information is obtained based on the data verification result. Specifically, the summary information is obtained by hashing the data verification result, such as using the sha256 algorithm. Uploading the summary information to the blockchain can ensure its security and fairness and transparency to users. The user device can download the summary information from the blockchain to verify whether the data verification result has been tampered with. The blockchain referred to in this example is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.
[0101] The technical method in this application can be applied to application scenarios such as smart government affairs / smart urban management / smart communities / smart security / smart logistics / smart medical care / smart education / smart environmental protection / smart transportation that involve encryption and verification of data information, thereby promoting the construction of smart cities.
[0102] In the data information encryption verification method provided in the embodiment of the present invention, the management server receives the transmission request information from the user terminal, generates the first secret key information and sends the first public key therein to the user terminal. After receiving the first public key, the user terminal generates the second secret key information and sends the second public key therein to the management server. The user terminal generates the terminal negotiation key and signs the data information to be sent to generate the data signature. The data information to be sent and the data signature are encoded and encrypted to obtain the encrypted data information and sent to the management server. The management server reverse encodes the encrypted data information and generates the target data signature according to the corresponding generated server negotiation key. It verifies whether the target data signature is consistent with the signature information in the reverse encoded data information to obtain the data verification result. Through the above method, by generating a data signature corresponding to the data information to be sent and encoding and encrypting it for transmission, the reliability of consistency verification of the data information can be greatly improved.
[0103] The embodiment of the present invention further provides a data information encryption verification system 100, which includes a user terminal 20 and a management server 30, and the data information encryption verification system 100 is used to execute any embodiment of the aforementioned data information encryption verification method. Fig. 9 , Fig. 9 A schematic block diagram of a user terminal provided by an embodiment of the present invention. Fig. 9 As shown, the user terminal 20 includes a transmission request information sending unit 21, a second key generation unit 22, a terminal negotiation key generation unit 23, a data signature generation unit 24 and an encrypted data information sending unit 25, and the management server 30 includes a first key generation unit 31, a server negotiation key generation unit 32, a reverse-coded data information acquisition unit 33, a target data signature generation unit 34 and a data verification result acquisition unit 35.
[0104] The transmission request information sending unit 21 is used to send transmission request information to the management server if receiving the data information to be sent input by the user.
[0105] The first key generation unit 31 is used to receive the transmission request information from the user terminal, generate the first key information according to the preset key generation rule, and send the first public key in the first key information to the user terminal.
[0106] In one embodiment, the first secret key generation unit 31 includes subunits: a server order generation unit, a target point coordinate calculation unit and a first secret key information acquisition unit.
[0107] A server order generation unit is used to randomly generate a server order that is less than the order threshold; a target point coordinate calculation unit is used to calculate the target point coordinates based on the server order and the base point coordinates; a first secret key information acquisition unit is used to use the server order as the first private key and the target point coordinates as the first public key.
[0108] The second key generating unit 22 is configured to generate second key information according to the key generating rule upon receiving the first public key, and feed back the second public key in the second key information to the management server.
[0109] In one embodiment, the second secret key generation unit 22 includes subunits: a terminal order generation unit, a terminal target point coordinate calculation unit, a terminal target point coordinate judgment unit and a second secret key information acquisition unit.
[0110] A terminal order generation unit, used to randomly generate a terminal order less than the order threshold; a terminal target point coordinate calculation unit, used to calculate the terminal target point coordinates according to the terminal order and the base point coordinates; a terminal target point coordinate judgment unit, used to judge whether the terminal target point coordinates are equal to the first public key; a second secret key information acquisition unit, used to use the terminal order as the second private key and the target point coordinates as the second public key if the terminal target point coordinates are not equal to the first public key.
[0111] The terminal negotiation key generation unit 23 is used to generate a corresponding terminal negotiation key according to a preset negotiation key generation rule, the first public key and the second key information.
[0112] The data signature generating unit 24 is used to generate a data signature corresponding to the data information to be sent according to the terminal negotiated secret key and a preset signature rule.
[0113] In one embodiment, the data signature generating unit 24 includes subunits: a parameter combination information acquiring unit, a valid character information acquiring unit, a concatenated character information acquiring unit and a data signature acquiring unit.
[0114] A parameter combination information acquisition unit is used to sort and combine multiple parameter information in the data information to be sent according to the parameter name sorting rule to obtain parameter combination information; a valid character information acquisition unit is used to filter out characters included in the parameter combination information according to the character screening rule to obtain valid character information; a spliced character information acquisition unit is used to splice the valid character information with the terminal negotiation key to obtain spliced character information; a data signature acquisition unit is used to generate a data signature corresponding to the spliced character information according to the signature algorithm.
[0115] The encrypted data information sending unit 25 is used to encode and encrypt the data information to be sent and the data signature according to a preset encoding rule to obtain encrypted data information and send it to the management server.
[0116] In one embodiment, the encrypted data information sending unit 25 includes subunits: a combined information obtaining unit and a coding encryption unit.
[0117] The combined information acquisition unit is used to combine the data information to be sent with the data signature to obtain the combined information; the encoding and encryption unit is used to encode and encrypt the combined information according to the encoding rule to obtain the encrypted data information.
[0118] The server negotiation key generation unit 32 is used to receive the second public key and the encrypted data information from the user terminal, and generate a corresponding server negotiation key according to the negotiation key generation rule, the second public key and the first key information.
[0119] The reverse-coded data information acquisition unit 33 is used to reverse-code the encrypted data information according to the coding rule to obtain reverse-coded data information.
[0120] The target data signature generating unit 34 is used to generate a target data signature corresponding to the target data information in the reverse-encoded data information according to the server negotiated secret key and the signature rule.
[0121] The data verification result acquisition unit 35 is used to verify whether the target data signature is consistent with the signature information in the reverse-encoded data information to obtain a data verification result.
[0122] In one embodiment, the management server 30 further includes sub-units: a verification signature generation unit and an encrypted verification information feedback unit.
[0123] A verification signature generation unit is used for the management server to generate a verification signature corresponding to the data verification result according to the server negotiated key and the signature rule; an encrypted verification information feedback unit is used for the management server to encode and encrypt the data verification result and the verification signature according to the encoding rule to obtain encrypted verification information and feed it back to the user terminal.
[0124] In one embodiment, the management server 30 further includes a subunit: a synchronization storage unit.
[0125] The synchronous storage unit is used to synchronously upload the data verification result to the blockchain for storage.
[0126] The data information encryption verification system provided in the embodiment of the present invention applies the above-mentioned data information encryption verification method, the management server receives the transmission request information from the user terminal to generate the first secret key information and sends the first public key therein to the user terminal, the user terminal generates the second secret key information after receiving the first public key and sends the second public key therein to the management server, the user terminal generates the terminal negotiation key and signs the data information to be sent to generate the data signature, encodes and encrypts the data information to be sent and the data signature to obtain the encrypted data information and sends it to the management server, the management server reverse encodes the encrypted data information and generates the target data signature according to the corresponding generated server negotiation key, verifies whether the target data signature is consistent with the signature information in the reverse encoded data information to obtain the data verification result. Through the above-mentioned method, by generating a data signature corresponding to the data information to be sent and encoding and encrypting it for transmission, the reliability of consistency verification of the data information can be greatly improved.
[0127] The above data information encryption verification system can be implemented in the form of a computer program. The computer program can be Fig.10 Runs on the computer device shown.
[0128] See also Fig.10 , Fig.10 2 is a schematic block diagram of a computer device provided by an embodiment of the present invention. The computer device may be a user terminal 20 for executing encryption verification of data information, or a management server 30 for executing the encryption verification method of data information.
[0129] See also Fig.10 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a storage medium 503 and an internal memory 504 .
[0130] The storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute the data information encryption verification method, wherein the storage medium 503 can be a volatile storage medium or a non-volatile storage medium.
[0131] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0132] The internal memory 504 provides an environment for the operation of the computer program 5032 in the storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the data information encryption verification method.
[0133] The network interface 505 is used for network communication, such as providing data information transmission, etc. Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device 500 to which the solution of the present invention is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0134] The processor 502 is used to run the computer program 5032 stored in the memory to implement the corresponding functions in the above-mentioned data information encryption and verification method.
[0135] Those skilled in the art will understand that Fig.10 The embodiments of the computer device shown in the figure do not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the computer device may only include a memory and a processor. In such embodiments, the structure and function of the memory and the processor are the same as those of the embodiment of the present invention. Fig.10 The embodiments shown are consistent and will not be described again here.
[0136] It should be understood that in the embodiment of the present invention, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0137] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a computer-readable storage medium. The computer-readable storage medium stores a first computer program or a second computer program, and when the first computer program is executed by a first processor and the second computer program is executed by a second processor, the above-mentioned data information encryption verification method is jointly implemented.
[0138] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0139] In the several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. Units with the same function may also be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0140] The units described as separate components may or may not be physically separated, and the components shown as units 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 units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0141] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0142] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned computer-readable storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk.
[0143] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A data information encryption verification method, applied to a data information encryption verification system, wherein the data information encryption verification system comprises a user terminal and a management server, wherein the user terminal and the management server are connected via a network to transmit data information, and wherein: The method comprises: If the user terminal receives the data information to be sent input by the user, it sends a transmission request information to the management server; The management server receives the transmission request information from the user terminal, generates first secret key information according to a preset secret key generation rule, and sends the first public key in the first secret key information to the user terminal; If the user terminal receives the first public key, it generates second key information according to the key generation rule, and feeds back the second public key in the second key information to the management server; The user terminal generates a corresponding terminal negotiation key according to a preset negotiation key generation rule, the first public key and the second key information; The user terminal generates a data signature corresponding to the data information to be sent according to the terminal negotiated secret key and a preset signature rule; The user terminal encodes and encrypts the data information to be sent and the data signature according to a preset encoding rule to obtain encrypted data information and sends the encrypted data information to the management server; The management server receives the second public key and the encrypted data information from the user terminal, and generates a corresponding server negotiation key according to the negotiation key generation rule, the second public key and the first key information; The management server reversely encodes the encrypted data information according to the encoding rule to obtain reversely encoded data information; The management server generates a target data signature corresponding to the target data information in the reverse-encoded data information according to the server negotiated secret key and the signature rule; The management server verifies whether the target data signature is consistent with the signature information in the reverse-coded data information to obtain a data verification result; The negotiation key generation rule is a calculation formula based on the first public key and the second private key. The calculation formula can be expressed as S'k=k'P mod r, wherein r is the preset parameter value in the calculation formula, S'k is the generated user terminal negotiation key, k' is the terminal order, k is the server order, P is the coordinate of the target point on the curve equation, P=[k]×G, G is the base point, a tangent is drawn along point G to obtain a tangent with point G as the tangent point, a perpendicular line is drawn through point G to be perpendicular to the tangent, and the intersection of the perpendicular line and the k-th order elliptic curve equation is point P.
2. The data information encryption verification method according to claim 1, characterized in that: The key generation rule includes a curve equation, base point coordinates and an order threshold, the first key information includes a first public key and a first private key, and the first key information is generated according to the preset key generation rule, including: Randomly generate a server order that is less than the order threshold; Calculate the target point coordinates according to the server order and the base point coordinates; The server order is used as the first private key, and the target point coordinates are used as the first public key.
3. The data information encryption verification method according to claim 2, characterized in that: The second key information includes a second public key and a second private key, and the generating the second key information according to the key generation rule includes: Randomly generate a terminal order less than the order threshold; The coordinates of the terminal target point are calculated according to the terminal order and the base point coordinates; Determining whether the terminal target point coordinates are equal to the first public key; If the terminal target point coordinates are not equal to the first public key, the terminal order is used as the second private key, and the target point coordinates are used as the second public key.
4. The data information encryption verification method according to claim 1, characterized in that: The signature rule includes a parameter name sorting rule, a character screening rule and a signature algorithm, and the data signature corresponding to the data information to be sent is generated according to the terminal negotiation key and the preset signature rule, including: Sorting and combining multiple parameter information in the data information to be sent according to the parameter name sorting rule to obtain parameter combination information; Screening the characters included in the parameter combination information according to the character screening rule to obtain valid character information; Concatenating the valid character information with the terminal negotiation key to obtain concatenated character information; A data signature corresponding to the concatenated character information is generated according to the signature algorithm.
5. The data information encryption verification method according to claim 1, characterized in that: The step of encoding and encrypting the data information to be sent and the data signature according to a preset encoding rule to obtain encrypted data information and sending the encrypted data information to the management server includes: Combining the data information to be sent with the data signature to obtain combined information; The combined information is encoded and encrypted according to the encoding rule to obtain the encrypted data information.
6. The data information encryption verification method according to claim 1, characterized in that: After the management server verifies whether the target data signature is consistent with the signature information in the reverse-coded data information to obtain a data verification result, the method further includes: The management server generates a verification signature corresponding to the data verification result according to the server negotiation key and the signature rule; The management server encodes and encrypts the data verification result and the verification signature according to the encoding rule to obtain encrypted verification information and feeds it back to the user terminal.
7. The data information encryption verification method according to claim 1, characterized in that: After the management server verifies whether the target data signature is consistent with the signature information in the reverse-coded data information to obtain a data verification result, the method further includes: The data verification results are synchronously uploaded to the blockchain for storage.
8. A data information encryption verification system, characterized in that: The data information encryption verification system includes a user terminal and a management server, wherein the user terminal includes a transmission request information sending unit, a second secret key generation unit, a terminal negotiation secret key generation unit, a data signature generation unit, and an encrypted data information sending unit, and the management server includes a first secret key generation unit, a server negotiation secret key generation unit, a reverse encoding data information acquisition unit, a target data signature generation unit, and a data verification result acquisition unit, including: A transmission request information sending unit, configured to send transmission request information to the management server upon receiving data information to be sent input by a user; A first key generation unit, configured to receive a transmission request message from a user terminal, generate first key information according to a preset key generation rule, and send a first public key in the first key information to the user terminal; A second key generating unit is configured to generate second key information according to the key generating rule upon receiving the first public key, and feed back the second public key in the second key information to the management server; A terminal negotiation key generation unit, configured to generate a corresponding terminal negotiation key according to a preset negotiation key generation rule, the first public key and the second key information; A data signature generating unit, configured to generate a data signature corresponding to the data information to be sent according to the terminal negotiated secret key and a preset signature rule; An encrypted data information sending unit, used to encode and encrypt the data information to be sent and the data signature according to a preset encoding rule to obtain encrypted data information and send it to the management server; A server negotiation key generation unit, configured to receive the second public key and the encrypted data information from the user terminal, and generate a corresponding server negotiation key according to the negotiation key generation rule, the second public key and the first key information; a reverse-coded data information acquisition unit, configured to reverse-code the encrypted data information according to the coding rule to obtain reverse-coded data information; A target data signature generating unit, configured to generate a target data signature corresponding to the target data information in the reverse-encoded data information according to the server negotiated secret key and the signature rule; A data verification result acquisition unit, used to verify whether the target data signature is consistent with the signature information in the reverse-coded data information to obtain a data verification result; The terminal negotiation key generation unit is also used to generate a negotiation key generation rule, and the negotiation key generation rule is generated based on a calculation formula for the first public key and the second private key. The calculation formula can be expressed as S'k=k'P mod r, wherein r is a preset parameter value in the calculation formula, S'k is the generated user terminal negotiation key, k' is the terminal order, k is the server order, P is the coordinate of the target point on the curve equation, P=[k]×G, G is the base point, and a tangent is drawn along point G to obtain a tangent with point G as the tangent point. A perpendicular line perpendicular to the tangent is drawn through point G, and the intersection of the perpendicular line and the k-th order elliptic curve equation is point P.
9. A data information encryption verification system, characterized in that: The data information encryption and verification system includes a user terminal and a management server, the user terminal includes a first memory, a first processor, and a first computer program stored in the first memory and executable on the first processor, the management server includes a second memory, a second processor, and a second computer program stored in the second memory and executable on the second processor, the first processor executes the first computer program and the second processor executes the second computer program to jointly implement the data information encryption and verification method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a first computer program and / or a second computer program, which, when the first computer program is executed by the first processor and the second computer program is executed by the second processor, jointly implement the data information encryption verification method as described in any one of claims 1 to 7.
