CN111131269A - User information verification method and device based on block chain - Google Patents

User information verification method and device based on block chain Download PDF

Info

Publication number
CN111131269A
CN111131269A CN201911373274.4A CN201911373274A CN111131269A CN 111131269 A CN111131269 A CN 111131269A CN 201911373274 A CN201911373274 A CN 201911373274A CN 111131269 A CN111131269 A CN 111131269A
Authority
CN
China
Prior art keywords
user
information
login
value
identity
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911373274.4A
Other languages
Chinese (zh)
Inventor
丁月辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201911373274.4A priority Critical patent/CN111131269A/en
Publication of CN111131269A publication Critical patent/CN111131269A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/18Network architectures or network communication protocols for network security using different networks or channels, e.g. using out of band channels
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Abstract

The invention discloses a user information verification method and a device based on a block chain, wherein the method comprises the following steps: receiving a login request sent by a login user through a client; performing MD5 encryption calculation on the user identification and the identity authentication information contained in the login request to obtain a first MD5 value; searching a second MD5 value of the login user stored in the blockchain system according to the user identification contained in the login request, wherein the blockchain system stores the user identification and the authentication information of one or more users which are acquired in advance, and the MD5 value obtained by carrying out MD5 encryption calculation on the user identification and the authentication information of each user; verifying whether the first MD5 value and the second MD5 value are consistent; and when the value of the first MD5 is consistent with that of the second MD5, the identity information of the login user is verified according to the identity verification information contained in the login request. The invention stores the user information by using the block chain, and can avoid the user information from being forged or falsified.

Description

User information verification method and device based on block chain
Technical Field
The present invention relates to the field of blockchains, and in particular, to a method and an apparatus for verifying user information based on a blockchain.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
With the continuous development of information technology, the problem of information security is increasingly prominent. User information verification is an important means for various application systems to guarantee information security.
At present, most of the existing user information authentication methods for various application systems authenticate user information such as a user name and a password of a current login user, but the user information is stored in a centralized manner and is usually stored in a single server, and if a hacker breaks through the server, the hacker can easily steal or tamper the user information on the server.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a user information verification method based on a block chain, which is used for solving the technical problem that the user information is easy to forge or tamper due to the fact that the user information is stored by a single node in the conventional user information verification method, and comprises the following steps: receiving a login request sent by a login user through a client, wherein the login request comprises: logging in user identification and identity authentication information of a user; performing MD5 encryption calculation on the user identification and the identity authentication information contained in the login request to obtain a first MD5 value; searching a second MD5 value of the login user stored in the blockchain system according to the user identification contained in the login request, wherein the blockchain system stores the user identification and the authentication information of one or more users which are acquired in advance, and the MD5 value obtained by carrying out MD5 encryption calculation on the user identification and the authentication information of each user; verifying whether the first MD5 value and the second MD5 value are consistent; and when the value of the first MD5 is consistent with that of the second MD5, the identity information of the login user is verified according to the identity verification information contained in the login request.
The embodiment of the invention also provides a user information verification device based on the block chain, which is used for solving the technical problem that the user information is easy to forge or tamper due to the fact that the user information is stored by adopting a single node in the conventional user information verification method, and the device comprises: the login module is used for receiving a login request sent by a login user through a client, wherein the login request comprises: logging in user identification and identity authentication information of a user; the MD5 encryption calculation module is used for carrying out MD5 encryption calculation on the user identification and the identity verification information contained in the login request to obtain a first MD5 value; the blockchain searching module is used for searching a second MD5 value of the login user stored in the blockchain system according to the user identifier contained in the login request, wherein the blockchain system stores the user identifier and the authentication information of one or more users which are acquired in advance, and the MD5 value obtained by carrying out MD5 encryption calculation on the user identifier and the authentication information of each user; a first information verification module for verifying whether the first MD5 value is consistent with the second MD5 value; and the second information verification module is used for verifying the identity information of the login user according to the identity verification information contained in the login request under the condition that the value of the first MD5 is consistent with the value of the second MD 5.
The embodiment of the invention also provides computer equipment for solving the technical problem that the user information is easy to forge or tamper due to the fact that the user information is stored in a single node in the conventional user information verification method.
The embodiment of the invention also provides a computer readable storage medium, which is used for solving the technical problem that the user information is easy to forge or tamper due to the fact that the user information is stored by adopting a single node in the existing user information verification method.
In the embodiment of the invention, the user identification and the identity authentication information of each user, and the MD5 value obtained by carrying out MD5 encryption calculation on the user identification and the identity authentication information of each user are stored in a block chain system in advance; after a login request sent by a login user through a client is received, performing MD5 encryption calculation on user identification and identity authentication information contained in the login request to obtain a first MD5 value; then, according to the user identification contained in the login request, a second MD5 value of the login user stored on the blockchain system is searched, and whether the first MD5 value is consistent with the second MD5 value is verified; and when the value of the first MD5 is consistent with that of the second MD5, the identity information of the login user is verified according to the identity verification information contained in the login request.
By the embodiment of the invention, the user information for verifying the user identity information is uploaded to the block chain system, and the user information is stored by utilizing a plurality of nodes in the block chain system, so that the block chain system has non-repudiation and anti-counterfeiting performance, and the problem that the user information is forged or falsified can be effectively avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a flowchart of a block chain-based user information verification method according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating an encryption principle of an MD5 encryption algorithm provided in an embodiment of the present invention;
fig. 3 is a schematic diagram of a block chain-based user information verification system according to an embodiment of the present invention;
fig. 4 is a flowchart of a user information registration or modification provided in an embodiment of the present invention;
fig. 5 is a flowchart of a user information login process provided in an embodiment of the present invention;
fig. 6 is a schematic diagram of a block chain-based user information verification apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
In the description of the present specification, the terms "comprising," "including," "having," "containing," and the like are used in an open-ended fashion, i.e., to mean including, but not limited to. Reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," etc., means that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the embodiments is for illustrative purposes to illustrate the implementation of the present application, and the sequence of steps is not limited and can be adjusted as needed.
The embodiment of the invention provides a user information verification method based on a block chain, which can be applied to any application system needing login verification. Fig. 1 is a flowchart of a block chain-based user information verification method provided in an embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
s101, receiving a login request sent by a login user through a client, wherein the login request comprises: user identification and authentication information of the login user.
It should be noted that, in the embodiment of the present invention, the client may be, but is not limited to, a mobile phone, a notebook computer, a computer, or a terminal device; the login request in S101 may be a login request requesting to login to any application system or server (e.g., a pan login request, a wechat login request, an online banking login request, etc.); the user identifier included in the login request may be identification information that uniquely identifies the login user (e.g., a user ID assigned by various application systems to the registered user, etc.); the authentication information included in the login request may be information for authenticating the identity of the login user, including but not limited to a user name or a password for registering the user in various application systems. The information used to verify the identity of the logged-in user may be different for different application systems.
S102, MD5 encryption calculation is carried out on the user identification and the identity verification information contained in the login request, and a first MD5 value is obtained.
It should be noted that MD5 is called Message Digest Algorithm (Message Digest Algorithm), and is a widely used cryptographic hash function, and can generate a 128-bit hash value from a plaintext string with any length according to a certain rule, and even if the plaintext Message is changed a little, the generated result will be completely different, so that it can ensure the information transmission to be complete and consistent according to the MD5 value.
The bottom layer implementation process of the MD5 encryption algorithm mainly comprises the following four steps:
firstly, processing an original text: the result of the remainder of the length of the original (bit) to 512 is calculated and if not equal to 448, the original needs to be filled in such a way that the result of the remainder of the original to 512 is equal to 448. The method of padding is that the first bit is padded with 1 and the rest of the bits are padded with 0. After filling, the length of the message is 512 × N + 448. The remaining positions (512-.
Secondly, setting an initial value: the hash result of the MD5 encryption algorithm is 128 bits long, and is divided into 4 groups per 32 bits. These 4 sets of results are derived from 4 initial values A, B, C, D over time. The initial values of A, B, C, D in the MD5 encryption algorithm are as follows (16 ary): a is 0x 01234567; b ═ 0x89 ABCDEF; c ═ 0 xfeedcba 98; d ═ 0x 76543210.
Step three, circular processing: fig. 2 shows the flow of A, B, C, D evolution in a single cycle. A, B, C, D are four packets of hash values, as shown in FIG. 2. Each cycle allows the old ABCD to generate a new ABCD. The number of cycles is determined by the length of the original text after processing. Assuming that the length of the processed original text is M, the number of main cycles is M/512; each main cycle contains 512/32 × 4 ═ 64 subcycles. FIG. 2 shows a single sub-cycle flow.
The following explains the respective elements referred to in fig. 2 one by one:
icon 201 shows a non-linear function the MD5 uses four functions:
F(X,Y,Z)=(X&Y)|((-X)&Z);
G(X,Y,Z)=(X&Z)|(Y&(-Z));
H(X,Y,Z)=X∧Y∧Z;
I(X,Y,Z)=Y∧(X|(-Z));
in the next 64 sub-cycles of the main cycle F, G, H, I alternates between using F16 times first, G16 times second, H16 times third and I16 times fourth.
icon 202 represents an addition.
③ Mi represents the original text after the first step, in the first step, the length of the original text after the treatment is an integral multiple of 512, every 512 bits of the original text are divided into 16 equal parts which are named as M0-M15, each equal part is 32 in length, and in 64 sub-cycles, every 16 cycles are alternately used for one of M1-M16.
④ Ki denotes a constant, which is different for each of the 64 sub-cycles.
icon 203 shows a shift left by S, the value of S also being constant.
Finally, the result of the calculation is added to B to replace the original B. The generation of new ABCD can be summarized as: new a is original d; new B + ((a + F (B, c, d) + Mi + Ki) <; new C is original b; new D is original c.
It should be noted that 64 sub-loops in the main loop can be summarized as the following four parts:
a first round:
“FF(a,b,c,d,M0,7,0xd76aa478)s[0]=7,K[0]=0xd76aa478;
FF(a,b,c,d,M1,12,0xe8c7b756)s[1]=12,K[1]=0xe8c7b756;
FF(a,b,c,d,M2,17,0x242070db);
FF(a,b,c,d,M3,22,0xc1bdceee);
FF(a,b,c,d,M4,7,0xf57c0faf);
FF(a,b,c,d,M5,12,0x4787c62a);
FF(a,b,c,d,M6,17,0xa8304613);
FF(a,b,c,d,M7,22,0xfd469501);
FF(a,b,c,d,M8,7,0x698098d8);
FF(a,b,c,d,M9,12,0x8b44f7af);
FF(a,b,c,d,M10,17,0xffff5bb1);
FF(a,b,c,d,M11,22,0x895cd7be);
FF(a,b,c,d,M12,7,0x6b901122);
FF(a,b,c,d,M13,12,0xfd987193);
FF(a,b,c,d,M14,17,0xa679438e);
FF(a,b,c,d,M15,22,0x49b40821)”
and a second round:
“GG(a,b,c,d,M1,5,0xf61e2562);
GG(a,b,c,d,M6,9,0xc040b340);
GG(a,b,c,d,M11,14,0x265e5a51);
GG(a,b,c,d,M0,20,0xe9b6c7aa);
GG(a,b,c,d,M5,5,0xd62f105d);
GG(a,b,c,d,M10,9,0×02441453);
GG(a,b,c,d,M15,14,0xd8a1e681);
GG(a,b,c,d,M4,20,0xe7d3fbc8);
GG(a,b,c,d,M9,5,0x21e1cde6);
GG(a,b,c,d,M14,9,0xc33707d6);
GG(a,b,c,d,M3,14,0xf4d50d87);
GG(a,b,c,d,M8,20,0x455a14ed);
GG(a,b,c,d,M13,5,0xa9e3e905);
GG(a,b,c,d,M2,9,0xfcefa3f8);
GG(a,b,c,d,M7,14,0x676f02d9);
GG(a,b,c,d,M12,20,0x8d2a4c8a)”
and a third round:
“HH(a,b,c,d,M5,4,0xfffa3942);
HH(a,b,c,d,M8,11,0x8771f681);
HH(a,b,c,d,M11,16,0x6d9d6122);
HH(a,b,c,d,M14,23,0xfde5380c);
HH(a,b,c,d,M1,4,0xa4beea44);
HH(a,b,c,d,M4,11,0x4bdecfa9);
HH(a,b,c,d,M7,16,0xf6bb4b60);
HH(a,b,c,d,M10,23,0xbebfbc70);
HH(a,b,c,d,M13,4,0x289b7ec6);
HH(a,b,c,d,M0,11,0xeaa127fa);
HH(a,b,c,d,M3,16,0xd4ef3085);
HH(a,b,c,d,M6,23,0x04881d05);
HH(a,b,c,d,M9,4,0xd9d4d039);
HH(a,b,c,d,M12,11,0xe6db99e5);
HH(a,b,c,d,M15,16,0x1fa27cf8);
HH(a,b,c,d,M2,23,0xc4ac5665)”
fourth wheel:
“Ⅱ(a,b,c,d,M0,6,0xf4292244);
Ⅱ(a,b,c,d,M7,10,0x432aff97);
Ⅱ(a,b,c,d,M14,15,0xab9423a7);
Ⅱ(a,b,c,d,M5,21,0xfc93a039);
Ⅱ(a,b,c,d,M12,6,0x655b59c3);
Ⅱ(a,b,c,d,M3,10,0x8f0ccc92);
Ⅱ(a,b,c,d,M10,15,0xffeff47d);
Ⅱ(a,b,c,d,M1,21,0x85845dd1);
Ⅱ(a,b,c,d,M8,6,0x6fa87e4f);
Ⅱ(a,b,c,d,M15,10,0xfe2ce6e0);
Ⅱ(a,b,c,d,M6,15,0xa3014314);
Ⅱ(a,b,c,d,M13,21,0x4e0811a1);
Ⅱ(a,b,c,d,M4,6,0xf7537e82);
Ⅱ(a,b,c,d,M11,10,0xbd3af235);
Ⅱ(a,b,c,d,M2,15,0x2ad7d2bb);
Ⅱ(a,b,c,d,M9,21,0xeb86d391)”
fourthly, splicing results: a, B, C, D four values finally generated by the circular processing are spliced together and converted into a character string.
It should be noted that, in the embodiment of the present invention, the authentication information may include, but is not limited to: a username and password. For example, user role information for characterizing the user identity rights may also be included. To further improve data security, the password may be encrypted with a random number. Optionally, the encryption is performed by using an asymmetric encryption manner, for example, when the client transmits the password to the server, the client (front end) applies for a random number from the server (back end), and simultaneously the client also generates a random number, encrypts the password by using the two random numbers together, and then transmits the encrypted password to the server.
In an alternative embodiment, in the case that the identity authentication information includes a user name and a password, the step S102 may further be implemented by: splicing the user identification, the user name and the password contained in the login request to generate a user information character string; and performing MD5 encryption calculation on the generated user information character string to obtain a first MD5 value.
In another optional embodiment, in the case that the identity authentication information includes a user name, a password, and user role information, the step S102 may further be implemented by: splicing the user identification, the user name, the password and the user role information contained in the login request to generate a user information character string; and performing MD5 encryption calculation on the generated user information character string to obtain a first MD5 value.
For example, a user identifier (user ID), a user name, a password, and a user role are concatenated into a character string using "-", and a hash value is generated from the plaintext of the concatenated character string by using the MD5 algorithm. The hash value generated by MD5 is a 128-bit binary number, i.e., a 32-bit hexadecimal number.
Suppose that the user information of a certain login user is as follows:
user ID: a user 0001;
user name: zhang III;
password: b/eTu2gEqP1BXsw8b5WiQXa0aPjFtwhB5ZzKtiYITTA ═ b;
and (3) user roles: manager;
the concatenation string is then:
user0001 Zhang Sanqi-b/eTu 2gEqP1BXsw8b5WiQXa0aPjFtwhB5 ZzKtityITTA ═ manager.
S103, searching a second MD5 value of the login user stored in the blockchain system according to the user identification contained in the login request, wherein the blockchain system stores the user identification and the authentication information of one or more users which are acquired in advance, and the MD5 value obtained by carrying out MD5 encryption calculation on the user identification and the authentication information of each user.
Optionally, before S103, the method for verifying user information based on a block chain according to the embodiment of the present invention may further include the following steps: receiving a registration request sent by one or more users through a client, wherein the registration request comprises user identification and authentication information of each user; performing MD5 encryption calculation on the user identification and the identity verification information contained in each registration request to obtain a second MD5 value of each user; the user identification, authentication information, and second MD5 values for each user are uploaded to the blockchain system.
In an optional implementation manner, when the authentication information includes a user name and a password, performing MD5 encryption calculation on the user identifier and the authentication information included in each registration request specifically includes the following steps: splicing the user identification, the user name and the password contained in each registration request to generate a user information character string; and performing MD5 encryption calculation on the generated user information character string to obtain a second MD5 value.
In another optional implementation, when the authentication information includes a user name, a password, and user role information, performing MD5 encryption calculation on the user identifier and the authentication information included in each registration request specifically includes the following steps: splicing the user identification, the user name, the password and the user role information contained in each registration request to generate a user information character string; and performing MD5 encryption calculation on the generated user information character string to obtain a second MD5 value.
Further, after uploading the user identifier, the authentication information, and the second MD5 value of each user to the blockchain system, the method for verifying user information based on blockchain according to the embodiment of the present invention may further include the following steps: receiving a user information modification request sent by each user through a client, wherein the user information modification request is used for modifying the identity authentication information of each user stored on the blockchain system; acquiring identity authentication information modified by each user according to a user information modification request sent by each user through a client; performing MD5 encryption calculation on the user identification of each user and the modified identity authentication information to obtain a third MD5 value of each user; the user identification of each user, the modified authentication information, and the third MD5 value are uploaded to the blockchain system.
In an optional implementation manner, when the authentication information includes a user name and a password, performing MD5 encryption calculation on the user identifier of each user and the modified authentication information to obtain a third MD5 value of each user specifically includes the following steps: splicing the user identification of each user and the modified user name or password to generate a user information character string; and performing MD5 encryption calculation on the generated user information character string to obtain a third MD5 value.
In another optional implementation, when the authentication information includes a user name, a password, and user role information, performing MD5 encryption calculation on the user identifier of each user and the modified authentication information to obtain a third MD5 value of each user specifically includes the following steps: splicing the user identification of each user and the modified user name, password or user role information to generate a user information character string; and performing MD5 encryption calculation on the generated user information character string to obtain a third MD5 value.
S104, verifying whether the first MD5 value is consistent with the second MD5 value.
It should be noted that, since the MD5 encryption algorithm is to generate a 128-bit hash value from a plaintext string of arbitrary length according to a certain rule, the generated result is completely different even if the plaintext message is changed a little, and thus, by verifying whether the first MD5 value and the second MD5 value are consistent, it can be determined whether the user information of the login user included in the login request is consistent with the user information of the login user stored in advance in the block chain.
And S105, when the value of the first MD5 is consistent with the value of the second MD5, verifying the identity information of the login user according to the identity verification information contained in the login request.
Specifically, when the identity information of the login user is verified according to the identity verification information included in the login request, the method can be implemented by the following steps: searching the identity authentication information of the login user stored in the block chain system according to the user identification contained in the login request; verifying whether the identity verification information contained in the login request is consistent with the identity verification information of the login user stored in the block chain system; if the identity authentication information contained in the login request is consistent with the identity authentication information of the login user stored in the blockchain system, returning a first response result, wherein the first response result is used for representing that the identity information of the login user is successfully authenticated; and if the identity authentication information contained in the login request is inconsistent with the identity authentication information of the login user stored in the blockchain system, returning a second response result, wherein the second response result is used for representing that the identity authentication of the login user fails.
Optionally, in a case that the value of the first MD5 is not consistent with the value of the second MD5, a third response result is returned, where the third response result is used to characterize that the identity information verification of the login user fails. It should be noted that the second response result and the third response result may be the same or different.
Fig. 3 is a schematic diagram of a block chain-based user information verification system according to an embodiment of the present invention, and as shown in fig. 3, the system includes: the system comprises a front end, a front end access layer, a core service layer, a block chain application layer and a block chain platform.
The front end is compiled based on a BFE front end frame, is mainly used for rendering a browser page and interacts with a front end access layer through an http protocol; the front-end access layer receives requests of user registration, login and the like from the front end, transmits user information to the core service layer, only performs simple processing on user data, and does not perform service logic related processing; the core business layer provides micro-service front-end calls with different functions (such as micro-services with various functions of user login verification, user information modification, user information registration and the like) based on a Dubbo micro-service framework, and receives micro-service requests from the access layer; the block chain application layer utilizes Spring Boot to encapsulate one layer of Fabric Java Sdk, and provides the function of interacting with the above service application layer and the underlying Fabric network; a blockchain system developed based on HyperLegendre Fabric is operated on a blockchain platform (Fabric), so that a core service layer can link various information to the blockchain platform by calling an API packaged by a blockchain application layer.
It should be noted that the BFE front-end framework is a progressive front-end framework for constructing a user interface based on VUE writing, and the framework only focuses on the view layer and adopts a design developed from bottom to top in increments. Vue is to implement the data binding and combined view components of the response through as simple an API as possible. The embodiment of the invention uses the Spring Boot framework to build the API interface of the development block chain layer, so that developers do not need to define the configuration of the template any more. Optionally, since Java has the characteristics of an object-oriented language such as encapsulation, inheritance, polymorphism, abstraction, and the like, the embodiment of the present invention may use Java language to implement a front-end access layer, a core service layer, and a blockchain application layer.
It should be noted that, in the embodiment of the present invention, the front end refers to a client, and the back end refers to a server.
Fig. 4 is a flow chart of user information registration or modification provided in the embodiment of the present invention, as shown in fig. 4, a front end sends a user information registration or modification request, and invokes a user information registration or modification microservice through a front end access layer; after the user information registration or modification micro service splices information such as a user ID, a user name, a password, a user role and the like into a character string, MD5 encryption calculation is carried out, then a function AddUserInfo is called, and the input comprises: parameter 1: a user ID; parameter 2: a concatenation string MD5 value; parameter 3: information such as user ID, user name, password, user role and the like; after receiving the request, the block chain layer splices the parameters 3 in the same way, performs MD5 encryption calculation, then compares the parameters with the parameters 2, and returns an error if the parameters are inconsistent; and if the data are consistent, writing the account book.
It should be noted that AddUserInfo is a function, configured to store the value of the splicing string MD5 to the blockchain layer, and map the value of the splicing string MD5 with the user ID, so that the value of the splicing string MD5 stored in the blockchain layer (obtained by the queryurinnfo MD5 function) can be obtained by the user ID.
The concrete implementation steps comprise:
①, using the user ID, user name, password, user role information of the user, and the value of the splicing string MD5 as the input value of the function AddUserInfo;
② after receiving the input value in ①, the blockchain layer concatenates the user ID, the user name, the password and the user role into a character string by using the 'to' character, and then generates a concatenated character string MD5 value;
③ the blockchain layer compares the value of the splicing string MD5 generated in ② with the input value in ① (value of the splicing string MD 5), if they are consistent, the value of the splicing string MD5 is saved, if they are not consistent, they are not saved, and an error is returned.
Fig. 5 is a flowchart of a user information login process provided in an embodiment of the present invention, as shown in fig. 5, a front end initiates a user login request, and invokes a user login microservice through a front end access layer; after splicing information such as user ID, user name, password, user role and the like into a character string by the user login micro-service, carrying out MD5 encryption calculation, and then calling a QueryUserInfo MD5 method (parameters: user ID); the block chain layer returns the MD5 value stored in the block chain according to the user ID, the user login micro-service compares the calculated MD5 value with the MD5 value returned by the block chain to verify whether the MD5 value and the MD5 value are consistent, and if the MD5 value and the MD5 value are not consistent, the user verification fails; if the verification is passed, returning a response result of successful user verification; and if the verification fails, returning a response result of the user verification failure.
It should be noted that the queryusellnfo MD5 is also a function, the input parameter is a user ID, and the blockchain layer returns the corresponding value of the stored concatenation string MD5 according to the input user ID.
As shown in fig. 3 and 4, in the process of registering and modifying the user information, the back-end core service layer performs MD5 encryption calculation on the user information (information such as a user ID, a user name, a password, a user role, and the like is spliced into a character string), and then transmits the result to the block chain layer for storage; as shown in fig. 5, in the user information login process, the back-end core service layer requests the block chain layer for the MD5 value of the user information string, checks the MD5 value with the user information MD5 value generated by itself, and if the check is inconsistent, the user login fails, thereby preventing the possibility that the user information on the single-point server is tampered.
Based on the same inventive concept, an embodiment of the present invention further provides a device for verifying user information based on a block chain, as described in the following embodiments. Because the principle of the device embodiment for solving the problem is similar to the block chain-based user information verification method, the implementation of the device embodiment may refer to the implementation of the method, and repeated parts are not described again.
Fig. 6 is a schematic diagram of a block chain-based user information verification apparatus according to an embodiment of the present invention, and as shown in fig. 6, the apparatus may include: the login module 61, the MD5 encryption calculation module 62, the blockchain lookup module 63, the first information verification module 64, and the second information verification module 65.
The login module 61 is configured to receive a login request sent by a login user through a client, where the login request includes: logging in user identification and identity authentication information of a user; the MD5 encryption calculation module 62 is configured to perform MD5 encryption calculation on the user identifier and the authentication information included in the login request to obtain a first MD5 value; the blockchain searching module 63 is configured to search a second MD5 value of the login user stored in the blockchain system according to the user identifier included in the login request, where the blockchain system stores pre-acquired user identifiers and authentication information of one or more users, and an MD5 value obtained by performing MD5 encryption calculation on the user identifier and the authentication information of each user; a first information verification module 64 for verifying whether the first MD5 value is consistent with the second MD5 value; and the second information verification module 65 is configured to, when the value of the first MD5 is consistent with the value of the second MD5, verify the identity information of the logged-in user according to the identity verification information included in the login request.
In an optional embodiment, the apparatus for verifying user information based on a block chain according to an embodiment of the present invention may further include: a registration module 66, configured to receive a registration request sent by one or more users through a client, where the registration request includes user identifiers and authentication information of the following users; the MD5 encryption calculation module 62 is further configured to perform MD5 encryption calculation on the user identifier and the authentication information included in each registration request to obtain a second MD5 value of each user; a blockchain storage module 67, configured to upload the user identifier, the authentication information, and the second MD5 value of each user to the blockchain system.
In an optional embodiment, the apparatus for verifying user information based on a block chain according to an embodiment of the present invention may further include: the user information modification module 68 is configured to receive a user information modification request sent by each user through the client, and obtain identity verification information modified by each user according to the user information modification request sent by each user through the client; the user information modification request is used for modifying the identity authentication information of each user stored on the blockchain system; the MD5 encryption calculation module 62 is further configured to perform MD5 encryption calculation on the user identifier and the modified authentication information of each user to obtain a third MD5 value of each user; the blockchain storage module 67 is further configured to upload the user identifier, the modified authentication information, and the third MD5 value of each user to the blockchain system.
In an optional embodiment, in the user information verification apparatus based on a blockchain provided in the embodiment of the present invention, the second information verification module 65 is further configured to search, according to a user identifier included in the login request, authentication information of a login user stored in the blockchain system; verifying whether the identity verification information contained in the login request is consistent with the identity verification information of the login user stored in the block chain system; if the identity authentication information contained in the login request is consistent with the identity authentication information of the login user stored in the blockchain system, returning a first response result, wherein the first response result is used for representing that the identity information of the login user is successfully authenticated; and if the identity authentication information contained in the login request is inconsistent with the identity authentication information of the login user stored in the blockchain system, returning a second response result, wherein the second response result is used for representing that the identity authentication of the login user fails.
In an optional embodiment, in the block chain-based user information verification apparatus according to an embodiment of the present invention, the first information verification module 64 is further configured to return a third response result in a case that the value of the first MD5 is inconsistent with the value of the second MD5, where the third response result is used to characterize that the authentication of the identity information of the login user fails.
Based on any one of the optional apparatus embodiments described above, as an optional implementation manner, in the block chain-based user information verification apparatus provided in the embodiment of the present invention, the authentication information at least includes: a username and password.
Optionally, the MD5 encryption calculation module 62 is further configured to perform splicing processing on the user identifier, the user name, and the password to generate a user information character string; and performing MD5 encryption calculation on the generated user information character string.
Based on the same inventive concept, an embodiment of the present invention further provides a computer device, so as to solve the technical problem that the user information is easy to be forged or tampered by using a single node to store the user information in the existing user information authentication method, where the computer device includes a memory, a processor, and a computer program stored in the memory and operable on the processor, and when the processor executes the computer program, the processor implements any one of the optional or preferred block chain-based user information authentication methods.
Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium, so as to solve the technical problem that the user information is easily forged or tampered by using a single node to store the user information in the existing user information authentication method, where the computer-readable storage medium stores a computer program for executing any one of the optional or preferred block chain-based user information authentication methods.
In summary, embodiments of the present invention provide a method, an apparatus, a computer device, and a computer-readable storage medium for verifying user information based on a blockchain, where in a process of user registration and user information modification, user information (information such as a user ID, a user name, a password, and a user role is spliced into a character string) is subjected to MD5 encryption calculation and then uploaded to a blockchain system for storage; in the process of user login, an MD5 value of a user information character string is requested from a block chain layer, a character string MD5 value generated according to the user information contained in the login request is verified, and if the verification is inconsistent, the user login fails, so that the possibility that the user information on the single-point server is tampered is eliminated.
The embodiment of the invention uploads the user information for verifying the user identity information to the block chain system, and stores the user information by using a plurality of nodes in the block chain system, thereby realizing multi-node storage of the user information, preventing the loss and the tampering of the user information of a single node, powerfully ensuring the identity authentication of the user, ensuring the identity authentication of the user to have non-repudiation and anti-counterfeiting performance, and improving the safety and the reliability of the system.
It should be noted that, because the blockchain system adopts a plurality of nodes to store the user information, even if a single node is tampered, the tampered information can be identified, and then the data of other nodes is checked and corrected, thereby improving the system security.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A user information verification method based on a block chain is characterized by comprising the following steps:
receiving a login request sent by a login user through a client, wherein the login request comprises: the user identification and the identity authentication information of the login user;
performing MD5 encryption calculation on the user identification and the identity authentication information contained in the login request to obtain a first MD5 value;
searching a second MD5 value of the login user stored in a blockchain system according to the user identification contained in the login request, wherein the blockchain system stores the user identification and the authentication information of one or more users which are acquired in advance, and the MD5 value obtained by carrying out MD5 encryption calculation on the user identification and the authentication information of each user;
verifying whether the first MD5 value and the second MD5 value are consistent;
and when the value of the first MD5 is consistent with the value of the second MD5, verifying the identity information of the login user according to the identity verification information contained in the login request.
2. The method of claim 1, wherein prior to looking up the second MD5 value for the logged-on user stored on the blockchain system based on the user identification contained in the login request, the method further comprises:
receiving a registration request sent by one or more users through a client, wherein the registration request comprises user identification and authentication information of each user;
performing MD5 encryption calculation on the user identification and the identity verification information contained in each registration request to obtain a second MD5 value of each user;
the user identification, authentication information, and second MD5 values for each user are uploaded to the blockchain system.
3. The method of claim 2, wherein after uploading the user identification, authentication information, and second MD5 values for each user to the blockchain system, the method further comprises:
receiving a user information modification request sent by each user through a client, wherein the user information modification request is used for modifying the identity authentication information of each user stored on a blockchain system;
acquiring identity authentication information modified by each user according to a user information modification request sent by each user through a client;
performing MD5 encryption calculation on the user identification of each user and the modified identity authentication information to obtain a third MD5 value of each user;
the user identification of each user, the modified authentication information, and the third MD5 value are uploaded to the blockchain system.
4. The method of claim 1, wherein verifying the identity information of the logged-in user based on the identity verification information included in the login request comprises:
searching the identity authentication information of the login user stored in the block chain system according to the user identification contained in the login request;
verifying whether identity verification information contained in the login request is consistent with identity verification information of the login user stored on a blockchain system;
if the identity authentication information contained in the login request is consistent with the identity authentication information of the login user stored on the blockchain system, returning a first response result, wherein the first response result is used for representing that the identity information of the login user is successfully authenticated;
and if the identity authentication information contained in the login request is inconsistent with the identity authentication information of the login user stored on the blockchain system, returning a second response result, wherein the second response result is used for representing that the identity information authentication of the login user fails.
5. The method of claim 1, wherein after verifying whether the first MD5 value and the second MD5 value are consistent, the method further comprises:
and when the first MD5 value is inconsistent with the second MD5 value, returning a third response result, wherein the third response result is used for representing that the identity information of the login user fails to be verified.
6. The method according to any of claims 1 to 5, wherein the authentication information comprises at least: a username and password.
7. The method of claim 6, wherein performing MD5 cryptographic calculations on the user identification and authentication information comprises:
splicing the user identification, the user name and the password to generate a user information character string;
and performing MD5 encryption calculation on the generated user information character string.
8. A user information verification apparatus based on a blockchain, comprising:
the system comprises a login module, a client and a server, wherein the login module is used for receiving a login request sent by a login user through the client, and the login request comprises: the user identification and the identity authentication information of the login user;
the MD5 encryption calculation module is used for carrying out MD5 encryption calculation on the user identification and the identity verification information contained in the login request to obtain a first MD5 value;
the blockchain searching module is used for searching a second MD5 value of the login user stored in a blockchain system according to the user identifier contained in the login request, wherein the blockchain system stores the user identifier and the authentication information of one or more users which are acquired in advance, and the MD5 value obtained by carrying out MD5 encryption calculation on the user identifier and the authentication information of each user;
a first information verification module to verify whether the first MD5 value and the second MD5 value are consistent;
and the second information verification module is used for verifying the identity information of the login user according to the identity verification information contained in the login request under the condition that the value of the first MD5 is consistent with the value of the second MD 5.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the blockchain-based user information authentication method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program for executing the block chain based user information authentication method according to any one of claims 1 to 7.
CN201911373274.4A 2019-12-27 2019-12-27 User information verification method and device based on block chain Pending CN111131269A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911373274.4A CN111131269A (en) 2019-12-27 2019-12-27 User information verification method and device based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911373274.4A CN111131269A (en) 2019-12-27 2019-12-27 User information verification method and device based on block chain

Publications (1)

Publication Number Publication Date
CN111131269A true CN111131269A (en) 2020-05-08

Family

ID=70503717

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911373274.4A Pending CN111131269A (en) 2019-12-27 2019-12-27 User information verification method and device based on block chain

Country Status (1)

Country Link
CN (1) CN111131269A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113141348A (en) * 2021-03-17 2021-07-20 重庆扬成大数据科技有限公司 Four-network-in-one data-based government affair safety guarantee working method

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106548091A (en) * 2016-10-14 2017-03-29 北京爱接力科技发展有限公司 A kind of data deposit card, the method and device of checking
CN107257340A (en) * 2017-06-19 2017-10-17 阿里巴巴集团控股有限公司 A kind of authentication method, authentication data processing method and equipment based on block chain
CN108632241A (en) * 2018-03-07 2018-10-09 湖南小步科技有限公司 A kind of multi-application system unified login method and apparatus
CN108880822A (en) * 2018-06-29 2018-11-23 郑州云海信息技术有限公司 A kind of identity identifying method, device, system and a kind of intelligent wireless device
US20180351747A1 (en) * 2017-05-30 2018-12-06 Sap Se Identity Verification Using Computer-Implemented Decentralized Ledger
CN109522698A (en) * 2018-10-11 2019-03-26 平安科技(深圳)有限公司 User authen method and terminal device based on block chain
US20190163896A1 (en) * 2017-11-28 2019-05-30 American Express Travel Related Services Company, Inc. Single Sign-On Solution Using Blockchain
CN110457878A (en) * 2019-08-14 2019-11-15 北京中电普华信息技术有限公司 A kind of identity identifying method based on block chain, apparatus and system
CN110555029A (en) * 2019-09-06 2019-12-10 腾讯科技(深圳)有限公司 ticket management method and device based on block chain and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106548091A (en) * 2016-10-14 2017-03-29 北京爱接力科技发展有限公司 A kind of data deposit card, the method and device of checking
US20180351747A1 (en) * 2017-05-30 2018-12-06 Sap Se Identity Verification Using Computer-Implemented Decentralized Ledger
CN107257340A (en) * 2017-06-19 2017-10-17 阿里巴巴集团控股有限公司 A kind of authentication method, authentication data processing method and equipment based on block chain
US20190163896A1 (en) * 2017-11-28 2019-05-30 American Express Travel Related Services Company, Inc. Single Sign-On Solution Using Blockchain
CN108632241A (en) * 2018-03-07 2018-10-09 湖南小步科技有限公司 A kind of multi-application system unified login method and apparatus
CN108880822A (en) * 2018-06-29 2018-11-23 郑州云海信息技术有限公司 A kind of identity identifying method, device, system and a kind of intelligent wireless device
CN109522698A (en) * 2018-10-11 2019-03-26 平安科技(深圳)有限公司 User authen method and terminal device based on block chain
CN110457878A (en) * 2019-08-14 2019-11-15 北京中电普华信息技术有限公司 A kind of identity identifying method based on block chain, apparatus and system
CN110555029A (en) * 2019-09-06 2019-12-10 腾讯科技(深圳)有限公司 ticket management method and device based on block chain and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵睿; 康哲; 张伟龙, 吉林大学出版社 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113141348A (en) * 2021-03-17 2021-07-20 重庆扬成大数据科技有限公司 Four-network-in-one data-based government affair safety guarantee working method
CN113141348B (en) * 2021-03-17 2023-04-28 重庆扬成大数据科技有限公司 Four-network-based data government affair security guarantee working method

Similar Documents

Publication Publication Date Title
CN107483509B (en) A kind of auth method, server and readable storage medium storing program for executing
CN112671720B (en) Token construction method, device and equipment for cloud platform resource access control
CN110264354B (en) Method and device for creating block chain account and verifying block chain transaction
CN106911684B (en) Authentication method and system
CN109660330B (en) Method and system for identity authentication on block chain
CN107196761B (en) A kind of method of core function in protection application program
CN110336807A (en) A kind of identity identifying method based on Web service, equipment and storage medium
CN114614994A (en) API interface data communication method, device, client and storage medium
CN112383522A (en) Function parameter data transmission encryption method, system, device and readable storage medium
CN107493250B (en) Method, client and server for authenticating webpage request
CN111241492A (en) Product multi-tenant secure credit granting method, system and electronic equipment
CN111131269A (en) User information verification method and device based on block chain
CN101789973A (en) Method and system for constructing Mashup application
CN111147471B (en) Terminal network access authentication method, device, system and storage medium
CN108292997B (en) Authentication control system and method, server device, client device, authentication method, and recording medium
CN116170144B (en) Smart power grid anonymous authentication method, electronic equipment and storage medium
CN108600266B (en) Statement filtering authentication method and system
US20150082026A1 (en) Systems and methods for locking an application to device without storing device information on server
CN116204914A (en) Trusted privacy computing method, device, equipment and storage medium
CN112637124B (en) Message processing method and device, electronic equipment and computer readable storage medium
CN115378605A (en) Data processing method and device based on block chain
CN114372245A (en) Block chain-based Internet of things terminal authentication method, system, device and medium
CN112118108B (en) SIP anti-theft verification method and system
Nowakowski Rest Api safety assurance by means of HMAC mechanism
CN113923202B (en) Load balancing method based on HTTP cluster server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200508

RJ01 Rejection of invention patent application after publication