User authentication method and terminal device based on blockchain

Through the blockchain-based user authentication method and the use of asymmetric encryption algorithms and hash operations, the problem of low security of login methods in the existing technology is solved, and the privacy of user identity information and device security are improved.

CN109522698BActive Publication Date: 2024-10-18PING AN TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201811182177.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-10-11
Publication Date
2024-10-18
Estimated Expiration
2038-10-11

AI Technical Summary

Technical Problem

Login methods in the prior art have low security and are susceptible to security issues such as password theft, password hijacking, and weak passwords being easily attacked.

Method used

A user authentication method based on the blockchain is used to generate a user certificate and use an asymmetric encryption algorithm to generate a public and private key pair. The private key performs a hash operation on the user certificate to obtain the signature data, and uses the public key of the chain device to perform the signature data Decrypt the signature and verify it with the pre-stored hash value to ensure the privacy of user identity information and device security.

Benefits of technology

It effectively prevents user identity information from being stolen or tampered with, improves device security, and ensures the authenticity and integrity of user login information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109522698B_ABST
    Figure CN109522698B_ABST
Patent Text Reader

Abstract

The present invention is applicable to the field of computer application technology, and provides a user authentication method based on blockchain, a terminal device and a computer-readable storage medium, including: generating a user certificate in advance according to the identity information of the user, and using an asymmetric encryption algorithm to generate a unique corresponding public-private key pair, performing a hash operation on the user certificate by using a private key to obtain signed data, obtaining the signed data of a chain device of the user logging into the blockchain system, and decrypting the signed data by using a public key corresponding to the chain device to obtain a hash value, comparing the decrypted hash value with a preset hash value, and verifying whether the identity information of the user is correct, thereby ensuring the privacy of the user's identity information and improving the security of the device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer application technology, and in particular relates to a blockchain-based user authentication method, terminal equipment, and computer-readable storage medium. Background Art

[0002] With the continuous advancement of science and technology, the way of information transmission is also constantly upgrading, and the way of value transmission has also been developed simultaneously. From telegraph, telephone, to the Internet, people have fully entered the information age. The Internet enables the entire communication network to achieve efficient information transmission, but it lacks an internal mechanism to effectively protect information security. People cannot transmit information with ownership point to point, and the cost of copying, disseminating or even tampering with a piece of information on the Internet is almost zero. Some traditional industries have been greatly impacted by this. Although governments around the world have continuously increased their efforts to protect the copyright of online information, it is still difficult to eliminate information security and data security issues from a technical level.

[0003] The login method in the prior art is generally to log in with a username and password. This login method faces many potential risks, such as: password theft, password hijacking, password use on multiple machines is easy to detect, weak passwords are easy to attack and other security issues. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a blockchain-based user authentication method, a terminal device, and a computer-readable storage medium to solve the problem of low security of the login method in the prior art.

[0005] A first aspect of an embodiment of the present invention provides a user authentication method based on blockchain, comprising:

[0006] Acquire the signature data generated when the user logs into the chain device in the blockchain system; the signature data is obtained by encrypting the hash value of the user's identity information using the private key corresponding to the chain device;

[0007] Obtaining a public key and a pre-stored hash value corresponding to the chain device; the pre-stored hash value is obtained based on preset identity information corresponding to the chain device;

[0008] Using the public key to decrypt the acquired signed data to obtain a hash value corresponding to the user's identity information, and using the pre-stored hash value to verify the hash value corresponding to the user's identity information;

[0009] If the hash value corresponding to the user's identity information passes the verification, the user is authorized to log in to the chain device.

[0010] A second aspect of an embodiment of the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0011] Acquire the signature data generated when the user logs into the chain device in the blockchain system; the signature data is obtained by encrypting the hash value of the user's identity information using the private key corresponding to the chain device;

[0012] Obtaining a public key and a pre-stored hash value corresponding to the chain device; the pre-stored hash value is obtained based on preset identity information corresponding to the chain device;

[0013] Using the public key to decrypt the acquired signed data to obtain a hash value corresponding to the user's identity information, and using the pre-stored hash value to verify the hash value corresponding to the user's identity information;

[0014] If the hash value corresponding to the user's identity information passes the verification, the user is authorized to log in to the chain device.

[0015] A third aspect of an embodiment of the present invention provides a terminal device, including:

[0016] A first acquisition unit is used to acquire the signature data generated when the user logs into a chain device in the blockchain system; the signature data is obtained by encrypting the hash value of the user's identity information using a private key corresponding to the chain device;

[0017] A second acquisition unit is used to acquire a public key corresponding to the chain device and a pre-stored hash value; the pre-stored hash value is obtained based on preset identity information corresponding to the chain device;

[0018] A data processing unit, configured to use the public key to decrypt the acquired signed data, obtain a hash value corresponding to the identity information of the user, and use the pre-stored hash value to verify the hash value corresponding to the identity information of the user;

[0019] The information verification unit is used to authorize the user to log in to the chain device if the hash value corresponding to the identity information of the user passes the verification.

[0020] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method of the first aspect.

[0021] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0022] The embodiment of the present invention generates a user certificate according to the user's identity information in advance, and uses an asymmetric encryption algorithm to generate a unique corresponding public-private key pair, performs a hash operation on the user certificate through the private key to obtain signed data, obtains the signed data of the chain device of the user when logging into the blockchain system, and decrypts the signed data through the public key corresponding to the chain device to obtain a hash value, compares the decrypted hash value with the preset hash value, verifies whether the user's identity information is correct, thereby ensuring the privacy of the user's identity information and improving the security of the device. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0024] Figure 1 is a flowchart of a blockchain-based user authentication method provided in Embodiment 1 of the present invention;

[0025] Figure 2 is a flowchart of a blockchain-based user authentication method provided in Embodiment 2 of the present invention;

[0026] Figure 3 is a schematic diagram of a terminal device provided in Embodiment 3 of the present invention;

[0027] Figure 4 It is a schematic diagram of a terminal device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0028] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0029] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0030] See also Figure 1 , Figure 1: is a flowchart of a blockchain-based user authentication method provided in Example 1 of the present invention. In this embodiment, the execution subject of the blockchain-based user authentication method is a terminal. The terminal includes but is not limited to mobile terminals such as smart phones, tablet computers, wearable devices, and can also be desktop computers. The blockchain-based user authentication method shown in the figure may include the following steps:

[0031] S101: Obtaining signature data input by a user when logging into a chain device in a blockchain system; the signature data is obtained by encrypting a hash value of the user's identity information using a private key corresponding to the chain device.

[0032] With the continuous advancement of science and technology, the way of information transmission is also constantly upgrading, and the way of value transmission has also been developed synchronously. From telegraph, telephone, to the Internet, people have fully entered the information age. The Internet enables the entire communication network to achieve efficient information transmission, but it lacks an internal mechanism to effectively protect information security. People cannot transmit information with ownership point to point, and the cost of copying, disseminating or even tampering with a piece of information on the Internet is almost zero. Some traditional industries have been greatly impacted by this. Although governments of various countries have continuously increased their efforts to protect the copyright of network information, it is still difficult to eliminate information security and data security issues from a technical level. The login method in the existing technology is generally login by username and password. This login method faces many potential risks, such as: password theft, password hijacking, password use on multiple machines is easy to be detected, weak passwords are easy to be attacked and other security issues.

[0033] In this embodiment, the user already knows his / her signature data before logging into the chain device. The signature data is obtained by performing hash operation and asymmetric encryption based on the user's identity information. Among them, the user's identity information can be information such as the user's input ID number, identity card number or biometrics, which can be one of them or a combination of multiple information. Further, the user's identity information in this embodiment can be divided into two types: biometric identification and behavioral feature identification. Biometrics can include but are not limited to fingerprint recognition, iris, palm prints, face, etc.; behavioral features can include but are not limited to voice recognition, signature and keyboard tapping action recognition.

[0034] When obtaining the signed data, first obtain the user's identity information, obtain the user certificate based on the user's identity information and the preset certificate format, generate a hash value of the user certificate, and encrypt the hash value of the user certificate with the user's private key to obtain the signed data. The signed data is unique to the user and is not known to others.

[0035] By performing a hash operation with the user's unique identity information in advance, a unique hash value of the user information is obtained, which is used to distinguish the user information of the current user from the user information of other users. The hash operation is to compress data of any length into a string of fixed length. The hash function in this embodiment can use Secure Hash Algorithm 1 (SHA-1) or Message Digest Algorithm MD5 (MD5), etc., and other hash operation methods can also be used without limitation here.

[0036] After the hash value is obtained through hash operation, the hash value is encrypted by the private key corresponding to the chain device. The private key corresponding to the chain device is the private key of the user pre-defined by the chain device. The encryption method can be symmetric encryption or asymmetric encryption, which is not limited here. Symmetric encryption algorithm uses the same secret key for encryption and decryption; while asymmetric encryption algorithm requires two keys for encryption and decryption, which are private key and private key. The public key and private key are a pair. If the data is encrypted with the public key, it can only be decrypted with the corresponding private key; if the data is encrypted with the private key, it can only be decrypted with the corresponding public key. Because encryption and decryption use two different keys. Compared with symmetric encryption, asymmetric encryption is more secure: both parties of symmetric encryption use the same secret key. If the secret key of one party is leaked, the entire communication will be cracked. Asymmetric encryption uses a pair of secret keys, one for encryption and the other for decryption. The public key is public and the secret key is saved by itself. It does not need to synchronize the secret key before communication like symmetric encryption. The asymmetric encryption algorithm may be Elgamal, knapsack algorithm, elliptic curve encryption algorithm, etc., which are not limited here.

[0037] It should be noted that in this embodiment, the chain device may correspond to one user or may be used by multiple users. When a chain device is used by multiple users, the corresponding public key is determined by identifying the user information of the user to verify the identity information of the user.

[0038] S102: Acquire a public key corresponding to the chain device and a pre-stored hash value; the pre-stored hash value is obtained based on preset identity information corresponding to the chain device.

[0039] In this embodiment, each chain device has its corresponding user, and the user authenticates and logs in by inputting his or her own signature data. Therefore, each chain device in this embodiment has its corresponding public key, which is used to authenticate the user information. The public key can be stored in the chain device or in the database of the server, which is not limited here. The user's identity information can be the user's certificate information, the user's biometric information, etc.

[0040] When calculating the hash value of the chain device, it is obtained by performing a hash operation based on the identity information of the threshold corresponding to the chain device. In this embodiment, each chain device has its corresponding user, and the identity information of the user corresponds to the chain device. Therefore, a hash operation is performed on the identity information of the user to obtain a hash value, and the hash value is stored in the corresponding chain device, so that when a user logs in to the chain device, the user identity of the user who attempts to log in to the chain device is verified by the pre-stored hash value.

[0041] S103: Use the public key to decrypt the acquired signed data to obtain a hash value corresponding to the user's identity information, and use the pre-stored hash value to verify the hash value corresponding to the user's identity information.

[0042] After obtaining the signature data generated when the user logs into the chain device in the blockchain, the public key corresponding to the chain device, and the hash value pre-stored in the chain device, the signature data is decrypted by the public key to obtain the hash value corresponding to the identity information of the logged-in user. Specifically, when decrypting the signature data, according to the encryption method used when encrypting the hash value of the identity information, the public key is used to decrypt the hash value corresponding to the identity information of the user.

[0043] In actual applications, the signature of user A can only be decrypted by the public key of user A, so that the chain device can confirm that the identity information is indeed sent by user A. Therefore, in this embodiment, the hash value obtained by decryption is compared with the preset hash value to verify whether the identity information of the user is correct.

[0044] S104: If the hash value corresponding to the user's identity information passes the verification, the user is authorized to log in to the chain device.

[0045] After using the pre-stored hash value to verify the hash value corresponding to the user's identity information, if the hash value obtained by decryption is the same as the preset hash value, it means that the currently logged-in user information is correct, and the user is the correct user corresponding to the chain device, and the user is authorized to log in to the chain device.

[0046] If the hash value obtained by decrypting the signature is different from the preset hash value, it means that the currently logged-in user information is incorrect, and the user's signature information may be input incorrectly. In this case, a notification to re-enter the information can be sent to the chain device; if the currently logged-in user information is incorrect, it may be that a malicious user wants to log in to the chain device. In this case, a warning message is sent to the chain device to prevent the user from making operations that are harmful to the device or the entire system.

[0047] The above scheme obtains the signature data generated when the user logs into the chain device in the blockchain system; obtains the public key corresponding to the chain device and the pre-stored hash value; the pre-stored hash value is obtained based on the preset identity information corresponding to the chain device; uses the public key to decrypt the acquired signature data to obtain the hash value corresponding to the user's identity information, and uses the pre-stored hash value to verify the hash value corresponding to the user's identity information; if the hash value corresponding to the user's identity information passes the verification, the user is authorized to log in to the chain device. By obtaining the signature data of the chain device when the user logs into the blockchain system, and decrypting the signature data using the public key corresponding to the chain device to obtain the hash value, the decrypted hash value is compared with the preset hash value to verify whether the user's identity information is correct, which ensures that the user's login information is not stolen or tampered with, and also improves the security of the device.

[0048] See also Figure 2 , Figure 2 : is a flowchart of a blockchain-based user authentication method provided in Embodiment 2 of the present invention. In this embodiment, the execution subject of the blockchain-based user authentication method is a terminal. The terminal includes but is not limited to mobile terminals such as smart phones, tablet computers, wearable devices, and can also be desktop computers. The blockchain-based user authentication method shown in the figure may include the following steps:

[0049] S201: Acquire the identity information of a registered user, and generate a user certificate according to the identity information of the registered user.

[0050] Before a user logs in to various chain devices of the blockchain system, it is necessary to obtain some information of the user in order to verify the user information entered by the user when logging in. In this embodiment, the user information of the user can be obtained first and registered to realize the user information archiving of the user.

[0051] Specifically, step S201 in this embodiment may specifically include steps S2011 to S2012:

[0052] S2011: Obtain the user's identity information; the identity information includes but is not limited to one or a combination of at least two of the following information: user account, ID number or biometrics.

[0053] In this embodiment, the user's identity information may include, but is not limited to: user account, ID number or biometrics. The biometrics may include, but are not limited to, physiological characteristics or behavioral characteristics inherent in the human body, such as fingerprints, irises, facial features, gait, typing habits, etc. It should be noted that the user identity information obtained in this embodiment may include one of the above information. In order to ensure the comprehensiveness and non-tamperability of the user information, it may also be a combination of at least two of the above information.

[0054] In practical applications, biometrics is a technology that uses human biological characteristics for identity authentication. More specifically, biometrics is a technology that uses computers, optics, acoustics, biosensors, biostatistics and other high-tech means to closely combine and use the inherent physiological and behavioral characteristics of the human body to identify personal identity. The biometric system samples biological characteristics, extracts their unique characteristics and converts them into digital codes, and further combines these codes into feature templates. When people interact with the recognition system for identity authentication, the recognition system obtains their characteristics and compares them with the feature templates in the data to determine whether they match, so as to decide whether to accept or reject the person. Biometrics include but are not limited to biometrics such as hand shape, fingerprints, face shape, iris, retina, pulse, auricle, etc., and behavioral characteristics include signatures, voices, keystrokes, etc. Among them, the structure of an individual's iris is unique and non-hereditary, so that even identical twins have different irises, and since childhood, they have basically not changed, making it very suitable for biometrics. Statistics show that so far, the error rate of iris recognition is the lowest among all biometric recognition.

[0055] 2012: The identity information is reviewed. If the review is passed, the identity information is input into a preset certificate structure based on the blockchain distributed ledger technology to obtain the user certificate.

[0056] After obtaining the user's identity information, the identity information is reviewed, including but not limited to: whether the format of the identity information conforms to the preset data format, whether the data integrity of the identity information meets the preset integrity requirements, and whether the data in the identity information conforms to the preset data generation time interval.

[0057] For example, when obtaining an ID card image as the user's identity information, it is necessary to review whether the ID card's validity date is qualified; when obtaining the user's fingerprint information, it is necessary to review whether the obtained fingerprint information is complete, etc.

[0058] Furthermore, step S201 may also include:

[0059] Obtain the user's identity information and verify whether the identity information is within a preset validity period;

[0060] If the identity information is within the validity period, generating a user certificate according to the identity information;

[0061] If the identity information is not within the validity period, new identity information of the user is obtained, and a new user certificate is generated according to the new identity information to replace the previous user certificate.

[0062] Specifically, in actual applications, if a certain identity information is used for a long time, it is easy to be tampered with and the security of the identity information cannot be guaranteed. Therefore, an expiration date is set in this embodiment. If the use time of the identity information reaches the expiration date, new identity information needs to be obtained to replace the old identity information to ensure the security and privacy of the identity information.

[0063] After the acquired identity information is qualified, the identity information is input into the certificate structure according to the preset certificate structure to obtain the user certificate.

[0064] Exemplarily, the user certificate can be obtained by entering the identity information used in the predefined structure of the X.509 certificate. X.509 is a digital certificate standard established by the International Telecommunication Union. In the X.509 system, the certificate issued by the e-commerce certification authority (CA) is bound to a unique distinguished name in accordance with the management of X.500, which can contain multiple fields and values ​​and can also support aliases. The trusted root certificate of an organization will be distributed to all employees who need to use the system. Mainstream browsers will pre-install a part of the root certificates, which are all trusted certificate certification authorities CA, so that the certificates issued by them can be directly trusted by the browser. Although users can delete or disable these root certificates, in fact, users rarely do so. On the latest Microsoft platform, even after the user removes the pre-installed root certificates, when the user visits the deleted root certificate websites again, these root certificates will be automatically restored to the trust list.

[0065] S202: Generate a unique key pair using an asymmetric encryption algorithm; the key pair includes a public key and a private key, and the private key and the public key uniquely correspond to each other.

[0066] Software or hardware modules that implement asymmetric encryption functions generally have the ability to generate and protect private keys. In the case of encryption security hardware such as smart cards, the generation and protection of private keys will be inside these hardware. When private keys are bound to security hardware, users can easily understand and implement the management requirements for these physical security credentials that store private keys. When there is no external security hardware, the encryption software package uses the resources of the local computing platform to generate key pairs and protect private keys. This file format for storing private keys is threatened by malicious code on the computer, and its security requirements for users are relatively high.

[0067] Symmetric encryption algorithms themselves have no constraints on the value of the key, although we will intentionally avoid some key values ​​that are too regular. Unlike symmetric keys, asymmetric encryption algorithms cannot use arbitrary bit strings as keys. The keys used in asymmetric encryption are particularly large numbers that meet the requirements of the algorithm principle. For example, the key of the RSA algorithm comes from two large prime numbers. There is no key exchange and distribution for asymmetric private keys. Asymmetric private keys should only be generated in a secure and controllable environment for the intended private key holder. Since there is no need to share with anyone else, asymmetric private keys are easier to control. In this way, we can establish a secure asymmetric encryption system in which only the owner of the private key can decrypt and sign the intended content.

[0068] Exemplarily, the RSA (Ron Rivest, Adi Shamir, Leonard Adleman) algorithm is the earliest widely used asymmetric encryption algorithm, which is based on the difficulty of factoring the product of large prime numbers. A newer asymmetric encryption algorithm is ECC, which is based on the discrete logarithm problem. It can achieve security comparable to RSA with less computing resource consumption. In this embodiment, a unique public-private key pair is generated by an asymmetric encryption algorithm, wherein the private key and the public key uniquely correspond, the private key is used to sign the user's identity information, and the public key is used to decrypt the signed data.

[0069] S203: Performing a hash operation on the user certificate using the private key to obtain signature data.

[0070] The hash operation can map an input of any length into an output of a fixed length, i.e., a hash value. In this embodiment, in order to implement a digital signature for a long file, a hash function operation is first performed on the message, and then the hash value of the message is signed instead of the original message. The hash function has the characteristics of one-way and collision resistance.

[0071] Digital signature, the signer processes the message and generates a digital string that cannot be forged by others. This digital string is also a valid proof of the authenticity of the message sent by the signer of the message. The use of digital signature technology can ensure the integrity of message transmission and the identity authentication of the sender, and prevent the occurrence of repudiation in transactions. In the device login system of this embodiment, asymmetric encryption can be used. The user's private key in the device login system is used for the current owner of the chain device. The owner must use the private key to sign the transaction message to prove that the publisher of the message is the owner of the corresponding chain device address. Without a private key, the user cannot sign the message. The public key is used to generate the user's chain device address.

[0072] For example, the user's public key is a 65-byte random number generated by the private key through the elliptic curve algorithm, and then a 20-byte message digest is generated through a hash operation as the main information of the chain device address, and then the version number information is added in front, and a 4-byte address check code is added at the end. The address check code is obtained by performing two hash operations on the summary result, and the first four bits of the hash value are taken to generate it. Finally, the version information, main information and address check code are put together and converted into an easily recognizable string through characters as the chain device address. The private key is the most important in the blockchain system. Once lost, it means that the property corresponding to the public key address is also lost. By using digital signatures, the blockchain device login system ensures the integrity and non-repudiation of the message, so that users can log in to the system safely.

[0073] S204: Obtain the signature data generated when the user logs into the chain device in the blockchain system; the signature data is obtained by encrypting the hash value of the user's identity information using the private key corresponding to the chain device.

[0074] In this embodiment, S204 and Figure 1 The implementation method of S101 in the corresponding embodiment is exactly the same, and the specific implementation method can be referred to Figure 1 The relevant description of S101 in the corresponding embodiment will not be repeated here.

[0075] S205: Acquire a public key corresponding to the chain device and a pre-stored hash value; the pre-stored hash value is obtained based on preset identity information corresponding to the chain device.

[0076] In this embodiment, S205 and Figure 1 The implementation method of S102 in the corresponding embodiment is exactly the same, and the specific implementation method can be referred to Figure 1 The relevant description of S102 in the corresponding embodiment will not be repeated here.

[0077] S206: Use the public key to decrypt the acquired signed data to obtain a hash value corresponding to the user's identity information, and use the pre-stored hash value to verify the hash value corresponding to the user's identity information.

[0078] In this embodiment, S206 and Figure 1 The implementation method of S103 in the corresponding embodiment is exactly the same, and the specific implementation method can be referred to Figure 1 The relevant description of S103 in the corresponding embodiment will not be repeated here.

[0079] S207: If the hash value corresponding to the user's identity information passes the verification, the user is authorized to log in to the chain device.

[0080] In this embodiment, S207 and Figure 1The implementation method of S104 in the corresponding embodiment is exactly the same, and the specific implementation method can be referred to Figure 1 The relevant description of S104 in the corresponding embodiment will not be repeated here.

[0081] Furthermore, after step S207, the following steps may be further included:

[0082] Receiving a successful login message sent by the chain device; the successful login message includes user information of the user;

[0083] Searching for user authority information corresponding to the user information from a preset authority database according to the user information;

[0084] The user authority information is sent to all chain devices in a preset device system; the user authority information is used by the chain devices to set the operation authority of the user.

[0085] Specifically, in the preset blockchain-based network system, there are many chain devices, each of which has its own corresponding user, and each user has his own permissions. Each chain device in the system operates according to its corresponding user permissions, and at the same time, all chain devices can also obtain the working methods and working data of other chain devices. However, it is still inevitable that some chain devices will exceed their own operating permissions. In this case, after the server receives the login success information sent by the chain device, it searches for the user permissions corresponding to the user information from the preset permission database according to the user information in the login success information, and sends the user permissions to the chain device to control the operating permissions of the chain device.

[0086] Furthermore, user permissions can be sent to all chain devices to notify all chain devices in the system of the permission information of the chain device, so that other chain devices can supervise the operation of the chain device. In this way, it can be ensured that each chain device in the system can operate normally and safely.

[0087] The above scheme generates a user certificate in advance according to the user's identity information, and uses an asymmetric encryption algorithm to generate a unique corresponding public-private key pair, performs a hash operation on the user certificate through the private key to obtain the signed data, obtains the signed data of the chain device of the user when logging into the blockchain system, and decrypts the signed data through the public key corresponding to the chain device to obtain a hash value, compares the decrypted hash value with the preset hash value, verifies whether the user's identity information is correct, ensures the privacy of the user's identity information, and improves the security of the device.

[0088] See also Figure 3 , Figure 3 Schematic diagram of a terminal device provided in Embodiment 3 of the present invention. The terminal device includes units for executing Figure 1-2 For details, please refer to the steps in the corresponding embodiment. Figure 1-2 For the convenience of explanation, only the parts related to this embodiment are shown. The terminal device 300 of this embodiment includes:

[0089] The first acquisition unit 301 is used to acquire the signature data generated when the user logs into the chain device in the blockchain system; the signature data is obtained by encrypting the hash value of the user's identity information using the private key corresponding to the chain device;

[0090] A second acquisition unit 302 is used to acquire a public key corresponding to the chain device and a pre-stored hash value; the pre-stored hash value is obtained based on preset identity information corresponding to the chain device;

[0091] The data processing unit 303 is used to use the public key to decrypt the acquired signed data, obtain the hash value corresponding to the identity information of the user, and use the pre-stored hash value to verify the hash value corresponding to the identity information of the user;

[0092] The information verification unit 304 is used to authorize the user to log in to the chain device if the hash value corresponding to the identity information of the user passes the verification.

[0093] Furthermore, the terminal device may also include:

[0094] A first generating unit, used to obtain the identity information of a registered user and generate a user certificate according to the identity information of the registered user;

[0095] A key generation unit, used to generate a unique key pair using an asymmetric encryption algorithm; the key pair includes a public key and a private key, and the private key and the public key are uniquely corresponding;

[0096] A hash operation unit is used to perform a hash operation on the user certificate using the private key to obtain signature data.

[0097] Furthermore, the first generating unit may include:

[0098] A third acquisition unit is used to acquire the identity information of the user; the identity information includes but is not limited to one or a combination of at least two of the following information: user account number, ID number or biometric feature;

[0099] The second generating unit is used to review the identity information. If the review is passed, the identity information is input into a preset certificate structure based on the blockchain distributed ledger technology to obtain the user certificate.

[0100] Furthermore, the first generating unit may include:

[0101] An information detection unit, used to obtain the user's identity information and detect whether the identity information is within a preset validity period;

[0102] A third generating unit, configured to generate a user certificate according to the identity information if the identity information is within the validity period;

[0103] A data updating unit is used to reacquire the identity information of the user if the identity information is not within the validity period, generate a new user certificate according to the new identity information, and replace the user certificate with the new user certificate.

[0104] Furthermore, the terminal device may also include:

[0105] A fourth acquisition unit is used to receive the login success information sent by the chain device; the login success information includes the user information of the user;

[0106] The authority determination unit is used to search for user authority information corresponding to the user information from a preset authority database according to the user information;

[0107] The authority sending unit is used to send the user authority information to all chain devices in a preset device system; the user authority information is used by the chain device to set the user's operation authority.

[0108] The above scheme generates a user certificate in advance according to the user's identity information, and uses an asymmetric encryption algorithm to generate a unique corresponding public-private key pair, performs a hash operation on the user certificate through the private key to obtain the signed data, obtains the signed data of the chain device of the user when logging into the blockchain system, and decrypts the signed data through the public key corresponding to the chain device to obtain a hash value, compares the decrypted hash value with the preset hash value, verifies whether the user's identity information is correct, ensures the privacy of the user's identity information, and improves the security of the device.

[0109] Figure 4 Schematic diagram of a terminal device provided by Embodiment 4 of the present invention. Figure 4 As shown, the terminal device 4 of this embodiment includes: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40. When the processor 40 executes the computer program 42, the steps in the above-mentioned blockchain-based user authentication method embodiment are implemented, such as Figure 1 Alternatively, when the processor 40 executes the computer program 42, the functions of each module / unit in the above-mentioned device embodiments are realized, for example, Figure 3 The functions of units 301 to 304 are shown.

[0110] Exemplarily, the computer program 42 may be divided into one or more modules / units, which are stored in the memory 41 and executed by the processor 40 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program 42 in the terminal device 4.

[0111] The terminal device 4 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 4 It is only an example of the terminal device 4 and does not constitute a limitation on the terminal device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.

[0112] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0113] The memory 41 may be an internal storage unit of the terminal device 4, such as a hard disk or memory of the terminal device 4. The memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FC), etc. equipped on the terminal device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used to store the computer program and other programs and data required by the terminal device. The memory 41 may also be used to temporarily store data that has been output or is to be output.

[0114] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0115] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0116] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0117] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium.

[0118] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A user authentication method based on blockchain, characterized in that: include: Obtain the signature data generated when the user logs into the chain device in the blockchain system; The signature data is obtained by encrypting the hash value of the user's identity information using the private key corresponding to the chain device; Obtain the public key corresponding to the chain device and the pre-stored hash value; The pre-stored hash value is obtained based on the preset identity information corresponding to the chain device; The acquired signed data is decrypted using the public key to obtain a hash value corresponding to the user's identity information, and the pre-stored hash value is used to verify the hash value corresponding to the user's identity information; If the hash value corresponding to the user's identity information passes the verification, the user is authorized to log in to the chain device; Before obtaining the public key corresponding to the chain device and the pre-stored hash value, the method further includes: Obtaining the identity information of the registered user and generating a user certificate based on the identity information of the registered user; An asymmetric encryption algorithm is used to generate a unique key pair; the key pair includes a public key and a private key, and the private key and the public key are uniquely corresponding; Performing a hash operation on the user certificate using the private key to obtain the pre-stored hash value; The obtaining of the identity information of the registered user and generating a user certificate according to the identity information of the registered user includes: Obtain the user's identity information and detect whether the usage time of the identity information is within the preset validity period; If the identity information is within the validity period, generating a user certificate according to the identity information; If the identity information is not within the validity period, re-acquire the identity information of the user, generate a new user certificate based on the new identity information, and replace the user certificate with the new user certificate; If the hash value corresponding to the identity information of the user passes the verification, then after authorizing the user to log in to the chain device, the method further includes: Receiving a login success message sent by the chain device; the login success message includes user information of the user; Searching for user authority information corresponding to the user information from a preset authority database according to the user information; The user authority information is sent to all chain devices in a preset device system; the user authority information is used by the chain devices to set the operation authority of the user.

2. The blockchain-based user authentication method according to claim 1, characterized in that: The obtaining of the identity information of the registered user and generating a user certificate according to the identity information of the registered user includes: Obtaining the user's identity information; the identity information includes one or a combination of at least two of the following information: user account number, ID number or biometrics; The identity information is reviewed, and if the review is passed, the identity information is input into a preset certificate structure based on the blockchain distributed ledger technology to obtain the user certificate.

3. A terminal device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and wherein when the processor executes the computer program, the following steps are implemented: Acquire the signature data generated when the user logs into the chain device in the blockchain system; the signature data is obtained by encrypting the hash value of the user's identity information using the private key corresponding to the chain device; Obtaining a public key and a pre-stored hash value corresponding to the chain device; the pre-stored hash value is obtained based on preset identity information corresponding to the chain device; The acquired signed data is decrypted using the public key to obtain a hash value corresponding to the user's identity information, and the pre-stored hash value is used to verify the hash value corresponding to the user's identity information; If the hash value corresponding to the user's identity information passes the verification, the user is authorized to log in to the chain device; Before obtaining the signature data generated by the user when logging into the chain device in the blockchain system, the method further includes: Obtaining the identity information of the registered user and generating a user certificate based on the identity information of the registered user; An asymmetric encryption algorithm is used to generate a unique key pair; the key pair includes a public key and a private key, and the private key and the public key are uniquely corresponding; Performing a hash operation on the user certificate using the private key to obtain signature data; The obtaining of the identity information of the registered user and generating a user certificate according to the identity information of the registered user includes: Obtain the user's identity information and detect whether the usage time of the identity information is within the preset validity period; If the identity information is within the validity period, generating a user certificate according to the identity information; If the identity information is not within the validity period, re-acquire the identity information of the user, generate a new user certificate based on the new identity information, and replace the user certificate with the new user certificate; If the hash value corresponding to the identity information of the user passes the verification, then after authorizing the user to log in to the chain device, the method further includes: Receiving a login success message sent by the chain device; the login success message includes user information of the user; Searching for user authority information corresponding to the user information from a preset authority database according to the user information; The user authority information is sent to all chain devices in a preset device system; the user authority information is used by the chain devices to set the operation authority of the user.

4. The terminal device according to claim 3, characterized in that: The obtaining of the identity information of the registered user and generating a user certificate according to the identity information of the registered user includes: Obtaining the user's identity information; the identity information includes one or a combination of at least two of the following information: user account number, ID number or biometrics; The identity information is reviewed, and if the review is passed, the identity information is input into a preset certificate structure based on the blockchain distributed ledger technology to obtain the user certificate.

5. A terminal device, characterized in that: include: A first acquisition unit is used to acquire the signature data generated when the user logs into the chain device in the blockchain system; The signature data is obtained by encrypting the hash value of the user's identity information using the private key corresponding to the chain device; A second acquisition unit, used to acquire a public key corresponding to the chain device and a pre-stored hash value; The pre-stored hash value is obtained based on the preset identity information corresponding to the chain device; A data processing unit, configured to use the public key to decrypt the acquired signed data, obtain a hash value corresponding to the identity information of the user, and use the pre-stored hash value to verify the hash value corresponding to the identity information of the user; An information verification unit, configured to authorize the user to log in to the chain device if the hash value corresponding to the identity information of the user passes the verification; The terminal device further includes: A first generating unit is used to obtain the identity information of the user and detect whether the usage time of the identity information is within a preset validity period; A key generation unit, used to generate a unique key pair using an asymmetric encryption algorithm; the key pair includes a public key and a private key, and the private key and the public key are uniquely corresponding; A hash operation unit, used to perform a hash operation on the user certificate using the private key to obtain the signature data; The first generating unit comprises: An information detection unit, used to obtain the user's identity information and detect whether the identity information is within a preset validity period; A third generating unit, configured to generate a user certificate according to the identity information if the identity information is within the validity period; a data updating unit, configured to reacquire the identity information of the user if the identity information is not within the validity period, generate a new user certificate according to the new identity information, and replace the user certificate with the new user certificate; The terminal device further includes: A fourth acquisition unit is used to receive the login success information sent by the chain device; the login success information includes the user information of the user; The authority determination unit is used to search for user authority information corresponding to the user information from a preset authority database according to the user information; The authority sending unit is used to send the user authority information to all chain devices in a preset device system; the user authority information is used by the chain device to set the user's operation authority.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to claim 1 or 2 are implemented.

Citation Information

Patent Citations

  • User authentication method and system

    CN107257336A