A transaction method, apparatus and storage medium
By adding algorithm type parameters to transaction messages and updating system configuration files, the problem of the transaction system's incompatibility with multiple encryption algorithms was solved, enabling flexible switching of encryption algorithms and smooth transaction execution.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2026-03-13
AI Technical Summary
Existing transaction methods are incompatible with multiple encryption algorithms, causing transactions to fail when the two parties use different encryption algorithms.
By adding an algorithm type parameter to transaction request and response messages, both parties are instructed to use the same encryption algorithm for encryption and decryption. This supports compatibility with multiple encryption algorithms and enables rapid switching of encryption algorithms by updating the system configuration file.
It improves the compatibility and availability of the trading system, reduces the impact of changes in encryption algorithms on transactions, and lowers the risk of transaction failure.
Smart Images

Figure CN115860949B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of encryption technology, and in particular to a transaction method, apparatus and storage medium. Background Technology
[0002] When two parties conduct information transactions, to ensure the secure transmission of messages, they need to encrypt their messages, including sensitive information, using encryption algorithms. Upon receiving the encrypted message, each party decrypts it using a decryption algorithm to retrieve the information. Previously, commercial cryptographic algorithms (Ron Rivest, Adi Shamir, Leonard Adleman, RSA) were used for encryption; however, the RSA algorithm has limited security and no longer meets the requirements for higher security. Therefore, a new encryption algorithm with higher security is proposed.
[0003] Since most existing transactions are based on the commercial encryption algorithm RSA, if a new encryption algorithm is introduced to encrypt the messages during transmission, the encrypted messages cannot be decrypted by the party that has not adopted the new encryption algorithm, and the transaction will not be able to proceed normally. Summary of the Invention
[0004] This application provides a transaction method, apparatus, and storage medium to solve the problem that existing transaction methods are incompatible with multiple encryption algorithms.
[0005] Firstly, this application provides a transaction method. This method can be executed by a terminal device with processing capabilities, such as a second terminal. Specifically, the method includes: the second terminal receiving a transaction request message sent by a first terminal, the transaction request message including an algorithm type parameter, the value of which is a first value indicating that the transaction request message is encrypted using a first encryption algorithm. The second terminal decrypts the transaction request message according to the first encryption algorithm to obtain transaction request information. Then, the second terminal generates a request response message based on the transaction request information, the request response message including first sensitive information and the algorithm type parameter, both of which are encrypted using the first encryption algorithm. The second terminal sends the request response message to the first terminal.
[0006] In this embodiment, when the first terminal and the second terminal are transacting, an algorithm type parameter is added to the transaction request message and the request response message. The algorithm type parameter indicates a first encryption algorithm, so that the first terminal and the second terminal agree on the encryption algorithm and encrypt and decrypt the message according to the first encryption algorithm indicated by the algorithm type parameter in the message. In this way, multiple encryption algorithms can be compatible during the transaction process between the two parties, which improves the availability of the system.
[0007] Optionally, the second terminal decrypts the transaction request message using the first encryption algorithm to obtain transaction request information, including: decrypting the transaction request message using the first encryption algorithm to obtain encrypted second sensitive information in the transaction request message. Then, the encrypted second sensitive information is decrypted using the first encryption algorithm to obtain the second sensitive information, which is part of the transaction request information.
[0008] Optionally, the second terminal generates a request-response message based on the transaction request information, including: determining first sensitive information based on second sensitive information; then encrypting the first sensitive information using the first encryption algorithm to obtain encrypted first sensitive information; and finally encrypting the encrypted first sensitive information and non-sensitive information using the first encryption algorithm to generate the request-response message.
[0009] Optionally, if the algorithm type parameter takes the second value, the method further includes: the second terminal determining the first sensitive information based on the second sensitive information; then, encrypting the first sensitive information according to a preset encryption algorithm to obtain the encrypted first sensitive information; and encrypting the encrypted first sensitive information and non-sensitive information according to the first encryption algorithm to generate a request-response message.
[0010] Optionally, after sending the request-response message to the first terminal, the system configuration file is updated by the second terminal according to the second encryption algorithm, and the updated system configuration file indicates that the system is only compatible with the second encryption algorithm.
[0011] In this embodiment, the first terminal and the second terminal can be compatible with multiple encryption algorithms during transactions. When it is necessary to restrict the encryption algorithm to a specific one (e.g., the second encryption algorithm) based on actual circumstances, the system configuration file can be directly updated so that the updated configuration file indicates that the system is only compatible with the second encryption algorithm. Because this process is relatively quick, the impact on transactions is minimal.
[0012] Secondly, this application provides a transaction apparatus. The apparatus includes a receiving module, a decryption module, an encryption module, and a sending module. The receiving module receives a transaction request message sent by a first terminal. The transaction request message includes an algorithm type parameter, which takes a first value indicating that the transaction request message is encrypted using a first encryption algorithm. The decryption module decrypts the transaction request message according to the first encryption algorithm to obtain transaction request information. The encryption module generates a request response message based on the transaction request information. The request response message includes first sensitive information and the algorithm type parameter, and both the request response message and the first sensitive information are encrypted using the first encryption algorithm. The sending module sends the request response message to the first terminal.
[0013] Optionally, the decryption module is specifically used to: decrypt the transaction request message according to the first encryption algorithm to obtain the encrypted second sensitive information in the transaction request message. Then, it decrypts the encrypted second sensitive information according to the first encryption algorithm to obtain the second sensitive information, which belongs to the transaction request information.
[0014] Optionally, the encryption module is specifically used to: determine the first sensitive information based on the second sensitive information; then, encrypt the first sensitive information according to the first encryption algorithm to obtain the encrypted first sensitive information; and finally, encrypt the encrypted first sensitive information and non-sensitive information according to the first encryption algorithm to generate a request-response message.
[0015] Optionally, the encryption module is further configured to: if the algorithm type parameter takes a second value, determine the first sensitive information based on the second sensitive information; then, encrypt the first sensitive information according to a preset encryption algorithm to obtain the encrypted first sensitive information; and encrypt the encrypted first sensitive information and non-sensitive information according to the first encryption algorithm to generate a request-response message.
[0016] Optionally, the sending module is also used to: update the system configuration file according to the second encryption algorithm, wherein the updated system configuration file indicates that the system is only compatible with the second encryption algorithm.
[0017] Thirdly, embodiments of this application provide an electronic device including a processor and a memory communicatively connected to the processor. The memory stores computer-executable instructions, which are executed by the processor to enable the processor to perform the method described in any one of the first aspects above.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, cause the processor to perform the method described in any one of the first aspects.
[0019] Fifthly, embodiments of this application provide a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor can read the computer program from the computer-readable storage medium, and when the processor executes the computer program, it can implement the method described in any one of the first aspects above. Attached Figure Description
[0020] Figure 1 A flowchart illustrating an existing transaction method provided in an embodiment of this application;
[0021] Figure 2 A flowchart illustrating the transaction method provided in an embodiment of this application;
[0022] Figure 3 A schematic diagram of the initial system configuration file of the terminal device provided in the embodiments of this application;
[0023] Figure 4 A schematic diagram of the switching state system configuration file of the terminal device provided in the embodiments of this application;
[0024] Figure 5 A schematic diagram of the target state system configuration file of the terminal device provided in the embodiments of this application;
[0025] Figure 6 This is a schematic diagram of the structure of the trading device provided in the embodiments of this application;
[0026] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0028] The data collection, dissemination, and use in this application all comply with relevant national laws and regulations.
[0029] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order, quantity, or importance, but simply to distinguish different components. For example, "first sensitive information" and "second sensitive information" are only used to indicate that there are two types of sensitive information, not to indicate a difference in priority or importance between the two types of sensitive information.
[0030] In the process of information exchange, it is usually necessary to encrypt the sent information to ensure information security. Take the exchange of information between a first terminal and a second terminal as an example. Figure 1 As shown, the information that the first and second terminals typically need to exchange includes both sensitive and non-sensitive information. Sensitive information, such as user names and bank card numbers, needs to be encrypted to prevent information leakage. The first or second terminal summarizes the information to be exchanged, generates a message, and sends it to the other party. The generated message is also encrypted to further ensure secure transmission.
[0031] For example, taking the first terminal as the initiator of the transaction, the first terminal first initiates the transaction and generates a transaction request message. Since the transaction request message generally carries sensitive information, the first terminal needs to encrypt the sensitive information in the transaction request message before generating it. Currently, the commercial cryptographic algorithm RSA is generally used as the original encryption algorithm to encrypt the messages of both parties in the transaction. After encrypting the sensitive information, the encrypted sensitive information is combined with some non-sensitive information and further encrypted to generate the transaction request message. The encryption algorithm used to generate the transaction request message is still the commercial cryptographic algorithm RSA. After generating the transaction request message, the first terminal sends the transaction request message to the second terminal. After receiving the encrypted request message sent by the first terminal, the second terminal decrypts the transaction request message according to the encryption algorithm RSA to obtain the non-sensitive information and the encrypted sensitive information. It then further decrypts the sensitive information according to the encryption algorithm RSA to obtain the sensitive information. After obtaining all the transaction request information in the transaction request message, the second terminal uses the same method as when generating the transaction request message to generate a request response message and sends the request response message back to the first terminal. The first terminal uses a similar decryption method to decrypt the request-response message and obtain all the information in the request-response message.
[0032] As can be seen, during the transaction between the first and second terminals, both parties use the same encryption algorithm, RSA, to encrypt and decrypt messages. However, with the increasing availability of various encryption algorithms, in addition to RSA, newer algorithms such as SM2 are available. Each terminal can choose its own encryption algorithm to encrypt and decrypt messages. If the first and second terminals select different encryption algorithms, the second terminal will be unable to decrypt the first terminal's messages, or the first terminal will be unable to decrypt the second terminal's messages, and the transaction will not proceed normally.
[0033] Therefore, this application provides a transaction method. This method can be applied to transaction systems compatible with multiple encryption algorithms. In this method, when a first terminal sends a transaction request message to a second terminal, it can inform the second terminal of the encryption algorithm used for the transaction request message. The second terminal encrypts the request response message according to the encryption algorithm used by the first terminal to complete the transaction. This method allows the first and second terminals to agree on the use of different encryption algorithms, thereby enabling compatibility with multiple encryption algorithms and enhancing system compatibility.
[0034] The technical solutions provided by the embodiments of this application are described below with reference to the accompanying drawings.
[0035] Please see Figure 2The diagram illustrates a flowchart of the transaction method provided in this application. It should also be noted that this method is applied to electronic devices with processing capabilities, such as mobile phones, tablets (PADs), and personal computers (PCs). Of course, the types of electronic devices used in this application are not limited to these. The following example uses the electronic device as a terminal, and the implementation of this application's embodiment is carried out by a first terminal and a second terminal; that is, the transaction is carried out by the first terminal and the second terminal.
[0036] S201. The second terminal receives a transaction request message sent by the first terminal, the transaction request message including an algorithm type parameter.
[0037] The transaction request information may include sensitive information and non-sensitive information. The sensitive information refers to the sensitive information encrypted by the first terminal using the first encryption algorithm. After encrypting the sensitive information, the first terminal combines the encrypted sensitive information with the non-sensitive information and further encrypts the sensitive information and non-sensitive information using the first encryption algorithm to obtain the transaction request message. Simultaneously, the first terminal adds an algorithm type parameter to the encrypted transaction request message, indicating which encryption algorithm the first terminal uses to encrypt the transaction request message. The first terminal then sends the transaction request message to the second terminal.
[0038] The algorithm type parameter indicates the encryption algorithm used by the first and second terminals to encrypt the transaction request and response messages. The system can be configured to be compatible with multiple encryption algorithms, allowing the first and second terminals to decrypt the transaction request and response messages according to the algorithm specified in the algorithm type parameter. For example, before conducting a transaction, the first and second terminals may agree to add an algorithm type parameter to the transaction request message, specifying the encryption algorithm used by each terminal to encrypt the message. Different values of the algorithm type parameter can indicate different encryption algorithms. For instance, the first value of the algorithm type parameter can indicate the RSA encryption algorithm or the newer SM2 algorithm. The first value of the algorithm type parameter can also be empty, because there may be cases where the terminal device has not updated its system, meaning that the terminal device only uses the RSA encryption algorithm for encrypting and decrypting messages and is incompatible with multiple encryption algorithms. In this case, the algorithm type parameter in the message sent by the first terminal will be empty. When the algorithm type parameter in the transaction request message sent by the first terminal is empty, the second terminal can still conduct transactions with the first terminal based on the empty algorithm type parameter.
[0039] S202, the second terminal decrypts the transaction request message according to the first encryption algorithm to obtain the transaction request information.
[0040] After receiving the transaction request message, the second terminal determines the first encryption algorithm used by the first terminal based on the algorithm type parameter in the transaction request message. Then, it uses the first encryption algorithm to decrypt the received transaction request message to obtain the transaction request information. As mentioned earlier, the transaction request information includes encrypted second sensitive information and non-sensitive information. After decrypting the transaction request message using the first encryption algorithm to obtain the transaction request message, the second terminal also decrypts the second sensitive information using the first encryption algorithm indicated by the algorithm type parameter carried in the transaction request message to obtain the second sensitive information.
[0041] It should be noted that when the algorithm type parameter is empty, the second terminal assumes that the first terminal has encrypted the transaction request message using the default encryption algorithm RSA. The second terminal can then decrypt the transaction request message using the RSA encryption algorithm to obtain the transaction request information from the message.
[0042] S203. The second terminal generates a request response message based on the transaction request information. The request response message includes first sensitive information and algorithm type parameters. Both the request response message and the first sensitive information are encrypted based on the first encryption algorithm.
[0043] After receiving the transaction request message, the second terminal can respond to the first terminal by sending a request-response message. The transaction request information includes sensitive and non-sensitive information; similarly, the request-response message also includes sensitive and non-sensitive information. Specifically, when processing the sensitive and non-sensitive information in the transaction request information, the second terminal determines the first sensitive information based on the sensitive information. This first sensitive information is the sensitive information that needs to be sent to the first terminal during the transaction. To ensure the smooth progress of the transaction, the second terminal encrypts the first sensitive information using the first encryption algorithm indicated by the algorithm type parameter, obtaining the encrypted first sensitive information. Then, the second terminal encrypts the encrypted first sensitive information and non-sensitive information using the first encryption algorithm to generate a request-response message. The second terminal sends the request-response message back to the first terminal. Simultaneously, the second terminal adds an algorithm type parameter to the encrypted request-response message, indicating which encryption algorithm the second terminal uses to encrypt the request-response message. The second terminal then sends the request-response message back to the first terminal.
[0044] It should be noted that when the algorithm type parameter takes the second value, which indicates a null value, the second terminal uses a preset encryption algorithm, namely the RSA encryption algorithm, to encrypt the first sensitive information and generates a request-response message based on the encrypted first sensitive information. Then, the preset encryption algorithm is used to encrypt the request-response message again, ensuring that the first terminal can decrypt the request-response message using its own existing encryption algorithm.
[0045] S204. The second terminal sends the request response message to the first terminal.
[0046] The second terminal sends a request-response message to the first terminal. Upon receiving the message, the first terminal decrypts it using the first encryption algorithm indicated by the algorithm type parameter. Then, the second terminal uses the first encryption algorithm to further decrypt the first sensitive information, obtaining the request-response information, such as the first sensitive information, from the message. After processing the request-response information, the first terminal can be considered to have completed a transaction with the second terminal.
[0047] In the transaction system provided in this application embodiment, when the first terminal sends a transaction request message to the second terminal, it can inform the second terminal of the encryption algorithm for the transaction request message. Multiple encryption algorithms can be selected. The second terminal encrypts the request response message according to the encryption algorithm agreed upon with the first terminal to complete the transaction. This method allows the first and second terminals to agree on using different encryption algorithms, thereby enabling compatibility with multiple encryption algorithms and enhancing system compatibility.
[0048] The transaction process using the transaction method provided in this application embodiment has been described above. It should be understood that the first terminal and the second terminal can use multiple encryption algorithms to encrypt messages during the transaction process. However, in some cases, it can be specified that the first terminal and the second terminal use only a new encryption algorithm for the transaction, such as using only a second encryption algorithm different from the first encryption algorithm originally used by the first terminal and the second terminal. For example, if a banking system stipulates that all terminals in the system use only the SM2 algorithm for transactions, then all terminals cannot be compatible with other encryption algorithms. In this case, in this application embodiment, the first terminal or the second terminal can store the algorithm type parameter in the system configuration file. By updating its own configuration file, the algorithm type parameter can be restricted to a fixed value, that is, the encryption algorithm is switched to a fixed encryption algorithm. The fixed algorithm corresponding to this fixed value can be the second encryption algorithm, and the process of switching from the first encryption algorithm to the second encryption algorithm will not affect the transaction. The specific implementation process of switching encryption algorithms during the transaction between the two parties is described below.
[0049] like Figure 3The diagram shows the initial system configuration file of the second terminal. For transaction request messages received by the second terminal, the first value of the algorithm type parameter is determined. Based on the specific value, a different encryption algorithm is selected to decrypt the transaction request message. Then, the second terminal continues to decrypt sensitive information using the same encryption algorithm, ultimately obtaining the transaction request information. For request-response messages sent by the second terminal, the first value of the algorithm type parameter is also determined. First, it is checked whether the algorithm type parameter is empty. If it is not empty, the value of the algorithm type parameter is checked to determine the encryption algorithm. The second terminal encrypts sensitive information using this encryption algorithm, and then checks whether the algorithm type parameter is empty. If it is not empty, the request-response message is encrypted using the same encryption algorithm. It should be noted that when the algorithm type parameter is empty, the second terminal encrypts using the system's preset encryption algorithm, RSA.
[0050] As can be seen from the initial system configuration files of the second and first terminals, the initial system is compatible with multiple encryption algorithms for transactions. Transaction request messages sent by the first terminal can be encrypted using the SM2 algorithm; the second terminal will then decrypt them using the SM2 algorithm and encrypt the request response message using the SM2 algorithm before sending the encrypted request response message back to the first terminal. For transaction requests initiated by the second terminal, the second terminal can encrypt the transaction request message using the RSA encryption algorithm. After sending this transaction request message to the first terminal, the second terminal will also receive the request response message encrypted by the first terminal using the RSA encryption algorithm.
[0051] like Figure 4 If both parties to the transaction want to switch their encryption algorithm to SM2, the second terminal enters a switching state. After switching, the second terminal must meet the requirements of the updated system configuration file, which indicates that the system is only compatible with the SM2 algorithm. A comparison of the initial system state and the state after switching shows that the system configuration does not change after the second terminal enters the switching state, therefore it will not affect the ongoing transaction. Then, the second terminal transitions from the switching state to the target state. Figure 5 The diagram shows the contents of the system configuration file of the second terminal in target mode. After the handover, the SM2 algorithm will be used whether receiving a transaction request message and decrypting it, or actively initiating a transaction and encrypting it.
[0052] By updating the system configuration file, the encryption algorithm can be switched in real time, minimizing the impact of changing the encryption algorithm and reducing the risk of transaction failure. If an anomaly occurs during the encryption algorithm change process, the system configuration file can be reset to ensure that the transaction proceeds normally.
[0053] The following describes another method for switching encryption algorithms by updating the system configuration file, provided by an embodiment of this application.
[0054] For example, the second terminal sets an algorithm type parameter in its system configuration file. This parameter differs from the algorithm type parameter in the transaction request message and does not need to be transmitted in the message. When no encryption algorithm switch is performed, the algorithm type parameter instructs the second terminal to use the RSA encryption algorithm. Then, the second terminal and the first terminal determine the periods during which no transactions occur based on the daily transaction volume and negotiate to switch encryption algorithms during these periods. The first terminal informs the second terminal of the algorithm switch during the negotiated period. Upon receiving the notification from the first terminal, the second terminal modifies the algorithm type parameter, which then takes effect to adopt the new encryption algorithm. Because the timing of the algorithm type parameter's activation is controllable, real-time switching is possible.
[0055] The transaction method described in the embodiments of this application has been introduced above. The apparatus provided in the embodiments of this application is described below.
[0056] Please see Figure 6 Based on the same inventive concept, this application also provides a transaction device 600. The transaction device 600 includes a receiving module 601, a decryption module 602, an encryption module 603, and a sending module 604. The receiving module 601 receives a transaction request message sent by a first terminal. The transaction request message includes an algorithm type parameter, which takes a first value indicating that the transaction request message is encrypted using a first encryption algorithm. The decryption module 602 decrypts the transaction request message according to the first encryption algorithm to obtain transaction request information. The encryption module 603 generates a request response message based on the transaction request information. The request response message includes first sensitive information and the algorithm type parameter, and both the request response message and the first sensitive information are encrypted using the first encryption algorithm. The sending module 604 sends the request response message to the first terminal.
[0057] Optionally, the decryption module 602 is specifically used to: decrypt the transaction request message according to the first encryption algorithm to obtain the encrypted second sensitive information in the transaction request message. Then, the encrypted second sensitive information is decrypted according to the first encryption algorithm to obtain the second sensitive information, which belongs to the transaction request information.
[0058] Optionally, the encryption module 603 is specifically used to: determine the first sensitive information based on the second sensitive information; then, encrypt the first sensitive information according to the first encryption algorithm to obtain the encrypted first sensitive information; and then encrypt the encrypted first sensitive information and non-sensitive information according to the first encryption algorithm to generate a request-response message.
[0059] Optionally, the encryption module 603 is further configured to: if the algorithm type parameter is null, determine the first sensitive information based on the second sensitive information; then, encrypt the first sensitive information according to a preset encryption algorithm to obtain the encrypted first sensitive information; and encrypt the encrypted first sensitive information and non-sensitive information according to the first encryption algorithm to generate a request-response message.
[0060] Optionally, the sending module 604 is also configured to: update the system configuration file according to the first encryption algorithm, wherein the updated system configuration file indicates that the system is only compatible with the first encryption algorithm.
[0061] Please see Figure 7 Based on the same inventive concept, this application provides an electronic device 700, which includes at least one processor 701, at least one memory 702, and computer program instructions stored in the memory. When the computer program instructions are executed by the processor, they implement the transaction method as described above.
[0062] Optionally, the processor 701 may be a central processing unit, an application-specific integrated circuit (ASIC), one or more integrated circuits for controlling program execution, a hardware circuit developed using a field-programmable gate array (FPGA), or a baseband processor.
[0063] Optionally, the read-write lock operating device further includes a memory 702 connected to at least one processor 701. The memory 702 may include read-only memory (ROM), random access memory (RAM), and disk storage. The memory 702 is used to store data required for the processor 701 to run. There may be one or more memories 702. The memory 702 is used in… Figure 7 It is shown together, but it should be noted that the memory 702 is not a mandatory functional module, therefore in Figure 7 It is shown in dashed lines.
[0064] Based on the same inventive concept, embodiments of this application also provide a computer-readable storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the transaction method as described above.
[0065] In specific implementation, computer-readable storage media include: Universal Serial Bus flash drive (USB), portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, and other storage media that can store program code.
[0066] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0067] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0068] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0069] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0070] If the integrated unit is implemented as 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 this application, in essence, 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. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: Universal Serial Bus flash disks, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0071] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A trading method, characterized in that, include: The second terminal receives the transaction request message sent by the first terminal. Both the first terminal and the second terminal are peer-to-peer transaction terminals with processing capabilities. The transaction request message includes an algorithm type parameter, which can take a first value and a null value. The first value indicates that the transaction request message is encrypted using a first encryption algorithm, and the null value indicates that the first terminal is a terminal that has not updated its system. Specifically, the transaction request message is a message obtained by the first terminal first encrypting the second sensitive information separately using the first encryption algorithm, and then encrypting the encrypted second sensitive information and non-sensitive information together using the same first encryption algorithm. If the value of the algorithm type parameter is the first value, the second terminal decrypts the transaction request message according to the first encryption algorithm to obtain the transaction request information; the transaction request information includes the second sensitive information and the non-sensitive information; The second terminal generates a request response message based on the transaction request information. The request response message includes first sensitive information and the algorithm type parameter. The first sensitive information is information determined by the second terminal based on the second sensitive information. The request-response message is specifically a message obtained by the second terminal first encrypting the first sensitive information separately using the first encryption algorithm, and then encrypting the encrypted first sensitive information and non-sensitive information as a whole using the same first encryption algorithm. The value of the algorithm type parameter in the request response message is exactly the same as the value of the algorithm type parameter in the transaction request message, so as to indicate that the request response message is encrypted using the first encryption algorithm; The second terminal sends the request response message to the first terminal.
2. The method as described in claim 1, characterized in that, The second terminal decrypts the transaction request message using the first encryption algorithm to obtain transaction request information, including: The second terminal decrypts the transaction request message according to the first encryption algorithm to obtain the second sensitive information encrypted in the transaction request message; The second terminal decrypts the encrypted second sensitive information according to the first encryption algorithm to obtain the second sensitive information, which belongs to the transaction request information.
3. The method as described in claim 2, characterized in that, The second terminal generates a request-response message based on the transaction request information, including: The second terminal determines the first sensitive information based on the second sensitive information; The second terminal encrypts the first sensitive information according to the first encryption algorithm to obtain the encrypted first sensitive information; The second terminal encrypts the encrypted first sensitive information and non-sensitive information according to the first encryption algorithm to generate the request response message.
4. The method as described in claim 2 or 3, characterized in that, If the value of the algorithm type parameter is the second value, the method further includes: The second terminal determines the first sensitive information based on the second sensitive information; The second terminal encrypts the first sensitive information according to a preset encryption algorithm to obtain the encrypted first sensitive information; The second terminal encrypts the encrypted first sensitive information and non-sensitive information according to the first encryption algorithm to generate the request response message.
5. The method according to any one of claims 1-3, characterized in that, After sending the request-response message to the first terminal, the method further includes: The second terminal updates the system configuration file according to the second encryption algorithm, and the updated system configuration file indicates that the system is only compatible with the second encryption algorithm.
6. A transaction device applied to a second terminal, characterized in that, The second terminal is a peer-to-peer transaction terminal with processing capabilities, and the transaction device includes: A receiving module is used to receive a transaction request message sent by a first terminal, wherein the first terminal is a peer-to-peer transaction terminal with processing capabilities; the transaction request message includes an algorithm type parameter, the value of which includes a first value and a null value, the first value indicating that the transaction request message is encrypted using a first encryption algorithm, and the null value indicating that the first terminal is a terminal that has not updated its system; specifically, the transaction request message is a message obtained by the first terminal first encrypting second sensitive information separately using the first encryption algorithm, and then encrypting the encrypted second sensitive information and non-sensitive information together using the same first encryption algorithm; The decryption module is used to decrypt the transaction request message according to the first encryption algorithm if the value of the algorithm type parameter is the first value, so as to obtain transaction request information; the transaction request information includes the second sensitive information and the non-sensitive information. An encryption module is used to generate a request response message based on the transaction request information. The request response message includes first sensitive information and the algorithm type parameter. The first sensitive information is information determined by the second terminal based on the second sensitive information. Specifically, the request response message is a message obtained by the second terminal first encrypting the first sensitive information separately using the first encryption algorithm, and then encrypting the encrypted first sensitive information and non-sensitive information as a whole using the same first encryption algorithm. The value of the algorithm type parameter in the request response message is completely consistent with the value of the algorithm type parameter in the transaction request message, indicating that the request response message is encrypted using the first encryption algorithm. The sending module is used to send the request-response message to the first terminal.
7. The apparatus as claimed in claim 6, characterized in that, The decryption module is specifically used for: The transaction request message is decrypted according to the first encryption algorithm to obtain the second sensitive information encrypted in the transaction request message; The encrypted second sensitive information is decrypted according to the first encryption algorithm to obtain the second sensitive information, which belongs to the transaction request information.
8. The apparatus as claimed in claim 7, characterized in that, The encryption module is specifically used for: The first sensitive information is determined based on the second sensitive information; The first sensitive information is encrypted according to the first encryption algorithm to obtain the encrypted first sensitive information; The first encrypted sensitive information and non-sensitive information are encrypted using the first encryption algorithm to generate the request response message.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-5.
11. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-5.
Citation Information
Patent Citations
Collection method and device based on near field communication (NFC)
CN111178873A
Message encryption method, message decryption method, device and program product
CN115396206A
Mobile terminal video encryption method and device and readable storage medium
CN115412744A