Payment code updating method, device, computer equipment and storage medium
By using symmetric key signature and decrypting payment code update requests and responses, the payment code update problem caused by asymmetric encryption in the prior art is solved, and a more efficient and secure payment code update process is achieved.
Patent Information
- Application Number
- CN202010268244.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-08
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2040-04-08
AI Technical Summary
In the prior art, asymmetric encryption and decryption process of QR codes is complicated, resulting in low efficiency in updating payment codes.
By determining the first symmetric key corresponding to the payment code to be updated, the user terminal uses the symmetric key to sign the payment code update request and sends it to the server. After receiving the server, it checks and passes the encrypted update payment code. The user terminal uses the key to decrypt and updates the payment code.
It improves the efficiency of payment code update, avoids complex computing and verification in asymmetric encrypted communication, and ensures the security of payment code transmission.
Smart Images

Figure CN113496404B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of mobile payment technology, and in particular to a payment code updating method, device, computer equipment and storage medium. Background Art
[0002] Mobile payment refers to the use of mobile clients to pay with electronic money using mobile phones and other electronic products. Mobile payment effectively combines the Internet, terminal devices, and financial institutions to form a new payment system. Mobile payment has created a new payment method and made electronic money popular.
[0003] QR code payment is a popular online mobile payment method. People only need to show their QR code for the merchant terminal to scan to realize password-free payment, which brings great convenience to people's payment process.
[0004] In order to prevent the user's QR code from being stolen and to ensure the security of the QR code payment process, traditional technology uses asymmetric encryption to encrypt and decrypt the QR code to ensure that the QR code will not be captured by a third party during transmission and cause leakage. However, the process of encrypting and decrypting the QR code using asymmetric encryption often requires complex calculations and verifications. Although this ensures the security of QR codes and other payment codes during the update process, it often takes a long time and computing power, which also causes the problem of poor payment code update effect in the existing technology. Summary of the invention
[0005] Based on this, it is necessary to provide a payment code updating method, device, computer equipment and storage medium that can improve the payment code updating effect in response to the above technical problems.
[0006] A payment code updating method, applied to a user terminal, comprising:
[0007] For the payment code to be updated, determining a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0008] Using the first symmetric key, signing a first payment code update request corresponding to the payment code to be updated and sending the signature to the server;
[0009] Receiving an updated payment code encrypted with the first symmetric key and sent by the server after the server verifies the first payment code update request;
[0010] The payment code to be updated is updated using the updated payment code to obtain an updated payment code.
[0011] A payment code updating method, applied to a server, comprising:
[0012] receiving a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0013] When the first payment code update request is verified and passed, an updated payment code is generated;
[0014] The updated payment code is encrypted using the first symmetric key and then sent to the user terminal, so that the user terminal updates the payment code to be updated to obtain an updated payment code.
[0015] A payment code updating device, applied to a user terminal, comprising:
[0016] a determination module, configured to determine, for a payment code to be updated, a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0017] a sending module, configured to use the first symmetric key to sign a first payment code update request corresponding to the payment code to be updated and then send the signature to the server;
[0018] A receiving module, configured to receive an updated payment code encrypted with the first symmetric key and sent by the server after the server verifies the first payment code update request;
[0019] The updating module is used to update the payment code to be updated by using the updated payment code to obtain an updated payment code.
[0020] A payment code updating device, applied to a server, comprising:
[0021] a receiving module, configured to receive a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0022] A generating module, configured to generate an updated payment code after the signature verification of the first payment code update request is passed;
[0023] The sending module is used to use the first symmetric key to encrypt the updated payment code and then send it to the user terminal, so that the user terminal can update the payment code to be updated to obtain an updated payment code.
[0024] A computer device, applied to a user terminal, comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0025] For the payment code to be updated, determining a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0026] Using the first symmetric key, signing a first payment code update request corresponding to the payment code to be updated and sending the signature to the server;
[0027] Receiving an updated payment code encrypted with the first symmetric key and sent by the server after the server verifies the first payment code update request;
[0028] The payment code to be updated is updated using the updated payment code to obtain an updated payment code.
[0029] A computer device, applied to a server, comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0030] receiving a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0031] When the first payment code update request is verified and passed, an updated payment code is generated;
[0032] The updated payment code is encrypted using the first symmetric key and then sent to the user terminal, so that the user terminal updates the payment code to be updated to obtain an updated payment code.
[0033] A computer-readable storage medium is applied to a user terminal and stores a computer program thereon. When the computer program is executed by a processor, the following steps are implemented:
[0034] For the payment code to be updated, determining a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0035] Using the first symmetric key, signing a first payment code update request corresponding to the payment code to be updated and sending the signature to the server;
[0036] Receiving an updated payment code encrypted with the first symmetric key and sent by the server after the server verifies the first payment code update request;
[0037] The payment code to be updated is updated using the updated payment code to obtain an updated payment code.
[0038] A computer-readable storage medium is applied to a server and stores a computer program thereon. When the computer program is executed by a processor, the following steps are implemented:
[0039] receiving a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0040] When the first payment code update request is verified and passed, an updated payment code is generated;
[0041] The updated payment code is encrypted using the first symmetric key and then sent to the user terminal, so that the user terminal updates the payment code to be updated to obtain an updated payment code.
[0042] The payment code update method, device, computer equipment and storage medium described above determine the first symmetric key corresponding to the payment code to be updated; wherein the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated, and the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; by using the first symmetric key, the first payment code update request corresponding to the payment code to be updated is signed and sent to the server, so as to request the server to issue an updated payment code encrypted by the first symmetric key, which is then used to update the payment code to be updated, and obtain the updated payment code. In this way, by using symmetric encryption to transmit the initial symmetric key corresponding to the initial payment code for subsequent symmetric encryption transmission of the payment code to be updated, the security of the initial symmetric key transmission can be guaranteed, and there is no need to use complex asymmetric keys to encrypt and transmit the updated QR code, which ensures the security of the payment code transmission while avoiding the problem of low transmission efficiency caused by the need for complex calculations and verifications when the device uses asymmetric encryption communication to update the payment code in the traditional technology, thereby improving the update effect of the payment code. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A diagram of an application environment of a payment code updating method in an embodiment;
[0044] Figure 2 A schematic diagram of a payment code update method in one embodiment;
[0045] Figure 3 It is a flowchart of another payment code updating method in one embodiment;
[0046] Figure 4 is a timing diagram of a payment code updating method in one embodiment;
[0047] Figure 5 A schematic diagram of a process of obtaining an initial payment code in an embodiment;
[0048] Figure 6 A schematic diagram of an interactive interface for an initial payment code acquisition process in one embodiment;
[0049] Figure 7is a timing diagram of an initial payment code acquisition process in one embodiment;
[0050] Figure 8 A schematic diagram of a flow chart of a payment code updating method in another embodiment;
[0051] Fig. 9 is a timing diagram of another payment code updating method in one embodiment;
[0052] Fig.10 A schematic flow chart of another payment code updating method in another embodiment;
[0053] Fig.11 It is a flowchart of a method for updating a payment code to be updated in one embodiment;
[0054] Fig.12 A schematic diagram of a payment code update application scenario in an embodiment;
[0055] Fig.13 A timing diagram of a payment code update application scenario in an embodiment;
[0056] Fig.14 It is a structural block diagram of a payment code updating device in one embodiment;
[0057] Fig.15 It is a structural block diagram of a payment code updating device in another embodiment;
[0058] Fig.16 is an internal structure diagram of a computer device in one embodiment;
[0059] Fig.17 The figure is a diagram of the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] The payment code update method provided in this application can be applied to Figure 1In the application environment shown. The user terminal 110 communicates with the server 120 through the network. The user terminal 110 first determines the first symmetric key corresponding to the payment code to be updated for the payment code to be updated; the first symmetric key is obtained from the server 120 when the user terminal updates the previous payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server 120 by the user terminal through asymmetric encryption communication; then, the user terminal 110 uses the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and sends it to the server 120; then, the user terminal 110 receives the updated payment code encrypted by the first symmetric key sent by the server 120 after the signature verification of the first payment code update request; finally, the user terminal 110 uses the updated payment code to update the payment code to be updated to obtain the updated payment code. In actual applications, the user terminal 110 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0062] In one embodiment, Figure 2 As shown, a payment code update method is provided, which is applied to Figure 1 The user terminal 110 in the example is used as an example to illustrate, and the following steps are included:
[0063] Step S210, for the payment code to be updated, determine the first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication.
[0064] The payment code may refer to a graphic code used by the user to perform payment operations. In practical applications, the payment code may be a graphic code such as a QR code or a one-dimensional code.
[0065] The payment code to be updated may refer to the payment code that needs to be updated.
[0066] The first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated. In actual applications, when the user terminal receives the updated payment code corresponding to the last payment code to be updated sent by the server, the user terminal can also receive the first symmetric key sent by the server for subsequent updating of the updated payment code.
[0067] The initial payment code may refer to a payment code that the user terminal obtains from the server for the first time.
[0068] Among them, the initial symmetric key corresponding to the initial payment code of the user terminal is obtained by the user terminal from the server through asymmetric encryption communication.
[0069] In a specific implementation, when the user terminal 110 detects that the payment code to be updated needs to be updated, the user terminal 110 determines the first symmetric key corresponding to the payment code to be updated for the payment code to be updated.
[0070] In actual applications, when the user terminal detects that the payment code to be updated meets the preset update condition, it can determine the first symmetric key corresponding to the payment code to be updated to update the payment code to be updated.
[0071] Among them, the update condition may be receiving the user's payment code display operation, and the front-end interface of the user terminal displays the payment code display page; for example, the user opens the payment code interface of the user terminal; or the front-end interface of the user terminal displays the payment code display page and then periodically pulls a new payment code for display; wherein the validity period of the payment code is 1 minute; or after the user uses the payment code to complete the payment, the front-end interface of the user terminal jumps back from displaying the payment success page to displaying the payment code display page and other update conditions.
[0072] Step S220: Use the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and then send it to the server.
[0073] The payment code update request may refer to a request for triggering the server to send an updated payment code.
[0074] In a specific implementation, after determining the first symmetric key corresponding to the payment code to be updated, the user terminal 110 uses the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and sends it to the server 120 .
[0075] Step S230, receiving the updated payment code encrypted with the first symmetric key and sent by the server after the server verifies the first payment code update request.
[0076] Among them, the updated payment code may refer to the payment code used to update the QR code to be updated.
[0077] In the specific implementation, when the server 120 receives the first payment code update request signed by the user terminal 110 using the first symmetric key, the server 120 uses the first symmetric key to verify the signature of the first payment code update request; when the server 120 passes the signature verification on the first payment code update request, the server 120 generates an updated payment code, and encrypts the updated payment code using the first symmetric key according to the preset symmetric encryption algorithm, and sends the encrypted updated payment code to the user terminal 110, so that the user terminal 110 receives the updated payment code encrypted by the first symmetric key sent by the server 120.
[0078] In actual applications, the server 120 may use the AES_CBC algorithm (AES (Advanced Encryption Standard) algorithm in CBC (Cipher Block Chaining) mode) to encrypt the updated payment code using the first symmetric key.
[0079] Step S240, using the updated payment code to update the payment code to be updated to obtain an updated payment code.
[0080] In a specific implementation, when the user terminal 110 receives the updated payment code encrypted by the server 120 using the first symmetric key, the user terminal 110 decrypts the encrypted updated payment code using the first symmetric key according to a preset symmetric decryption algorithm to obtain an updated payment code; then, the user terminal 110 uses the updated payment code to update the payment code to be updated to obtain an updated payment code.
[0081] Finally, the user terminal 110 displays the updated payment code, which is then used for the merchant terminal to scan for transaction payment. After the merchant terminal scans the updated payment code, it sends a deduction request to the server 120 according to the information carried by the updated payment code to complete the transaction payment.
[0082] The above-mentioned payment code update method determines the first symmetric key corresponding to the payment code to be updated; wherein the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated, and the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; by using the first symmetric key, the first payment code update request corresponding to the payment code to be updated is signed and sent to the server, so as to request the server to issue an updated payment code encrypted by the first symmetric key, which is then used to update the payment code to be updated, and obtain the updated payment code. In this way, by using symmetric encryption to transmit the initial symmetric key corresponding to the initial payment code for subsequent symmetric encryption transmission of the payment code to be updated, the security of the initial symmetric key transmission can be guaranteed, and there is no need to rely on complex asymmetric keys to encrypt and transmit the updated QR code, which ensures the security of the payment code transmission while avoiding the problem of low transmission efficiency caused by the need for complex calculations and verifications when the device uses asymmetric encryption communication to update the payment code in the traditional technology, thereby improving the update effect of the payment code.
[0083] In one of the embodiments, after the server verifies the first payment code update request, the method also includes: receiving a second symmetric key encrypted with the first symmetric key after the server verifies the first payment code update request; caching the second symmetric key to the corresponding target cache location; the second symmetric key is used to update the updated payment code.
[0084] The target cache location may refer to a target location in the user terminal cache for storing the second symmetric key.
[0085] In a specific implementation, after the server 120 verifies the signature of the first payment code update request, the server 120 can generate a second symmetric key while generating an updated QR code; specifically, the server 120 can generate a random number of a preset length, and use the random number as the second symmetric key; then, the server 120 encrypts the second symmetric key using the first symmetric key according to a preset symmetric encryption algorithm, and sends the encrypted second symmetric key to the user terminal 110, so that the user terminal 110 receives the second symmetric key encrypted by the first symmetric key sent by the server 120.
[0086] When the user terminal 110 receives the second symmetric key encrypted by the first symmetric key sent by the server 120, the user terminal 110 uses the symmetric decryption algorithm preset by the user terminal 110 to decrypt the encrypted second symmetric key by using the first symmetric key, and obtains the second symmetric key randomly generated by the server 120. Finally, the user terminal 110 can use the second symmetric key to update the updated payment code for the next time.
[0087] In addition, when the user terminal 110 successfully receives the second symmetric key sent by the server 120, the user terminal 110 discards the first symmetric key.
[0088] It should be noted that the process of updating the updated payment code using the second symmetric key is consistent with the process of updating the updated payment code using the first symmetric key in the above text, and will not be repeated here.
[0089] The technical solution of this embodiment is that after the server verifies the signature of the first payment code update request, the second symmetric key encrypted by the first symmetric key is received by the server and the second symmetric key is cached to the corresponding target cache location; and then used for the subsequent use of symmetric encryption communication method to update the updated payment code for the next time, avoiding excessive reliance on asymmetric encryption communication method for the next update of the updated payment code, reducing the amount of computing power of the device, and improving the data transmission efficiency when the updated payment code is updated for the next time, thereby improving the update effect of the payment code.
[0090] In one of the embodiments, a first symmetric key is used to sign a first payment code update request corresponding to the payment code to be updated and then sent to a server, including: using the first symmetric key to generate a digital signature of the first payment code update request; sending the first payment code update request and the digital signature to the server, so that the server uses the first symmetric key and the digital signature to verify the first payment code update request.
[0091] In a specific implementation, the user terminal 110 uses the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and then sends it to the server 120. This process specifically includes: the user terminal 110 uses the first symmetric key to generate a digital signature for the first payment code update request; after the user terminal 110 generates the digital signature for the first payment code update request, the user terminal 110 sends the first payment code update request and the digital signature to the server 120.
[0092] Specifically, the user terminal 110 may combine the first payment code update request and the digital signature to obtain the first payment code update signature request; then, the user terminal 110 sends the first payment code update signature request to the server 120 for receipt by the server 120. After the server 120 receives the first payment code update request and the corresponding digital signature, the server 120 may verify the digital signature using the first symmetric key, thereby verifying the first payment code update request.
[0093] The technical solution of this embodiment uses a first symmetric key to generate a digital signature for a first payment code update request; the first payment code update request and the digital signature are sent to the server, so that the server uses the first symmetric key and the digital signature to verify the first payment code update request, so that the server can safely obtain the payment code update request of the user terminal, thereby improving the security of updating the payment code using symmetric encryption communication.
[0094] In one embodiment, a first symmetric key is used to generate a digital signature of a first payment code update request, including: generating a message digest of the first payment code update request according to a preset digest algorithm; and encrypting the message digest using the first symmetric key to obtain a digital signature of the first payment code update request.
[0095] In practical applications, the preset digest algorithm can be a message digest algorithm such as MD5, SHA1, SHA512, etc.
[0096] In a specific implementation, when the user terminal 110 uses the first symmetric key to generate the digital signature of the first payment code update request, the user terminal 110 generates a message digest of the first payment code update request according to a preset digest algorithm. Finally, the user terminal 110 encrypts the message digest using the first symmetric key according to a preset symmetric encryption algorithm, thereby obtaining the digital signature of the first payment code update request. In this way, when the server 120 receives the signed first payment code update request, the server 120 uses the first symmetric key to verify the signature of the first payment code update request.
[0097] The technical solution of this embodiment, in the process of using the first symmetric key to generate the digital signature of the first payment code update request, generates a message digest of the first payment code update request by following a preset digest algorithm; uses the first symmetric key to encrypt the message digest to obtain the digital signature of the first payment code update request, which is used for the server to accurately verify the validity and authenticity of the first payment code update request, so that the server can safely obtain the payment code update request of the user terminal, thereby improving the security of updating the payment code using symmetric encryption communication.
[0098] In one embodiment, Figure 3As shown, another payment code update method is provided, comprising the following steps: Step S310, for the payment code to be updated, determining the first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication. Step S320, generating a message digest of the first payment code update request corresponding to the payment code to be updated according to a preset digest algorithm. Step S330, encrypting the message digest using the first symmetric key to obtain a digital signature of the first payment code update request. Step S340, sending the first payment code update request and the digital signature to the server, so that the server verifies the first payment code update request using the first symmetric key and the digital signature. Step S350, receiving the updated payment code encrypted using the first symmetric key and the second symmetric key encrypted using the first symmetric key sent by the server after the signature verification of the first payment code update request is passed. Step S360, using the updated payment code to update the payment code to be updated to obtain an updated payment code. Step S370, caching the second symmetric key to the corresponding target cache location; the second symmetric key is used to update the updated payment code. It should be noted that the specific limitations of the above steps can be found in the specific limitations of a payment code update method above, which will not be repeated here.
[0099] In order to facilitate the understanding of those skilled in the art, Figure 4 A timing diagram of a payment code update method is provided. Figure 4 As shown, the user terminal 110 sends a first payment code update request signed by a first symmetric key to the server; when the server receives the first payment code update request, it verifies the signature of the first payment code update request and generates an update QR code and a second symmetric key; then, the server sends the update QR code and the second symmetric key encrypted by the first symmetric key. After the user terminal 110 receives the update QR code and the second symmetric key encrypted by the first symmetric key sent by the server, it uses the first symmetric key to decrypt the encrypted update QR code and the second symmetric key to obtain the decrypted update QR code and the second symmetric key. Finally, the user terminal 110 uses the decrypted update QR code to update the payment code to be updated and obtains the updated payment code; and caches the decrypted second symmetric key in a preset cache location for subsequent updates to the updated payment code.
[0100] In one embodiment, if Figure 5 As shown, a method for obtaining an initial payment code is provided, and the method is applied to Figure 1The user terminal 110 in the example is used for explanation, and the following steps are included: Step S510, when receiving the user's payment code acquisition instruction, sending a payment code acquisition request to the server; the payment code acquisition request carries the user's payment password; Step S520, when the server verifies the payment password, receiving the initial payment code and initial symmetric key encrypted by asymmetric encryption sent by the server; Step S530, decrypting the encrypted initial payment code and initial symmetric key by asymmetric decryption method to obtain the initial payment code and initial symmetric key.
[0101] The payment code acquisition instruction may refer to an instruction for a user to obtain an initial payment code input.
[0102] In a specific implementation, when a user needs to display a payment code for the first time through the user terminal 110 to make a payment transaction, the user can touch the payment code display entrance in the user graphical interface of the user terminal 110 and enter the corresponding payment password to enter the payment code to obtain the instruction. Figure 6 An exemplary interactive interface diagram of the initial payment code acquisition process is provided.
[0103] Then, when the user terminal 110 detects receipt of the user's payment code acquisition instruction, the user terminal 110 responds to the payment code acquisition instruction and sends a payment code acquisition request carrying the user's payment password to the server 120 for the server 120 to receive.
[0104] When the server 120 receives the payment code acquisition request sent by the user terminal 110, the server 120 verifies the payment password in the payment code acquisition request, and after the payment password verification is passed, the server 120 generates an initial payment code and randomly generates an initial symmetric key corresponding to the initial payment code.
[0105] Then, the server 120 encrypts the initial payment code and the initial symmetric key using an asymmetric encryption method to obtain the encrypted initial payment code and the initial symmetric key. Finally, the server 120 sends the encrypted initial payment code and the initial symmetric key to the user terminal 110. When the user terminal 110 receives the encrypted initial payment code and the initial symmetric key sent by the server 120, the user terminal 110 decrypts the encrypted initial payment code and the initial symmetric key using an asymmetric decryption method to obtain the initial payment code and the initial symmetric key.
[0106] Specifically, when the user terminal 110 detects the payment code acquisition instruction input by the user, that is, the user inputs the payment password, the user terminal 110 generates a public-private key pair; wherein the public-private key pair includes the private key of the user terminal 110 and the public key of the user terminal 110; then, the user terminal 110 requests the server 120 to upload the public key certificate of the user terminal 110 to the server 120, so that the server 120 obtains the public key of the user terminal 110. At the same time, the private key certificate is stored in the local secure storage area of the user terminal 110 to realize the secure storage of the private key of the user terminal 110.
[0107] When the server 120 encrypts the initial payment code and the initial symmetric key using an asymmetric encryption method and obtains the encrypted initial payment code and the initial symmetric key, the server 120 may use the public key of the user terminal 110 and encrypt the initial payment code and the initial symmetric key generated by the server 120 according to a preset encryption algorithm, obtain the encrypted initial payment code and the initial symmetric key, and send them to the user terminal 110. After the user terminal 110 receives the encrypted initial payment code and the initial symmetric key sent by the server 120, the user terminal 110 may read the private key of the user terminal 110 from the local secure storage area, and use the private key of the user terminal 110 to encrypt the encrypted initial payment code and the initial symmetric key, thereby obtaining the initial payment code and the initial symmetric key.
[0108] The technical solution of this embodiment is as follows: when receiving the user's payment code acquisition instruction, sending a payment code acquisition request carrying the user's payment password to the server; when the server verifies the payment password, receiving the initial payment code and initial symmetric key encrypted by asymmetric encryption sent by the server; and decrypting the encrypted initial payment code and initial symmetric key by asymmetric decryption to obtain the initial payment code and initial symmetric key. In this way, the initial payment code and initial symmetric key are encrypted and transmitted by asymmetric encryption communication, which ensures the security of the initial payment code and the initial symmetric key, and also improves the security of the user terminal when the initial symmetric key is used to update the initial payment code.
[0109] In order to facilitate the understanding of those skilled in the art, Figure 7 A timing diagram of the initial payment code acquisition process is provided. Figure 7As shown, when the user terminal 110 detects that it has received the user's payment code acquisition instruction, the user terminal 110 responds to the payment code acquisition instruction and uploads the public key certificate of the user terminal 110 and the user's payment password to the server 120 for the server 120 to receive. Then, the server 120 verifies the payment password, and generates an initial payment code and a randomly generated initial symmetric key corresponding to the initial payment code after the payment password verification passes. Finally, the server 120 can use the public key of the user terminal 110 to encrypt the initial payment code and the initial symmetric key generated by the server 120 according to the preset encryption algorithm, obtain the encrypted initial payment code and the initial symmetric key, and send them to the user terminal 110. After the user terminal 110 receives the encrypted initial payment code and the initial symmetric key sent by the server 120, the user terminal 110 can read the private key of the user terminal 110 from the local secure storage area, and use the private key of the user terminal 110 to encrypt the encrypted initial payment code and the initial symmetric key, thereby obtaining the initial payment code and the initial symmetric key.
[0110] In one of the embodiments, it also includes: when it is determined that the first symmetric key has expired, the second payment code update request to update the payment code is signed using an asymmetric encryption method and then sent to the server: when the server verifies the signature of the second payment code update request, it receives the updated payment code and the second symmetric key encrypted using the asymmetric encryption method sent by the server, and decrypts the encrypted updated payment code and the second symmetric key using an asymmetric decryption method to obtain the updated payment code and the second symmetric key.
[0111] The first symmetric key has a corresponding key validity period. In practical applications, the key validity period may be 24 hours.
[0112] In a specific implementation, the user terminal 110 also needs to determine whether the first symmetric key has expired. When the first symmetric key determines that the first symmetric key has expired, the user terminal 110 does not perform the step of using the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and then send it to the server 120. The user terminal 110 uses an asymmetric encryption method to sign the second payment code update request to be updated and then sends it to the server 120; when the server 120 receives the second payment code update request, the server 120 verifies the signature of the second payment code update request using an asymmetric decryption method, and after the signature verification is passed, sends the updated payment code and the second symmetric key encrypted using the asymmetric encryption method to the user terminal 110. After the user terminal 110 receives the encrypted updated payment code and the second symmetric key sent by the server 120, the user terminal 110 decrypts the encrypted updated payment code and the second symmetric key using an asymmetric decryption method to obtain the updated payment code and the second symmetric key.
[0113] Specifically, the user terminal 110 may use the private key of the user terminal 110 to sign the second payment code update request for updating the payment code and then send it to the server 120; when the server 120 receives the second payment code update request, the server 120 uses the public key of the user terminal 110 to verify the signature of the second payment code update request, and after the signature verification is passed, the updated payment code and the second symmetric key encrypted by the public key of the user terminal 110 are sent to the user terminal 110. After the user terminal 110 receives the encrypted updated payment code and the second symmetric key sent by the server 120, the user terminal 110 decrypts the encrypted updated payment code and the second symmetric key by the private key of the user terminal 110 to obtain the updated payment code and the second symmetric key.
[0114] In actual applications, the user terminal 110 determines whether the first symmetric key has expired. The user terminal 110 can determine whether the usage time of the first symmetric key exceeds the corresponding key validity time. If so, the first symmetric key is determined to be expired. Of course, the user terminal 110 can also determine whether a key expiration notification for the first symmetric key sent by the server 120 is received; when the user terminal 110 receives a key expiration notification for the first symmetric key sent by the server 120, the user terminal 110 can also determine that the first symmetric key has expired.
[0115] According to the technical solution of this embodiment, when the user terminal uses the first symmetric key to update the payment code to be updated in a symmetric encryption communication manner, when it is determined that the first symmetric key is expired, the second payment code update request to be updated is signed by an asymmetric encryption method and then sent to the server: when the server verifies the signature of the second payment code update request, it receives the updated payment code and the second symmetric key encrypted by the asymmetric encryption method sent by the server, and decrypts the encrypted updated payment code and the second symmetric key by an asymmetric decryption method to obtain the updated payment code and the second symmetric key, thereby realizing the validity period control of the symmetric key and preventing the symmetric key from being leaked due to the lack of interaction between the mobile phone and the server within a certain period of time.
[0116] In one of the embodiments, before the step of signing the second payment code update request for updating the payment code by asymmetric encryption and then sending it to the server when the first symmetric key is determined to be expired, it also includes: using the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and then sending it to the server; when receiving the symmetric key expiration notification sent by the server; determining that the first symmetric key is expired; the symmetric key expiration notification is a notification generated by the server when the first symmetric key is determined to be expired after receiving the first payment code update request.
[0117] The symmetric key expiration notification may refer to a notification generated by the server when the first symmetric key expires.
[0118] In a specific implementation, before the step of using an asymmetric encryption method to sign the second payment code update request for updating the payment code and then sending it to the server 120 when the user terminal 110 determines that the first symmetric key has expired, the user terminal 110 needs to use the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and then send it to the server 120; when the server 120 receives the first payment code update request signed by the user terminal 110 using the first symmetric key, the server 120 uses the first symmetric key to verify the signature of the first payment code update request; at the same time, the server 120 also needs to determine whether the first symmetric key has expired; specifically, the server 120 determines whether the usage time of the first symmetric key exceeds the corresponding key validity time. If so, it determines that the first symmetric key has expired and generates a symmetric key expiration notification and sends it to the user terminal 110.
[0119] When the user terminal 110 receives the symmetric key expiration notification for the first symmetric key issued by the server 120, the user terminal 110 determines that the first symmetric key has expired, and then the user terminal 110 deletes the first symmetric key in the cache to discard the first symmetric key. Then, the user terminal 110 signs the second payment code update request for updating the payment code in an asymmetric encryption manner and sends it to the server 120, thereby obtaining the updated payment code and the second symmetric key generated by the server 120 in an asymmetric encryption communication manner.
[0120] The technical solution of this embodiment uses the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and send it to the server. When the symmetric key expiration notification sent by the server is received, the first symmetric key is determined to be expired, and the updated payment code and the second symmetric key generated by the server are obtained by asymmetric encryption communication, so that the server actively invalidates the first symmetric key in the user terminal, and the server can force the symmetric key cached by the user terminal to be refreshed.
[0121] In another embodiment, Figure 8As shown, a payment code update method is provided, comprising the following steps: Step S810, for the payment code to be updated, determining the first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication. Step S820, using the first symmetric key, signing the first payment code update request corresponding to the payment code to be updated and sending it to the server. Step S830, when receiving the symmetric key expiration notification sent by the server; signing the second payment code update request of the payment code to be updated by asymmetric encryption and sending it to the server; the symmetric key expiration notification is a notification generated by the server when the first symmetric key is determined to be expired after receiving the first payment code update request. Step S840, when the server verifies the second payment code update request and passes it, receiving the updated payment code and the second symmetric key encrypted by asymmetric encryption sent by the server. Step S850, decrypt the encrypted updated payment code and the second symmetric key using an asymmetric decryption method to obtain the updated payment code and the second symmetric key. It should be noted that the specific definition of the above steps can refer to the specific definition of a payment code update method above, which will not be repeated here.
[0122] In order to facilitate the understanding of those skilled in the art, Fig. 9 A timing diagram of another payment code update method is provided. Fig. 9 As shown, the user terminal 110 uses the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and then sends it to the server 120; the server 120 verifies the signature of the first payment code update request and detects whether the first symmetric key is expired; when the first symmetric key expires, the server 120 sends a symmetric key expiration notification to the user terminal 110; when the user terminal 110 receives the symmetric key expiration notification, the user terminal 110 determines that the first symmetric key is expired, and then the user terminal 110 deletes the first symmetric key in the cache to discard the first symmetric key.
[0123] Then, the user terminal 110 uses the private key of the user terminal 110 to sign the second payment code update request for the payment code to be updated and sends it to the server 120; when the server 120 receives the second payment code update request, the server 120 uses the public key of the user terminal 110 to verify the signature of the second payment code update request, and after the signature verification is passed, the updated payment code and the second symmetric key encrypted by the public key of the user terminal 110 are sent to the user terminal 110. After the user terminal 110 receives the encrypted updated payment code and the second symmetric key sent by the server 120, the user terminal 110 uses the private key of the user terminal 110 to decrypt the encrypted updated payment code and the second symmetric key to obtain the updated payment code and the second symmetric key. Finally, the user terminal 110 displays the updated payment code and caches the second symmetric key to the corresponding target cache location.
[0124] In another embodiment, Fig.10 As shown, another payment code update method is provided, which is applied to Fig.10 The server 120120 in the example is used for explanation, and the following steps are included: Step S1010, receiving the first payment code update request sent by the user terminal for the payment code to be updated; the first payment code update request is a request signed by the user terminal using the first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server 120 when the user terminal updates the previous payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server 120 by the user terminal through asymmetric encryption communication. Step S1020, after the signature verification of the first payment code update request is passed, an updated payment code is generated. Step S1030, the updated payment code is encrypted using the first symmetric key and sent to the user terminal, so that the user terminal updates the payment code to be updated to obtain an updated payment code.
[0125] It should be noted that the specific limitations of the above steps can be found in the specific limitations of a payment code update method mentioned above, which will not be repeated here.
[0126] The above-mentioned payment code update method determines the first symmetric key corresponding to the payment code to be updated; wherein the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated, and the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; by using the first symmetric key, the first payment code update request corresponding to the payment code to be updated is signed and sent to the server, so as to request the server to issue an updated payment code encrypted by the first symmetric key, which is then used to update the payment code to be updated, and obtain the updated payment code. In this way, by using symmetric encryption to transmit the initial symmetric key corresponding to the initial payment code for subsequent symmetric encryption transmission of the payment code to be updated, the security of the initial symmetric key transmission can be guaranteed, and there is no need to use complex asymmetric keys to encrypt and transmit the updated QR code, which ensures the security of the payment code transmission while avoiding the problem of low transmission efficiency caused by the need for complex calculations and verifications when the device uses asymmetric encryption communication to update the payment code in the traditional technology, thereby improving the update effect of the payment code.
[0127] In one of the embodiments, it also includes: obtaining the key validity period corresponding to the first symmetric key; if the first symmetric key is determined to be expired according to the key validity period, discarding the first symmetric key and generating a symmetric key expiration notification; the symmetric key expiration notification is used to notify the user terminal to discard the first symmetric key and then use an asymmetric encryption method to sign the second payment code update request to update the payment code and send it to the server.
[0128] The symmetric key expiration notification is used to notify the user terminal to abandon the first symmetric key.
[0129] Among them, the symmetric key expiration notification is also used to notify the user terminal to use an asymmetric encryption method to sign the second payment code update request to update the payment code and send it to the server to obtain the updated payment code and the second symmetric key.
[0130] In a specific implementation, after the server 120 receives the first payment code update request signed by the user terminal 110 using the first symmetric key, the server 120 also needs to determine whether the first symmetric key has expired; specifically, the server 120 obtains the key validity period corresponding to the first symmetric key; and determines whether the first symmetric key has expired according to the key validity period. When the server 120 determines that the first symmetric key has expired, the server 120 discards the first symmetric key; at the same time, the server 120 generates and sends a symmetric key expiration notification to the user terminal 110. After receiving the symmetric key expiration notification for the first symmetric key, the user terminal 110 discards the first symmetric key, and signs the second payment code update request to update the payment code using an asymmetric encryption method and sends it to the server 120 to obtain the updated payment code and the second symmetric key.
[0131] Specifically, after receiving the symmetric key expiration notification for the first symmetric key, the user terminal 110 may use the private key of the user terminal 110 to sign the second payment code update request for updating the payment code and send it to the server 120; when the server 120 receives the second payment code update request, the server 120 uses the public key of the user terminal 110 to verify the signature of the second payment code update request, and after the signature verification is passed, the updated payment code and the second symmetric key encrypted by the public key of the user terminal 110 are sent to the user terminal 110. After the user terminal 110 receives the encrypted updated payment code and the second symmetric key sent by the server 120, the user terminal 110 uses the private key of the user terminal 110 to decrypt the encrypted updated payment code and the second symmetric key to obtain the updated payment code and the second symmetric key.
[0132] The technical solution of this embodiment is to obtain the key validity period corresponding to the first symmetric key; if the first symmetric key is determined to be expired according to the key validity period, the first symmetric key is discarded and a symmetric key expiration notification is generated; the symmetric key expiration notification is used to notify the user terminal to discard the first symmetric key and then use an asymmetric encryption method to sign the second payment code update request for updating the payment code and send it to the server. In this way, the server can control the validity period of the symmetric key and actively invalidate the symmetric key in the user terminal, so that the server can force the refresh of the symmetric key cached by the user terminal, thereby improving the security of the payment code transmission process.
[0133] In one of the embodiments, it also includes: obtaining a digital signature corresponding to the first payment code update request; using a first symmetric key to verify the digital signature; when the digital signature passes the verification, it is determined that the first payment code update request passes the signature verification.
[0134] In a specific implementation, after the server 120 receives the first payment code update request sent by the user terminal 110 for the payment code to be updated, the server 120 verifies the signature of the first payment code update request, specifically including: the server 120 can obtain the digital signature corresponding to the first payment code update request; then, use the first symmetric key to verify the digital signature to determine whether the digital signature passes the verification.
[0135] In one of the embodiments, the server uses the first symmetric key to perform signature verification on the digital signature, which specifically includes: using the first symmetric key to decrypt the digital signature to obtain the summary to be verified of the first payment code update request; generating a message digest of the first payment code update request according to a preset digest algorithm; when the message digest is consistent with the summary to be verified, it is determined that the digital signature has passed the verification.
[0136] In the specific implementation, the server 120 uses the first symmetric key to decrypt the digital signature according to the preset symmetric key decryption algorithm, and uses the obtained encrypted digital signature as the summary to be verified of the payment code update request; then, the server 120 generates a message digest of the first payment code update request according to the preset digest algorithm; then, the server 120 determines whether the message digest is consistent with the summary to be verified; when the server 120 determines that the message digest is consistent with the summary to be verified, the server 120 determines that the digital signature has passed the verification, and then the server 120 determines that the first payment code update request has passed the signature verification.
[0137] The technical solution of this embodiment is to obtain the digital signature corresponding to the first payment code update request; use the first symmetric key to decrypt the digital signature to obtain the summary to be verified of the first payment code update request; generate the message digest of the first payment code update request according to the preset digest algorithm; when the message digest is consistent with the summary to be verified, it is determined that the digital signature has passed the verification, and then the first payment code update request has passed the signature verification, thereby accurately verifying the validity and authenticity of the first payment code update request, so that the server can safely obtain the payment code update request of the user terminal, thereby improving the security of updating the payment code using symmetric encryption communication.
[0138] In one embodiment, Fig.11As shown, a method for updating a payment code to be updated is provided, comprising the following steps: Step S1110, receiving a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication. Step S1120, obtaining a key validity period corresponding to the first symmetric key. Step S1130, determining whether the first symmetric key is expired according to the key validity period.
[0139] Step S1140: If yes, the first symmetric key is discarded and a symmetric key expiration notification is generated; the symmetric key expiration notification is used to notify the user terminal to discard the first symmetric key and then use an asymmetric encryption method to sign the second payment code update request for the payment code to be updated and send it to the server.
[0140] Step S1150, if not, obtain the digital signature corresponding to the first payment code update request. Step S1151, use the first symmetric key to decrypt the digital signature to obtain the summary to be verified of the first payment code update request. Step S1152, generate a message digest of the first payment code update request according to a preset digest algorithm. Step S1153, when the message digest is consistent with the summary to be verified, generate an updated payment code. Step S1154, use the first symmetric key to encrypt the updated payment code and send it to the user terminal, so that the user terminal can update the payment code to be updated to obtain the updated payment code. It should be noted that the specific limitations of the above steps can be found in the specific limitations of a payment code update method above, which will not be repeated here.
[0141] It should be understood that although Figure 2 , Figure 3 , Figure 5 , Figure 8 , Fig.10 and Fig.11 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , Figure 3 , Figure 5 , Figure 8 , Fig.10 and Fig.11At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0142] like Fig.12 As shown, the present application also provides a schematic diagram of a payment code update application scenario. 130 is a merchant terminal; at the same time, Fig.13 A timing diagram for a payment code update application scenario is also provided; Fig.13 As shown, specifically, the application of the payment code update method in this application scenario is as follows:
[0143] When the user needs to use the payment code to complete a payment transaction with the merchant, the user can start the payment code display page of the user terminal 110; at this time, the user terminal 110 detects that the payment code to be updated needs to be updated, so the user terminal 110 determines the first symmetric key for the payment code to be updated; then, the user terminal 110 sends a first payment code update request signed by the first symmetric key to the server 120; and then obtains the updated QR code and the second symmetric key encrypted by the server 120 using the first symmetric key; then, the user terminal 110 uses the decrypted updated QR code to update the payment code to be updated, obtains the updated payment code, and generates a payment code display page containing the updated payment code; at the same time, the user terminal 110 caches the second symmetric key in a preset cache location for subsequent updates to the updated payment code. In this way, the merchant terminal 130 obtains the information carried by the updated payment code by scanning the updated payment code in the payment code display page of the user terminal 110; then, the merchant terminal 130 sends a deduction request for the user account to the server 120 based on the information carried by the updated payment code to complete the transaction payment with the user.
[0144] In one embodiment, Fig.14 As shown, a payment code updating device is provided, which is applied to Figure 1 The user terminal 110 in the embodiment of the present invention may adopt a software module or a hardware module, or a combination of the two to become a part of the computer device. The device specifically includes: a determination module 1410, a sending module 1420, a receiving module 1430 and an updating module 1440, wherein:
[0145] The determination module 1410 is used to determine, for the payment code to be updated, a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0146] A sending module 1420 is used to use the first symmetric key to sign a first payment code update request corresponding to the payment code to be updated and then send the signature to the server;
[0147] The receiving module 1430 is used to receive the updated payment code encrypted by the first symmetric key and sent by the server after the server verifies the signature of the first payment code update request;
[0148] The updating module 1440 is used to update the payment code to be updated by using the updated payment code to obtain an updated payment code.
[0149] The above-mentioned payment code updating device determines the first symmetric key corresponding to the payment code to be updated; wherein the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated, and the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; by using the first symmetric key, the first payment code update request corresponding to the payment code to be updated is signed and sent to the server, so as to request the server to issue the updated payment code encrypted by the first symmetric key, and then used to update the payment code to be updated, and obtain the updated payment code. In this way, by using symmetric encryption to transmit the initial symmetric key corresponding to the initial payment code for subsequent symmetric encryption transmission of the payment code to be updated, the security of the initial symmetric key transmission can be guaranteed, and there is no need to use complex asymmetric keys to encrypt and transmit the updated QR code, so as to achieve the goal of ensuring the security of the payment code transmission while avoiding the problem of low transmission efficiency caused by the need for the device to undergo complex calculations and verifications when the payment code is updated by asymmetric encryption communication in the traditional technology, thereby improving the update effect of the payment code.
[0150] In one embodiment, after the server verifies the signature of the first payment code update request, the payment code update device further includes:
[0151] A symmetric key receiving module, used for receiving a second symmetric key encrypted by using the first symmetric key after the server verifies the signature of the first payment code update request;
[0152] A cache module is used to cache the second symmetric key to a corresponding target cache location; the second symmetric key is used to update the updated payment code.
[0153] In one embodiment, the sending module 1420 is specifically used to use the first symmetric key to generate a digital signature of the first payment code update request; send the first payment code update request and the digital signature to the server, so that the server uses the first symmetric key and the digital signature to verify the first payment code update request.
[0154] In one embodiment, the sending module 1420 is specifically used to generate a message digest of the first payment code update request according to a preset digest algorithm; use the first symmetric key to encrypt the message digest to obtain a digital signature of the first payment code update request.
[0155] In one embodiment, the payment code updating device also includes: an instruction receiving module, which is used to send a payment code acquisition request to the server when receiving a user's payment code acquisition instruction; the payment code acquisition request carries the user's payment password; an initial key encryption and decryption module, which is used to receive the initial payment code and initial symmetric key encrypted by asymmetric encryption sent by the server after the server verifies the payment password, and decrypt the encrypted initial payment code and initial symmetric key by asymmetric decryption to obtain the initial payment code and the initial symmetric key.
[0156] In one embodiment, the payment code update device also includes: an asymmetric request module, which is used to sign the second payment code update request for the payment code to be updated by asymmetric encryption and send it to the server when it is determined that the first symmetric key is expired; an updated payment code encryption and decryption module, which is used to receive the updated payment code and the second symmetric key encrypted by asymmetric encryption sent by the server after the server verifies the signature of the second payment code update request, and decrypt the encrypted updated payment code and the second symmetric key by asymmetric decryption to obtain the updated payment code and the second symmetric key.
[0157] In one of the embodiments, before the step of signing the second payment code update request for the payment code to be updated by asymmetric encryption and then sending it to the server when the first symmetric key is determined to be expired, the payment code update device also includes: an update request sending module, used to use the first symmetric key to sign the first payment code update request corresponding to the payment code to be updated and then send it to the server; a notification receiving module, used to determine that the first symmetric key is expired when receiving the symmetric key expiration notification sent by the server; the symmetric key expiration notification is a notification generated by the server when the first symmetric key is determined to be expired after receiving the first payment code update request.
[0158] In another embodiment, Fig.15 As shown, a payment code updating device is provided, which is applied to Figure 1 The server 120 in the embodiment of the present invention may adopt a software module or a hardware module, or a combination of the two to become a part of the computer device. The device specifically includes: a receiving module 1510, a generating module 1520 and a sending module 1530, wherein:
[0159] The receiving module 1510 is configured to receive a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication;
[0160] A generating module 1520, configured to generate an updated payment code after the signature verification of the first payment code update request is passed;
[0161] The sending module 1530 is used to use the first symmetric key to encrypt the updated payment code and then send it to the user terminal, so that the user terminal can update the payment code to be updated to obtain an updated payment code.
[0162] The above-mentioned payment code updating device determines the first symmetric key corresponding to the payment code to be updated; wherein the first symmetric key is obtained from the server when the user terminal updates the previous payment code to be updated, and the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; by using the first symmetric key, the first payment code update request corresponding to the payment code to be updated is signed and sent to the server, so as to request the server to issue the updated payment code encrypted by the first symmetric key, and then used to update the payment code to be updated, and obtain the updated payment code. In this way, by using symmetric encryption to transmit the initial symmetric key corresponding to the initial payment code for subsequent symmetric encryption transmission of the payment code to be updated, the security of the initial symmetric key transmission can be guaranteed, and there is no need to use complex asymmetric keys to encrypt and transmit the updated QR code, so as to achieve the goal of ensuring the security of the payment code transmission while avoiding the problem of low transmission efficiency caused by the need for the device to undergo complex calculations and verifications when the payment code is updated by asymmetric encryption communication in the traditional technology, thereby improving the update effect of the payment code.
[0163] In one of the embodiments, the payment code updating device also includes: a validity period acquisition module, used to obtain the key validity period corresponding to the first symmetric key; a notification sending module, used to discard the first symmetric key and generate a symmetric key expiration notification if the first symmetric key is determined to be expired according to the key validity period; the symmetric key expiration notification is used to notify the user terminal to discard the first symmetric key and then use an asymmetric encryption method to sign the second payment code update request for the payment code to be updated and send it to the server.
[0164] In one of the embodiments, the payment code update device also includes: a signature module, used to obtain the digital signature corresponding to the first payment code update request; a signature verification module, used to use the first symmetric key to perform signature verification on the digital signature; and a determination module, used to determine that the first payment code update request has passed the signature verification when the digital signature passes the verification.
[0165] In one of the embodiments, the signature verification module is specifically used to use the first symmetric key to decrypt the digital signature to obtain the summary to be verified of the first payment code update request; generate a message digest of the first payment code update request according to a preset digest algorithm; when the message digest is consistent with the summary to be verified, it is determined that the digital signature has passed the verification.
[0166] For the specific definition of a payment code updating device, please refer to the definition of a payment code updating method above, which will not be repeated here. Each module in the above-mentioned payment code updating device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0167] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.16 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store symmetric key data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a payment code update method is implemented.
[0168] In another embodiment, a computer device is provided. The computer device may be a user terminal, and its internal structure diagram may be as follows: Fig.17 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a payment code update method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0169] Those skilled in the art will understand that Fig.17The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0170] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0171] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0172] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0173] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0174] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A payment code updating method, characterized in that: Applied to a user terminal, the method comprises: For the payment code to be updated, determining a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; Using the first symmetric key, signing a first payment code update request corresponding to the payment code to be updated and sending the signature to the server; Receiving an updated payment code encrypted with the first symmetric key and sent by the server after the server verifies the first payment code update request; The payment code to be updated is updated using the updated payment code to obtain an updated payment code.
2. The method according to claim 1, characterized in that When the server passes the signature verification on the first payment code update request, the method further includes: Receiving a second symmetric key encrypted with the first symmetric key after the server verifies the first payment code update request; The second symmetric key is cached to a corresponding target cache location; the second symmetric key is used to update the updated payment code.
3. The method according to claim 1, characterized in that Also includes: When receiving a payment code acquisition instruction from the user, sending a payment code acquisition request to the server; The payment code acquisition request carries the user's payment password; After the server verifies the payment password, it receives the initial payment code and initial symmetric key encrypted by asymmetric encryption and sent by the server, and decrypts the encrypted initial payment code and initial symmetric key by asymmetric decryption to obtain the initial payment code and the initial symmetric key.
4. The method according to claim 1, characterized in that: Also includes: When the first symmetric key expires, the second payment code update request for the payment code to be updated is signed by an asymmetric encryption method and then sent to the server: After the server verifies the signature of the second payment code update request, it receives the updated payment code and the second symmetric key encrypted by asymmetric encryption sent by the server, and decrypts the encrypted updated payment code and the second symmetric key by asymmetric decryption to obtain the updated payment code and the second symmetric key.
5. The method according to claim 4, characterized in that Before the step of signing the second payment code update request for the payment code to be updated in an asymmetric encryption manner and then sending the signature to the server when the first symmetric key expires, the method further includes: Using the first symmetric key, signing a first payment code update request corresponding to the payment code to be updated and sending the signature to the server; When the symmetric key expiration notification sent by the server is received, the first symmetric key is determined to be expired; the symmetric key expiration notification is a notification generated by the server when the server determines that the first symmetric key is expired after receiving the first payment code update request.
6. A payment code updating method, characterized in that: Applied to a server, the method comprises: receiving a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; When the first payment code update request is verified and passed, an updated payment code is generated; The updated payment code is encrypted using the first symmetric key and then sent to the user terminal, so that the user terminal updates the payment code to be updated to obtain an updated payment code.
7. The method according to claim 6, characterized in that Also includes: Obtaining a key validity period corresponding to the first symmetric key; If the first symmetric key is determined to be expired according to the key validity period, the first symmetric key is discarded and a symmetric key expiration notification is generated; The symmetric key expiration notification is used to notify the user terminal to abandon the first symmetric key and then use an asymmetric encryption method to sign the second payment code update request for the payment code to be updated and then send it to the server.
8. A payment code updating device, characterized in that: Applied to a user terminal, the device comprises: a determination module, configured to determine, for a payment code to be updated, a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; a sending module, configured to use the first symmetric key to sign a first payment code update request corresponding to the payment code to be updated and then send the signature to the server; A receiving module, configured to receive an updated payment code encrypted with the first symmetric key and sent by the server after the server verifies the first payment code update request; The updating module is used to update the payment code to be updated by using the updated payment code to obtain an updated payment code.
9. A payment code updating device, characterized in that: Applied to a server, the device comprises: a receiving module, configured to receive a first payment code update request sent by a user terminal for a payment code to be updated; the first payment code update request is a request signed by the user terminal using a first symmetric key corresponding to the payment code to be updated; the first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated; the initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication; A generating module, configured to generate an updated payment code after the signature verification of the first payment code update request is passed; The sending module is used to use the first symmetric key to encrypt the updated payment code and then send it to the user terminal, so that the user terminal can update the payment code to be updated to obtain an updated payment code.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the processor implements the steps of the method according to any one of claims 1 to 5, or implements the steps of the method according to any one of claims 6 to 7.
11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 5, or implements the steps of the method according to any one of claims 6 to 7.
Citation Information
Patent Citations
Method and system for transmitting data between terminal and server and sign-in and payment method
CN101964793A
Information sending method, information receiving method, information sending device, information receiving device and system
CN107070909A