Login method and device based on block chain account, electronic equipment and medium
By passing the signature and verification of structured plaintext information between the terminal device and the server, the problem of time-consuming blockchain login verification time and privacy data leakage is solved, and efficient and secure user login authentication is achieved.
Patent Information
- Application Number
- CN202411115191.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-03
AI Technical Summary
The existing blockchain-based login verification solution has the problem of long login time and risk of user privacy data leakage, especially due to the complex smart contract interaction logic and the single point of failure risk of centralized authentication services.
By passing structured plaintext information between the terminal device and the server, the user signs and verifies the information on the terminal device, and the server verifies the signature information to achieve login identity authentication, avoiding complex smart contract interaction and centralized authentication services. Risk, reducing the risk of data breach.
It simplifies user login operations, improves login efficiency, reduces the risk of data leakage, avoids third-party server storage through local storage of structured plaintext information, and improves security and user experience.
Smart Images

Figure CN119071044A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of Internet and blockchain technology, and in particular to a blockchain account-based login method, device, electronic device and medium. Background Art
[0002] With the widespread popularity of Internet applications, login security and login convenience have become increasingly important. Generally, the login method based on username and password is adopted, which has the following defects: it is easy to be cracked and easy to be attacked by phishing.
[0003] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following technical problems in the related technology: due to its decentralized and tamper-proof characteristics, blockchain technology has gradually become a new way to improve network security; in the related technology, some solutions are based on blockchain smart contracts to verify login identity, but in this case, the use of complex smart contract interaction logic results in a long login verification time, affecting the user experience; some smart contracts require the use of centralized authentication services, which poses a risk of single point failure and the risk of leakage of user privacy data. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present disclosure provide a blockchain account-based login method, device, electronic device and medium.
[0005] In the first aspect, the embodiments of the present disclosure provide a login method based on a blockchain account. The above method is applied to a terminal device, including: sending a login request for a target application to a server; receiving structured plaintext information fed back by the above server and presenting it on a visual interface, wherein the structured plaintext information includes: a blockchain account address corresponding to a login identity; in response to a signature instruction of the above visual interface, signing the structured plaintext information to obtain signature information; based on the above signature information, sending a signature verification request to the above server; and receiving the login verification result fed back by the above server.
[0006] In some embodiments, the structured plaintext information is of message type, and the structured plaintext information further includes: message version, random number, timestamp of message sending, declaration content, target domain name corresponding to the target application, and resource address corresponding to the login request.
[0007] In some embodiments, in response to the signature instruction of the above-mentioned visual interface, the above-mentioned structured plaintext information is signed to obtain the signature information, including: in response to the signature instruction of the above-mentioned visual interface, based on the preset private key in the preset key pair, the above-mentioned structured plaintext information is signed to obtain the signature information. Wherein, the above-mentioned signature information includes: a digital signature after encrypting the target hash value based on the preset private key, and the above-mentioned target hash value is obtained by hashing the above-mentioned structured plaintext information by the preset hash algorithm; so that the above-mentioned server verifies the above-mentioned signature information based on the preset public key in the above-mentioned preset key pair and the structured plaintext information to obtain the login verification result; wherein, the structured plaintext information used by the above-mentioned server for verification is one of the following: the structured plaintext information stored locally by the above-mentioned server, or the structured plaintext information attached to the signature information sent by the above-mentioned terminal device.
[0008] In some embodiments, in response to the signature instruction of the above-mentioned visual interface, the above-mentioned structured plaintext information is signed to obtain signature information, including: in response to the signature instruction of the above-mentioned visual interface, a signature algorithm option is presented; according to the target signature algorithm selected by the user in the above-mentioned signature algorithm options, the above-mentioned structured plaintext information is signed to obtain signature information.
[0009] In some embodiments, after receiving the structured plaintext information fed back by the above-mentioned server, it also includes: verifying whether the above-mentioned structured plaintext information contains agreed fields; the above-mentioned agreed fields refer to necessary fields contained in the structured plaintext information of the message type; after the verification, presenting the above-mentioned structured plaintext information on a visual interface; wherein the above-mentioned visual interface includes a signature operation function key, and the above-mentioned signature operation function key is used to trigger signature instructions and cancel signature instructions.
[0010] In the second aspect, the embodiment of the present disclosure provides a login method based on a blockchain account. The above method is applied to the server, including: receiving a login request for a target application sent by a terminal device; according to the above login request, feeding back structured plaintext information to the above terminal device; the above structured plaintext information includes: a blockchain account address corresponding to the login identity; receiving a signature verification request sent by the terminal device containing signature information to be verified; verifying the above signature information to be verified, obtaining a login verification result and feeding it back to the above terminal device.
[0011] In some embodiments, the structured plaintext information is of message type, and the structured plaintext information further includes: message version, random number, timestamp of message sending, declaration content, target domain name corresponding to the target application, and resource address corresponding to the login request.
[0012] In some embodiments, the signature information to be verified includes: a digital signature to be verified; in other embodiments, the signature information to be verified includes: a digital signature to be verified and structured plaintext information to be verified. The signature information to be verified is verified to obtain a login verification result, including: based on the preset public key and structured plaintext information in the preset key pair, the signature information to be verified is verified to obtain a login verification result; wherein, the structured plaintext information used by the server for verification is one of the following: structured plaintext information stored locally by the server, or structured plaintext information attached to the signature information to be verified sent by the terminal device; wherein, the server verifies whether the structured plaintext information to be verified attached to the signature information sent by the terminal device is consistent with the locally stored structured plaintext information, and if the verification is passed, the structured plaintext information to be verified attached to the signature information to be verified sent by the terminal device is used to verify the digital signature to be verified; if the verification fails, the structured plaintext information stored locally by the server is used to verify the digital signature to be verified. Among them, verifying the above-mentioned signature information to be verified includes: verifying whether the format of the above-mentioned signature information to be verified conforms to the preset specification; if the verification is successful, verifying whether the time difference between the current timestamp and the timestamp of the message sent in the above-mentioned structured plaintext information is less than the set threshold; if the time difference is less than the set threshold, verifying whether the random number in the above-mentioned structured plaintext information has been used; if the above-mentioned random number has not been used, decrypting the above-mentioned digital signature to be verified based on the preset public key to obtain a hash value to be verified; comparing the above-mentioned hash value to be verified with the target hash value after hashing the above-mentioned structured plaintext information to see if they are consistent, and if the above-mentioned hash value to be verified is consistent with the above-mentioned target hash value, generating a login verification result of verification success.
[0013] In some embodiments, when the format of the signature information to be verified meets the preset specifications, a login verification result of failed verification is generated; when the time difference exceeds the set threshold, a login verification result of failed verification is generated; when a random number is used, a login verification result of failed verification is generated; when the above-mentioned hash value to be verified and the above-mentioned target hash value are inconsistent, a login verification result of failed verification is generated.
[0014] In a third aspect, an embodiment of the present disclosure provides a login device based on a blockchain account. The above-mentioned login device is a terminal device, comprising: a login request sending module, a message receiving module, a display module, a signature processing module, a signature verification request sending module and a login verification result receiving module. The above-mentioned login request sending module is used to send a login request for a target application to the server. The above-mentioned message receiving module is used to receive the structured plaintext information fed back by the above-mentioned server. The above-mentioned display module is used to present the above-mentioned structured plaintext information on a visual interface, and the above-mentioned structured plaintext information includes: a blockchain account address corresponding to the login identity. The above-mentioned signature processing module is used to respond to the signature instruction of the above-mentioned visual interface, and perform signature processing on the above-mentioned structured plaintext information to obtain signature information. The above-mentioned signature verification request sending module is used to send a signature verification request to the above-mentioned server based on the above-mentioned signature information. The above-mentioned login verification result receiving module is used to receive the login verification result fed back by the above-mentioned server.
[0015] In a fourth aspect, an embodiment of the present disclosure provides a login device based on a blockchain account. The above-mentioned device is a server, comprising: a login request receiving module, a message sending module, a signature verification request receiving module, a signature verification module and a login verification result sending module. The above-mentioned login request receiving module is used to receive a login request for a target application sent by a terminal device. The above-mentioned message sending module is used to feedback structured plaintext information to the above-mentioned terminal device according to the above-mentioned login request; the above-mentioned structured plaintext information includes: a blockchain account address corresponding to the login identity. The above-mentioned signature verification request receiving module is used to receive a signature verification request containing signature information to be verified sent by a terminal device. The above-mentioned signature verification module is used to verify the above-mentioned signature information to be verified and obtain a login verification result. The above-mentioned login verification result sending module is used to feedback the above-mentioned login verification result to the above-mentioned terminal device.
[0016] In a fifth aspect, an embodiment of the present disclosure provides an electronic device. The electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the blockchain account-based login method provided by the first or second embodiment when executing the program stored in the memory.
[0017] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the blockchain account-based login method provided by the first embodiment or the second embodiment is implemented.
[0018] The above technical solution provided by the embodiments of the present disclosure has at least some or all of the following advantages:
[0019] The invention provides a method for realizing user login identity authentication through signing and verifying structured plaintext information; by sending a login request for a target application to a server, the server feeds back structured plaintext information containing a blockchain account address to a terminal device and presents it on a visual interface of the terminal device; since the blockchain account address is corresponding to and unique to the login identity, the user only needs to sign the structured plaintext information, generate signature information on the terminal device side, and send a signature verification request to the server based on the signature information; the server can verify and admit the login identity by verifying the signature information, thereby obtaining a login verification result; the logged-in user only needs to sign the structured plaintext information presented on the visual interface, which is easy to operate and improves processing time efficiency; since the structured plaintext information is sent to the terminal device through the server, the user's privacy data or information related to the user's identity (such as the blockchain account address, the login identity information corresponding to the login identity, the corresponding relationship between the login identity information and the blockchain account address, etc.) in the structured plaintext information is stored locally on the server, and does not need to be stored on a third-party server, which can greatly reduce the risk of data leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] Figure 1 The system architecture of the blockchain account-based login method applicable to the embodiment of the present disclosure is schematically shown;
[0023] Figure 2 The flowchart of the blockchain account-based login method according to an embodiment of the present disclosure is schematically shown;
[0024] Figure 3 The following schematically shows an interaction sequence diagram of a terminal device and a server in a process of executing a login method based on a blockchain account according to an embodiment of the present disclosure;
[0025] Figure 4 The following schematically shows an interface diagram of a visualization interface presenting structured plaintext information according to an embodiment of the present disclosure;
[0026] Figure 5 The flowchart of a blockchain account-based login method according to another embodiment of the present disclosure is schematically shown;
[0027] Figure 6 The detailed implementation flow chart of step S540 of an embodiment of the present disclosure is schematically shown;
[0028] Figure 7 The structural block diagram of the electronic device provided by the embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.
[0030] Figure 1 The system architecture of the blockchain account-based login method applicable to the embodiment of the present disclosure is schematically shown.
[0031] Reference Figure 1 As shown, the system architecture 100 of the blockchain account-based login method applicable to the embodiment of the present disclosure includes: a terminal device 110, a network 112, and a server 120. The network 112 is a medium that provides a communication link between the terminal device 110 and the server 120. The network 112 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0032] The user can use the terminal device 110 to interact with the server 120 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 110, such as shopping applications, web browser applications, video playback applications, search applications, instant messaging tools, email clients, social platform software, e-book applications, etc. (only for example).
[0033] The terminal device 110 may be any electronic device with a display screen, including but not limited to: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart driving car, etc.
[0034] The server 120 may be a server that provides various services, such as a background management server (only as an example) that provides service support for the target application logged in by the user using the terminal device 110 and data processing. The background management server may analyze and process the received login request or data processing request, and feed back the processing result (such as the verification result after verification according to the user login request, the returned web page, information, or data, etc.) to the terminal device.
[0035] The first exemplary embodiment of the present disclosure provides a login method based on a blockchain account. The method of this embodiment can be applied to Figure 1 The terminal device 110 in the exemplary system architecture 100 .
[0036] Figure 2 The flowchart of a blockchain account-based login method according to an embodiment of the present disclosure is schematically shown.
[0037] Reference Figure 2 As shown, the blockchain account-based login method provided by an embodiment of the present disclosure includes the following steps: S210, S220, S230, S240 and S250.
[0038] In step S210, a login request for the target application is sent to the server.
[0039] Figure 3 The diagram schematically shows an interaction sequence diagram between a terminal device and a server in a process of executing a blockchain account-based login method according to an embodiment of the present disclosure.
[0040] In some implementation scenarios, various applications are installed on the terminal device 110, which may be web applications, mobile applications (APPs), or mini-programs, etc. The user initiates a login request for the target application to be logged in by operating the terminal device. For example, the user enters the login interface of the target application on the terminal device and initiates a login instruction on the terminal device by clicking the login function key. Figure 3 As shown in sequence number ①, after receiving the above login instruction, the terminal device sends a login request for the target application to the server.
[0041] The embodiments of the present disclosure provide a method for implementing user login identity authentication through the signing and verification of structured plaintext information. In some embodiments, the target application of the above-mentioned terminal device is assigned a unique blockchain account address corresponding to the login identity. The login identity information corresponding to the login identity can be information related to the user identity, which can include but is not limited to: user mobile phone number, user account, user name, user's third-party account (supports associated login), etc. The corresponding relationship between the login identity information and the blockchain account address is stored on the server side.
[0042] In the login scenario, users do not need to enter at least two identity login information such as user name, password, ID number, verification code, etc. as in related technologies. Users only need to enter the login identity information corresponding to the current login identity on the terminal device and click the login function key, or the terminal device sends the locally stored login identity information to the server after the user clicks the login function key. After receiving the login request carrying the login identity information, the server determines the blockchain account address corresponding to the current login identity based on the correspondence between the login identity information and the blockchain account address. Since the blockchain account has strong security and privacy protection capabilities, the blockchain account address corresponding to the current login identity is unique. Therefore, by signing and verifying the structured plaintext information containing the blockchain account address, efficient authentication of the user's login identity can be achieved.
[0043] In some embodiments, reference Figure 3 As shown in sequence number ②, after receiving the login request for the target application sent by the terminal device, the server feeds back structured plaintext information to the terminal device. The structured plaintext information includes the blockchain account address corresponding to the login identity.
[0044] Since structured plaintext information is sent to the terminal device through the server, the structured plaintext information involving user privacy data or information related to the user identity (such as blockchain account address, login identity information corresponding to the login identity, the correspondence between the login identity information and the blockchain account address, etc.) is stored locally on the server and does not need to be stored on a third-party server, which can greatly reduce the risk of data leakage.
[0045] In step S220, the structured plaintext information fed back by the server is received and presented on a visual interface, wherein the structured plaintext information includes: a blockchain account address corresponding to the login identity.
[0046] In some embodiments, the structured plaintext information is of message type. As shown in Table 1, in addition to the blockchain account address, the structured plaintext information also includes: message version, random number, timestamp of message sending, statement, target domain name corresponding to the target application, and resource address corresponding to the login request (in Table 1, the example is the request uniform resource identifier URI).
[0047] In some embodiments, after receiving the structured plaintext information fed back by the server, the method further includes: verifying whether the structured plaintext information contains the agreed field; if the agreed field is contained, the verification is deemed to be passed; after the verification is passed, referring to Figure 3 As shown in sequence number ③, the above structured plain text information is presented in a visual interface. The above agreed fields refer to the necessary fields contained in the structured plain text information of the message type, as shown in Table 1.
[0048] Table 1 Examples of agreed fields in structured plaintext information
[0049]
[0050]
[0051] Figure 4 An interface diagram of a visualization interface presenting structured plaintext information according to an embodiment of the present disclosure is schematically shown.
[0052] In some embodiments, reference Figure 4 As shown, the structured plaintext information is presented in the visualization interface 400, and the structured plaintext information includes the following fields and corresponding field values:
[0053] Blockchain account address (also called signature account): adxSaVcjJyvTqWwDZfubb5LtAJ2FphtY7scUm;
[0054] Request domain name: https: / / example.com;
[0055] Request URI: https: / / example.com / login
[0056] Message version: 1;
[0057] Random number: 7282732;
[0058] Timestamp of message sending: 2024-XX (indicating month)-XX (indicating date)T16:25:24Z.
[0059] At the same time, the fields in the structured plain text information are sorted and concatenated according to the URL format, for example, in ascending order of the first letters of the fields, and then concatenated, and the concatenated information is presented in the information column 420 corresponding to the information to be signed, for example, in Figure 4The symbol "&" is used to indicate concatenation. The visual interface 400 further includes a signature operation function key 410, which includes a signature cancel function key 411 and a signature confirmation function key 412; the signature confirmation function key 412 is used to trigger a signature instruction, and the signature cancel function key 411 is used to cancel a signature instruction. When the user views the information to be signed and clicks the signature confirmation function key 412 in the signature operation function key 410, the terminal device is deemed to have received the signature instruction.
[0060] In step S230, in response to the signature instruction of the visual interface, the structured plaintext information is signed to obtain signature information.
[0061] Reference Figure 3 As shown in sequence number ④, after the terminal device receives the signature instruction, it executes the operation of signing the structured plaintext information.
[0062] In some embodiments, considering the compatibility between different blockchain platforms, the embodiments of the present disclosure support the selection of multiple encryption signature algorithms. Users can choose the appropriate algorithm for signing according to their own blockchain account type, and the server can verify based on the corresponding signature algorithm, which can adapt to a wider range of user needs.
[0063] In some embodiments, the above step S230 specifically includes: presenting signature algorithm options in response to the signature instruction of the above visual interface; and signing the above structured plaintext information according to the target signature algorithm selected by the user in the above signature algorithm options to obtain signature information.
[0064] The above-mentioned signature algorithm options include but are not limited to the following signature algorithms: RSA (an asymmetric encryption algorithm) signature algorithm, ECDSA (elliptic curve digital signature algorithm) signature algorithm, EdDSA (Edwards curve digital signature algorithm) signature algorithm, SM2 (an elliptic curve encryption algorithm) signature algorithm, etc. For example, the ED25519 signature algorithm in EdDSA (Edwards curve digital signature algorithm) is used in this embodiment, and this signature algorithm has better security and high-efficiency processing characteristics for login verification scenarios.
[0065] On the basis of the above embodiment, the structured plaintext information is signed to obtain signature information, which specifically includes: based on a preset private key in a preset key pair, the structured plaintext information is signed to obtain signature information.
[0066] In some embodiments, the signature information includes: a digital signature encrypted based on a preset private key to obtain a target hash value. In other embodiments, the signature information includes: the digital signature and the structured plaintext information. The target hash value is obtained by performing hash processing on the structured plaintext information using a preset hash algorithm.
[0067] Based on the above signature information, the above server verifies the above signature information based on the preset public key and structured plaintext information in the above preset key pair to obtain a login verification result.
[0068] In some embodiments, the structured plaintext information used by the server for verification is one of the following: structured plaintext information stored locally by the server, or structured plaintext information attached to the signature information sent by the terminal device.
[0069] In some embodiments, if the signature information sent by the terminal device is accompanied by structured plaintext information, the above-mentioned server verifies whether the structured plaintext information attached to the signature information sent by the terminal device is consistent with the locally stored structured plaintext information. If the verification is successful, the structured plaintext information attached to the signature information sent by the terminal device is used to verify the above-mentioned signature information; if the verification fails, in order to avoid illegal login attacks, the structured plaintext information locally stored by the above-mentioned server is used.
[0070] In an embodiment in which signature information is verified using structured plaintext information stored locally on the server, since the server locally stores structured plaintext information and sends the structured plaintext information to the terminal device, the terminal device only needs to sign the structured plaintext information to obtain a digital signature and send the digital signature to the server for verification; the server uses the locally stored structured plaintext information and the digital signature sent by the terminal device for verification, which can effectively save the resource consumption corresponding to the transmission of structured plaintext information between the terminal device and the server, and the risk of login attacks or information leakage caused by tampering with the structured plaintext information after it is intercepted during the transmission of the structured plaintext information from the terminal device to the server (for example, by tampering with the random number, timestamp, etc. in the structured plaintext information).
[0071] In step S240, based on the signature information, a signature verification request is sent to the server.
[0072] Reference Figure 3 As shown in sequence number ⑤, the terminal device submits a signature verification request to the server. The signature verification request carries signature information, which may include the digital signature; or include both the digital signature and structured plaintext information.
[0073] Reference Figure 3 As shown in sequence number ⑥, after receiving the signature verification request, the server verifies the signature information and obtains the login verification result.
[0074] In the embodiments of the present disclosure, since a random number is included in the structured plaintext information, this random number is generated on the server and is a unique result. If the random number in the signature information carried in the signature verification request has been used, it means that there may be a risk of a replay attack. In this case, the server fails to verify the signature information to avoid illegal login requests.
[0075] In the embodiments of the present disclosure, since the structured plaintext information includes the timestamp of message sending, this timestamp indicates the moment when the structured plaintext message is sent from the server. Based on this timestamp, the time interval from the time when the structured plaintext information is sent to the time when the signature verification request is submitted to the terminal device can be determined. For card control when this time interval is within a reasonable range, a response result of unable to log in or login failure will be fed back for a timed-out login request.
[0076] In the embodiments of the present disclosure, since random numbers are set in the structured plaintext information, replay attacks can be effectively defended; since the timestamp of message sending is set in the structured plaintext information, a login failure is responded to a timed-out login request. When verifying the signature information, it is mainly based on the comparison of the decrypted result of the structured plaintext information and the above-mentioned digital signature. When the signature information sent by the terminal device contains structured plaintext information, if it is illegally intercepted during the transmission process, in this case, in order to forge the consistency of the digital signature and the structured plaintext information, the illegal attacker may tamper with the original structured plaintext information (for example, the modification of the random number may also meet the condition that it has not been used) and the digital signature together. Therefore, when verifying on the server side, an additional comparison step can be added. This comparison step is used to compare whether the structured plaintext information in the signature information sent by the terminal device is consistent with the structured plaintext information locally stored on the server. In the case of inconsistency, in order to avoid the risk caused by verification based on the tampered structured plaintext information, the structured plaintext information locally stored on the server is used to verify the digital signature in the signature information; in the case of consistency, the structured plaintext information attached to the signature information or the structured plaintext information stored locally can be used to verify the digital signature in the signature information.
[0077] In step S250, the login verification result fed back by the server is received.
[0078] Reference Figure 3As shown in sequence number ⑦, the terminal device receives the login verification result fed back by the above-mentioned server; the above-mentioned login verification result can be two categories, namely, verification passed or verification failed. If the terminal device receives the login verification result of verification passed, the target interface after successful login is presented on the display interface. If the terminal device receives the login verification result of verification failed, a prompt message for the user's login failure can be presented.
[0079] In the embodiment including steps S210 to S250, user identity authentication is achieved by signing a structured plaintext message containing a blockchain account address and verifying the validity of the signature; a method for achieving user login identity authentication through signing and verification of structured plaintext information is provided. Specifically, by sending a login request for the target application to the server, the server will feedback structured plaintext information containing the blockchain account address to the terminal device and present it on the visual interface of the terminal device; since the blockchain account address corresponds to and is unique to the login identity, the user only needs to sign the structured plaintext information, generate signature information on the terminal device side and send a signature verification request to the server based on this signature information; the server can verify and access the login identity by verifying the signature information, thereby obtaining a login verification result; the logged-in user only needs to sign the structured plaintext information presented on the visual interface, which is easy to operate and improves processing efficiency; since the structured plaintext information is sent to the terminal device through the server, the structured plaintext information involves user privacy data or information related to the user identity (such as the blockchain account address, the login identity information corresponding to the login identity, the correspondence between the login identity information and the blockchain account address, etc.) is stored locally on the server, and does not need to be stored on a third-party server, which can greatly reduce the risk of data leakage.
[0080] The second exemplary embodiment of the present disclosure provides a login method based on a blockchain account. The method of this embodiment can be applied to Figure 1 The server 120 in the exemplary system architecture 100 .
[0081] Figure 5 The flowchart of a blockchain account-based login method according to another embodiment of the present disclosure is schematically shown.
[0082] Reference Figure 5 As shown, the blockchain account-based login method applied to the server provided in the embodiment of the present disclosure includes the following steps: S510, S520, S530 and S540.
[0083] In step S510, a login request for a target application sent by a terminal device is received.
[0084] Reference Figure 3As shown in the process corresponding to sequence number ①, the server receives a login request for the target application sent by the terminal device. In some embodiments, the login request carries login identity information.
[0085] In step S520, according to the above login request, structured plaintext information is fed back to the above terminal device; the above structured plaintext information includes: a blockchain account address corresponding to the login identity.
[0086] Reference Figure 3 As shown in the process corresponding to sequence number ②, the server feeds back structured plaintext information to the above terminal device. Based on the correspondence between the locally stored login identity information and the blockchain account address, the server uses the blockchain account address corresponding to the current login identity as a component of the structured plaintext information, and also generates a new, unused random number as a component of the structured plaintext information.
[0087] In some embodiments, the structured plaintext information is of message type. In addition to the blockchain account address, the structured plaintext information also includes: message version, random number, message sending timestamp, declaration content, target domain name corresponding to the target application, and resource address corresponding to the login request.
[0088] In step S530, a signature verification request including signature information to be verified is received from a terminal device.
[0089] Reference Figure 3 As shown in the process corresponding to sequence number ⑤, the terminal device submits a signature verification request, and the server side receives the above signature verification request.
[0090] In a real login scenario, the above-mentioned signature information to be verified can be normal signature information sent by the terminal device, which will eventually achieve successful login after verification; it can also be signature information that has been intercepted and tampered with or illegally modified. It is expected that illegal login attacks can be blocked based on the verification logic of the signature information to be verified on the server.
[0091] In some embodiments, the signature information to be verified includes: a digital signature to be verified. In other embodiments, the signature information includes: a digital signature to be verified and structured plaintext information to be verified.
[0092] In step S540, the signature information to be verified is verified, a login verification result is obtained and fed back to the terminal device.
[0093] Reference Figure 3 As shown in the process indicated by sequence number ⑥, the server verifies the signature information to be verified and obtains the login verification result. Figure 3 As shown in the process indicated by sequence number ⑦, the server feeds back the login verification result to the terminal device.
[0094] In some embodiments, the above-mentioned signature information to be verified is verified to obtain a login verification result, including: based on the preset public key and structured plaintext information in the preset key pair, the above-mentioned signature information to be verified is verified to obtain a login verification result. Wherein, the structured plaintext information used by the above-mentioned server for verification is one of the following: structured plaintext information stored locally by the above-mentioned server, or structured plaintext information attached to the signature information to be verified sent by the above-mentioned terminal device (specifically described as structured plaintext information to be verified); wherein, the above-mentioned server verifies whether the structured plaintext information to be verified attached to the signature information sent by the terminal device is consistent with the locally stored structured plaintext information. If the verification is passed, the structured plaintext information to be verified attached to the signature information to be verified sent by the terminal device is used to verify the above-mentioned digital signature to be verified; if the verification fails, the structured plaintext information stored locally by the above-mentioned server is used to verify the above-mentioned digital signature to be verified.
[0095] Figure 6 The detailed implementation flow chart of step S540 of an embodiment of the present disclosure is schematically shown.
[0096] Specifically, refer to Figure 6 As shown, verifying the above signature information to be verified includes the following steps: S610, S621, S631, S641, S650 and S661.
[0097] In step S610, it is verified whether the format of the signature information to be verified complies with a preset specification.
[0098] In step S621, if the verification is successful, it is verified whether the time difference between the current timestamp and the timestamp of the message sent in the structured plaintext information is less than a set threshold.
[0099] In step S631, when the time difference is less than the set threshold, verify whether the random number in the structured plaintext information has been used;
[0100] In step S641, when the random number is not used, the digital signature to be verified is decrypted based on a preset public key to obtain a hash value to be verified.
[0101] In step S650, the hash value to be verified is compared with the target hash value after hash processing of the structured plaintext information to see whether they are consistent.
[0102] In step S661, when the hash value to be verified is consistent with the target hash value, a login verification result indicating that the verification is passed is generated.
[0103] Reference Figure 6 As shown in the dotted box, step S540 also includes steps corresponding to the following branches: S622, S632, S642 and S662.
[0104] In step S622, when the format of the signature information to be verified meets the preset specification, a login verification result indicating that the verification failed is generated.
[0105] In step S632, when the time difference exceeds the set threshold, a login verification result indicating verification failure is generated.
[0106] In step S642, when a random number is used, a login verification result indicating that the verification has failed is generated.
[0107] In step S662, when the hash value to be verified is inconsistent with the target hash value, a login verification result indicating that the verification failed is generated.
[0108] In this embodiment, multiple layers of verification are set up and the logic of entering the next layer of verification after each layer of verification passes is used, which helps to defend against various attacks and improve login security.
[0109] In the embodiment including steps S510 to S540, the user identity is authenticated by signing a structured plaintext message containing a blockchain account address and verifying the validity of the signature, providing a method for realizing user login identity authentication by signing and verifying structured plaintext information. Specifically, by receiving a login request for a target application sent by a terminal device, the server feeds back structured plaintext information containing a blockchain account address to the terminal device and presents it on the visual interface of the terminal device; since the blockchain account address corresponds to and is unique to the login identity, the user only needs to sign the structured plaintext information, generate signature information on the terminal device side, and send a signature verification request to the server based on this signature information; the server can verify and access the login identity by verifying the signature information, thereby obtaining a login verification result. The logged-in user only needs to sign the structured plaintext information presented on the visual interface, which is easy to operate and improves processing time. Since structured plaintext information is sent to the terminal device through the server, the structured plaintext information involving user privacy data or information related to the user identity (such as blockchain account address, login identity information corresponding to the login identity, the correspondence between the login identity information and the blockchain account address, etc.) is stored locally on the server and does not need to be stored on a third-party server, which can greatly reduce the risk of data leakage.
[0110] For more details of this embodiment, the interaction with the terminal device, etc., please refer to the description of the first embodiment, which will not be repeated here.
[0111] A third exemplary embodiment of the present disclosure provides a blockchain account-based login device.
[0112] The login device of this embodiment can be Figure 1 The terminal device 110 in the exemplary system architecture 100 includes: a login request sending module, a message receiving module, a display module, a signature processing module, a signature verification request sending module and a login verification result receiving module.
[0113] The login request sending module is used to send a login request for a target application to the server.
[0114] The message receiving module is used to receive the structured plain text information fed back by the server.
[0115] The above-mentioned display module is used to present the above-mentioned structured plaintext information on a visual interface, and the above-mentioned structured plaintext information includes: a blockchain account address corresponding to the login identity.
[0116] The signature processing module is used to respond to the signature instruction of the visual interface, perform signature processing on the structured plaintext information, and obtain signature information.
[0117] The signature verification request sending module is used to send a signature verification request to the server based on the signature information.
[0118] The login verification result receiving module is used to receive the login verification result fed back by the server.
[0119] In some embodiments, the structured plaintext information is of message type, and the structured plaintext information further includes: message version, random number, timestamp of message sending, declaration content, target domain name corresponding to the target application, and resource address corresponding to the login request.
[0120] In some embodiments, the signature processing module is specifically used to: respond to the signature instruction of the visual interface, and based on the preset private key in the preset key pair, sign the structured plaintext information to obtain signature information. The signature information includes: a digital signature encrypted by the target hash value based on the preset private key, and the target hash value is obtained by hashing the structured plaintext information with the preset hash algorithm. The server verifies the signature information based on the preset public key and the structured plaintext information in the preset key pair to obtain a login verification result; the structured plaintext information used by the server for verification is one of the following: structured plaintext information stored locally on the server, or structured plaintext information attached to the signature information sent by the terminal device.
[0121] In some embodiments, the signature processing module includes: a signature algorithm presentation module and a signature processing module.
[0122] The signature algorithm presentation module is used to present signature algorithm options in response to the signature instruction of the visual interface.
[0123] The signature processing module is used to perform signature processing on the structured plaintext information according to the target signature algorithm selected by the user in the signature algorithm option to obtain signature information.
[0124] The above-mentioned login device also includes: a field verification module.
[0125] The above-mentioned field verification module is used to verify whether the above-mentioned structured plaintext information contains the agreed fields; the above-mentioned agreed fields refer to the necessary fields contained in the structured plaintext information of the message type.
[0126] After verification, the display module is used to present the structured plaintext information on a visual interface; wherein the visual interface includes a signature operation function key, and the signature operation function key is used to trigger a signature instruction and cancel a signature instruction.
[0127] For more details of this embodiment, please refer to the relevant description of the first embodiment, which will not be repeated here.
[0128] A fourth exemplary embodiment of the present disclosure provides a blockchain account-based login device.
[0129] The login device of this embodiment can be Figure 1 The server 120 in the exemplary system architecture 100 includes: a login request receiving module, a message sending module, a signature verification request receiving module, a signature verification module and a login verification result sending module.
[0130] The login request receiving module is used to receive a login request for a target application sent by a terminal device.
[0131] The message sending module is used to feedback structured plaintext information to the terminal device according to the login request; the structured plaintext information includes: the blockchain account address corresponding to the login identity.
[0132] The signature verification request receiving module is used to receive a signature verification request containing signature information sent by a terminal device.
[0133] The signature verification module is used to verify the signature information and obtain a login verification result.
[0134] The login verification result sending module is used to feed back the login verification result to the terminal device.
[0135] In some embodiments, the structured plaintext information is of message type, and the structured plaintext information further includes: message version, random number, timestamp of message sending, declaration content, target domain name corresponding to the target application, and resource address corresponding to the login request.
[0136] In some embodiments, the above-mentioned signature information to be verified includes: a digital signature to be verified; in other embodiments, the above-mentioned signature information to be verified includes: a digital signature to be verified and structured plaintext information to be verified.
[0137] The above-mentioned signature information to be verified is verified to obtain a login verification result, including: based on the preset public key and structured plaintext information in the preset key pair, the above-mentioned signature information to be verified is verified to obtain a login verification result; wherein, the structured plaintext information used by the above-mentioned server for verification is one of the following: the structured plaintext information locally stored by the above-mentioned server, or the structured plaintext information attached to the signature information to be verified sent by the above-mentioned terminal device; wherein, the above-mentioned server verifies whether the structured plaintext information to be verified attached to the signature information sent by the terminal device is consistent with the locally stored structured plaintext information. If the verification is successful, the structured plaintext information to be verified attached to the signature information to be verified sent by the terminal device is used to verify the above-mentioned digital signature to be verified; if the verification fails, the structured plaintext information locally stored by the above-mentioned server is used to verify the above-mentioned digital signature to be verified.
[0138] Among them, verifying the above-mentioned signature information to be verified includes: verifying whether the format of the above-mentioned signature information to be verified conforms to the preset specification; if the verification is successful, verifying whether the time difference between the current timestamp and the timestamp of the message sent in the above-mentioned structured plaintext information is less than the set threshold; if the time difference is less than the set threshold, verifying whether the random number in the above-mentioned structured plaintext information has been used; if the above-mentioned random number has not been used, decrypting the above-mentioned digital signature to be verified based on the preset public key to obtain a hash value to be verified; comparing the above-mentioned hash value to be verified with the target hash value after hashing the above-mentioned structured plaintext information to see if they are consistent, and if the above-mentioned hash value to be verified is consistent with the above-mentioned target hash value, generating a login verification result of verification success.
[0139] In some embodiments, when the format of the signature information to be verified meets the preset specifications, a login verification result of failed verification is generated; when the time difference exceeds the set threshold, a login verification result of failed verification is generated; when a random number is used, a login verification result of failed verification is generated; when the above-mentioned hash value to be verified and the above-mentioned target hash value are inconsistent, a login verification result of failed verification is generated.
[0140] For more details of this embodiment, please refer to the relevant descriptions of the first embodiment and the second embodiment, which will not be repeated here.
[0141] Any number of the functional modules included in the login device of the third embodiment to the fourth embodiment can be combined into one module, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. At least one of the functional modules included in the login device of the third embodiment to the fourth embodiment can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the functional modules included in the login device of the third embodiment to the fourth embodiment can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0142] A fifth exemplary embodiment of the present disclosure provides an electronic device.
[0143] Figure 7 The structural block diagram of the electronic device provided by the embodiment of the present disclosure is schematically shown.
[0144] Reference Figure 7 As shown, the electronic device 700 provided in the embodiment of the present disclosure includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702 and the memory 703 communicate with each other through the communication bus 704; the memory 703 is used to store computer programs; the processor 701 is used to implement the blockchain account-based login method provided in the first embodiment or the second embodiment when executing the program stored in the memory.
[0145] The sixth exemplary embodiment of the present disclosure further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the blockchain account-based login method provided in the first embodiment or the second embodiment is implemented.
[0146] The computer-readable storage medium may be included in the device or apparatus described in the above embodiment; or it may exist independently without being assembled into the device or apparatus. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0147] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0148] It should be noted that the collection, collection, update, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution provided by the embodiments of the present disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.
[0149] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0150] The foregoing is merely a specific embodiment of the present disclosure, which enables those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied herein.
Claims
1. A login method based on a blockchain account, characterized in that: Applied to a terminal device, the method comprises: Send a login request for the target application to the server; Receive structured plaintext information fed back by the server and present it on a visual interface, wherein the structured plaintext information includes: a blockchain account address corresponding to the login identity; In response to the signature instruction of the visual interface, the structured plaintext information is signed to obtain signature information; Based on the signature information, sending a signature verification request to the server; Receive the login verification result fed back by the server.
2. The method according to claim 1, characterized in that The structured plaintext information is of message type, and the structured plaintext information further includes: Message version, random number, timestamp of message sending, declaration content, target domain name corresponding to the target application and resource address corresponding to the login request.
3. The method according to claim 1, characterized in that In response to the signature instruction of the visual interface, the structured plaintext information is signed to obtain signature information, including: In response to the signature instruction of the visual interface, the structured plaintext information is signed based on a preset private key in a preset key pair to obtain signature information; Among them, the signature information includes: a digital signature encrypted based on a preset private key, and the target hash value is obtained by hashing the structured plaintext information with a preset hash algorithm; so that the server verifies the signature information based on the preset public key and the structured plaintext information in the preset key pair to obtain a login verification result; wherein the structured plaintext information used by the server for verification is one of the following: structured plaintext information locally stored by the server, or structured plaintext information attached to the signature information sent by the terminal device.
4. The method according to any one of claims 1 to 3, characterized in that In response to the signature instruction of the visual interface, the structured plaintext information is signed to obtain signature information, including: In response to the signing instruction of the visual interface, presenting signing algorithm options; The structured plaintext information is signed according to the target signature algorithm selected by the user in the signature algorithm option to obtain signature information.
5. The method according to claim 1, characterized in that After receiving the structured plaintext information fed back by the server, the method further includes: Verifying whether the structured plaintext information contains an agreed field; the agreed field refers to a necessary field contained in the structured plaintext information of the message type; After verification, the structured plaintext information is presented on a visual interface; wherein the visual interface includes a signature operation function key, and the signature operation function key is used to trigger a signature instruction and cancel a signature instruction.
6. A login method based on a blockchain account, characterized in that: Applied to the server, the method includes: Receiving a login request for a target application sent by a terminal device; Feedback structured plaintext information to the terminal device according to the login request; the structured plaintext information includes: a blockchain account address corresponding to the login identity; Receiving a signature verification request sent by a terminal device and containing signature information to be verified; The signature information to be verified is verified, a login verification result is obtained and fed back to the terminal device.
7. The method according to claim 6, characterized in that The structured plaintext information is of message type, and the structured plaintext information further includes: Message version, random number, timestamp of message sending, declaration content, target domain name corresponding to the target application and resource address corresponding to the login request.
8. The method according to claim 6 or 7, characterized in that: The signature information to be verified includes: a digital signature to be verified; or, the signature information to be verified includes: a digital signature to be verified and structured plaintext information to be verified; The verification of the signature information to be verified to obtain a login verification result includes: Based on the preset public key and structured plaintext information in the preset key pair, the signature information to be verified is verified to obtain a login verification result; wherein, the structured plaintext information used by the server for verification is one of the following: structured plaintext information locally stored by the server, or structured plaintext information attached to the signature information to be verified sent by the terminal device; wherein, the server verifies whether the structured plaintext information to be verified attached to the signature information to be verified sent by the terminal device is consistent with the structured plaintext information stored locally, and if the verification is passed, the structured plaintext information to be verified attached to the signature information to be verified sent by the terminal device is used to verify the digital signature to be verified; if the verification fails, the structured plaintext information locally stored by the server is used to verify the digital signature to be verified; Among them, verifying the signature information to be verified includes: verifying whether the format of the signature information to be verified conforms to the preset specification; if the verification is successful, verifying whether the time difference between the current timestamp and the timestamp of the message sent in the structured plaintext information is less than the set threshold; if the time difference is less than the set threshold, verifying whether the random number in the structured plaintext information has been used; if the random number has not been used, decrypting the digital signature to be verified based on the preset public key to obtain a hash value to be verified; comparing the hash value to be verified with the target hash value after hashing the structured plaintext information to see if they are consistent; if the hash value to be verified is consistent with the target hash value, generating a login verification result of verification success.
9. The method according to claim 8, characterized in that Verifying the signature information to be verified to obtain a login verification result also includes: When the time difference exceeds the set threshold, a login verification result indicating that the verification failed is generated; In the case where a random number is used, a login verification result of failed verification is generated; When the hash value to be verified is inconsistent with the target hash value, a login verification result indicating that the verification failed is generated.
10. A login device based on a blockchain account, characterized in that: The login device is a terminal device, comprising: A login request sending module, used to send a login request for a target application to a server; A message receiving module, used to receive structured plain text information fed back by the server; A display module, used to present the structured plaintext information on a visual interface, wherein the structured plaintext information includes: a blockchain account address corresponding to a login identity; A signature processing module, used to perform signature processing on the structured plaintext information in response to a signature instruction of the visual interface to obtain signature information; A signature verification request sending module, used to send a signature verification request to the server based on the signature information; The login verification result receiving module is used to receive the login verification result fed back by the server.
11. A login device based on a blockchain account, characterized in that: The device is a server, comprising: A login request receiving module, used to receive a login request for a target application sent by a terminal device; A message sending module, configured to feed back structured plaintext information to the terminal device according to the login request; the structured plaintext information includes: a blockchain account address corresponding to the login identity; A signature verification request receiving module, used to receive a signature verification request containing signature information sent by a terminal device; A signature verification module, used to verify the signature information and obtain a login verification result; The login verification result sending module is used to feed back the login verification result to the terminal device.
12. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, for implementing the method according to any one of claims 1 to 9 when executing a program stored in a memory.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Security verification method and device for network request, and storage medium
CN121462236A
