Disclosure of Invention
The invention mainly aims to provide a zero-knowledge proof method and a zero-knowledge proof system for personal information and a computer readable storage medium, and aims to solve the technical problem that privacy information is exposed due to the existing personal information verification.
In order to achieve the above object, the present application provides a zero-knowledge proof method of personal information, comprising the steps of:
the third party verification server receives at least one piece of personal information to be verified, authority ID authenticated by the information to be verified and Mercker verification information sent by a user terminal, wherein the Mercker verification information comprises a hash value of at least one other node except a Mercker node corresponding to the personal information to be verified or comprises a hash value of at least one other node except the Mercker node corresponding to the personal information to be verified and a corresponding belonging layer;
the third party verification server acquires a hash algorithm and an ordered Mercker tree construction rule corresponding to the authority ID of the information to be verified according to the authority ID of the information to be verified;
the third party verification server calculates according to the Hash algorithm, the ordered Mercker tree construction rule, the at least one piece of personal information to be verified and the Mercker verification information to obtain a Mercker root value to be verified, and sends the Mercker root value to be verified and an authority ID authenticated by the information to be verified to a block chain platform;
the block chain platform acquires at least one Mercker root value corresponding to the authority ID authenticated by the information to be verified and identical to the Mercker root value to be verified according to the received Mercker root value to be verified and the authority ID authenticated by the information to be verified, and sends the acquired Mercker root values, the corresponding digital signatures and the corresponding storage time to the third party verification server;
and the third party verification server receives each Mercker root value, the corresponding digital signature and the corresponding storage time sent by the block chain platform, and verifies each personal information to be verified sent by the user terminal according to the authority ID authenticated by the information to be verified, each received Mercker root value, the corresponding digital signature and the corresponding storage time.
Optionally, the merkel verification information further includes at least one piece of personal information that is not to be verified;
the third party verification server calculates according to the hash algorithm, the ordered Mercker tree construction rule, the at least one piece of personal information to be verified and the Mercker verification information, and the step of obtaining the Mercker root value to be verified comprises the following steps:
and the third party verification server calculates according to the hash algorithm, the ordered Mercker tree construction rule, the at least one piece of personal information to be verified, the at least one piece of personal information not to be verified and the Mercker verification information to obtain a Mercker root value to be verified, wherein the Mercker verification information comprises at least one piece of personal information not to be verified and hash values of at least one other node except the Mercker node corresponding to the personal information to be verified or comprises at least one piece of personal information not to be verified, hash values of at least one other node except the Mercker node corresponding to the personal information to be verified and a corresponding layer.
Optionally, the step of verifying, by the third party verification server, each piece of personal information to be verified sent by the user terminal according to the authority ID authenticated by the piece of information to be verified, the received tacle root value, the corresponding digital signature, and the corresponding storage time includes:
the third party verification server selects a Mercker root value with the closest storage time from the Mercker root values according to the storage time corresponding to the Mercker root values;
the third party verification server acquires a first public key of an authority corresponding to the authority ID in the information to be verified according to the authority ID in the information to be verified, and verifies the digital signature corresponding to the Mercker root value with the latest storage time by adopting the first public key;
if the verification is passed, the third party verification server determines that the personal information to be verified sent by the user terminal is true;
and if the verification fails, the third party verification server determines that the personal information to be verified sent by the user terminal is not true.
Optionally, the step of the block chain platform obtaining, according to the received mercker root value to be verified and the authority ID authenticated by the information to be verified, at least one mercker root value corresponding to the authority ID authenticated by the information to be verified, which is the same as the mercker root value to be verified, and sending the obtained mercker root values, the corresponding digital signatures, and the corresponding storage times to the third party verification server includes:
the authority server receives at least two pieces of personal information sent by a user terminal, and creates a file number and an information file which corresponds to the file number and comprises the at least two pieces of personal information sent by the user terminal according to the received at least two pieces of personal information sent by the user terminal;
the authority server constructs a first Mercker tree corresponding to the file number by adopting a preset Hash algorithm, a preset ordered Mercker tree construction rule and each piece of personal information in the information file, and sends an authority ID, the file number and the information file to a user terminal;
the authority server signs the Mercker root value of the first Mercker tree according to a first private key, and generates a first digital signature corresponding to the Mercker root value of the first Mercker tree;
the authority server stores information including the Mercker root value of the first Mercker tree, a first digital signature corresponding to the Mercker root value of the first Mercker tree, and an authority ID to the block chain platform.
Optionally, the step of the authority server storing information including the mercker root value of the first mercker tree, a first digital signature corresponding to the mercker root value of the first mercker tree, and an authority ID to the block chain platform includes:
the authority server calls an intelligent contract on the block chain platform to create a first transaction record comprising the Mercker root value of the first Mercker tree, a first digital signature corresponding to the Mercker root value of the first Mercker tree and an authority ID;
the authority server stores the first transaction record to the blockchain platform.
Optionally, after the storing, by the authority server, information including the mercker root value of the first mercker tree, a first digital signature corresponding to the mercker root value of the first mercker tree, and an authority ID in the block chain platform, the method further includes:
the authority server receives an update request sent by a user terminal, wherein the update request comprises a file number and at least one piece of personal information;
the authority server generates a new information file corresponding to the file number in the update request according to the information file corresponding to the file number in the update request and at least one piece of personal information in the update request;
the authority server constructs a second Merck tree corresponding to the file number in the update request by adopting a preset Hash algorithm, a preset ordered Merck tree construction rule and each piece of personal information in the new information file, and sends the authority ID, the file number in the update request and the new information file to the user terminal;
the authority server adopts a first private key to sign the Mercker root value of a second Mercker tree to generate a second digital signature;
the authority stores information including a merkel root value of a second merkel tree, a second digital signature, and an authority ID to the blockchain platform.
Optionally, the authority server signs the mercker root value of the second mercker tree with the first private key, and the step of generating the second digital signature further includes:
the authority server signs the Mercker root value of the first Mercker tree corresponding to the file number in the updating request by adopting a second private key, generates a third digital signature, and stores information including the Mercker root value of the first Mercker tree, the third digital signature and the authority ID to the block chain platform.
Optionally, the step of the authority storing information including the merck root value of the second merck tree, the second digital signature, and the authority ID to the blockchain platform includes:
the authority server calls an intelligent contract on the blockchain platform to create a second transaction record comprising the Mercker root value of the second Mercker tree, the second digital signature and the authority ID;
and the authority server sends the second transaction record to be stored in the block chain platform.
Further, to achieve the above object, the present invention provides a zero-knowledge proof system of personal information, the system comprising:
the third party verification server is used for receiving at least one piece of personal information to be verified, authority ID authenticated by the information to be verified and Mercker verification information sent by a user terminal, wherein the Mercker verification information comprises a hash value of at least one other node except a Mercker node corresponding to the personal information to be verified or comprises a hash value of at least one other node except the Mercker node corresponding to the personal information to be verified and a corresponding belonging layer;
the third party verification server is further configured to obtain a hash algorithm and an ordered mercker tree construction rule corresponding to the authority ID authenticated by the information to be verified according to the authority ID authenticated by the information to be verified, calculate according to the hash algorithm, the ordered mercker tree construction rule, the at least one piece of personal information to be verified and the mercker verification information, obtain a mercker root value to be verified, and send the mercker root value to be verified and the authority ID authenticated by the information to be verified to the block chain platform;
the block chain platform is used for acquiring at least one Mercker root value corresponding to the authority ID authenticated by the information to be verified and identical to the Mercker root value to be verified according to the received Mercker root value to be verified and the authority ID authenticated by the information to be verified, and sending the acquired Mercker root values, the corresponding digital signatures and the corresponding storage time to the third party verification server;
the third party verification server is further configured to receive each mercker root value, the corresponding digital signature, and the corresponding storage time sent by the block chain platform, and verify each personal information to be verified sent by the user terminal according to an authority ID authenticated by the information to be verified, the received each mercker root value, the corresponding digital signature, and the corresponding storage time.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the zero-knowledge proof method of personal information as described above.
The embodiment of the invention provides a zero-knowledge proof method, a zero-knowledge proof system and a computer readable storage medium for personal information.A third party verification server receives at least one piece of personal information to be verified, authority ID authenticated by the information to be verified and Mercker verification information sent by a user terminal, wherein the Mercker verification information comprises a hash value of at least one other node except a Mercker node corresponding to the personal information to be verified or comprises a hash value of at least one other node except the Mercker node corresponding to the personal information to be verified and a corresponding belonging layer; the third party verification server acquires a hash algorithm and an ordered Mercker tree construction rule corresponding to the authority ID of the information to be verified according to the authority ID of the information to be verified; the third party verification server calculates according to the Hash algorithm, the ordered Mercker tree construction rule, the at least one piece of personal information to be verified and the Mercker verification information to obtain a Mercker root value to be verified, and sends the Mercker root value to be verified and an authority ID authenticated by the information to be verified to a block chain platform; the block chain platform acquires at least one Mercker root value corresponding to the authority ID authenticated by the information to be verified and identical to the Mercker root value to be verified according to the received Mercker root value to be verified and the authority ID authenticated by the information to be verified, and sends the acquired Mercker root values, the corresponding digital signatures and the corresponding storage time to the third party verification server; and the third party verification server receives each Mercker root value, the corresponding digital signature and the corresponding storage time sent by the block chain platform, and verifies each personal information to be verified sent by the user terminal according to the authority ID authenticated by the information to be verified, each received Mercker root value, the corresponding digital signature and the corresponding storage time. Therefore, in the process of verifying certain personal information, the user is not required to provide all other personal information including the privacy information, and only the personal information to be verified is required to be selected and provided to the third-party institution.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a hardware structure of a third party authentication server, a user terminal, an authority server or a blockchain platform provided in various embodiments of the present invention, where the third party authentication server, the user terminal, the authority server or the blockchain platform includes a communication module 10, a memory 20, a processor 30, and other components. Those skilled in the art will appreciate that the third party verification server, user terminal, authority server, or blockchain platform illustrated in fig. 1 may also include more or fewer components than illustrated, or combine certain components, or a different arrangement of components. Wherein, the processor 30 is connected to the memory 20 and the communication module 10, respectively, and the memory 20 stores thereon a computer program, which is executed by the processor 30 at the same time.
The communication module 10 may be connected to an external device through a network. The communication module 10 can receive data from an external device and can also send data, commands and information to the external device. The external device may be a user terminal, a third party authentication server, a user terminal, an authority server, or a blockchain platform.
The memory 20 may be used to store software programs as well as various data. The memory 20 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (constructing a merkel tree based on user information), and the like; the storage data area may store data or information created according to use of a third party authentication server, a user terminal, an authority server, or a blockchain platform, and the like. Further, the memory 20 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 30, which is a control center of the third party authentication server, the user terminal, the authority server or the blockchain platform, connects each part of the whole third party authentication server, the user terminal, the authority server or the blockchain platform by using various interfaces and lines, and executes various functions and processing data of the third party authentication server, the user terminal, the authority server or the blockchain platform by operating or executing software programs and/or modules stored in the memory 20 and calling data stored in the memory 20, thereby integrally monitoring the third party authentication server, the user terminal, the authority server or the blockchain platform. Processor 30 may include one or more processing units; preferably, the processor 30 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 30.
Although not shown in fig. 1, the third party authentication server, the user terminal, the authority server, or the blockchain platform may further include a circuit control module, which is used for connecting with a mains supply, implementing power control, and ensuring normal operation of other components.
Those skilled in the art will appreciate that the third party authentication server, user terminal, authority server, or blockchain platform configurations shown in fig. 1 do not constitute a limitation of third party authentication servers, user terminals, authority servers, or blockchain platforms, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
Various embodiments of the method of the present invention are presented in terms of the above-described hardware architecture.
Referring to fig. 2, in a first embodiment of a zero-knowledge proof method of personal information of the present invention, the zero-knowledge proof method of personal information includes the steps of:
step S10, the third party verification server receives at least one piece of personal information to be verified, authority ID authenticated by the information to be verified and Mercker verification information sent by the user terminal, wherein the Mercker verification information comprises the hash value of at least one other node except the Mercker node corresponding to the personal information to be verified or comprises the hash value of at least one other node except the Mercker node corresponding to the personal information to be verified and the corresponding belonging layer;
in the present scenario, zero knowledge proof means that one party (prover) can prove to the other party (verifier) that a statement is correct without revealing other useful information beyond that statement is correct. In the present invention, "statement" refers to personal information to be authenticated. A merkel Tree (Merkle Tree) is a binary Tree data structure that stores hash values, with leaves of the merkel Tree being hash values of data blocks (e.g., a data block may be an information, file, or collection of files), and non-leaf nodes being hash values of their corresponding child node concatenation strings. The ordered merkel tree construction rule refers to a rule for sequencing positions of all nodes in each layer in a corresponding layer when an effective merkel tree is constructed, and the node position sequencing rule can arrange the positions of the nodes from left to right in turn from small to large or from large to small according to the size of a 16-system numerical value of a hash value of each node in each layer or the numerical sequence of character ASCII codes of the hash value of each node in each layer.
When a user needs to verify personal information, the user can send at least one piece of information to be verified, an authority ID authenticated by the information to be verified and Mercker verification information to a service auditing terminal through a wireless or wired network through a user terminal, or can directly input the at least one piece of information to be verified, the authority ID authenticated by the information to be verified and the Mercker verification information to a terminal of a third-party verification authority and then send the information to a third-party verification server, wherein the Mercker verification information comprises at least one hash value of other nodes except the Mercker node corresponding to the personal information to be verified or at least one hash value of other nodes except the Mercker node corresponding to the personal information to be verified and a corresponding affiliated layer.
When the third party verification server verifies at least one piece of personal information of the user, the user terminal can send a hash algorithm and an ordered Mercker tree construction rule besides the at least one piece of personal information to be verified, the authority ID authenticated by the information to be verified and the Mercker verification information.
It should be noted that, in order to prevent the sent information of the at least one piece of to-be-verified personal information, the merkel verification information, and the authority ID from being intercepted by others, a public key of the third party verification server may be used to encrypt the information of the at least one piece of to-be-verified personal information, the merkel verification information, and the authority ID, and then the encrypted information is sent to the third party verification server, and the third party verification server may use its own private key to decrypt the encrypted information, thereby obtaining the hash algorithm, the at least one piece of to-be-verified personal information, and the merkel verification information sent by the user terminal.
The hash value of each node in the merkel verification information is a one-way result generated by a hash mapping function and cannot be used to deduce any useful information per se. The nodes in the tacher verification information are hash values of all nodes except the tacher node corresponding to the personal information to be verified, which are necessary on a hash calculation path from the tacher node corresponding to the personal information to be verified to the tacher root value, or hash values of all nodes except the tacher node corresponding to the personal information to be verified and corresponding layers, if the fastest hash calculation path is adopted, the provided tacher verification information only comprises a group of node hash value arrays which are arranged in order, and the arrangement order is the sequence order of using the node values in the process of calculating the tacher root value. If the non-fastest Hash calculation path is adopted, the provided Mercker verification information also comprises the layer corresponding to each node Hash value besides the node Hash value. For example, the information to be verified is the name P1 in fig. 6, and the hash calculation path from the node position corresponding to the name to the merkel root of the merkel tree in fig. 6 may be B + CD + EF, or B + C + D + E + F, where the hash calculation path of B + CD + EF is the fastest hash calculation path for a, and the hash calculation path of B + C + D + E + F is the slowest hash calculation path for a, and if the fastest hash calculation path is adopted, the merkel verification information is a set of ordered node hash value arrays { hash (P2), hash (C + D), hash (E + F) }. If the calculation path is B + C + D + EF, the tachr verification information includes the hash value of the node B and the layer to which the node B belongs as the first layer, the hash value of the node C and the layer to which the node C belongs as the first layer, the hash value of the node D and the layer to which the node D belongs as the first layer, and the hash value of the node EF and the layer to which the node EF belongs as the third layer. For another example, the information to be verified is the name of P1 and the place of origin of P3 in fig. 6, and the hash calculation path from the node position corresponding to the name and the place of origin to the merkel root of the merkel tree in fig. 6 may be B + D + EF (fastest hash calculation path) or B + D + E + F. The number of other nodes in the mercker verification information except the mercker node corresponding to the personal information to be verified is determined by the complexity of the mercker tree, the simpler the mercker tree is, the fewer the layers are, the fewer the number of other nodes needs to be provided, for example, the simplest mercker tree consisting of only two leaf nodes and a mercker root node is, and then the user terminal only needs to provide the node value of one leaf node except the mercker node corresponding to the personal information to be verified.
It should be noted that the tacle authentication information sent by the user terminal may include at least one piece of personal information that is not to be authenticated, in addition to the hash value of at least one other node except the tacle node corresponding to the personal information to be authenticated. For example, the authenticatee provides information to be authenticated "place of birth: the plaintext information of the Shandong smoke station ", in order to verify the plaintext information, the Mercker verification information provided by the verifier can include the node hash value AB in the second layer, the node hash value EF in the third layer and the current address in FIG. 6: guangzhou "plain text information.
Step S20, the third party verification server obtains a hash algorithm and an ordered Mercker tree construction rule corresponding to the authority ID of the information to be verified according to the authority ID of the information to be verified;
the third party verification server can send a request for obtaining a hash algorithm and an ordered Mercker tree construction rule to an authority server corresponding to the authority ID according to the authority ID authenticated by the information to be verified, and after receiving the request sent by the third party verification server, the authority server corresponding to the authority ID sends the hash algorithm and the ordered Mercker tree construction rule adopted by the Mercker tree constructed by the authority to the third party verification server.
When the third party verification server stores authority IDs including hash algorithms of all authority IDs and ordered Mercker tree construction rules, the hash algorithms and the ordered Mercker tree construction rule corresponding relation table, the third party verification server inquires and obtains the hash algorithms and the ordered Mercker tree construction rules corresponding to the authority IDs from the labels according to the authority IDs authenticated by information to be verified.
The hash algorithm may be MD4 algorithm, MD5 algorithm, SHA-1, SHA-256, SHA-512, Guomy algorithm, or other hash algorithms.
Step S30, the third party verification server calculates according to the hash algorithm, the ordered Mercker tree construction rule, the at least one piece of personal information to be verified and the Mercker verification information to obtain a Mercker root value to be verified, and sends the Mercker root value to be verified and the authority ID authenticated by the information to be verified to a block chain platform;
the third party verification server calculates the hash value layer by using the acquired hash algorithm and the ordered Mercker tree construction rule according to the received hash value and the layer of the received at least one piece of personal information to be verified and the hash value and the layer of the other nodes except the Mercker node corresponding to the personal information to be verified, and finally obtains the Mercker root value to be verified. For example, the authenticatee provides information to be authenticated as "place of birth: plaintext information and merkel verification information of the Shandong tobacco station', wherein the merkel verification information is hash value of node D (P4), hash value of node AB (A + B) and hash value of node EF (E + F) of the merkel tree in FIG. 6, and the ordered merkel tree construction rule obtained by the third-party verification server is that the nodes on the same layer are sequentially arranged from left to right from small to large. The third party verification server calculates the information to be verified by adopting a hash algorithm to obtain a hash value of the node C (P3), wherein the hash value (P3) is smaller than the hash value (P4); and then calculating a hash value hash (C + D) of the second layer of node CD according to the hash value of the node C and the hash value of the node D, further comparing the hash (A + B) with the hash (C + D) to obtain a hash (A + B) smaller than the hash (C + D), calculating a hash value of the third layer of node ABCD according to the hash (A + B) and the hash (C + D) to obtain a hash (AB + CD), finally comparing the hash (AB + CD) with the hash (E + F) to obtain that the hash (AB + CD) is smaller than the hash (E + F), and calculating a to-be-verified Mercker root hash (ABCD + EF) according to the hash (AB + CD) and the hash (E + F).
After the merkel root value to be verified is obtained through calculation, the third party verification server sends the merkel root value to be verified and the authority ID authenticated by the information to be verified to the block chain platform through a wired or wireless network. For example, the third party verification server sends the mercker root value to be verified and the authority ID authenticated by the information to be verified to the blockchain platform through an API interface of the blockchain platform.
Step S40, the block chain platform acquires at least one Mercker root value corresponding to the Mercker root value to be verified and corresponding to the information ID to be verified according to the received Mercker root value to be verified and the information ID to be verified, and sends the acquired Mercker root values, the corresponding digital signatures and the corresponding storage time to the third party verification server;
since a plurality of merck root values identical to the merck root value to be verified may be stored on the blockchain platform, some of the merck root values are sent by the authority server corresponding to the authority ID authenticated by the information to be verified, some of the merck root values are sent by other authority servers, and some of the merck root values are sent by the non-authority servers.
When the block chain platform queries from a database storing the Mercker root value or a transaction record storing the Mercker root value according to the Mercker root value to be verified and the authority ID of the information to be verified, at least one Mercker root value which is the same as the Mercker root value to be verified and is sent by an authority corresponding to the authority ID of the information to be verified is obtained, and the Mercker root value obtained through querying, a corresponding digital signature and storage time are sent to a third party verification server.
It should be noted that, when the blockchain platform does not inquire the mercker root value which is identical to the mercker root value to be verified and sent by the authority corresponding to the authority ID of the authentication of the information to be verified, the blockchain platform feeds back information that the mercker root value to be verified does not exist to the third party verification server, and the third party verification server directly determines that each piece of personal information to be verified sent by the user terminal is incorrect according to the information.
Step S50, the third party verifying server receives each mercker root value, the corresponding digital signature, and the corresponding storage time sent by the blockchain platform, and verifies each personal information to be verified sent by the user terminal according to the authority ID of the information to be verified authentication, the received each mercker root value, the corresponding digital signature, and the corresponding storage time.
The third party verification server selects a Mercker root value with the latest storage time from the Mercker root values according to the storage time, acquires a first public key of an authority ID of information authentication to be verified according to the authority ID of the information authentication to be verified, verifies a digital signature corresponding to the Mercker root value with the latest storage time by adopting the first public key, determines that personal information to be verified sent by the user terminal is real if the verification is passed, and sends information passing the verification to the user terminal; and if the verification fails, determining that the personal information to be verified sent by the user terminal is not true, and sending the information which fails to pass the verification to the user terminal. The third verification server can also directly determine that the personal information to be verified sent by the user terminal is true if the number of the Mercker root values fed back by the block chain platform is an odd number; and if the number is an even number, determining that the personal information to be verified sent by the user terminal is not true.
It should be noted that, after at least one mercker root value which is the same as the mercker root value to be verified and is sent by the authority corresponding to the authority ID of the information authentication to be verified is obtained through block chain query, the mercker root value with the latest storage time is selected from the mercker root values, the mercker root value with the latest storage time is verified by using the first public key of the authority corresponding to the authority ID of the information authentication to be verified, if the verification is passed, the information of the mercker root value to be verified is fed back to the third party verification server, and the third party verification server determines that each piece of personal information to be verified sent by the user terminal is real; if the verification fails, feeding back information without the Mercker root value to be verified to a third party verification server, so that the third party verification server determines that the personal information to be verified sent by the user terminal is incorrect.
For example, when it is necessary to check whether a customer is wanted to evade, the customer is only required to show some node information (node value, or node value and belonging layer) in the mercker tree constructed based on pieces of personal information including whether or not the customer is evading, and a mercker root value to be verified is calculated based on the above information provided by the customer, information that the customer is not going to be verified, and a hash algorithm and mercker tree node sorting rule adopted for constructing the mercker tree. And then inquiring according to the Mercker root value to be verified through a block chain, feeding back at least one acquired Mercker root value to a verification server, judging whether the information which is not escaped by the customer and is to be verified is true by the verification server according to each received Mercker root value, if so, determining that the customer is not wanted evacuees, otherwise, determining that the customer is wanted evacuees. If the name provided by the user is determined to be true, the user only needs to show whether crime records exist.
In this embodiment, a third party verification server receives at least one piece of to-be-verified personal information, an authority ID authenticated by the to-be-verified information, and tacle verification information sent by a user terminal, where the tacle verification information includes a hash value of at least one other node except for the tacle node corresponding to the to-be-verified personal information or includes a hash value of at least one other node except for the tacle node corresponding to the to-be-verified personal information and a corresponding belonging layer; the third party verification server acquires a hash algorithm and an ordered Mercker tree construction rule corresponding to the authority ID of the information to be verified according to the authority ID of the information to be verified; the third party verification server calculates according to the Hash algorithm, the ordered Mercker tree construction rule, the at least one piece of personal information to be verified and the Mercker verification information to obtain a Mercker root value to be verified, and sends the Mercker root value to be verified and an authority ID authenticated by the information to be verified to a block chain platform; the block chain platform acquires at least one Mercker root value corresponding to the authority ID authenticated by the information to be verified and identical to the Mercker root value to be verified according to the received Mercker root value to be verified and the authority ID authenticated by the information to be verified, and sends the acquired Mercker root values, the corresponding digital signatures and the corresponding storage time to the third party verification server; and the third party verification server receives each Mercker root value, the corresponding digital signature and the corresponding storage time sent by the block chain platform, and verifies each personal information to be verified sent by the user terminal according to the authority ID authenticated by the information to be verified, each received Mercker root value, the corresponding digital signature and the corresponding storage time. Therefore, in the process of verifying certain personal information, the user is not required to provide all other personal information including the privacy information, and only the personal information to be verified is required to be selected and provided to the third-party institution.
Further, referring to fig. 3, the first embodiment of the zero-knowledge proof method of personal information of the present application is proposed as a second embodiment of the zero-knowledge proof method of personal information of the present application, and in this embodiment, the step S50 includes:
step S51, the third party verifying server selects a mercker root value with the closest storage time from the mercker root values according to the storage time corresponding to each mercker root value;
step S52, the third party verifying server obtains a first public key of an authority corresponding to the authority ID in the information to be verified according to the authority ID in the information to be verified, and verifies the digital signature corresponding to the Mercker root value with the closest storage time by adopting the first public key;
step S53, if the verification is passed, the third party verification server determines that each personal information to be verified sent by the user terminal is true;
and step S54, if the verification fails, the third party verification server determines that the personal information to be verified sent by the user terminal is not true.
In the present scheme, there may be a change in certain information that is personal to the user, such as the user's place of residence, marital status, etc. When the authority server acquires that the personal information of the user changes, a merkel root value b is recreated according to the updated personal information, but because the merkel root value a of the merkel tree constructed based on the personal information of the user before updating is already stored on the block chain platform, the merkel root value a cannot be deleted and modified, the situation that the user uses the updated old personal information to verify is not prevented, the authority server uses a second private key to re-sign the merkel root value a to generate a second digital signature, and then the information including the merkel root value a, the corresponding second digital signature and the authority ID is stored in the block chain platform. This results in two pieces of information including the merck root value a being stored on the blockchain platform.
After a third party verification server receives at least one Mercker root value which is the same as the Mercker root value to be verified and corresponds to the Mercker root value to be verified and is sent by a block chain platform, a Mercker root value with the latest storage time is selected from the Mercker root values according to the storage time, a first public key of the Mercker root value to be verified and is authenticated is obtained according to the Mercker root value to be verified and is used for verifying a digital signature corresponding to the Mercker root value with the latest storage time, if the verification is passed, the fact that personal information to be verified and sent by a user terminal is real is determined, and verified information is sent to the user terminal; and if the verification fails, determining that the personal information to be verified sent by the user terminal is not true, and sending the information which fails to pass the verification to the user terminal.
It should be noted that there may be only one private key for the authority server. When the validity or the failure state of the mercker root value changes due to the change of the personal information of the user, the authoritative server signs the mercker root value by using the same private key again, and stores the mercker root value and the corresponding digital signature to the block chain platform again. This results in a plurality of identical merck root values for the blockchain platform, and the corresponding digital signatures for these merck root values are also identical. The third verification service can also directly determine that the personal information to be verified sent by the user terminal is true if the number of the Mercker root values fed back by the block chain platform is an odd number; and if the number is an even number, determining that the personal information to be verified sent by the user terminal is not true.
The embodiment provides a policy for determining a valid mercker root value by using a first public key for verification by a blockchain platform, so that after personal information is updated, a user is prevented from passing verification by using real information before updating.
Further, a third embodiment of the zero-knowledge proof method of personal information of the present application is proposed according to the first embodiment of the zero-knowledge proof method of personal information of the present application, and in this embodiment, the step S40 is preceded by:
step S60, the authority server receives at least two pieces of personal information sent by the user terminal, and creates a file number and an information file corresponding to the file number and including at least two pieces of personal information sent by the user terminal according to the received at least two pieces of personal information sent by the user terminal;
step S70, the authority server constructs a first Mercker tree corresponding to the file number by adopting a preset hash algorithm, a preset ordered Mercker tree construction rule and each piece of personal information in the information file, and sends the authority ID, the file number and the information file to a user terminal;
step S80, the authority server signs the mercker root value of the first mercker tree according to a first private key, and generates a first digital signature corresponding to the mercker root value of the first mercker tree;
in step S90, the authority server stores information including the mercker root value of the first mercker tree, the first digital signature corresponding to the mercker root value of the first mercker tree, and the authority ID in the block chain platform.
In the scheme, the authority server receives at least two pieces of personal information sent by the user terminal, and creates a unique file number and an information file corresponding to the file number, wherein the information file comprises each piece of personal information sent by the user terminal.
It should be noted that, after receiving at least two pieces of personal information sent by the user terminal, the authority server may first check authenticity of each piece of personal information sent by the user terminal, for example, an identity card number sent by the user terminal, and judge whether the length specified by the identity card number is met or not, or judge whether the identity card number and a name sent by the user terminal are in a corresponding relationship or not. When it is determined that all the pieces of personal information sent by the user terminal are true, a unique file number and an information file corresponding to the file number are created, wherein the information file comprises all the pieces of personal information sent by the user terminal.
And the authority server adopts a preset hash algorithm, a preset ordered Mercker tree construction rule and each piece of personal information in the information archive to construct a first Mercker tree corresponding to the archive number. The detailed procedure for the construction of the merkel tree in fig. 6, for example, is as follows: the method comprises the steps that firstly, hash values corresponding to personal information, namely hash (P1), hash (P2), hash (P3), hash (P4), hash (P5) and hash (P6), are obtained through a preset hash algorithm, the hash values are compared, the hash values are obtained, the hash values are found to be (P1) < hash (P2) < hash (P3) < hash (P4) < hash (P5) < hash (P6), and leaf nodes of a first layer are sequentially sorted according to a preset ordered merkel tree construction rule (sorted from small to large in sequence from left to right); secondly, according to the sorted hash values of the leaf nodes, a hash algorithm is adopted to obtain a hash value hash (A + B) of a node AB at a second layer, a hash value hash (C + D) of a node CD and a hash value hash (E + F) of a node EF, wherein the hash value hash (A + B) < the hash (C + D) < the hash (E + F), according to a sorting rule, the node AB with the hash (A + B) is a first position at the second layer, the node CD with the hash (C + D) is a second position at the second layer, and the node EF of the hash (E + F) automatically rises to be a third layer; thirdly, according to the hash (A + B) and the hash (C + D), calculating the hash value of the third-layer node ABCD as the hash (AB + CD), wherein the hash (AB + CD) is less than the hash (E + F), and according to a sorting rule, placing the node ABCD at the first position of the third layer and placing the node EF at the second position of the third layer; and fourthly, calculating the hash value of the Mercker root node as hash (ABCD + EF) according to the hash (AB + CD) and the hash (E + F).
It should be noted that, in the process of transmitting the plaintext information and the mercker verification information and in the process of verifying the information by the third party verification server, even if a secret transmission mechanism is adopted, part of the hash value used for the mercker verification may be leaked. Repeated requests for a variety of personal information, such as by network snooping or malicious authentication mechanisms, may result in all or part of the mercker tree data being obtained by an unauthorized person. Since identity and privacy information are mostly of a discrete finite set of fixed size, such as gender { male, female }, marital status { unmatched, married, dissimilarity, funeral } and the like. An attacker can construct leaf nodes for many times through an exhaustion method, and the final Mercker root value is calculated by combining the information of the known ordered digital abstract layer. If the actual Mercker value of the individual is matched, the attacker obtains the plaintext content of a certain personal information. In order to prevent a malicious attacker from deducing personal information in an exhaustive manner, when a leaf node is constructed, a specific numerical value can be allocated to each piece of personal information, and a hash algorithm is adopted to calculate the personal information and the corresponding specific numerical value to obtain a hash value corresponding to the piece of personal information. The specific value can be a value randomly generated by an authority, or a hash value of a personal password uploaded by a user, and the personal password can be replaced by the individual through the authority authentication mechanism regularly. Thus, even if an attacker can exhaust the plaintext information in the limited discrete set, the attacker cannot exhaust a specific numerical value, and thus cannot exhaust the hash value corresponding to the plaintext information, and thus cannot deduce the merck root value.
After the authority server constructs the first Mercker tree, the authority ID, the file number and the information archive are sent to the user terminal, the user terminal obtains a hash algorithm and an ordered Mercker tree construction rule corresponding to the authority ID according to the authority ID, and then constructs the first Mercker tree according to the information archive, the hash algorithm and the ordered Mercker tree construction rule, so that data in the first Mercker tree are obtained.
After the authority server constructs the first merkel tree, the authority ID, the profile number and the information file are sent to the user terminal, and the first merkel tree corresponding to the profile number can also be sent to the user terminal.
It should be noted that the authority server may send the digital certificate to the user terminal by generating a digital certificate that includes the authority ID, the profile number, and the information profile, and the digital certificate may further include a digital certificate of the first mercker tree corresponding to the profile number.
The authority server signs the Mercker root value of the constructed first Mercker tree by using the first private key, and generates a first digital signature corresponding to the Mercker root value of the first Mercker tree (the signature by using the first private key represents that the Mercker root value is valid). Then, the authority server sends the information including the mercker root value of the first mercker tree, the first digital signature and the authority ID to the block chain platform, and the block chain platform stores the received information including the mercker root value of the first mercker tree, the first digital signature and the authority ID.
It should be noted that, when the authority server considers that the mercker root value that has been created is invalid for some reason, such as user personal information update, the authority server may sign the mercker root value using the second private key to generate a digital signature (using the second private key to sign, which represents that the mercker root value is invalid), and store the information storage value blockchain platform including the mercker root value, the digital signature and the authority ID.
The embodiment constructs the Mercker tree based on personal information provided by the user terminal by adopting a preset hash algorithm and an ordered Mercker tree construction rule, and stores the Mercker root value of the Mercker tree in a block chain platform. Because the hash digest algorithm is a one-way mapping algorithm, plaintext information cannot be calculated through a hash value in a reverse direction, the root value of the Mercker tree is directly related to the content and the position of any leaf node, the change of the content or the position of any leaf node can cause the change of the root value, and data stored on a block chain platform cannot be modified and deleted, so that the safety of identity content information of a user is ensured, and the Mercker root value of the Mercker tree created based on the user information is not easy to modify.
Further, referring to fig. 4, a fourth embodiment of the zero-knowledge proving method of personal information of the present application is proposed according to the first embodiment of the zero-knowledge proving method of personal information of the present application, and in this embodiment, the step S90 includes:
step S91, the authority server calls an intelligent contract on the block chain platform to create a first transaction record including the mercker root value of the first mercker tree, a first digital signature corresponding to the mercker root value of the first mercker tree, and an authority ID;
in step S92, the authority server stores the first transaction record to the blockchain platform.
In the scheme, the authority server generates a transaction by calling an intelligent contract on a block chain platform, and the authority server writes the Mercker root value of the first Mercker tree, the first digital signature and the information of the authority into a transaction record. The transaction record is then stored in the invoked smart contract on the blockchain platform. Fig. 7 is a transaction record storing the mercker root value, in which the string of characters ending with aecb88 in Input Data of the transaction record is the information including the mercker root value and the corresponding digital signature, and the information in From is the authority ID.
The embodiment ensures that the mercker value is not easily modified by writing the mercker value into the transaction record and storing the mercker value on the blockchain platform.
Further, a fifth embodiment of the zero-knowledge proof method of personal information of the present application is proposed according to the first embodiment of the zero-knowledge proof method of personal information of the present application, and in the present embodiment, the step S90 is followed by:
step S100, the authority server receives an update request sent by a user terminal, wherein the update request comprises a file number and at least one piece of personal information;
step S110, the authority server generates a new information file corresponding to the file number in the update request according to the information file corresponding to the file number in the update request and at least one piece of personal information in the update request;
step S120, the authority server adopts a preset hash algorithm, a preset ordered Mercker tree construction rule and each piece of personal information in the new information file to construct a second Mercker tree corresponding to the file number in the update request, and sends the authority ID, the file number in the update request and the new information file to the user terminal;
step S130, the authority server adopts a first private key to sign the Mercker root value of a second Mercker tree to generate a second digital signature;
in step S140, the authority stores information including the mercker root value of the second mercker tree, the second digital signature, and the authority ID to the blockchain platform.
In the scheme, after receiving an update request comprising a file number and at least one piece of personal information sent by a user terminal, an authority server calls an information file corresponding to the file number according to the file number in the update request, updates the information file corresponding to the file number according to the at least one piece of personal information in the update request and a plurality of pieces of personal information in the information file corresponding to the file number, and sends an authority ID, the file number in the update request and the new information file to the user terminal, or sends the authority ID, the file number in the update request, the new information and a second Merck tree corresponding to the file number in the update request to the user terminal.
It should be noted that the personal information in the update request may be only an update of a certain piece of information content in the original information archive, for example, the existence of a certain piece of personal information in the original archive is "place of residence is guangdong", and the existence of a certain piece of personal information in the update request is "place of residence is shenzhen", in which case the original piece of personal information "place of residence is guangdong" is deleted, and the personal information "place of residence is shenzhen" is stored in the original information archive, so as to generate a new information archive. The personal information in the update request may be information that does not exist in the original information file, in which case the personal information in the update request is added to the original information file to create a new information file.
After the information archive is updated, the authority server generates a second Mercker tree corresponding to a new information archive according to a preset Hash algorithm and the new information archive. Signing the Mercker root value of the second Mercker tree by adopting a first private key, generating a second digital signature, and storing information comprising the Mercker root value, the second digital signature and the authority ID of the second Mercker tree to the block chain platform
It should be noted that, before the step of storing, by the authority, information including the mercker root value of the second mercker tree, the second digital signature, and the authority ID in the block chain platform, the method further includes:
the authority server signs the Mercker root value of the first Mercker tree corresponding to the file number in the updating request by adopting a second private key, generates a third digital signature, and stores information including the Mercker root value of the first Mercker tree, the third digital signature and the authority ID to the block chain platform.
When some personal information of the user changes, since the mercker root value corresponding to the personal information of the user before updating is stored on the block chain platform, the mercker root value cannot be deleted and modified, and the situation that the user uses the old personal information for authentication is not prevented. The authority server has a first private key and a second private key (the first private key signs to indicate that the Mercker root value is valid, and the second private key signs to indicate that the Mercker root is invalid), and after the information file is updated, the authority server signs the Mercker root value corresponding to the stored information file before updating by using the second private key to generate a third digital signature; and storing the information comprising the Mercker root value corresponding to the information archive before updating and the third digital signature to the block chain platform.
According to the embodiment, the information archive is updated according to the personal information updating request of the user terminal, a new Mercker tree is created for the updated information archive, and the root value of the new Mercker tree is stored in the block chain platform, so that after some personal information of the user is updated, the updated real information can be ensured to pass verification.
The invention also provides a zero-knowledge proof method and a zero-knowledge proof system for the personal information.
Referring to fig. 5, in one embodiment, the system includes: a third party authentication server 100, a blockchain platform 200, and a user terminal 300.
The third party verification server 100 is configured to receive at least one piece of personal information to be verified, an authority ID authenticated by the information to be verified, and tacher verification information sent by the user terminal 300, where the tacher verification information includes a hash value of at least one other node except for the tacher node corresponding to the personal information to be verified or includes a hash value of at least one other node except for the tacher node corresponding to the personal information to be verified and a corresponding belonging layer;
the third party verification server 100 is further configured to obtain a hash algorithm and an ordered mercker tree construction rule corresponding to the authority ID authenticated by the information to be verified according to the authority ID authenticated by the information to be verified, calculate according to the hash algorithm, the ordered mercker tree construction rule, the at least one piece of personal information to be verified and the mercker verification information, obtain a mercker root value to be verified, and send the mercker root value to be verified and the authority ID authenticated by the information to be verified to the block chain platform 200;
the block chain platform 200 is configured to obtain at least one mercker root value that is the same as the mercker root value to be verified and corresponds to the authority ID authenticated by the information to be verified according to the received mercker root value to be verified and the authority ID authenticated by the information to be verified, and send the obtained mercker root values, the corresponding digital signatures, and the corresponding storage times to the third party verification server 100;
the third party verification server 100 is further configured to receive each mercker root value, the corresponding digital signature, and the corresponding storage time sent by the blockchain platform 200, and verify each personal information to be verified sent by the user terminal 300 according to the authority ID authenticated by the information to be verified, the received each mercker root value, the corresponding digital signature, and the corresponding storage time.
It should be noted that the above system has all the technical features of the first embodiment of the zero-knowledge proof method for personal information, and the specific interaction process can be executed with reference to all the embodiments of the foregoing method, and accordingly, all the technical effects of the embodiments of the foregoing method are also achieved.
The invention also proposes a computer-readable storage medium on which a computer program is stored. The computer-readable storage medium may be the Memory 20 in the server in fig. 1, and may also be at least one of a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, and an optical disk, and the computer-readable storage medium includes several pieces of information for enabling a third party authentication server, a user terminal, an authority server, and/or a blockchain platform to perform the methods according to the embodiments of the present invention.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.