Order tamper-proofing method, device, computer equipment and readable storage medium
Through the validity detection and hash chain signature of order information, the security issues of the order system are solved, the authenticity verification and tampering monitoring of order information are realized, and the security and operational reliability of the system are improved.
Patent Information
- Application Number
- CN202310168323.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2043-02-24
AI Technical Summary
The existing order system has poor security and cannot effectively prevent order information tampering, which leads to property losses and operational risks. It is also unable to trace the problem of inconsistent quantity of categories.
By obtaining user order information for validity testing, generating payment call tokens, using remote procedure call services to obtain private keys for hash operations, and building hash chain signatures, the integrity and security of the orders are ensured.
The security of the order system has been improved, and it can monitor tampering in real time and prevent property loss, ensuring the authenticity and traceability of order information.
Smart Images

Figure CN116091065B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to an order tamper-proofing method, device, computer equipment, and readable storage medium. Background Art
[0002] The existing order system does not process signatures, and technical personnel can use tools to modify the core information of the order (such as order user information, order amount, order type, SKU information included in the order, coupon information included in the order, and order completion status), resulting in the inability to verify the authenticity of the order information, causing corresponding property losses; when a virus invades the order system and maliciously tamperes with the order data records, the order system cannot monitor the tampered orders in real time, resulting in property losses; the existing order system cannot effectively detect system omissions caused by manual deletion of orders, thereby affecting the company's operations; secondly, the existing order system has no effective monitoring mechanism, and core business risks are uncontrollable; when the number of categories included in the order is inconsistent with the number of categories shipped from the warehouse, the existing order system cannot trace whether the problem is a data problem or a human problem. Summary of the Invention
[0003] The purpose of the present invention is to provide an order tamper-proofing method, device, computer equipment and readable storage medium, aiming to solve the problems such as poor security of existing order systems.
[0004] In a first aspect, an embodiment of the present invention provides an order tamper-proofing method, comprising:
[0005] Obtain the user's order information for this order and perform validity check on the order information;
[0006] If the order information fails the validity check, the order process is terminated and the order exception information is output. If the order information passes the validity check, the security parameters and payment parameters of the corresponding category are extracted according to the payment category and sent to the third-party payment service to generate a payment call token;
[0007] If the payment call token generation fails, the order process is terminated and the order exception information is output. If the payment call token generation is successful, the payment result is obtained through the payment call token;
[0008] If the payment result is payment failure, the order status is changed to failure and the payment failure exception information is filled in. If the payment result is payment success, the first hash value of the previous successfully paid order is retrieved and assembled with the core information of this order into the signature parameter;
[0009] Creating a remote procedure call service, and obtaining a first private key through the remote procedure call service;
[0010] Obtaining a second hash value by performing a hash operation on the signature parameter and the first private key;
[0011] The second hash value is used as the input source of the next order and participates in the signature of the next order.
[0012] In a second aspect, an embodiment of the present invention provides an order tamper-proofing device, comprising:
[0013] A detection unit, used to obtain the order information of the user and perform validity detection on the order information;
[0014] A generating unit, configured to terminate the order process and output order exception information if the order information fails the validity check; and if the order information passes the validity check, extract the security parameters and payment parameters corresponding to the payment category and send them to the third-party payment service to generate a payment call token;
[0015] An acquisition unit, configured to terminate the order process and output order exception information if the payment call token generation fails, and to obtain the payment result through the payment call token if the payment call token generation succeeds;
[0016] An assembly unit, configured to change the order status to failed and enter payment failure exception information if the payment result is payment failure; and to query the first hash value of the previous successfully paid order and assemble it with the core information of the current order into signature parameters if the payment result is payment success;
[0017] A creation unit, configured to create a remote procedure call service, and obtain a first private key through the remote procedure call service;
[0018] a computing unit, configured to obtain a second hash value by performing a hash operation on the signature parameter and the first private key;
[0019] The signature unit is configured to use the second hash value as an input source for the next order and participate in the signature of the next order.
[0020] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the order anti-tampering method described in the first aspect is implemented.
[0021] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the order anti-tampering method described in the first aspect above is implemented.
[0022] The present invention discloses an order tamper-proofing method, apparatus, computer equipment and readable storage medium. The method comprises: obtaining order information of a user's order and performing a validity check on the order information; if the order information fails the validity check, terminating the order process and outputting order exception information; if the order information passes the validity check, extracting security parameters and payment parameters of the corresponding category according to the payment category and sending them to a third-party payment service to generate a payment call token; if the payment call token fails to be generated, terminating the order process and outputting order exception information; if the payment call token is successfully generated, obtaining a payment result through the payment call token; if the payment result is payment failure, modifying the order status to failure and filling in payment failure exception information; if the payment result is payment success, querying a first hash value of a previous successfully paid order and assembling it with the core information of the current order into a signature parameter; creating a remote procedure call service and obtaining a first private key through the remote procedure call service; obtaining a second hash value by performing a hash operation on the signature parameter and the first private key; using the second hash value as an input source for the next order and participating in the signature of the next order. This invention uses the hash value of a current order as the input source for the next order and includes it in the signature of the next order, constructing a connected hash chain. This allows for tamper detection of both individual and entire order lists, thereby improving the security of the order system. Embodiments of the present invention also provide an order tamper-proofing device, a computer-readable storage medium, and a computer device, all of which have the aforementioned beneficial effects and are not further elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 This is a flow chart of the order tamper-proofing method of this embodiment;
[0025] Figure 2 is an elliptic curve graph over the finite field GF(23);
[0026] Figure 3 This is a schematic block diagram of the order anti-tampering device of this embodiment. DETAILED DESCRIPTION
[0027] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0028] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0029] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0030] 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.
[0031] See also Figure 1 The present invention provides a method for automatic rollback of a fault, comprising:
[0032] S101: Obtain the order information of the user for this order;
[0033] S102: Determine whether the order information passes the validity test;
[0034] If the order information passes the validity check, step S103 is executed; if the order information fails the validity check, step S111 is executed: the order process is terminated and order exception information is output.
[0035] Among them, validity checks mainly include product inventory checks, user coupon validity checks, and whether the order amount is consistent with the input amount;
[0036] In a specific application scenario, when a user places an order, it is necessary to confirm whether the products of the corresponding specifications on the order are in stock to ensure that they can be delivered to the user within the scheduled time. When the user uses the relevant coupons, it is also necessary to verify whether the coupons are expired and whether they are applicable to the ordered products, etc. After placing the order, it is also necessary to confirm whether the order amount is consistent with the input amount to avoid corresponding losses for merchants and users.
[0037] S103: Extract the security parameters and payment parameters of the corresponding category according to the payment category and send them to the third-party payment service to generate a payment call token;
[0038] When the order information passes the validity check, the order information will be saved in the database, and the order status will be initialized to "paying". Then, the security parameters and payment parameters of the corresponding category will be taken out according to the payment category and sent to the third-party payment service to generate a payment call token.
[0039] Among them, the payment type can be WeChat, Alipay, UnionPay card or digital RMB, etc. The payment parameters of WeChat and Alipay are shown in Table 1;
[0040] Table 1
[0041]
[0042]
[0043] When sending the corresponding category of security parameters and payment parameters to the third-party payment service to generate the payment call token, in order to protect the interface security of the third-party payment service, the interface data needs to be security verified, so the data requesting the interface needs to be signed.
[0044] The signature generation steps are as follows: take all sent or received data as set M, then sort the parameter names of the parameters with non-empty parameter values in set M from small to large according to ASCII code (lexicographical order), then use the URL key-value pair format (i.e. key1=value1&key2=value2... format) to concatenate the sorted set M into a string stringA; then concatenate key to the end of stringA to obtain stringSignTemp, then perform MD5 operation on stringSignTemp, and then convert all characters in the stringSignTemp after the operation to uppercase to obtain sign Value.
[0045] The following rules must be followed during the signature generation process: parameter names are sorted in ascending order according to ASCII code (lexicographical order); if the parameter value is empty, it will not be included in the signature; parameter names are case-sensitive; when the verification call returns or the third-party payment service actively notifies the signature, the transmitted sign value will not be included in the signature and the generated signature will be verified against the sign value; the interface of the third-party payment service may add fields, and the added extended fields must be supported when verifying the signature.
[0046] In one embodiment, the key setting path in the WeChat signing process is: enter the WeChat Merchant Platform (pay.weixin.qq.com), then enter the Account Center, then enter the Account Settings, then enter API Security, and then set the API key, where the key length is 32 bytes.
[0047] S104: Whether the payment call token is generated successfully;
[0048] After sending the security parameters and payment parameters to the third-party payment service to generate the payment call token, it is necessary to verify whether the payment call token is generated successfully. If the payment call token is generated successfully, execute step S105. If the payment call token is not generated successfully, execute step S111: terminate the order process and output order exception information.
[0049] S105: Obtain payment result through the payment call token;
[0050] When the payment call token is generated successfully, the payment call token is input into the software development kit (SDK) of the corresponding payment method to obtain the payment result.
[0051] S106: Whether the payment result is successful;
[0052] After obtaining the payment result, you need to perform relevant operations according to the payment result. If the payment result is successful, execute step S107. If the payment result is failed, execute step S112: change the order status to failed and fill in the payment failure exception information.
[0053] S107: Query the first hash value of the last successfully paid order and assemble it into signature parameters based on the core information of this order;
[0054] The core information includes: order number information (OrderID), order amount information (Amount), inventory unit information included in the order (Skus), discount information included in the order (Bonus), user identity information (UserID) and order success status information (Success).
[0055] The specific content of signature parameter assembly is as follows: convert the first hash value of the previous successfully paid order, the order number information of the current order, and the order amount information into a string; then concatenate the converted first hash value of the previous successfully paid order, the order number information of the current order, and the order amount information with the inventory unit information, discount information included in the order, user identity information, and order success status information contained in the current order to obtain a temporary signature parameter; then convert the temporary signature parameter to lowercase; then convert the lowercase temporary signature parameter into a byte array to obtain the signature parameter.
[0056] In one embodiment, the long integers of the three fields, namely, the first hash value PreHash of the previous successfully paid order, the order number information OrderID of the current order, and the order amount information Amount, are converted into the strings sPreHash, sOrderID, and sAmount. Then, sPreHash, sOrderID, sAmount, the inventory unit information Skus contained in the current order, the preferential information Bonus contained in the order, the user identity information UserID, and the order success status information Success are concatenated to obtain StringA, StringA = sPreHashs + sOrder + sAmount + Skus + Bonus + UserID + Success. Then, StringA is converted into lowercase, and then the lowercase StringA is converted from a string into a StringA byte array.
[0057] S108: Create a remote procedure call service, and obtain a first private key through the remote procedure call service;
[0058] The created remote procedure call service (RPC service) provides three types of service interfaces to other services, namely: public key plaintext query interface (business services can verify the accuracy of core data signatures through public keys); signature verification interface (signature machine service provides signature verification to the outside world); signature interface (signature machine service provides signature services to the outside world).
[0059] Among them, in order to ensure the high availability of RPC services, this embodiment adopts a cluster microservice approach, and the registration center ETCD is a middleware of a high-availability distributed key-value storage registration center that supports cluster services to implement load balancing algorithms and realize RPC service registration and discovery. Therefore, after the signature machine service is initialized, this embodiment writes the remote procedure call service into the registration center and starts the transmission control protocol remote request monitoring.
[0060] To ensure the security of the private key, this embodiment uses a distributed signature machine, so that the security of the very important private key can be guaranteed, and the private key business is not coupled to the business system. This embodiment also provides the following security measures:
[0061] 1. Import the private key into the memory of the signature machine service through the administrator console, and keep the private key only in memory for security reasons;
[0062] 2. To prevent the private key from being leaked during the import process, this embodiment is released as an application extension (dll) through a software development kit and is closed source. At the same time, the signature machine service filters and scans log keywords, screens whether it contains private key plaintext, and monitors whether there is printing in the log monitoring system and when aggregating log files;
[0063] 3. Use Hypertext Transfer Protocol Secure (HTTPS) to import private keys, and use the encryption principle of HTTPS to reduce the risk of theft during key transmission;
[0064] 4. The ECDSA elliptic curve algorithm is used to encrypt and decrypt the private key. The ECDSA elliptic curve algorithm has extremely high security and performance.
[0065] Among them, the principle of the ECDSA elliptic curve algorithm is: two points P and G on the elliptic curve, and P = kG, G is the base point on the elliptic curve, k is the private key, and P is the public key; given k and G, it is easy to calculate P according to the addition rule, but it is difficult to calculate k given P and G; the addition calculation of the elliptic curve is to connect A and B to draw a straight line and use the point where the straight line intersects the elliptic curve as the third point, and then draw a line parallel to the Y axis through the third point. The parallel line intersects the elliptic curve at the fourth point, and the fourth point is the result of A+B.
[0066] Elliptic curve y^2=x^3+ax+b(modP), modP is to define the elliptic curve on the finite field GF(P), so that the smooth elliptic curve becomes a series of points. These points have no pattern. The less regular it is, the harder it is to crack. Therefore, the number before G is very difficult to find and can be used as a private key, such as Figure 2 As shown, P=23, (0, 1) is the base point.
[0067] The encryption and decryption process of the elliptic curve is as follows:
[0068] Select an elliptic curve EC(a, b) and take a point on the elliptic curve as the base point G
[0069] Choose a large number as the private key k and generate a public key P = kG;
[0070] Encryption: Choose a random number r and convert the plaintext M into a ciphertext C, where C is the ciphertext and also a point pair.
[0071] C=(rG,M+rP)
[0072] Decryption: Receive M+rP; the receiver knows the private key k and obtains the plaintext M through M+rP-krG=M+rkG-rkG=M.
[0073] S109: Obtain a second hash value by performing a hash operation on the signature parameter and the first private key;
[0074] In one embodiment, the first private key and the StringA byte array are input into the ECDSA-Sha256Sign function to perform a hash product operation, generate a hash value similar to 48edbcdns78sdbnacba87394738, and update the generated hash value into the order HASH column in the database.
[0075] S110: Use the second hash value as the input source of the next order and participate in the signature of the next order.
[0076] Because the order system accepts order requests concurrently, when the order is paid, the previous order may still be in an unfinished state. In this case, applying the Sha-256 hash algorithm signature will cause the entire order chain to be unable to form a complete and verifiable signature chain. In this case, the order will not be included in the signature. Therefore, this embodiment provides an abnormal order processing timer task to handle similar events.
[0077] The abnormal order processing scheduled task is as follows: obtain the most recent order with a completed and signed status; search in the order in which the orders are generated; if the status of the next order after the obtained order is completed and unsigned, sign the next order; if the status of the next order after the obtained order is an error, skip the next order and search for other orders in the order in which the orders are generated; if the status of the next order after the obtained order is the initial status of payment, end the abnormal order processing scheduled task.
[0078] The abnormal order processing scheduled task is started and executed according to the first scheduled time, and is usually set to execute the abnormal order processing scheduled task once every 15 minutes.
[0079] This embodiment also provides a method for detecting the legitimacy of an order signature chain: executing a scheduled task for signature accuracy detection according to a second predetermined time; locating the order that was successfully detected last time and is the most recent; obtaining the core information and signature information of the located order; obtaining a second private key through a remote procedure call service and using the second private key to perform a Sha-256 hash operation on the core information to obtain a Sha-256 hash value; comparing the Sha-256 hash value with the signature information; if the Sha-256 hash value is consistent with the signature information, continuing to process the next order; if the Sha-256 hash value is inconsistent with the signature information, sending an abnormal signature order details message to the message queue, and sending an alarm message to the user in the form of a text message.
[0080] In this embodiment, each transaction order is signed using a hash algorithm. All transaction orders in the block are constructed into a "Merkle tree" using a tree structure. In this way, once the transaction data is tampered with, the order hash value will change, the hash value of the leaf node of the "Merkle tree" will change, and eventually the hash value of the root node of the "Merkle tree" will change. The hash value of the block header containing the transaction "Merkle tree" will also change. Finally, other nodes can easily detect that the transaction information has been tampered with by detecting the block header hash chain information.
[0081] This embodiment uses the Sha-256 hash signature algorithm to sign the order. The Sha-256 hash signature algorithm is collision-resistant, irreversible, and puzzle-friendly, and can reduce the possibility of effective tampering of the hash value to close to zero.
[0082] See also Figure 3 This embodiment provides an order tamper-proofing device 300, comprising:
[0083] The detection unit 301 is used to obtain the order information of the user and perform validity detection on the order information;
[0084] Generating unit 302 is configured to terminate the order process and output order exception information if the order information fails the validity check. If the order information passes the validity check, retrieve the security parameters and payment parameters corresponding to the payment type and send them to the third-party payment service to generate a payment call token.
[0085] The acquisition unit 303 is configured to terminate the order process and output order exception information if the payment call token generation fails; and to obtain the payment result through the payment call token if the payment call token generation succeeds;
[0086] Assembly unit 304 is configured to change the order status to failed and enter payment failure exception information if the payment result is payment failure. If the payment result is payment success, query the first hash value of the previous successfully paid order and assemble it with the core information of the current order into signature parameters;
[0087] A creating unit 305 is configured to create a remote procedure call service and obtain a first private key through the remote procedure call service;
[0088] A computing unit 306 is configured to obtain a second hash value by performing a hash operation on the signature parameter and the first private key;
[0089] The signature unit 307 is configured to use the second hash value as an input source for the next order and participate in the signature of the next order.
[0090] Furthermore, the core information includes: order number information, order amount information, inventory unit information included in the order, discount information included in the order, user identity information, and order success status information; the assembly unit 304 includes:
[0091] A string conversion subunit, configured to convert the first hash value of the last successfully paid order, the order number information of the current order, and the order amount information into a string;
[0092] A concatenation subunit is configured to concatenate the converted first hash value of the previous successfully paid order, the order number and amount of the current order, the inventory unit information, the discount information, the user identity information, and the order success status information contained in the current order to obtain a temporary signature parameter;
[0093] A lowercase conversion subunit, configured to convert the temporary signature parameter into lowercase;
[0094] The byte array conversion subunit is used to convert the temporary signature parameter converted to lowercase into a byte array to obtain the signature parameter.
[0095] Furthermore, the creation unit 305 includes:
[0096] The import subunit is used to import the private key into the memory of the signature machine service through the administrator console;
[0097] The monitoring sub-unit is used to publish in the form of application extension through the software development kit, is closed source, filters scan log keywords, screens whether it contains private key plaintext, and monitors whether there is printing;
[0098] The private key import subunit is used to import the private key using the Hypertext Transfer Protocol Security protocol;
[0099] The encryption subunit is used to encrypt and decrypt the private key using the ECDSA elliptic curve algorithm.
[0100] Furthermore, the creation unit 305 further includes:
[0101] The writing subunit is used to write the remote procedure call service into the registration center and start the transmission control protocol remote request monitoring.
[0102] Furthermore, it also includes:
[0103] An abnormal timed task execution unit, configured to execute an abnormal order processing timed task according to a first predetermined time;
[0104] An order acquisition unit is used to acquire the most recent order that is completed and signed;
[0105] A retrieval unit, used for sequentially searching in the order in which the orders are generated;
[0106] A signature processing unit, configured to perform signature processing on the next order if the status of the next order of the acquired order is completed and has no signature;
[0107] The skip unit is used to skip the next order if the status of the next order of the obtained order is an error, and then retrieve other orders in the order of order generation;
[0108] The task ending unit is used to end the abnormal order processing scheduled task if the status of the next order of the obtained order is the initial status of payment.
[0109] Furthermore, it also includes:
[0110] an accuracy detection task execution unit, configured to execute a signature accuracy detection timing task according to a second predetermined time;
[0111] Positioning unit, used to locate the order with the most recent successful detection;
[0112] An information acquisition unit, used to acquire the core information and signature information of the located order;
[0113] a hash operation unit, configured to obtain a second private key through the remote procedure call service and perform a Sha-256 hash operation on the core information using the second private key to obtain a Sha-256 hash value;
[0114] A comparing unit, configured to compare the Sha-256 hash value with the signature information;
[0115] A processing unit, configured to continue processing the next order if the Sha-256 hash value is consistent with the signature information;
[0116] The alarm unit is used to send an abnormal signature order details message to the message queue if the Sha-256 hash value is inconsistent with the signature information, and send an alarm message to the user in the form of a text message.
[0117] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-mentioned devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0118] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When executed, the computer program can implement the methods provided in the above embodiments. The storage medium can include any medium capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0119] The present invention further provides a computer device that may include a memory and a processor. The memory stores a computer program, and the processor, when invoking the computer program in the memory, can implement the method provided in the above embodiment. Of course, the computer device may also include various network interfaces, a power supply, and other components.
[0120] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0121] It should also be noted that, in this specification, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprising" or any other variations thereof are intended to cover non-exclusive.
[0122] Inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a..." does not preclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
Claims
1. A method for preventing order tampering, characterized in that: include: Obtain the user's order information for this order and perform validity check on the order information; If the order information fails the validity check, the order process is terminated and the order exception information is output. If the order information passes the validity check, the security parameters and payment parameters of the corresponding category are extracted according to the payment category and sent to the third-party payment service to generate a payment call token; If the payment call token generation fails, the order process is terminated and the order exception information is output. If the payment call token generation is successful, the payment result is obtained through the payment call token; If the payment result is payment failure, the order status is changed to failure and the payment failure exception information is filled in. If the payment result is payment success, the first hash value of the previous successfully paid order is retrieved and assembled with the core information of this order into the signature parameter; Creating a remote procedure call service, and obtaining a first private key through the remote procedure call service; Obtaining a second hash value by performing a hash operation on the signature parameter and the first private key; Use the second hash value as the input source of the next order and participate in the signature of the next order; The core information includes: order number information, order amount information, inventory unit information included in the order, discount information included in the order, user identity information and order success status information; The query of the signature of the last successfully paid order and the combination of the signature parameters with the core information of the current order include: Convert the first hash value of the previous successfully paid order, the order number and amount of this order into a string; The temporary signature parameters are obtained by concatenating the first hash value of the previous successfully paid order, the order number and amount of the current order, the inventory unit information of the current order, the discount information included in the order, the user identity information, and the order success status information. Convert the temporary signature parameter to lowercase; Convert the temporary signature parameter converted to lowercase into a byte array to obtain the signature parameter; The signature generation steps are as follows: take all sent or received data as set M, sort the parameter names of the parameters with non-empty parameter values in set M in ascending order according to ASCII code, and concatenate the sorted set M into a string stringA using the URL key-value pair format; concatenate key to the end of stringA to obtain stringSignTemp, then perform MD5 operation on stringSignTemp, and then convert all characters in stringSignTemp after the operation to uppercase to obtain the sign value.
2. The order tamper-proof method according to claim 1, characterized in that: The creation of a remote procedure call service includes: Import the private key into the memory of the signature machine service through the administrator console; Released as an application extension through a software development kit, closed source, filters scan log keywords, screens for the presence of private key plaintext, and monitors for printouts; Import private keys using Hypertext Transfer Protocol Security (HTTS). The ECDSA elliptic curve algorithm is used to encrypt and decrypt the private key.
3. The order tamper-proof method according to claim 1, characterized in that: The creation of the remote procedure call service also includes: writing the remote procedure call service into a registration center and starting transmission control protocol remote request monitoring.
4. The order tamper-proof method according to claim 1, characterized in that: Also includes: Execute the abnormal order processing scheduled task according to the first scheduled time; Get the most recent order with a completed status and signature completed; Search in the order of order generation; If the status of the next order of the acquired order is completed and has no signature, the next order will be signed; If the status of the next order of the obtained order is an error, skip the next order and retrieve other orders in the order they were generated. If the status of the next order of the obtained order is the initial status of payment, the abnormal order processing scheduled task is terminated.
5. The order tamper-proofing method according to claim 1, characterized in that: Also includes: Execute the signature accuracy detection timed task according to the second predetermined time; Locate the most recent order that was successfully tested. Obtain the core information and signature information of the located order; Obtaining a second private key through the remote procedure call service and performing a Sha-256 hash operation on the core information using the second private key to obtain a Sha-256 hash value; Compare the Sha-256 hash value with the signature information; If the Sha-256 hash value is consistent with the signature information, the next order will be processed; If the Sha-256 hash value is inconsistent with the signature information, an abnormal signature order details message is sent to the message queue, and an alarm message is sent to the user in the form of a text message.
6. An order tamper-proof device, characterized in that: include: A detection unit, used to obtain the order information of the user and perform validity detection on the order information; A generating unit, configured to terminate the order process and output order exception information if the order information fails the validity check; and if the order information passes the validity check, extract the security parameters and payment parameters corresponding to the payment category and send them to the third-party payment service to generate a payment call token; An acquisition unit, configured to terminate the order process and output order exception information if the payment call token generation fails, and to obtain the payment result through the payment call token if the payment call token generation succeeds; An assembly unit, configured to change the order status to failed and enter payment failure exception information if the payment result is payment failure; and to query the first hash value of the previous successfully paid order and assemble it with the core information of the current order into signature parameters if the payment result is payment success; A creation unit, configured to create a remote procedure call service, and obtain a first private key through the remote procedure call service; a computing unit, configured to obtain a second hash value by performing a hash operation on the signature parameter and the first private key; a signature unit, configured to use the second hash value as an input source for a next order and participate in the signature of the next order; The core information includes: order number information, order amount information, inventory unit information included in the order, discount information included in the order, user identity information and order success status information; The assembly unit comprises: A string conversion subunit, configured to convert the first hash value of the last successfully paid order, the order number information of the current order, and the order amount information into a string; A concatenation subunit is configured to concatenate the converted first hash value of the previous successfully paid order, the order number and amount of the current order, the inventory unit information, the discount information, the user identity information, and the order success status information contained in the current order to obtain a temporary signature parameter; A lowercase conversion subunit, configured to convert the temporary signature parameter into lowercase; A byte array conversion subunit is used to convert the temporary signature parameter converted to lowercase into a byte array to obtain a signature parameter; The signature generation steps are as follows: take all sent or received data as set M, sort the parameter names of the parameters with non-empty parameter values in set M in ascending order according to ASCII code, and concatenate the sorted set M into a string stringA using the URL key-value pair format; concatenate key to the end of stringA to obtain stringSignTemp, then perform MD5 operation on stringSignTemp, and then convert all characters in stringSignTemp after the operation to uppercase to obtain the sign value.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the order tamper-proofing method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to execute the order tamper-proofing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Payment method and payment system
CN106779702A
Hotel reservation transfer transaction system and method based on block chain technology
CN112561105A
Medical payment method and system based on supervision node
CN114912910A