[go: up one dir, main page]

CN113496404B - Payment code updating method, device, computer equipment and storage medium - Google Patents

Payment code updating method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN113496404B
CN113496404B CN202010268244.3A CN202010268244A CN113496404B CN 113496404 B CN113496404 B CN 113496404B CN 202010268244 A CN202010268244 A CN 202010268244A CN 113496404 B CN113496404 B CN 113496404B
Authority
CN
China
Prior art keywords
payment code
symmetric key
updated
server
user terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010268244.3A
Other languages
Chinese (zh)
Other versions
CN113496404A (en
Inventor
黄中辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010268244.3A priority Critical patent/CN113496404B/en
Publication of CN113496404A publication Critical patent/CN113496404A/en
Application granted granted Critical
Publication of CN113496404B publication Critical patent/CN113496404B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/32Payment architectures, schemes or protocols characterised by the use of specific devices or networks using wireless devices
    • G06Q20/327Short range or proximity payments by means of M-devices
    • G06Q20/3276Short range or proximity payments by means of M-devices using a pictured code, e.g. barcode or QR-code, being read by the M-device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3823Payment protocols; Details thereof insuring higher security of transaction combining multiple encryption tools for a transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The application relates to a payment code updating method, a payment code updating device, computer equipment and a storage medium. The method comprises the steps of determining a first symmetric key corresponding to a payment code to be updated according to the payment code to be updated, obtaining the first symmetric key from a server when the user terminal updates the last payment code to be updated, obtaining the initial symmetric key corresponding to the initial payment code of the user terminal from the server through asymmetric encryption communication, signing a first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key, sending the first payment code update request to the server, receiving an update payment code encrypted by adopting the first symmetric key and sent by the server after the first payment code update request is checked and signed, and updating the payment code to be updated by adopting the update payment code to obtain the updated payment code. By adopting the method, the updating effect of the payment code can be improved.

Description

Payment code updating method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of mobile payment technologies, and in particular, to a method, an apparatus, a computer device, and a storage medium for updating a payment code.
Background
The mobile payment means that the mobile client uses electronic products such as mobile phones to carry out electronic money payment, and the mobile payment effectively combines the Internet, terminal equipment and financial institutions, so that a novel payment system is formed. The mobile payment creates a new payment mode, so that the electronic money starts to be popularized.
Two-dimensional code payment is an online mobile payment mode which is popular at present, people can realize password-free payment only by displaying two-dimensional codes of the people for a merchant terminal to scan, and great convenience is brought to the payment process of the people.
In order to prevent the two-dimension code of a user from being stolen so as to ensure the safety of the two-dimension code payment process, the traditional technology adopts asymmetric encryption to encrypt and decrypt the two-dimension code so as to ensure that the two-dimension code cannot be leaked due to the fact that a third party grabs data in the transmission process. However, the encryption and decryption process of the two-dimensional code by using asymmetric encryption and decryption often needs to undergo complex operation and verification, which ensures the security of the two-dimensional code and other payment codes in the updating process, but often needs to consume longer time and calculation power, which also causes the problem of poor payment code updating effect in the prior art.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a payment code updating method, apparatus, computer device, and storage medium capable of improving the effect of payment code updating.
A payment code updating method applied to a user terminal, the method comprising:
Determining a first symmetric key corresponding to a payment code to be updated aiming at the payment code to be updated, wherein the first symmetric key is obtained from a server when the user terminal updates the last payment code to be updated;
Signing a first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key, and then sending the first payment code update request to the server;
Receiving an updated payment code encrypted by the first symmetric key, which is sent by the server after the first payment code update request passes the verification;
and updating the payment code to be updated by adopting the updated payment code to obtain an updated payment code.
A payment code updating method applied to a server, the method comprising:
The method comprises the steps of receiving a first payment code updating request sent by a user terminal aiming at a payment code to be updated, wherein the first payment code updating request is a request after the user terminal signs a first symmetric key corresponding to the payment code to be updated, the first symmetric key is acquired from a server when the user terminal updates the last payment code to be updated, and the initial symmetric key corresponding to an initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal;
Generating an updated payment code after the first payment code updating request passes the verification;
And encrypting the updated payment code by adopting the first symmetric key and then sending the encrypted payment code to the user terminal so that the user terminal can update the payment code to be updated to obtain the updated payment code.
A payment code updating apparatus applied to a user terminal, the apparatus comprising:
The system comprises a determining module, a determining module and a processing module, wherein the determining module is used for determining a first symmetric key corresponding to a payment code to be updated aiming at the payment code to be updated, wherein the first symmetric key is acquired from a server when the user terminal updates the last payment code to be updated;
The sending module is used for signing a first payment code updating request corresponding to the payment code to be updated by adopting the first symmetric key and then sending the first payment code updating request to the server;
The receiving module is used for receiving an updated payment code encrypted by the first symmetric key, which is sent by the server after the first payment code update request passes the verification;
And the updating module is used for updating the payment code to be updated by adopting the updated payment code to obtain an updated payment code.
A payment code updating device for use with a server, the device comprising:
The system comprises a receiving module, a receiving module and a server, wherein the receiving module is used for receiving a first payment code updating request sent by a user terminal aiming at a payment code to be updated, the first payment code updating request is a request after the user terminal signs by adopting a first symmetric key corresponding to the payment code to be updated, the first symmetric key is acquired from the server when the user terminal updates the last payment code to be updated, and the initial symmetric key corresponding to the initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal;
The generation module is used for generating an updated payment code after the first payment code update request passes the verification;
And the sending module is used for encrypting the updated payment code by adopting the first symmetric key and sending the encrypted payment code to the user terminal so that the user terminal can update the payment code to be updated to obtain the updated payment code.
A computer device for use in a user terminal, comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
Determining a first symmetric key corresponding to a payment code to be updated aiming at the payment code to be updated, wherein the first symmetric key is obtained from a server when the user terminal updates the last payment code to be updated;
Signing a first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key, and then sending the first payment code update request to the server;
Receiving an updated payment code encrypted by the first symmetric key, which is sent by the server after the first payment code update request passes the verification;
and updating the payment code to be updated by adopting the updated payment code to obtain an updated payment code.
A computer device for application to a server, comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
The method comprises the steps of receiving a first payment code updating request sent by a user terminal aiming at a payment code to be updated, wherein the first payment code updating request is a request after the user terminal signs a first symmetric key corresponding to the payment code to be updated, the first symmetric key is acquired from a server when the user terminal updates the last payment code to be updated, and the initial symmetric key corresponding to an initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal;
Generating an updated payment code after the first payment code updating request passes the verification;
And encrypting the updated payment code by adopting the first symmetric key and then sending the encrypted payment code to the user terminal so that the user terminal can update the payment code to be updated to obtain the updated payment code.
A computer readable storage medium for application to a user terminal, having stored thereon a computer program which when executed by a processor performs the steps of:
Determining a first symmetric key corresponding to a payment code to be updated aiming at the payment code to be updated, wherein the first symmetric key is obtained from a server when the user terminal updates the last payment code to be updated;
Signing a first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key, and then sending the first payment code update request to the server;
Receiving an updated payment code encrypted by the first symmetric key, which is sent by the server after the first payment code update request passes the verification;
and updating the payment code to be updated by adopting the updated payment code to obtain an updated payment code.
A computer readable storage medium, for application to a server, having stored thereon a computer program which when executed by a processor performs the steps of:
The method comprises the steps of receiving a first payment code updating request sent by a user terminal aiming at a payment code to be updated, wherein the first payment code updating request is a request after the user terminal signs a first symmetric key corresponding to the payment code to be updated, the first symmetric key is acquired from a server when the user terminal updates the last payment code to be updated, and the initial symmetric key corresponding to an initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal;
Generating an updated payment code after the first payment code updating request passes the verification;
And encrypting the updated payment code by adopting the first symmetric key and then sending the encrypted payment code to the user terminal so that the user terminal can update the payment code to be updated to obtain the updated payment code.
The payment code updating method, the device, the computer equipment and the storage medium are characterized by determining a first symmetric key corresponding to the payment code to be updated, wherein the first symmetric key is obtained from a server when a 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 through asymmetric encryption communication, the first symmetric key is adopted to sign a first payment code updating request corresponding to the payment code to be updated, and then the first symmetric key is sent to the server to request the server to send the updating payment code encrypted by the first symmetric key, and the updating payment code is further used for updating the payment code to be updated, so that the updated payment code is obtained. Therefore, by adopting the symmetric encryption mode to transmit the initial symmetric key corresponding to the initial payment code and used for carrying out symmetric encryption transmission on the payment code to be updated subsequently, the security of the transmission of the initial symmetric key can be ensured, the encryption transmission of the updated two-dimensional code by using a complex asymmetric key is not needed, the problem that the transmission efficiency is low because the equipment needs to undergo complex operation and verification when the payment code is updated by adopting asymmetric encryption communication in the prior art is avoided while the transmission security of the payment code is ensured, and the updating effect of the payment code is improved.
Drawings
FIG. 1 is a diagram of an application environment for a payment code update method in one embodiment;
FIG. 2 is a flow chart of a payment code update method according to an embodiment;
FIG. 3 is a flow chart illustrating another method of updating a payment code according to one embodiment;
FIG. 4 is a timing diagram of a method for updating a payment code according to one embodiment;
FIG. 5 is a flow chart of an initial payment code acquisition method according to one embodiment;
FIG. 6 is a schematic diagram of an interactive interface for an initial payment code acquisition process in one embodiment;
FIG. 7 is a timing diagram of an initial payment code acquisition process in one embodiment;
FIG. 8 is a flowchart of a payment code update method according to another embodiment;
FIG. 9 is a timing diagram of another method for updating a payment code in one embodiment;
FIG. 10 is a flowchart of another method for updating a payment code according to another embodiment;
FIG. 11 is a flowchart of a method for updating a payment code according to one embodiment;
FIG. 12 is a diagram of a payment code update application scenario, according to one embodiment;
FIG. 13 is a timing diagram of a payment code update application scenario, according to one embodiment;
FIG. 14 is a block diagram of a payment code update device in one embodiment;
FIG. 15 is a block diagram showing a payment code update apparatus according to another embodiment;
FIG. 16 is an internal block diagram of a computer device in one embodiment;
fig. 17 is an internal structural diagram of a computer device in another embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The payment code updating method provided by the application can be applied to an application environment shown in figure 1. Wherein the user terminal 110 communicates with the server 120 through a network. The user terminal 110 determines a first symmetric key corresponding to the payment code to be updated according to the payment code to be updated, the first symmetric key is obtained from the server 120 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 120 through asymmetric encryption communication by the user terminal, the user terminal 110 signs a first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key and then sends the first payment code update request to the server 120, the user terminal 110 receives an update payment code encrypted by adopting the first symmetric key and sent by the server 120 after the first payment code update request passes, and finally the user terminal 110 updates the payment code to be updated by adopting the update payment code to obtain an updated payment code. In practical applications, the user terminal 110 may be, but not limited to, various personal computers, notebook computers, smartphones, tablet computers and portable wearable devices, and the server 104 may be implemented by a stand-alone server or a server cluster composed of a plurality of servers.
In one embodiment, as shown in fig. 2, a payment code updating method is provided, which is illustrated by taking the application of the method to the user terminal 110 in fig. 1 as an example, and includes the following steps:
step S210, a first symmetric key corresponding to the payment code to be updated is determined according to the payment code to be updated, wherein the first symmetric key is obtained from a server when the user terminal updates the last 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 through asymmetric encryption communication.
The payment code may be a graphic code for a user to perform a payment operation. In practical application, the payment code may be a two-dimensional code, a one-dimensional code, or other graphic code.
The payment code to be updated may refer to a payment code that needs to be updated. In the practical application, the method has the advantages that,
The first symmetric key is obtained from the server when the user terminal updates the last payment code to be updated. In practical application, 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 may also receive the first symmetric key sent by the server and used for updating the updated payment code subsequently.
The initial payment code may be a payment code acquired by the user terminal from the server for the first time.
The initial symmetric key corresponding to the initial payment code of the user terminal is obtained from the server through asymmetric encryption communication by the user terminal.
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 a first symmetric key corresponding to the payment code to be updated for the payment code to be updated.
In practical application, the user terminal may determine the first symmetric key corresponding to the payment code to be updated to update the payment code to be updated when detecting that the payment code to be updated meets a preset updating condition.
The updating condition can be that a payment code display operation of a user is received, a payment code display page is displayed on a front end interface of the user terminal, for example, the user opens the payment code interface of the user terminal, a new payment code can be pulled out for display at regular time after the payment code display page is displayed on the front end interface of the user terminal, wherein the validity period of the payment code is 1 minute, and the updating condition that the front end interface of the user terminal jumps back to display the payment code display page from a display payment success page after the user finishes paying by using the payment code.
Step S220, the first symmetric key is adopted, and the first payment code updating request corresponding to the payment code to be updated is signed and then sent to the server.
Wherein the payment code update request may refer to a request for triggering the server to issue an update of the payment code.
In a specific implementation, after determining the first symmetric key corresponding to the payment code to be updated, the user terminal 110 signs the first payment code update request corresponding to the payment code to be updated by using the first symmetric key, and sends the signed first payment code update request to the server 120.
Step S230, the receiving server sends the updated payment code encrypted by the first symmetric key after the first payment code update request passes the verification.
The update payment code may refer to a payment code for updating the two-dimensional code to be updated.
In a specific implementation, when the server 120 receives a first payment code update request signed by the user terminal 110 by using a first symmetric key, the server 120 performs signature verification on the first payment code update request by using the first symmetric key, and when the server 120 performs signature verification on the first payment code update request, the server 120 generates an update payment code, encrypts the update payment code by using the first symmetric key according to a preset symmetric encryption algorithm, and sends the encrypted update payment code to the user terminal 110, so that the user terminal 110 receives the update payment code encrypted by using the first symmetric key sent by the server 120.
In practice, the server 120 may encrypt the updated payment code with the first symmetric key using aes_cbc algorithm (AES (Advanced Encryption Standard, advanced encryption standard) algorithm in CBC (Cipher Block Chaining, ciphertext block chaining) mode).
Step S240, the updated payment code is adopted to update the payment code to be updated, and the updated payment code is obtained.
In a specific implementation, after receiving an updated payment code encrypted by the server 120 using the first symmetric key, the user terminal 110 decrypts the encrypted updated payment code by using the first symmetric key according to a preset symmetric decryption algorithm to obtain the updated payment code, and then, the user terminal 110 updates the payment code to be updated by using the updated payment code to obtain the updated payment code.
Finally, the user terminal 110 displays the updated payment code, and is further used for the merchant terminal to scan for transaction payment, and after the merchant terminal scans the updated payment code, the merchant terminal sends a deduction request to the server 120 according to the information carried by the updated payment code, so as to complete the transaction payment.
The payment code updating method comprises the steps of determining a first symmetric key corresponding to a payment code to be updated, wherein the first symmetric key is obtained from a server when a user terminal updates the last 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 through asymmetric encryption communication by the user terminal, signing a first payment code updating request corresponding to the payment code to be updated by adopting the first symmetric key, and then sending the first payment code updating request to the server to request the server to send the updated payment code encrypted by adopting the first symmetric key, and then the updated payment code is obtained. Therefore, by adopting the symmetric encryption mode to transmit the initial symmetric key corresponding to the initial payment code and used for carrying out symmetric encryption transmission on the payment code to be updated subsequently, the security of the transmission of the initial symmetric key can be ensured, the encryption transmission of the updated two-dimensional code is not needed to be carried out by depending on a complex asymmetric key, the problem that the transmission efficiency is low because the equipment needs to undergo complex operation and verification when the payment code is updated by adopting asymmetric encryption communication in the prior art is avoided while the transmission security of the payment code is ensured, and the updating effect of the payment code is improved.
In one embodiment, after the server performs signature verification on the first payment code update request, the method further includes receiving a second symmetric key encrypted by the first symmetric key after the server performs signature verification on the first payment code update request, caching the second symmetric key to a corresponding target cache location, and updating the updated payment code by the second symmetric key.
The target cache location may refer to a target location in the user terminal cache for storing the second symmetric key.
In a specific implementation, after the server 120 performs signature verification on the first payment code update request, the server 120 may generate a second symmetric key while generating an update two-dimensional code, specifically, the server 120 may generate a random number with a preset length and use the random number as the second symmetric key, and then the server 120 encrypts the second symmetric key with 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 sent by the server 120 and encrypted with the first symmetric key.
After the user terminal 110 receives the second symmetric key encrypted by the first symmetric key sent by the server 120, the user terminal 110 adopts a preset symmetric decryption algorithm to decrypt the encrypted second symmetric key by using the first symmetric key, so as to obtain a second symmetric key randomly generated by the server 120. Finally, the user terminal 110 may use the second symmetric key to perform the next update on the updated payment code.
In addition, when the user terminal 110 successfully receives the second symmetric key transmitted by the server 120, the user terminal 110 discards the first symmetric key.
It should be noted that, the process of updating the updated payment code by using the second symmetric key is consistent with the principle of the process of updating the updated payment code by using the first symmetric key, which is not described herein.
According to the technical scheme, after the server passes the signature verification of the first payment code updating request, the second symmetric key which is encrypted by the first symmetric key and is used for caching the second symmetric key to the corresponding target caching position is received by the receiving server after the signature verification of the first payment code updating request is passed, and further the method is used for subsequently updating the updated payment code by adopting the symmetric encryption communication mode, so that the next updating of the updated payment code by the asymmetric encryption communication mode is avoided, the operation amount of equipment is reduced, the data transmission efficiency when the updated payment code is updated next time is improved, and the updating effect of the payment code is further improved.
In one embodiment, the method for signing the first payment code update request corresponding to the payment code to be updated by using the first symmetric key comprises the steps of generating a digital signature of the first payment code update request by using the first symmetric key, and 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 by using the first symmetric key and the digital signature.
In a specific implementation, in a process that the user terminal 110 signs a first payment code update request corresponding to a payment code to be updated by using a first symmetric key and then sends the first payment code update request to the server 120, the method specifically includes that the user terminal 110 generates a digital signature of the first payment code update request by using the first symmetric key, and when the user terminal 110 generates the digital signature of 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.
Specifically, the user terminal 110 may combine the first payment code update request and the digital signature to obtain a first payment code update signature request, and then the user terminal 110 sends the first payment code update signature request to the server 120 for the server 120 to receive. 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 implementing verification of the first payment code update request.
According to the technical scheme, the first symmetric key is adopted to generate the digital signature of the first payment code update request, and the first payment code update request and the digital signature are sent to the server, so that the server can verify the first payment code update request by adopting the first symmetric key and the digital signature, the server can safely acquire the payment code update request of the user terminal, and safety when the payment code is updated by adopting a symmetric encryption communication mode is improved.
In one embodiment, the method for generating the digital signature of the first payment code update request by using the first symmetric key comprises the steps of generating a message digest of the first payment code update request according to a preset digest algorithm, and encrypting the message digest by using the first symmetric key to obtain the digital signature of the first payment code update request.
In practical applications, the preset digest algorithm may be a message digest algorithm such as MD5, SHA1, SHA512, etc.
In a specific implementation, in a process that the user terminal 110 uses the first symmetric key to generate a 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 by using the first symmetric key according to a preset symmetric encryption algorithm, so as to obtain the digital signature of the first payment code update request. Thus, when the server 120 receives the signed first payment code update request, the server 120 signs the first payment code update request with the first symmetric key.
In the technical scheme of the embodiment, in the process of generating the digital signature of the first payment code update request by adopting the first symmetric key, the message digest of the first payment code update request is generated by adopting a preset digest algorithm, and the message digest is encrypted by adopting the first symmetric key to obtain the digital signature of the first payment code update request, so that the server can accurately check the validity and the authenticity of the first payment code update request, the server can safely acquire the payment code update request of the user terminal, and the security of updating the payment code by adopting a symmetric encryption communication mode is improved.
In one embodiment, as shown in fig. 3, another payment code updating method is provided, which includes the steps of determining a first symmetric key corresponding to a payment code to be updated according to the payment code to be updated, where the first symmetric key is obtained from a server when the user terminal updates a last payment code to be updated, and the initial symmetric key corresponding to an initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication. Step 320, 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. And step S330, encrypting the message digest by adopting the first symmetric key to obtain the 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 an updated payment code encrypted by the first symmetric key and a second symmetric key encrypted by the first symmetric key, which are sent by the server after the first payment code update request passes the verification. And step S360, updating the payment code to be updated by adopting the updated payment code to obtain an updated payment code. And step S370, caching the second symmetric key to a corresponding target caching position, wherein the second symmetric key is used for updating the updated payment code. It should be noted that, the specific limitation of the above steps may be referred to the specific limitation of a payment code updating method, which is not described herein.
To facilitate understanding by those skilled in the art, fig. 4 provides a timing diagram of a method of updating a payment code. As shown in fig. 4, the user terminal 110 transmits a first payment code update request signed by a first symmetric key to the server, generates an update two-dimensional code and a second symmetric key after the server receives the first payment code update request and verifies the first payment code update request, and then transmits the update two-dimensional code and the second symmetric key encrypted by the first symmetric key. After receiving the updated two-dimensional code and the second symmetric key sent by the server and encrypted by the first symmetric key, the user terminal 110 decrypts the encrypted updated two-dimensional code and the second symmetric key by using the first symmetric key, so as to obtain the decrypted updated two-dimensional code and the decrypted second symmetric key. Finally, the user terminal 110 uses the decrypted updated two-dimensional code to update the payment code to be updated to obtain the updated payment code, and caches the decrypted second symmetric key in a preset cache position for updating the updated payment code subsequently.
In one embodiment, as shown in fig. 5, an initial payment code obtaining method is provided, which is applied to the user terminal 110 in fig. 1 for illustration, and includes the steps of sending a payment code obtaining request to a server when receiving a payment code obtaining instruction of a user, sending the payment code obtaining request to the server, carrying a payment password of the user, receiving an initial payment code and an initial symmetric key sent by the server and encrypted by an asymmetric encryption mode after the payment password is verified by the server, and decrypting the encrypted initial payment code and initial symmetric key by an asymmetric decryption mode to obtain an initial payment code and an initial symmetric key, wherein the step S520 is described by taking the application of the method to the user terminal 110 in fig. 1 as an example.
The payment code acquisition instruction may be an instruction for the user to acquire the initial payment code input.
In a specific implementation, when a user needs to display a payment code through the user terminal 110 for the first time to conduct payment transaction, the user can touch a payment code display entry in a user graphical interface of the user terminal 110 and input a corresponding payment code to realize input of a payment code acquisition instruction. For ease of understanding by those skilled in the art, FIG. 6 is an exemplary illustration of an interactive interface for an initial payment code acquisition process.
Then, when the user terminal 110 detects that the payment code acquisition instruction of the user is received, the user terminal 110 responds to the payment code acquisition instruction and sends a payment code acquisition request carrying the payment code of the user to the server 120 for the server 120 to receive.
When the server 120 receives the payment code acquisition request sent by the user terminal 110, the server 120 checks the payment code in the payment code acquisition request, and after the payment code passes the check, the server 120 generates an initial payment code and randomly generates an initial symmetric key corresponding to the initial payment code.
Then, the server 120 encrypts the initial payment code and the initial symmetric key by using an asymmetric encryption method to obtain the encrypted initial payment code and the encrypted initial symmetric key. Finally, the server 120 transmits the encrypted initial payment code and initial symmetric key 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 decrypts the encrypted initial payment code and the initial symmetric key by adopting an asymmetric decryption mode to obtain the initial payment code and the initial symmetric key.
Specifically, when the user terminal 110 detects a payment code acquisition instruction input by a user, that is, the user inputs a payment code, the user terminal 110 generates a public-private key pair, where the public-private key pair includes a private key of the user terminal 110 and a public key of the user terminal 110, and then the user terminal 110 requests the server 120 to upload a public key certificate of the user terminal 110 to the server 120, so that the server 120 acquires the public key of the user terminal 110. Meanwhile, the private key certificate is stored in a local secure storage area of the user terminal 110 to realize secure storage of the private key of the user terminal 110.
When the server 120 encrypts the initial payment code and the initial symmetric key in an asymmetric encryption manner to obtain the encrypted initial payment code and the encrypted initial symmetric key, the server 120 may encrypt the initial payment code and the initial symmetric key generated by the server 120 according to a preset encryption algorithm by using the public key of the user terminal 110, so as to obtain the encrypted initial payment code and the encrypted initial symmetric key, and send the encrypted initial payment code and the encrypted initial symmetric key 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 encrypt the encrypted initial payment code and the initial symmetric key using the private key of the user terminal 110, thereby obtaining the initial payment code and the initial symmetric key.
According to the technical scheme, when a payment code acquisition instruction of a user is received, a payment code acquisition request carrying a payment code of the user is sent to a server, after the payment code is verified by the server, an initial payment code and an initial symmetric key which are sent by the server and encrypted in an asymmetric encryption mode are received, and the encrypted initial payment code and the encrypted initial symmetric key are decrypted in an asymmetric decryption mode to obtain the initial payment code and the initial symmetric key, so that encryption transmission of the initial payment code and the initial symmetric key is carried out in an asymmetric encryption communication mode, the safety of the initial payment code and the initial symmetric key is guaranteed, and meanwhile, the safety of a user terminal when the initial payment code is updated by the initial symmetric key is improved.
To facilitate understanding by those skilled in the art, FIG. 7 provides a timing diagram of an initial payment code acquisition process. As shown in fig. 7, when the user terminal 110 detects that the payment code acquisition instruction of the user is received, the user terminal 110 uploads the public key certificate of the user terminal 110 and the payment code of the user to the server 120 for the server 120 to receive in response to the payment code acquisition instruction. Then, the server 120 checks the payment password, and generates an initial payment code and randomly generates an initial symmetric key corresponding to the initial payment code after the payment password passes the check. Finally, the server 120 may encrypt the initial payment code and the initial symmetric key generated by the server 120 according to a preset encryption algorithm by using the public key of the user terminal 110, so as to obtain the encrypted initial payment code and the encrypted initial symmetric key, and send the encrypted initial payment code and the encrypted initial symmetric key to the user terminal 110. After receiving 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 encrypt the encrypted initial payment code and the initial symmetric key using the private key of the user terminal 110, thereby obtaining the initial payment code and the initial symmetric key.
In one embodiment, the method further comprises the steps of signing a second payment code updating request of the payment code to be updated by adopting an asymmetric encryption mode when the first symmetric key is judged to be out of date, and then sending the second payment code updating request to the server, receiving the encrypted updating payment code and the second symmetric key sent by the server by adopting the asymmetric encryption mode after the second payment code updating request is checked and signed by the server, and decrypting the encrypted updating payment code and the second symmetric key by adopting the asymmetric decryption mode to obtain the updating payment code and the second symmetric key.
The first symmetric key has a corresponding key effective duration. In practical applications, the key validity duration may be 24 hours.
In a specific implementation, the ue 110 further needs to determine whether the first symmetric key is expired, and when the first symmetric key determines that the first symmetric key is expired, the ue 110 does not perform the step of signing the first payment code update request corresponding to the payment code to be updated with the first symmetric key and then sending the signed first payment code update request to the server 120. The user terminal 110 signs the second payment code update request of the payment code to be updated by adopting an asymmetric encryption mode and then sends the second payment code update request to the server 120, when the server 120 receives the second payment code update request, the server 120 performs signature verification on the second payment code update request by adopting an asymmetric decryption mode, and after the signature verification passes, sends the updated payment code encrypted by adopting the asymmetric encryption mode and the second symmetric key to the user terminal 110. After receiving 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 adopting an asymmetric decryption manner, so as to obtain the updated payment code and the second symmetric key.
Specifically, the user terminal 110 may sign the second payment code update request of the payment code to be updated by using the private key of the user terminal 110, and send the second payment code update request to the server 120, when the server 120 receives the second payment code update request, the server 120 signs the second payment code update request by using the public key of the user terminal 110, and sends the updated payment code encrypted by using the public key of the user terminal 110 and the second symmetric key to the user terminal 110 after the sign passes. After receiving 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 using the private key of the user terminal 110, so as to obtain the updated payment code and the second symmetric key.
In practical application, the ue 110 determines whether the first symmetric key is expired, and the ue 110 may determine whether the usage time length of the first symmetric key exceeds the corresponding key valid time length, if so, determine that the first symmetric key is expired. Of course, the user terminal 110 may also determine whether the first symmetric key is expired by determining whether the key expiration notification for the first symmetric key issued by the server 120 is received, and when the user terminal 110 receives the key expiration notification for the first symmetric key issued by the server 120, the user terminal 110 may also determine that the first symmetric key is expired.
In the technical scheme of the embodiment, when the user terminal adopts the first symmetric key to update the payment code to be updated in a symmetric encryption communication mode, and when the first symmetric key is judged to be out of date, the second payment code update request of the payment code to be updated is signed in an asymmetric encryption mode and then sent to the server, namely, when the server checks and passes the second payment code update request, the server receives the encrypted update payment code and the second symmetric key in an asymmetric encryption mode, and decrypts the encrypted update payment code and the second symmetric key in an asymmetric decryption mode to obtain the update payment code and the second symmetric key, so that the symmetric key is controlled in a valid period, and the problem that the symmetric key is leaked due to no interaction between the mobile phone and the server in a certain time is solved.
In one embodiment, before the step of signing the second payment code update request of the payment code to be updated by adopting an asymmetric encryption mode and then sending the second payment code update request to the server when the first symmetric key is judged to be out of date, the method further comprises the steps of signing the first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key and then sending the first payment code update request to the server, judging that the first symmetric key is out of date when a symmetric key expiration notice sent by the server is received, wherein the symmetric key expiration notice is a notice generated when the server judges that the first symmetric key is out of date after the first payment code update request is received.
Wherein the symmetric key expiration notification may refer to a notification generated by the server for when the first symmetric key expires.
In a specific implementation, before the step that when the user terminal 110 determines that the first symmetric key expires, the user terminal 110 signs a second payment code update request of a payment code to be updated by adopting an asymmetric encryption mode and sends the second payment code update request to the server 120, the user terminal 110 needs to use a first symmetric key to sign a first payment code update request corresponding to the payment code to be updated and send the first payment code update request to the server 120, when the server 120 receives the first payment code update request signed by the user terminal 110 by using the first symmetric key, the server 120 uses the first symmetric key to perform signature verification on the first payment code update request, meanwhile, the server 120 also needs to determine whether the first symmetric key expires, specifically, the server 120 determines whether the using time length of the first symmetric key exceeds the corresponding key validity time length, if yes, determines that the first symmetric key expires and generates a symmetric key expiration notification and sends the symmetric key expiration notification to the user terminal 110.
After 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 is 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 of the payment code to be updated by adopting an asymmetric encryption mode and sends the second payment code update request to the server 120, so that the update payment code and the second symmetric key generated by the server 120 are acquired by adopting an asymmetric encryption communication mode.
According to the technical scheme, after a first symmetric key is adopted, a first payment code updating request corresponding to a payment code to be updated is signed and sent to a server, when a symmetric key expiration notification sent by the server is received, the first symmetric key is judged to be expired, an updated payment code and a second symmetric key generated by the server are obtained in an asymmetric encryption communication mode, the first symmetric key in a user terminal is actively disabled by the server, and the server can forcedly refresh the symmetric key cached by the user terminal.
In another embodiment, as shown in fig. 8, a payment code updating method is provided, which includes the steps of determining, for a payment code to be updated, a first symmetric key corresponding to the payment code to be updated, where the first symmetric key is obtained from a server when the user terminal updates a last payment code to be updated, and the initial symmetric key corresponding to an initial payment code of the user terminal is obtained from the server by the user terminal through asymmetric encryption communication. Step S820, signature the first payment code update request corresponding to the payment code to be updated by using the first symmetric key, and then sending the signature to the server. And step S830, when a symmetric key expiration notice sent by the server is received, signing a second payment code update request of the payment code to be updated by adopting an asymmetric encryption mode, and then sending the second payment code update request to the server, wherein the symmetric key expiration notice is a notice generated when the server determines that the first symmetric key is expired after receiving the first payment code update request. Step S840, after the server performs signature verification on the second payment code update request, the server receives the encrypted update payment code and the second symmetric key sent by the server and adopting the asymmetric encryption mode. And step S850, decrypting the encrypted updated payment code and the second symmetric key by adopting an asymmetric decryption mode to obtain the updated payment code and the second symmetric key. It should be noted that, the specific limitation of the above steps may be referred to the specific limitation of a payment code updating method, which is not described herein.
Fig. 9 provides a timing diagram of another method of updating a payment code for ease of understanding by those skilled in the art. As shown in fig. 9, the user terminal 110 signs a first payment code update request corresponding to a payment code to be updated by using a first symmetric key, and sends the first payment code update request to the server 120, the server 120 signs the first payment code update request and detects whether the first symmetric key is expired, when the first symmetric key is expired, 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.
The user terminal 110 signs the second payment code update request of the payment code to be updated by using the private key of the user terminal 110, and then sends the second payment code update request to the server 120, when the server 120 receives the second payment code update request, the server 120 performs signature verification on the second payment code update request by using the public key of the user terminal 110, and after the signature verification passes, sends the encrypted update payment code and the second symmetric key to the user terminal 110 by using the public key of the user terminal 110. After receiving 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 using the private key of the user terminal 110, so as 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.
In another embodiment, as shown in fig. 10, another payment code updating method is provided, and the method is applied to the server 120120 in fig. 10 for illustration, and includes the steps of receiving a first payment code updating request sent by a user terminal for a payment code to be updated, where the first payment code updating request is a request signed by the user terminal by using a first symmetric key corresponding to the payment code to be updated, where the first symmetric key is acquired from the server 120 when the user terminal updates the last payment code to be updated, and where an initial symmetric key corresponding to an initial payment code of the user terminal is acquired from the server 120 by asymmetric encryption communication. In step S1020, when the first payment code update request passes the verification, an update payment code is generated. Step S1030, the updated payment code is encrypted by 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 the updated payment code.
It should be noted that, the specific limitation of the above steps may be referred to the specific limitation of a payment code updating method, which is not described herein.
The payment code updating method includes the steps of determining a first symmetric key corresponding to a payment code to be updated, wherein the first symmetric key is obtained from a server when a user terminal updates a last payment code to be updated, the initial symmetric key corresponding to an initial payment code of the user terminal is obtained from the server through asymmetric encryption communication by the user terminal, signing a first payment code updating request corresponding to the payment code to be updated by the aid of the first symmetric key, and then sending the first payment code updating request to the server to request the server to send the updated payment code encrypted by the aid of the first symmetric key, and the updated payment code is obtained. Therefore, by adopting the symmetric encryption mode to transmit the initial symmetric key corresponding to the initial payment code and used for carrying out symmetric encryption transmission on the payment code to be updated subsequently, the security of the transmission of the initial symmetric key can be ensured, the encryption transmission of the updated two-dimensional code by using a complex asymmetric key is not needed, the problem that the transmission efficiency is low because the equipment needs to undergo complex operation and verification when the payment code is updated by adopting asymmetric encryption communication in the prior art is avoided while the transmission security of the payment code is ensured, and the updating effect of the payment code is improved.
In one embodiment, the method further comprises the steps of obtaining a key validity period corresponding to the first symmetric key, discarding the first symmetric key and generating a symmetric key expiration notice if the first symmetric key is determined to be expired according to the key validity period, and signing a second payment code update request for updating the payment code by adopting an asymmetric encryption mode after the symmetric key expiration notice is used for informing a user terminal to discard the first symmetric key, and sending the second payment code update request to a server.
Wherein the symmetric key expiration notification is used to inform the user terminal to discard the first symmetric key.
The symmetric key expiration notification is further used for notifying the user terminal to sign a second payment code update request of the payment code to be updated in an asymmetric encryption mode and then send the second payment code update request to the server so as to acquire the updated payment code and the second symmetric key.
In a specific implementation, after the server 120 receives the first payment code update request signed by the user terminal 110 with the first symmetric key, the server 120 needs to determine whether the first symmetric key is expired, specifically, the server 120 determines whether the first symmetric key is expired by acquiring a key validity period corresponding to the first symmetric key, and determines whether the first symmetric key is expired according to the key validity period. When the server 120 determines that the first symmetric key is expired, the server 120 discards the first symmetric key, and at the same time, the server 120 generates and transmits 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, signs the second payment code update request for updating the payment code by adopting an asymmetric encryption mode, and sends the second payment code update request to the server 120 to acquire the updated payment code and the second symmetric key.
Specifically, after receiving the notification of expiration of the symmetric key for the first symmetric key, the user terminal 110 may sign the second payment code update request for updating the payment code by using the private key of the user terminal 110 and send the second payment code update request to the server 120, when the server 120 receives the second payment code update request, the server 120 performs signature verification on the second payment code update request by using the public key of the user terminal 110, and after the signature verification passes, sends the encrypted updated payment code and the second symmetric key encrypted by using the public key of the user terminal 110 to the user terminal 110. After receiving 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 using the private key of the user terminal 110, so as to obtain the updated payment code and the second symmetric key.
According to the technical scheme of the embodiment, the key validity period corresponding to the first symmetric key is obtained; if the first symmetric key is judged to be out of date according to the key validity period, the first symmetric key is abandoned, and a symmetric key expiration notice is generated, wherein the symmetric key expiration notice is used for informing a user terminal that a second payment code update request for updating the payment code is signed by adopting an asymmetric encryption mode after the first symmetric key is abandoned and then is sent to a server, so that the server can control the validity period of the symmetric key, the symmetric key in the user terminal is actively invalidated, the server can forcedly refresh the symmetric key cached by the user terminal, and the safety degree of the payment code transmission process is improved.
In one embodiment, the method further comprises the steps of obtaining a digital signature corresponding to the first payment code update request, adopting a first symmetric key to conduct signature verification on the digital signature, and judging that the first payment code update request passes verification when the digital signature passes verification.
In a specific implementation, after the server 120 receives a first payment code update request sent by the user terminal 110 for a payment code to be updated, the server 120 performs signature verification on the first payment code update request, which specifically includes that the server 120 can obtain a digital signature corresponding to the first payment code update request, and then, signature verification is performed on the digital signature by adopting a first symmetric key, so as to determine whether the digital signature passes verification.
In one embodiment, the server adopts the first symmetric key to decrypt the digital signature to obtain a to-be-verified digest of the first payment code update request, generates a message digest of the first payment code update request according to a preset digest algorithm, and determines that the digital signature passes verification when the message digest is consistent with the to-be-verified digest.
In a specific implementation, the server 120 decrypts the digital signature by adopting a first symmetric key according to a preset symmetric key decryption algorithm, and uses the obtained encrypted digital signature as a to-be-verified digest of the payment code update request, then the server 120 generates a message digest of the first payment code update request according to a preset digest algorithm, then the server 120 judges whether the message digest is consistent with the to-be-verified digest, and when the server 120 determines that the message digest is consistent with the to-be-verified digest, the server 120 determines that the digital signature passes verification, and then the server 120 determines that the first payment code update request passes the verification.
According to the technical scheme, the digital signature corresponding to the first payment code update request is obtained, the digital signature is decrypted by adopting a first symmetric key to obtain a to-be-verified abstract of the first payment code update request, a message abstract of the first payment code update request is generated according to a preset abstract algorithm, when the message abstract is consistent with the to-be-verified abstract, the digital signature is judged to pass verification, and further the first payment code update request is judged to pass verification, so that the validity and the authenticity of the first payment code update request are accurately verified, the server can safely obtain the payment code update request of the user terminal, and the safety of updating the payment code by adopting a symmetric encryption communication mode is improved.
In one embodiment, as shown in fig. 11, there is provided a method for updating a payment code to be updated, which includes the steps of receiving a first payment code update request sent by a user terminal for the payment code to be updated, where the first payment code update request is a request after the user terminal signs a first symmetric key corresponding to the payment code to be updated, where the first symmetric key is acquired from the server when the user terminal updates a last payment code to be updated, and where an initial symmetric key corresponding to an initial payment code of the user terminal is acquired 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.
Step S1140, if yes, discarding the first symmetric key and generating a symmetric key expiration notice, where the symmetric key expiration notice is used to notify the user terminal that the second payment code update request of the payment code to be updated is signed by adopting an asymmetric encryption mode after discarding the first symmetric key, and then sent to the server.
Step S1150, if not, obtaining a digital signature corresponding to the first payment code update request. And step S1151, decrypting the digital signature by using the first symmetric key to obtain a digest to be verified of the first payment code update request. In step S1152, a message digest of the first payment code update request is generated according to a preset digest algorithm. In step S1153, when the message digest is consistent with the digest to be verified, an updated payment code is generated. Step S1154, encrypting the updated payment code by using the first symmetric key, and sending the encrypted payment code to the user terminal, so that the user terminal updates the payment code to be updated to obtain an updated payment code. It should be noted that, the specific limitation of the above steps may be referred to the specific limitation of a payment code updating method, which is not described herein.
It should be understood that, although the steps in the flowcharts of fig. 2, 3, 5, 8, 10, and 11 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps of fig. 2, 3, 5, 8, 10, and 11 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
As shown in fig. 12, the present application further provides a payment code updating application scenario diagram. Wherein 130 is a merchant terminal, and fig. 13 also provides a timing chart of a payment code update application scenario, and as shown in fig. 13, the application of the payment code update method in the application scenario is as follows:
When the user needs to use the payment code to complete payment transaction with the merchant, the user can start a payment code display page of the user terminal 110, at the moment, the user terminal 110 detects that the payment code to be updated needs to be updated, so that the user terminal 110 determines a 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, further the server 120 acquires the encrypted update two-dimensional code and the second symmetric key by using the first symmetric key, then the user terminal 110 updates the payment code to be updated by using the decrypted update two-dimensional code to obtain the updated payment code, and generates the payment code display page containing the updated payment code, and meanwhile, the user terminal 110 caches the second symmetric key in a preset cache position for updating 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, and then, the merchant terminal 130 sends a deduction request for the user account to the server 120 according to the information carried by the updated payment code, so as to complete the transaction payment with the user.
In one embodiment, as shown in fig. 14, a payment code updating apparatus is provided, applied to the user terminal 110 in fig. 1, where the apparatus may use a software module or a hardware module, or a combination of the two forms a part of a computer device, and the apparatus specifically includes a determining module 1410, a transmitting module 1420, a receiving module 1430, and an updating module 1440, where:
The determining module 1410 is configured to determine, for a payment code to be updated, a first symmetric key corresponding to the payment code to be updated, where the first symmetric key is obtained from a server when the user terminal updates a last payment code to be updated;
a sending module 1420, configured to sign a first payment code update request corresponding to the payment code to be updated by using the first symmetric key, and send the signature to the server;
A receiving module 1430, configured to receive an update payment code encrypted by the first symmetric key, which is sent after the server performs signature verification on the first payment code update request;
The updating module 1440 is configured to update the payment code to be updated by using the updated payment code, so as to obtain an updated payment code.
The payment code updating device determines a first symmetric key corresponding to the payment code to be updated, wherein the first symmetric key is an initial symmetric key which is acquired from a server when a user terminal updates the last payment code to be updated and corresponds to the initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal, and the first symmetric key is adopted to sign a first payment code updating request corresponding to the payment code to be updated and then send the first payment code updating request to the server so as to request the server to send the updated payment code encrypted by the first symmetric key, and the updated payment code is further used for updating the payment code to be updated, so that the updated payment code is obtained. Therefore, by adopting the symmetric encryption mode to transmit the initial symmetric key corresponding to the initial payment code and used for carrying out symmetric encryption transmission on the payment code to be updated subsequently, the security of the transmission of the initial symmetric key can be ensured, the encryption transmission of the updated two-dimensional code by using a complex asymmetric key is not needed, the problem that the transmission efficiency is low because the equipment needs to undergo complex operation and verification when the payment code is updated by adopting asymmetric encryption communication in the prior art is avoided while the transmission security of the payment code is ensured, and the updating effect of the payment code is improved.
In one embodiment, after the server performs signature verification on the first payment code update request, the payment code update device further includes:
The symmetric key receiving module is used for receiving a second symmetric key which is encrypted by adopting the first symmetric key after the server performs signature verification on the first payment code updating request;
And the caching module is used for caching the second symmetric key to a corresponding target caching position, and the second symmetric key is used for updating the updated payment code.
In one embodiment, the sending module 1420 is specifically configured to generate a digital signature of the first payment code update request using the first symmetric key, and send 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.
In one embodiment, the sending module 1420 is specifically configured to generate a message digest of the first payment code update request according to a preset digest algorithm, and encrypt the message digest with the first symmetric key to obtain a digital signature of the first payment code update request.
In one embodiment, the payment code updating device further comprises an instruction receiving module, an initial key encryption and decryption module and an initial symmetric key encryption module, wherein the instruction receiving module is used for sending a payment code acquisition request to the server when receiving a payment code acquisition instruction of a user, the payment code acquisition request carries a payment code of the user, and the initial key encryption and decryption module is used for receiving an initial payment code and an initial symmetric key which are sent by the server and encrypted in an asymmetric encryption mode after the server verifies the payment code, and decrypting the encrypted initial payment code and initial symmetric key in an asymmetric decryption mode to obtain the initial payment code and the initial symmetric key.
In one embodiment, the payment code updating device further comprises an asymmetric request module, which is used for signing the second payment code updating request of the payment code to be updated by adopting an asymmetric encryption mode when the first symmetric key is judged to be out of date, and then sending the second payment code updating request to the server, wherein the update payment code encryption and decryption module is used for receiving the encrypted update payment code and the second symmetric key which are sent by the server by adopting the asymmetric encryption mode after the server performs signature verification on the second payment code updating request, and decrypting the encrypted update payment code and the encrypted second symmetric key by adopting an asymmetric decryption mode, so as to obtain the update payment code and the second symmetric key.
In one embodiment, before the step of signing the second payment code update request of the payment code to be updated by adopting an asymmetric encryption mode and then sending the second payment code update request to the server when the first symmetric key is determined to be expired, the payment code update device further comprises an update request sending module, a notification receiving module and a notification receiving module, wherein the update request sending module is used for signing the first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key and then sending the first payment code update request to the server, the notification receiving module is used for determining that the first symmetric key is expired when a symmetric key expiration notification sent by the server is received, and the symmetric key expiration notification is a notification generated when the server determines that the first symmetric key is expired after receiving the first payment code update request.
In another embodiment, as shown in fig. 15, there is provided a payment code updating apparatus, applied to the server 120 in fig. 1, which may employ a software module or a hardware module, or a combination of both, as a part of a computer device, and the apparatus specifically includes a receiving module 1510, a generating module 1520, and a transmitting module 1530, where:
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, where the first payment code update request is a request after the user terminal signs a first symmetric key corresponding to the payment code to be updated, where the first symmetric key is obtained from the server when the user terminal updates a last payment code to be updated;
a generating module 1520, configured to generate an updated payment code after the first payment code update request passes the verification;
And the sending module 1530 is configured to encrypt the updated payment code with the first symmetric key, and send the encrypted updated payment code to the user terminal, so that the user terminal updates the payment code to be updated to obtain an updated payment code.
The payment code updating device determines a first symmetric key corresponding to the payment code to be updated, wherein the first symmetric key is an initial symmetric key which is acquired from a server when a user terminal updates the last payment code to be updated and corresponds to the initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal, and the first symmetric key is adopted to sign a first payment code updating request corresponding to the payment code to be updated and then send the first payment code updating request to the server so as to request the server to send the updated payment code encrypted by the first symmetric key, and the updated payment code is further used for updating the payment code to be updated, so that the updated payment code is obtained. Therefore, by adopting the symmetric encryption mode to transmit the initial symmetric key corresponding to the initial payment code and used for carrying out symmetric encryption transmission on the payment code to be updated subsequently, the security of the transmission of the initial symmetric key can be ensured, the encryption transmission of the updated two-dimensional code by using a complex asymmetric key is not needed, the problem that the transmission efficiency is low because the equipment needs to undergo complex operation and verification when the payment code is updated by adopting asymmetric encryption communication in the prior art is avoided while the transmission security of the payment code is ensured, and the updating effect of the payment code is improved.
In one embodiment, the payment code updating device further comprises an effective period obtaining module, a notification sending module and a server, wherein the effective period obtaining module is used for obtaining a key effective period corresponding to the first symmetric key, the notification sending module is used for discarding the first symmetric key and generating a symmetric key expiration notification if the first symmetric key is judged to be out of date according to the key effective period, and the symmetric key expiration notification is used for notifying the user terminal to sign the second payment code updating request of the payment code to be updated by adopting an asymmetric encryption mode after discarding the first symmetric key and then sending the second payment code updating request to the server.
In one embodiment, the payment code updating device further comprises a signature module, a signature verification module and a judgment module, wherein the signature module is used for acquiring a digital signature corresponding to the first payment code updating request, the signature verification module is used for carrying out signature verification on the digital signature by adopting the first symmetric key, and the judgment module is used for judging that the first payment code updating request passes the signature verification when the digital signature passes the verification.
In one embodiment, the signature verification module is specifically configured to decrypt the digital signature by using the first symmetric key to obtain a digest 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, and determine that the digital signature passes verification when the message digest is consistent with the digest to be verified.
For a specific limitation of a payment code updating device, reference may be made to the limitation of a payment code updating method hereinabove, and the description thereof will not be repeated here. Each of the modules in the payment code updating apparatus may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 16. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing symmetric key data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a payment code updating method.
In another embodiment, a computer device is provided, which may be a user terminal, and the internal structure thereof may be as shown in fig. 17. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured 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 computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a payment code updating method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 17 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (11)

1. A payment code updating method, applied to a user terminal, comprising:
Determining a first symmetric key corresponding to a payment code to be updated aiming at the payment code to be updated, wherein the first symmetric key is obtained from a server when the user terminal updates the last payment code to be updated;
Signing a first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key, and then sending the first payment code update request to the server;
Receiving an updated payment code encrypted by the first symmetric key, which is sent by the server after the first payment code update request passes the verification;
and updating the payment code to be updated by adopting the updated payment code to obtain an updated payment code.
2. The method of claim 1, wherein after the server passes the check-out of the first payment code update request, the method further comprises:
receiving a second symmetric key which is encrypted by adopting the first symmetric key after the server performs signature verification on the first payment code updating request;
and caching the second symmetric key to a corresponding target cache position, wherein the second symmetric key is used for updating the updated payment code.
3. The method as recited in claim 1, further comprising:
When receiving a payment code acquisition instruction of a user, sending a payment code acquisition request to the server, wherein the payment code acquisition request carries a payment password of the user;
And after the payment password passes verification by the server, receiving an initial payment code and an initial symmetric key which are sent by the server and are encrypted by an asymmetric encryption mode, and decrypting the encrypted initial payment code and initial symmetric key by an asymmetric decryption mode to obtain the initial payment code and the initial symmetric key.
4. The method as recited in claim 1, further comprising:
when the first symmetric key expires, signing a second payment code updating request of the payment code to be updated by adopting an asymmetric encryption mode, and then sending the second payment code updating request to the server:
and after the server passes the verification of the second payment code updating request, receiving the updating payment code and the second symmetric key which are sent by the server and are encrypted by adopting an asymmetric encryption mode, and decrypting the encrypted updating payment code and the second symmetric key by adopting an asymmetric decryption mode to obtain the updating payment code and the second symmetric key.
5. The method of claim 4, further comprising, before the step of signing the second payment code update request for the payment code to be updated with an asymmetric encryption scheme and sending the second payment code update request to the server when the first symmetric key expires:
Signing a first payment code update request corresponding to the payment code to be updated by adopting the first symmetric key, and then sending the first payment code update request to the server;
And judging that the first symmetric key is out of date when the symmetric key expiration notice sent by the server is received, wherein the symmetric key expiration notice is generated when the server judges that the first symmetric key is out of date after receiving the first payment code updating request.
6. A payment code updating method, applied to a server, comprising:
The method comprises the steps of receiving a first payment code updating request sent by a user terminal aiming at a payment code to be updated, wherein the first payment code updating request is a request after the user terminal signs a first symmetric key corresponding to the payment code to be updated, the first symmetric key is acquired from a server when the user terminal updates the last payment code to be updated, and the initial symmetric key corresponding to an initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal;
Generating an updated payment code after the first payment code updating request passes the verification;
And encrypting the updated payment code by adopting the first symmetric key and then sending the encrypted payment code to the user terminal so that the user terminal can update the payment code to be updated to obtain the updated payment code.
7. The method as recited in claim 6, further comprising:
acquiring a key validity period corresponding to the first symmetric key;
and if the first symmetric key is judged to be out of date according to the key validity period, discarding the first symmetric key and generating a symmetric key expiration notice, wherein the symmetric key expiration notice is used for notifying the user terminal that the second payment code updating request of the payment code to be updated is signed by adopting an asymmetric encryption mode after discarding the first symmetric key and then is sent to the server.
8. A payment code updating device, characterized by being applied to a user terminal, comprising:
The system comprises a determining module, a determining module and a processing module, wherein the determining module is used for determining a first symmetric key corresponding to a payment code to be updated aiming at the payment code to be updated, wherein the first symmetric key is acquired from a server when the user terminal updates the last payment code to be updated;
The sending module is used for signing a first payment code updating request corresponding to the payment code to be updated by adopting the first symmetric key and then sending the first payment code updating request to the server;
The receiving module is used for receiving an updated payment code encrypted by the first symmetric key, which is sent by the server after the first payment code update request passes the verification;
And the updating module is used for updating the payment code to be updated by adopting the updated payment code to obtain an updated payment code.
9. A payment code updating device for use with a server, said device comprising:
The system comprises a receiving module, a receiving module and a server, wherein the receiving module is used for receiving a first payment code updating request sent by a user terminal aiming at a payment code to be updated, the first payment code updating request is a request after the user terminal signs by adopting a first symmetric key corresponding to the payment code to be updated, the first symmetric key is acquired from the server when the user terminal updates the last payment code to be updated, and the initial symmetric key corresponding to the initial payment code of the user terminal is acquired from the server through asymmetric encryption communication by the user terminal;
The generation module is used for generating an updated payment code after the first payment code update request passes the verification;
And the sending module is used for encrypting the updated payment code by adopting the first symmetric key and sending the encrypted payment code to the user terminal so that the user terminal can update the payment code to be updated to obtain the updated payment code.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 5 or the steps of the method of any one of claims 6 to 7.
11. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any one of claims 1 to 5 or the steps of the method of any one of claims 6 to 7.
CN202010268244.3A 2020-04-08 2020-04-08 Payment code updating method, device, computer equipment and storage medium Active CN113496404B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010268244.3A CN113496404B (en) 2020-04-08 2020-04-08 Payment code updating method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010268244.3A CN113496404B (en) 2020-04-08 2020-04-08 Payment code updating method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113496404A CN113496404A (en) 2021-10-12
CN113496404B true CN113496404B (en) 2025-04-15

Family

ID=77995665

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010268244.3A Active CN113496404B (en) 2020-04-08 2020-04-08 Payment code updating method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113496404B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117479111B (en) * 2023-12-25 2024-03-22 广州鲁邦通物联网科技股份有限公司 Wi-Fi technology-based offline automatic payment method, system and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101964793A (en) * 2010-10-08 2011-02-02 上海银联电子支付服务有限公司 Method and system for transmitting data between terminal and server and sign-in and payment method
CN107070909A (en) * 2017-04-01 2017-08-18 广东欧珀移动通信有限公司 Information sending method, information receiving method, device and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101449644B1 (en) * 2013-05-22 2014-10-15 한국정보통신주식회사 POS System and Method for Payment using Encrypted Card Information
KR101726243B1 (en) * 2015-04-10 2017-04-26 한국신용카드결제 (주) Mutual authentication and key exchange method for key renewal of payment system, and key sharing method with third-party servers
TWI581599B (en) * 2015-04-30 2017-05-01 鴻海精密工業股份有限公司 Key generation system, data signature and encryption system and method
CN110659899B (en) * 2019-08-08 2022-05-27 深圳汇商通盈科技有限公司 Offline payment method, device and equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101964793A (en) * 2010-10-08 2011-02-02 上海银联电子支付服务有限公司 Method and system for transmitting data between terminal and server and sign-in and payment method
CN107070909A (en) * 2017-04-01 2017-08-18 广东欧珀移动通信有限公司 Information sending method, information receiving method, device and system

Also Published As

Publication number Publication date
CN113496404A (en) 2021-10-12

Similar Documents

Publication Publication Date Title
CN113691502B (en) Communication method, device, gateway server, client and storage medium
CN111316596B (en) Encryption chip with identity verification function
CN113422679B (en) Key generation method, device and system, encryption method, electronic device and computer readable storage medium
CN113826096B (en) User authentication and signature device and method using user biometric identification data
CN113572743A (en) Data encryption and decryption method and device, computer equipment and storage medium
CN106411520B (en) Method, device and system for processing virtual resource data
US8769301B2 (en) Product authentication based upon a hyperelliptic curve equation and a curve pairing function
TWI715833B (en) Air card issuing method, device, computing equipment, computer readable storage medium and computer program product
CN117560150A (en) Key determination method, device, electronic equipment and computer-readable storage medium
CN113496404B (en) Payment code updating method, device, computer equipment and storage medium
CN115277117A (en) File viewing method and device, electronic equipment and storage medium
CN116049802B (en) Application single sign-on method, system, computer equipment and storage medium
WO2015124798A2 (en) Method & system for enabling authenticated operation of a data processing device
KR20240135359A (en) Electronic device that performs user authentication using homomorphic encryption and control method thereof
HK40052387A (en) Payment code update method, device, computer equipment and storage medium
CN116112268B (en) Data processing method, device, computer equipment and storage medium
CN115529129B (en) Encrypted communication method, system, computer device, readable storage medium, and program product
HK40030413A (en) Cryptography chip with identity verification
CN119363329A (en) A communication method, device, equipment and medium between a server and a security chip
HK40059899A (en) Key generation method, device and system, encryption method, electronic equipment and computer readable storage medium
CN116308349A (en) Payment method, device, electronic equipment and readable storage medium
CN118233108A (en) Key initialization method based on hardware security module and storage medium
CN119313457A (en) Blockchain transaction method and system capable of hiding transaction information and storage medium
HK1244566A1 (en) Online card issuance method and apparatus
KR20200055251A (en) A method for judging application forgery using user secret key, a packet validation authentication method using dynamic token, and its system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40052387

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant