System, method and device for knowledge question answering based on blockchain
By using attribute encryption algorithms and sub-private key mechanisms on the blockchain, the questions asked by the questioner and the answerer specified in the knowledge question-and-answer platform are solved, and efficient privacy protection and accurate answers are achieved.
Patent Information
- Application Number
- CN202210722715.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2042-06-24
AI Technical Summary
In the knowledge question and answer platform, the questioner cannot effectively protect privacy information and cannot specify a specific answerer, resulting in privacy leakage and inaccurate answers.
A blockchain-based system is adopted to generate the main public key and the main private key through the attribute encryption algorithm. The questioner encrypts the problem information at attributes and stores the encrypted problem information on the blockchain. The management device generates the solver's sub-private key based on the solver's attribute information and uploads it to the blockchain. The answerer device decrypts the problem information through the sub-private key, and only the answerer who complies with a specific encryption policy can decrypt and reply to the question.
The protection of the question information of the questioner is achieved, ensuring that only the answerers who meet specific conditions can see and respond to the questions, thereby improving privacy protection and answering accuracy, while allowing the questioner to flexibly designate the answerer.
Smart Images

Figure CN115242398B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification belong to the field of blockchain technology, and in particular to a system for knowledge question and answer based on blockchain, and a method and device for knowledge question and answer based on blockchain. Background Art
[0002] With the rapid development of communication technology, the Internet has gradually become an important way for people to obtain information. For example, users can ask questions through the knowledge question and answer platform, and other users can answer the questions after seeing the questions. Usually, on the knowledge question and answer platform, the questions raised by the questioner will be directly disclosed to all users, and the questioner cannot select the answerer. However, in some cases, some questions may involve the privacy information of the questioner, so the questioner may not want his question to be seen by everyone. And some questions may be highly professional, and the questioner may only want to ask the answerer with relevant professional background. For example, consult a urologist about relevant conditions, consult a lawyer about marriage problems, consult a psychologist about family problems, and so on. Therefore, in the process of knowledge question and answer, it is of great significance to protect the privacy information of the questioner and specify the answerer of the question. Summary of the invention
[0003] One or more embodiments of this specification describe a blockchain-based knowledge question-answering system, and a blockchain-based knowledge question-answering method and device.
[0004] According to a first aspect, a system for knowledge question and answer based on blockchain is provided, the system comprising an answerer device, a questioner device, a management device and a blockchain, the blockchain storing the attribute information of the answerer, the management device comprising a master public key and a master private key for generating based on an attribute encryption algorithm, the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy; the management device is used to obtain the attribute information of the answerer from the blockchain, generate a first attribute list of the answerer based on the attribute information, generate an answerer sub-private key corresponding to the answerer based on the first attribute list, the master public key and the master private key, and upload the answerer sub-private key to the blockchain; the answerer device is also used to obtain the answerer sub-private key and the encrypted question information from the blockchain, decrypt the encrypted question information using the answerer sub-private key, and in the case where the first attribute list conforms to the first encryption strategy, the decryption is successful to obtain the question information; the answerer device is also used to receive the answer information input by the answerer for the question information, and upload the answer information to the blockchain; the questioner device is used to obtain the answer information from the blockchain.
[0005] According to a second aspect, a blockchain-based knowledge question-answering method is provided, which is applied to a node of a blockchain, wherein attribute information of an answerer is stored in the blockchain, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, and the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy. The method comprises: in response to a request sent by the management device, sending the attribute information of the answerer to the management device; receiving a sub-private key of the answerer corresponding to the answerer from the management device, and storing the sub-private key of the answerer in the blockchain, wherein the sub-private key of the answerer is based on the above. The encrypted question information is generated by the above-mentioned attribute information, the above-mentioned master public key and the master private key; in response to the request sent by the above-mentioned answerer device, the above-mentioned answerer sub-private key and the above-mentioned encrypted question information are sent to the above-mentioned answerer device; the above-mentioned answer information is received by the above-mentioned answerer device through the following process: using the above-mentioned answerer sub-private key to decrypt the above-mentioned encrypted question information, when the first attribute list corresponding to the above-mentioned answerer device conforms to the above-mentioned first encryption strategy, the decryption is successful to obtain the question information; receiving the answer information input by the above-mentioned answerer for the above-mentioned question information; in response to the request sent by the above-mentioned questioner device, the above-mentioned answer information is sent to the above-mentioned questioner device.
[0006] According to a third aspect, a blockchain-based knowledge question-and-answer method is provided, which is applied to an answerer device, wherein the blockchain stores the answerer's attribute information, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, and the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy. The method includes: obtaining the answerer's sub-private key and the encrypted question information from the blockchain, decrypting the encrypted question information using the answerer's sub-private key, and in the case that the first attribute list corresponding to the answerer device conforms to the first encryption strategy, the decryption is successful to obtain the question information, wherein the answerer's sub-private key is generated by the management device based on the answerer's attribute information, the master public key and the master private key; receiving the answer information input by the answerer for the question information, and sending the answer information to the blockchain.
[0007] According to a fourth aspect, a device for knowledge question and answer based on blockchain is provided, which is arranged at a node of blockchain, wherein attribute information of the answerer is stored in the above-mentioned blockchain, the above-mentioned management device includes a master public key and a master private key for generating based on an attribute encryption algorithm, and the encrypted question information stored in the above-mentioned blockchain is obtained by the questioner device through attribute encryption based on the above-mentioned master public key and a first encryption strategy. The above-mentioned device includes: a first sending unit, configured to send the attribute information of the answerer to the above-mentioned management device in response to a request sent by the above-mentioned management device; a first receiving unit, configured to receive the answerer's sub-private key corresponding to the above-mentioned answerer from the above-mentioned management device, and store the above-mentioned answerer sub-private key in the above-mentioned blockchain, wherein the above-mentioned answerer sub-private key is based on the above-mentioned attribute information , the master public key and the master private key are generated; a second sending unit is configured to send the solver sub-private key and the encrypted question information to the solver device in response to a request sent by the solver device; a second receiving unit is configured to receive the answer information sent by the solver device, wherein the answer information is obtained by the solver device through the following process: decrypting the encrypted question information using the solver sub-private key, and in the case where the first attribute list corresponding to the solver device conforms to the first encryption strategy, the decryption is successful to obtain the question information; receiving the answer information input by the solver for the question information; a third sending unit is configured to send the answer information to the questioner device in response to a request sent by the questioner device.
[0008] According to the fifth aspect, a blockchain-based knowledge question-and-answer apparatus is provided, which is arranged in an answerer device, wherein the blockchain stores the answerer's attribute information, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, and the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy. The apparatus includes: an information acquisition unit, configured to obtain the answerer's sub-private key and the encrypted question information from the blockchain, and use the answerer's sub-private key to decrypt the encrypted question information. In the case that the first attribute list corresponding to the answerer device conforms to the first encryption strategy, the decryption is successful and the question information is obtained, wherein the answerer's sub-private key is generated by the management device based on the answerer's attribute information, the master public key and the master private key; an information receiving unit, configured to receive the answer information input by the answerer for the question information, and send the answer information to the blockchain.
[0009] According to the sixth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the above-mentioned computer program is executed in a computer, the computer executes the method described in any implementation manner of the second aspect or the third aspect.
[0010] According to the seventh aspect, a computing device is provided, comprising a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, the method described in any implementation manner in the second aspect or the third aspect is implemented.
[0011] According to an embodiment of the present specification, a knowledge question-answering system based on blockchain is provided, the system includes an answerer device, a questioner device, a management device and a blockchain, wherein the attribute information of the answerer is stored in the blockchain, the management device includes a master public key and a master private key for generating based on an attribute encryption algorithm, and the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy. The management device can obtain the attribute information of the answerer from the blockchain, generate a first attribute list of the answerer based on the attribute information, and generate a corresponding answerer sub-private key of the answerer based on the first attribute list, the master public key and the master private key, and upload the answerer sub-private key to the blockchain. The answerer device can obtain the answerer sub-private key and the encrypted question information from the blockchain, and use the answerer sub-private key to decrypt the encrypted question information. In the case where the first attribute list conforms to the first encryption strategy, the decryption is successful and the question information is obtained. Afterwards, the answerer device receives the answer information input by the answerer for the question information, and uploads the answer information to the blockchain. In this way, the questioner device can obtain the answer information from the blockchain. In this system, only the answerer device whose first attribute list conforms to the first encryption policy corresponding to the encrypted question information can successfully decrypt the encrypted question information and obtain the question information, thereby achieving protection of the question information. At the same time, the questioner device can specify the answerer device that answers the question by setting the first encryption policy. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0013] Figure 1 A diagram of a blockchain architecture in one embodiment is shown;
[0014] Figure 2 A schematic diagram showing an application scenario in which the blockchain-based knowledge question-answering system in the embodiments of this specification can be applied;
[0015] Figure 3 A schematic diagram showing a process of storing attribute information of a solver in a blockchain;
[0016] Figure 4 A timing diagram showing an example of interaction between an answerer device, a questioner device, a management device and a blockchain in a blockchain-based knowledge question-answering system;
[0017] Figure 5 A schematic diagram of a first encryption strategy is shown;
[0018] Figure 6 A schematic diagram showing a second signature strategy for an example in which public attributes include "psychology" and "philosophy";
[0019] Figure 7 A schematic diagram showing the account information structure of a blockchain account;
[0020] Figure 8 A schematic block diagram of a blockchain-based knowledge question-answering device according to an embodiment is shown;
[0021] Fig. 9 A schematic block diagram of a blockchain-based knowledge question-answering apparatus according to another embodiment is shown. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0023] Blockchain technology is a special distributed database technology that is suitable for storing simple, sequential, and verifiable data within the system. Cryptography and consensus algorithms ensure that data cannot be tampered with or forged. To further explain blockchain technology, Figure 1 A diagram of a blockchain architecture in one embodiment is shown. Figure 1 In the blockchain architecture diagram shown, the blockchain 100 includes, for example, 6 nodes. The lines between the nodes schematically represent P2P (Peer to Peer) connections. These nodes can store the full amount of ledgers, that is, store the status of all blocks and all accounts. Among them, each node in the blockchain can generate the same state in the blockchain by executing the same transaction, and each node in the blockchain can store the same state database. It can be understood that Figure 1Although it is shown that the blockchain includes 6 nodes, the embodiments of this specification are not limited to this, but may include other numbers of nodes. Specifically, the nodes included in the blockchain can meet the Byzantine Fault Tolerance (BFT) requirements. The Byzantine Fault Tolerance requirement can be understood as Byzantine nodes can exist inside the blockchain, but the blockchain does not reflect Byzantine behavior to the outside. In general, some Byzantine fault tolerance algorithms require the number of nodes to be greater than 3f+1, where f is the number of Byzantine nodes, such as the Practical Byzantine Fault Tolerance algorithm PBFT (Practical Byzantine Fault Tolerance).
[0024] Transactions in the blockchain field can refer to task units that are executed and recorded in the blockchain. Transactions usually include a send field (From), a receive field (To), and a data field (Data). Among them, in the case where the transaction is a transfer transaction, the From field indicates the account address that initiates the transaction (i.e., initiates a transfer task to another account), the To field indicates the account address that receives the transaction (i.e., receives the transfer), and the Data field includes the transfer amount. In the case where the transaction calls a smart contract in the blockchain, the From field indicates the account address that initiates the transaction, the To field indicates the account address of the contract called by the exchange, and the Data field includes the function name in the calling contract, and the incoming parameters of the function, etc., which are used to obtain the code of the function from the blockchain and execute the code of the function when the transaction is executed.
[0025] The blockchain can provide the function of smart contracts. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system. Smart contracts can be defined in the form of code. Calling a smart contract in Ethereum is to initiate a transaction pointing to the smart contract address, so that each node in the Ethereum network runs the smart contract code in a distributed manner. It should be noted that in addition to being able to create smart contracts by users, smart contracts can also be set by the system in the genesis block. This type of contract is generally called a genesis contract. Generally, some blockchain data structures, parameters, properties and methods can be set in the genesis contract. In addition, accounts with system administrator privileges can create system-level contracts or modify system-level contracts (referred to as system contracts). Among them, the system contract can be used to add data structures of data for different businesses in the blockchain.
[0026] In the scenario of deploying a contract, for example, Bob sends a transaction containing information about creating a smart contract (i.e. deploying a contract) to Figure 1In the blockchain shown, the data field of the transaction includes the code of the contract to be created (such as bytecode or machine code), and the to field of the transaction is empty to indicate that the transaction is used to deploy the contract. After the nodes reach an agreement through the consensus mechanism, the contract address "0x6f8ae93..." of the contract is determined, and each node adds a contract account corresponding to the contract address of the smart contract in the state database, allocates the state storage corresponding to the contract account, and saves the contract code in the state storage of the contract, so that the contract is successfully created.
[0027] In the scenario of calling a contract, for example, Bob sends a transaction for calling a smart contract to Figure 1 In the blockchain shown, the from field of the transaction is the address of the account of the transaction initiator (i.e. Bob), the "0x6f8ae93..." in the to field represents the address of the smart contract being called, and the data field of the transaction includes the method and parameters for calling the smart contract. After the transaction is reached in the blockchain, each node in the blockchain can execute the transaction separately, thereby executing the contract separately, and updating the status database based on the execution of the contract.
[0028] As mentioned above, in the process of knowledge question answering, it is of great significance to protect the privacy information of the questioner and specify the answerer of the question. To this end, an embodiment of this specification provides a knowledge question answering system based on blockchain, which realizes the protection of the question information of the questioner, and the questioner device can specify the answerer device to answer the question by setting an encryption policy. As an example, Figure 2 The schematic diagram shows an application scenario in which the blockchain-based knowledge question-answering system of the embodiment of this specification can be applied. Figure 2As shown, in this application scenario, the answerer device 201, the questioner device 202, the management device 203 and the blockchain 100 may be included. The attribute information of the answerer is pre-stored in the blockchain 100. Here, the answerer device 201 may be a terminal device used by the answerer, the questioner device 202 may be a terminal device used by the questioner, and the management device 203 may be a device corresponding to the regulatory agency. The regulatory agency may be responsible for assigning attribute labels to users (including questioners, answerers, etc.), generating sub-private keys, etc. Here, the answerer device 201, the questioner device 202 and the management device 203 may be provided with an encryption module. For example, a CP-ABE (ciphertext policy attribute based encryption) encryption module may be provided. The ciphertext of CP-ABE corresponds to an access policy, and the key corresponds to an attribute set. The ciphertext can be decrypted only when the attributes in the attribute set can satisfy this access policy. The management device 203 may generate a master public key and a master private key based on the attribute encryption algorithm, and upload the master public key to the blockchain 100. The questioner device 202 can encrypt the question information by attributes based on the master public key and the first encryption strategy, thereby obtaining the encrypted question information, and store the encrypted question information in the blockchain 100. The management device 203 can obtain the attribute information of the answerer from the blockchain 100, generate the first attribute list of the answerer based on the attribute information, and generate the answerer's sub-private key corresponding to the answerer based on the first attribute list, the master public key and the master private key, and upload the answerer's sub-private key to the blockchain. In this way, the answerer device 201 can obtain the answerer's sub-private key and the encrypted question information from the blockchain 100, and use the answerer's sub-private key to decrypt the encrypted question information. In the case where the first attribute list conforms to the first encryption strategy, the decryption is successful and the question information is obtained. The answerer can see the question information through the display of the answerer device 201, and input the answer information to the answerer device 201. The answerer device 201 can receive the answer information input by the answerer for the question information, and send the answer information to the blockchain 100. The questioner device 202 can obtain the answer information from the blockchain 100. It is understood that the answerer device and questioner device mentioned in the embodiments of this specification are only relative, not fixed. For example, in a question-and-answer scenario, user A can be the answerer, and the device used by user A is the answerer device. In another question-and-answer scenario, user A can be the questioner, and the device used by user A is the questioner device.
[0029] Figure 3 A schematic diagram showing a process of storing the attribute information of the solver in the blockchain. Figure 3In the example shown, the solver device 201, the management device 203 and the certification authority device 204 that interact with the blockchain 100 may be provided with a CP-ABE encryption module. The specific process of storing the solver's attribute information may be as follows:
[0030] S301, the management device 203 generates a master public key and a master private key.
[0031] As an example, the management device 203 can generate a master public key and a master private key by calling the Setup function of the CP-ABE encryption module. The master public key can be uploaded to the blockchain 100 for public disclosure, and the master private key is kept by the management device 203 and cannot be leaked. As another example, the master public key and the master private key can also be generated by secure multi-party computing. The master private key is jointly maintained by multiple management devices 203, and when the master private key needs to be used, multiple management devices 203 participate in the calculation at the same time. The generation process of the master public key and the master private key can be as follows: CPABE_Setup (msk, mpk), where mpk can represent the master public key and msk can represent the master private key.
[0032] S302, the management device 203 uploads the master public key to the blockchain 100.
[0033] In this embodiment, the management device 203 can send a transaction Tx1 to any blockchain node of the blockchain 100. The transaction Tx1 can be sent by the blockchain account A1 of the management organization corresponding to the management device 203. The account A1 corresponds to the account private key systemSK and the account public key systemPK. The private key systemSK can be used to generate a digital signature for the transaction Tx1, and the public key systemPK can be used to verify the digital signature. The transaction Tx1 can call the data management contract C1 (hereinafter referred to as contract C1) in the blockchain to upload the master public key to the blockchain. Among them, the contract can be deployed to the blockchain by the management device 203 to manage the digital identity corresponding to the blockchain account. After receiving the transaction, the above-mentioned blockchain node sends the transaction to other nodes in the blockchain, so that each node in the blockchain can execute the transaction. By executing the transaction, each node of the blockchain stores the master public key in the contract state of contract C1.
[0034] S303, the certification authority device 204 obtains the master public key from the blockchain 100.
[0035] The authentication authority device 204 can receive the master public key mpk from any node in the blockchain 100 by sending a query transaction for calling the contract C1. At the same time, the authentication authority device 204 can also similarly obtain the public key systemPK of the account A1 corresponding to the management device 203 from the blockchain.
[0036] S304, the solver device 201 uploads the solver information of the solver to the blockchain 100.
[0037] In this embodiment, the solver device 201 can upload the solver's solver information to the blockchain 100. The solver information can be various identity information related to the solver's identity, including but not limited to name, nickname, identity certificate picture, passport picture, etc. The solver device 201 can also upload the asymmetrically encrypted public key accountPK to the blockchain 100, and the solver device 201 locally and securely saves the private key accountSK corresponding to accountPK. The public key accountPK can be used for subsequent encrypted information transmission.
[0038] Here, the solver information uploaded by the solver device 201 can also be used to register a personal on-chain account on the blockchain. Based on this, the solver device 201 can receive the on-chain account information returned by the blockchain 100, for example, the on-chain account ID. Specifically, the solver device 201 can send a transaction to the blockchain 100, and the transaction can call the contract C1 to register all external accounts (Externally Owned Accounts, EOA) to the blockchain. The node of the blockchain executes the transaction, generates on-chain account information, and returns the on-chain account information to the solver device 201. The blockchain can store the generated account information of the solver device 201 under the contract account. For example, the information included in the solver information can be spliced and then hashed to obtain the on-chain account ID. Specifically,
[0039] accountID=RegisterAccount(accountInfo,accountPK)=HASH(accountInfo||accountPK).
[0040] Among them, accountInfo represents the answerer information, and accountID represents the on-chain account ID corresponding to the answerer's device.
[0041] In practice, the blockchain 100 can directly generate the on-chain account information corresponding to the solver device based on the solver information uploaded by the solver device 201, and return the on-chain account information to the solver device 201. The blockchain 100 can also generate the on-chain account information corresponding to the solver device based on the solver information after the management device 203 verifies the solver information uploaded by the solver device 201, and then return the on-chain account information to the solver device 201. Specifically, after the management device 203 monitors the RegisterAccount contract call event on the chain, it can obtain the solver information uploaded by the solver device 201, and verify the solver information (for example, identity verification and authentication, etc.), and upload the verification pass information to the blockchain 100 after the verification passes. After receiving the verification pass information, the blockchain 100 can create the on-chain account information corresponding to the solver device 201 based on the solver information, and return the on-chain account information to the solver device 201.
[0042] In some optional implementations, the attribute information may include the identity information of the answerer, and the management device 203 may also generate a system public key and a system private key, and upload the system public key to the blockchain 100. Specifically, the management device 203 may generate an encryption authentication key pair for the system, wherein the encryption authentication key pair may include a system public key systemPK and a system private key systemSK, and the key pair may support asymmetric encryption algorithms and signature algorithms, such as elliptic curve cryptography (ECC) algorithm keys, and support elliptic curve digital signature algorithms (ECDSA) and elliptic curve integrated encryption schemes (ECIES) encryption and decryption algorithms. Taking ECC as an example, the system public key systemPK and the system private key systemSK can be generated by calling KeyGen, and the specific calculation process is as follows:
[0043] systemPK, systemSK=ECC_KeyGen().
[0044] Based on this, the solver device 201 can use the system public key systemPK obtained from the blockchain to encrypt the solver information, and upload the encrypted identity information to the blockchain 100. Taking ECIES as an example, encryption can be performed by calling ENCRYPT. Specifically,
[0045] accountInfoCipher=ECIES_ENCRYPT(systemPK,accountInfo).
[0046] Among them, accountInfo represents the solver information, and accountInfoCipher represents the encrypted decryptor information. At this time, accountID can be generated in the following way:
[0047] accountID=RegisterAccount(accountInfoCipher,accountPK).
[0048] Through this implementation, the answerer device 201 can encrypt the answerer information before uploading it, thereby making the answerer identity information more secure.
[0049] S305, the management device 203 obtains the answerer information from the blockchain.
[0050] Here, the management device 203 can obtain the solver information of the solver uploaded by the solver device 201 from the blockchain 100. If the solver information obtained by the management device 203 is the encrypted solver information accountInfoCipher, the management device 203 can use the system private key systemSK to decrypt the obtained encrypted solver information. Specifically,
[0051] accountInfo=ECIES_DECRYPT(systemSK, accountInfoCipher).
[0052] S306: The management device 203 generates an attribute list and a child private key of the solver.
[0053] In this embodiment, after the management device 203 verifies the identity information of the solver contained in the solver information, the blockchain account of the solver can be created by the node of the blockchain, which can be called the first account in this example. The solver can own the first account. Afterwards, the management device 203 can generate an attribute list corresponding to the solver based on the solver information uploaded by the solver device 201, and the attribute list can include the first account and the solver's identity information (or identity attributes). The solver's attribute list can include multiple attribute tags of the solver, and the attribute tag can be the sum of a class of features, or can be a set of data describing the solver. As an example, the attributes included in the solver's attribute list can be used to describe the solver's basic identity. For example, the attribute list can include but is not limited to the first account, name, nickname, identity identifier and other attributes. Afterwards, the management device 203 can generate a sub-private key of the solver device 201 based on the attribute list, the master public key and the master private key. For example, the management device 203 can generate the sub-private key sk corresponding to the solver device 201 through the KeyGen function of CP-ABE. Specifically,
[0054] sk=CPABE_KeyGen(AttriList, msk, mpk).
[0055] It can be seen from the above formula that the input parameters of the function CPABE_keygen() include the attribute list AttriList, msk and mpk. The sub-private key sk is generated by the attribute-based encryption algorithm. The sub-private key sk can be used to perform attribute signing based on the signature policy to obtain a signature to prove that the solver corresponding to the first account has specific attributes in the attribute list (that is, it satisfies the signature policy), and mpk can be used to verify that the signature is true based on the signature policy, that is, to verify that the solver corresponding to the first account has specific attributes in the attribute list.
[0056] S307, the management device 203 uploads the sub-private key and the attribute list to the blockchain 100.
[0057] In this embodiment, after the management device 203 generates the sub-private key and the attribute list, the blockchain account accountID corresponding to the solver device and the sub-private key blockchain 100 can be used for the solver device 201 to obtain the sub-private key from the blockchain.
[0058] In some optional implementations, the above S307 may also be specifically implemented as follows:
[0059] First, the management device 203 can encrypt the sub-private key based on the public key accountPK of the blockchain account corresponding to the solver device 201 to obtain an encrypted sub-private key. As an example, the management device 203 can use the public key of the blockchain account corresponding to the solver device 201 to adopt an encryption scheme, such as ECIES (elliptic curve integrate encrypt scheme), to encrypt the sub-private key to obtain a first encrypted sub-private key, and upload the blockchain account corresponding to the solver device 201 to the blockchain in association with the first encrypted sub-private key. In this way, the solver device 201 can obtain the first encrypted sub-private key corresponding to its own blockchain account from the blockchain, and can obtain the sub-private key by decrypting the first encrypted sub-private key. As another example, the management device 203 can also use the public key accountPK of the blockchain account corresponding to the solver device 201 to encrypt the solver's attribute list and sub-private key to obtain a second encrypted sub-private key. Specifically,
[0060] Second encrypted child private key = ECIES_ENCRYPT (accountPK, attribute list, sk).
[0061] The solver device 201 can obtain the corresponding attribute list and sub-private key by decrypting the second encrypted sub-private key.
[0062] Then, the management device 203 uploads the encrypted sub-private key to the blockchain 100 in association with the blockchain account corresponding to the solver device 201, so that the solver device 201 can obtain the encrypted sub-private key from the blockchain 100 and decrypt it to obtain the sub-private key.
[0063] For example, the blockchain can store the encrypted sub-private key accountCipher generated for the solver device 201 and uploaded by the management device 203 into the contract status of the on-chain contract. For example, a list accountInfoList can be pre-set, and each piece of information stored in the list accountInfoList can include data {accountID, accountPK, accountCipher}. In this way, the solver device 201 can obtain the corresponding encrypted sub-private key accountCiphe from the blockchain 100 according to the accountID, and use the private key accountSK corresponding to the accountPK to decrypt the encrypted sub-private key to obtain the sub-private key. As an example, when the encrypted sub-private key accountCipher is the second encrypted sub-private key, the solver device 201 can obtain the sub-private key and the attribute list by decryption, specifically:
[0064] Attribute list, sk = ECIES_DECRYPT (accountSK, second encrypted child private key).
[0065] Through this implementation method, the sub-private key can be encrypted and then uploaded to the blockchain, thereby protecting the sub-private key and improving the security of the sub-private key.
[0066] S308, the solver device obtains the sub-private key and attribute list from the blockchain.
[0067] S309: The solver device performs attribute signing based on the first signature policy and the sub-private key to obtain a first signature.
[0068] In this implementation, the solver device 201 needs to prove to the certification authority that the blockchain account accountID is its own on-chain account ID. To this end, the solver device 201 generates a first signature. The first signature can be obtained by performing an attribute signature based on the first signature strategy and the child private key. Here, the first signature strategy can include the solver's identity information and blockchain account, that is, the first account.
[0069] For example, an attribute-based signature (ABS) can be used for attribute signing. ABS is a public key signature verification algorithm, and the user's key and signature structure depend on the attributes. Only when the attribute set of the user's key (including multiple attribute tags) matches the signature policy can the signature and verification be successful. In this example, the solver device 201 can perform an attribute signature on the summary data1 of the combined information of the solver's identity information (e.g., identity identifier) and the blockchain account based on the first signature attribute policy: {identity information and blockchain account} and the sub-private key sk to obtain a first signature sign1. Specifically,
[0070] Data1 = HASH ("identity information" + accountID),
[0071] Sign1=ABS_Sign(sk, policy, data1).
[0072] S310 , the solver device 201 sends the first signature and the first signature policy to the certification authority device 204 .
[0073] Specifically, in order to protect the information in the first signature policy, the solver device can use the public key of the certification authority corresponding to the certification authority device 204 to encrypt the first signature and the first signature policy, and send the encrypted ciphertext to the certification authority device 204, so that the certification authority device 204 can obtain the first signature and the first signature policy by decrypting the ciphertext using the private key of the certification authority device 204.
[0074] S311, the certification authority device 204 verifies the first signature based on the pre-acquired master public key and the first signature policy.
[0075] In this example, the certification authority device can verify the first signature based on the first signature policy and the master public key mpk of the management device.
[0076] For example, the authentication agency device can obtain the identity information and blockchain account corresponding to the solver device in advance. In this way, after the authentication agency device obtains the first signature sign1, it can perform verification. The specific calculation is as follows:
[0077] Data1 = HASH ("identity information" + accountID),
[0078] result1=ABS_Verify(mpk, policy, data1, sign1).
[0079] Only when result1 is true can it be proved that the identity information of the solver and the blockchain account are bound one by one. In other words, it can be proved that the blockchain account is the on-chain account corresponding to the solver's identity information.
[0080] S312, when the verification is successful, the authentication authority device 204 uploads the authentication attributes corresponding to the first account to the blockchain 100.
[0081] Here, the authentication attribute can be an attribute issued by the authentication authority device to the answerer device. Taking the authentication authority as a university and the attribute issued as a degree attribute as an example, the authentication attribute can be as follows: info = {accountID, "Master's degree from XXX University in 2022"}. Optionally, the authentication authority device can sign the authentication attribute using its own private key companySK and encrypt it using the system public key systemPK of the management device. Specifically,
[0082] infoHash=HASH(info),
[0083] infoSign=ECIES_Sign(companySK, infoHash),
[0084] infoCipher=ECIES_ENCRYPT(systemPK, info).
[0085] Among them, infoCipher can represent encryption authentication attributes, and infoSign can represent digital signatures.
[0086] Afterwards, the certification authority device can call the contract interface PublishCert to upload the authentication attribute information including the blockchain account accountID of the solver device and the encrypted authentication attribute infoCipher to the blockchain. For example, it can be stored in the account certificate list AccountCertsList pre-set in the contract state. Specifically,
[0087] PublishCert(accountID,infoCipher,infoSign).
[0088] Through this implementation, the authentication authority device can issue authentication attributes to the answerer device.
[0089] S313, the blockchain stores the authentication attribute in association with the first account.
[0090] In this embodiment, the blockchain can store authentication attributes in association with the first account corresponding to the answerer. In this way, the blockchain can store the identity attributes and authentication attributes of the answerer in association with the first account. The identity attributes and authentication attributes in the attribute list are attribute information of the answerer. Through this implementation, by continuously adding the authentication attributes of the answerer, the attributes corresponding to the answerer will gradually become richer, and the basic information, learning, social practice, skill certification and other information corresponding to the answerer can form a complete digital identity of the answerer.
[0091] Therefore, based on Figure 3 The process shown can store the attribute information of the solver in the blockchain 100.
[0092] Please continue to see Figure 4 , Figure 4 A timing diagram showing an example of interaction between the answerer device 201, the questioner device 202, the management device 203 and the blockchain 100 in the blockchain-based knowledge question-answering system of an embodiment of this specification.
[0093] S401, the questioner device 202 obtains the master public key uploaded by the management device 203 from the blockchain 100;
[0094] S402, the questioner device 202 performs attribute encryption based on the master public key, the question information and the first encryption strategy to obtain encrypted question information;
[0095] S403, the questioner device 202 uploads the encrypted question information to the blockchain 100.
[0096] In practice, the questioner can set the first encryption strategy according to the actual scenario and needs. The first encryption strategy can be used to specify the conditions under which the device can decrypt the encrypted question information when the attribute tags are met. For different question information, corresponding first encryption strategies can be set. As an example, the structure of the first encryption strategy can be a tree structure. Figure 5 , Figure 5 A schematic diagram of a first encryption strategy is shown. The encrypted question information obtained based on the first encryption strategy needs to have the attribute of "education" and the answerer with one of the three attributes of "bachelor", "master" or "doctor" to decrypt successfully, otherwise the decryption fails. It can be understood that Figure 5 The first encryption strategy shown is only used to explain the tree structure, rather than to limit the content of the first encryption strategy. In practice, different question information may correspond to different first encryption strategies.
[0097] As an example, the structure of question information / answer information may include the following: {MID information unique ID, QID question unique ID, content encrypted (or plain text) question information / answer information content, relatedID related ID}, where the related ID (identifier) can be used when answering questions and asking supplementary questions.
[0098] As an example, in some scenarios, the questioner can ask questions to answerers corresponding to a limited number of blockchain accounts. In these scenarios, the content can be encrypted based on attributes.
[0099] For example, the questioner asks educators the question "How to better communicate with rebellious adolescents and provide guidance". The questioner finds blockchain accounts with "education" attributes and scores greater than 10,000 on the blockchain. For example, if three such blockchain accounts {AccountIdA, AccountIdB, AccountIdC} are found, the first encryption policy designed can be {1of3}{AccountIdA, AccountIdB, AccountIdC}, that is, only these three blockchain accounts can decrypt the encrypted question information. Based on this example, the structure of the question information can be as follows:
[0100] {
[0101] MID:MID1=HASH(QID|AccountId),
[0102] QID: Random question ID,
[0103] content:CPABE_ENCRYPT(Question, policy, mpk),
[0104] relatedID:null
[0105] }
[0106] It can be understood that since the structure of this example is the structure of question information, the AccountId here can represent the account of the questioner.
[0107] As another example, in some scenarios, the questioner can ask a question to a class of people. In these scenarios, the content can be encrypted based on attributes.
[0108] For example, ask cryptography professionals about the question "Can important data between banks be secured only through TLS? Are there any other recommended solutions?" Ask the blockchain account with the "cryptography" attribute, and the first encryption policy designed can be {1of1}{"cryptography"}, that is, only the device corresponding to the blockchain account with the "cryptography" attribute can decrypt the encrypted question information. Based on this example, the structure of the question information can be as follows:
[0109] {
[0110] MID:MID1=HASH(QID|AccountId),
[0111] QID: Random question ID,
[0112] content:CPABE_ENCRYPT(Question, policy, mpk),
[0113] relatedID:null
[0114] }
[0115] It can be understood that since the structure of this example is the structure of question information, the AccountId here can represent the account of the questioner.
[0116] As another example, in some scenarios, the questioner can ask questions publicly to everyone. In these scenarios, the content can be uploaded to the blockchain in plain text.
[0117] For example, if you ask everyone the question "What are the character relationships and timeline of movie M?", you do not need to design an encryption strategy. Based on this example, the structure of the question information can be as follows:
[0118] {
[0119] MID:MID1=HASH(QID|AccountId),
[0120] QID: Random question ID,
[0121] content:Question,
[0122] relatedID:null
[0123] }
[0124] It can be understood that since the structure of this example is the structure of question information, the AccountId here can represent the account of the questioner.
[0125] In scenarios where attribute encryption is required, the questioner device can perform attribute encryption based on the master public key, question information, and the first encryption strategy to obtain encrypted question information, and upload the encrypted question information to the blockchain. In scenarios where attribute encryption is not required, the questioner device can upload the question information in plain text to the blockchain. For example, the encrypted (or plain text) question information can be stored in the question and answer list QuestionAndAnswerList pre-set in the contract state of the contract. Among them, the encrypted question information can only be decrypted and seen by the answerer device that complies with the first encryption strategy, thereby protecting the privacy information of the questioner.
[0126] S404, the management device 203 obtains attribute information from the blockchain.
[0127] S405, the management device 203 generates an attribute list of the solver based on the attribute information, and generates a solver sub-private key corresponding to the solver based on the attribute list, the master public key and the master private key.
[0128] In this embodiment, the management device can obtain attribute information from the blockchain. If the attribute information includes encrypted authentication attributes, the encrypted authentication attributes can be decrypted to obtain authentication attributes for the answerer.
[0129] For example, the management device can obtain the authentication attribute information (accountID, infoCipher, infoSign) from the account certificate list AccountCertsList, and then verify the validity of the attribute information. Specifically,
[0130] Decrypt to obtain authentication attributes, info = ECIES_DECRYPT (systemSK, infoCipher),
[0131] infoHash=HASH(info).
[0132] Verify the validity of the digital signature infoSign of the certification authority device, specifically,
[0133] result=ECIES_Verify(companyPK, infoSign, infoHash).
[0134] As an example, after the digital signature verification is passed, the management device can verify the rationality and legality of the authentication attribute info = {accountID, "Master's degree of XXX University in 2022"} off-chain, for example, verify whether the qualifications of the certification body are sufficient, whether the issuance time is reasonable, etc. After the verification is passed, the management device can generate an attribute list of the solver based on the attribute information, which can include the identity attributes and authentication attributes of the solver.
[0135] Afterwards, the management device may generate an answerer sub-private key corresponding to the answerer based on the attribute list, the master public key, and the master private key.
[0136] Taking the certification body as a university, the attribute issued as a degree attribute, and the certification attribute as info = {accountID, "Master's degree from XXX University in 2022"} as an example, the management device can add an attribute tag "Master's degree from XXX University in 2022" to the solver device based on the identity attribute included in the attribute list, thereby obtaining an updated attribute list for the solver device, including identity attributes and certification attributes. Based on this, the management device can generate an updated solver sub-private key corresponding to the solver. For example, the KeyGen function of CP-ABE can be called to generate the solver sub-private key. Specifically,
[0137] skNew=CPABE_KeyGen(AttriListNew, msk, mpk).
[0138] Among them, skNew can represent the updated solver sub-private key, AttriListNew can represent the attribute list updated by the solver device, and AttriListNew can include authentication attributes and identity attributes.
[0139] Afterwards, the management device can use the public key accountPK of the solver device to encrypt the attribute label AttriListNew and the solver's sub-private key skNew. For example, the ECIES algorithm or the RSA algorithm can be used for encryption. Taking the ECIES algorithm as an example, specifically,
[0140] accountCipherNew=ECIES_ENCRYPT(accountPK,AttriListNew,skNew).
[0141] And store the data {accountID, accountPK, accountCipherNew} in the contract status list accountInfoList of the on-chain contract. Among them, accountID is the on-chain account ID of the solver's device.
[0142] Optionally, the solver may have a first account in the blockchain, the attribute list includes the first account, the management device is further used to upload the attribute list to the blockchain, and the blockchain is used to store the attribute list and the solver's sub-private key in an associated manner.
[0143] For example, when the blockchain stores the attribute list and the solver sub-private key in association, it is specifically used to: store in association with the first account a first ciphertext obtained by encrypting the solver sub-private key and the attribute list of the first account, wherein the first ciphertext is generated by the management device using the public key of the first account for encryption.
[0144] S406, the management device 203 uploads the solver's sub-private key to the blockchain.
[0145] S407, the solver device 201 obtains the solver's sub-private key and encrypted question information from the blockchain 100.
[0146] Specifically, the solver device 201 may send a transaction to the blockchain 100, and the transaction may call the contract C1 to obtain the solver sub-private key and the encrypted question information from the blockchain 100. The node of the blockchain may execute the transaction and send the solver sub-private key and the encrypted question information to the solver device 201.
[0147] For example, the solver device can obtain the attribute label AttriListNew and the solver sub-private key skNew assigned by the management device from the contract status list accountInfoList according to accountID and accountPK.
[0148] AttriListNew,skNew=ECIES_DECRYPT(accountSK,accountCipherNew).
[0149] Afterwards, the solver device can use the solver's child private key skNew to decrypt the encrypted question information stored in the blockchain.
[0150] S408, the answerer device 201 uses the answerer's sub-private key to decrypt the encrypted question information. When the attribute list conforms to the first encryption strategy, the decryption is successful and the question information is obtained.
[0151] In this embodiment, the solver device 201 can obtain the solver's sub-private key and the encrypted question information from the blockchain 100, and try to decrypt the encrypted question information using the sub-private key. When the attribute list corresponding to the solver conforms to the first encryption strategy, the decryption is successful and the question information is obtained. For example, the solver device 201 can try to decrypt the encrypted question information by calling the Decrypt function of CP-ABE. Specifically,
[0152] Question information = CPABE_DECRYPT (encrypted question information, skNew).
[0153] Through the DECRYPT function, only when the attribute list corresponding to the solver conforms to the first encryption strategy of the encrypted question information can the decryption be successful and the question information be obtained.
[0154] S409, the answerer device 201 receives the answer information input by the answerer in response to the question information, and uploads the answer information to the blockchain 100.
[0155] In this embodiment, after the answerer device 201 successfully decrypts the encrypted question information, the decrypted question information can be displayed for the answerer to view. The answerer device 201 can also receive the answer information input by the answerer to the question information, and send the answer information to the blockchain. For example, the answer information can be sent to the blockchain in plain text.
[0156] In some optional implementations, sometimes the answerer does not want the answer information he / she inputs to be seen by everyone, in order to protect his / her intellectual property rights on the one hand and the privacy information of the questioner on the other. Based on this, after the answerer's device receives the answer information input by the answerer for the question information, it can perform attribute encryption based on the master public key, the answer information and the second encryption strategy to obtain the encrypted answer information, and upload the encrypted answer information to the blockchain.
[0157] The second encryption policy can be used to specify the conditions under which the device can decrypt the encrypted answer information. For example, assuming that the answer information is Answer and the second encryption policy is policy, the answerer device can generate the encrypted answer information for the answer information Answer by calling the Encrypt function of CP-ABE. Specifically,
[0158] Encrypted answer information = CPABE_ENCRYPT (Answer, policy, mpk).
[0159] Through this implementation, the answerer can specify the device that can view the answer information by setting the second encryption policy, thereby protecting the answer information.
[0160] S410, the questioner device 202 may obtain answer information from the blockchain.
[0161] In this embodiment, the questioner device can obtain answer information from the blockchain, thereby realizing knowledge question and answer between the questioner device and the answerer device.
[0162] In some optional implementations, the blockchain may store a first information identifier associated with the encrypted question information, for example, the MID in the structure of the question information. It is understood that different encrypted (or plaintext) question information may correspond to different information identifiers. Afterwards, the answerer device may send the answer information and the first information identifier to the blockchain in association.
[0163] Specifically, the answerer device can obtain all the encrypted question information from the question-answer list QuestionAndAnswerList in the contract status, and decrypt it using its own answerer sub-private key. If the decryption is successful, it means that the question is directed to itself; if the decryption is unsuccessful, it means that the question is not directed to itself.
[0164] Question=CPABE_DECRYPT(content,sk).
[0165] For questions that are successfully decrypted or public, the answerer can decide whether to answer them. For example, the answerer device can assemble the answer information entered by the answerer into the following form:
[0166] {
[0167] MID:MID2=HASH(MID1|AccountId),
[0168] QID: original question QID,
[0169] content:CPABE_ENCRYPT(Answer, policy, mpk) or Answer,
[0170] relatedID:MID1
[0171] }
[0172] It can be understood that since the structure of this example is the structure of the answer information, the AccountId here can represent the account of the answerer. Here, whether the answer information Answer is encrypted or not is determined by the answerer. For example, if the answer information involves the privacy of the questioner, or the answer information includes relatively important information, the answerer can choose to encrypt it so that only the questioner can decrypt and see the answer information. RelatedID represents the information identifier of the question information of the related question, which is used to mark the answer to that piece of information.
[0173] In some optional implementations, the answerer device may generate a second information identifier for the answer information, such as the MID in the structure of the answer information in the above example. In this way, the questioner device may also send the additional question information and the second information identifier to the blockchain in association.
[0174] For example, after the questioner gets the answer information, if he still has questions, he can continue to ask additional questions. The questioner device can assemble the additional question information QuestionNew into the following form:
[0175] {
[0176] MID:HASH(MID2|AccountId),
[0177] QID: original question QID,
[0178] content:ABE_ENCRYPT(QuestionNew, policy, mpk) or QuestionNew,
[0179] relatedID:MID2
[0180] }
[0181] It can be understood that since the structure of this example is the structure of question information, the AccountId here can represent the account of the questioner.
[0182] Here, whether the additional question information QuestionNew is encrypted can be determined by the questioner. For example, in some scenarios where encryption is required, the questioner device can perform attribute encryption based on the master public key mpk, the additional question information QuestionNew and the third encryption policy policy to obtain the encrypted additional question information, specifically, ABE_ENCRYPT(QuestionNew, policy, mpk). And upload the encrypted additional question information to the blockchain. For example, the encrypted additional question information can be sent to the blockchain in association with the second information identifier. For another example, in some scenarios where encryption is not required, the questioner device can send the plaintext additional question information QuestionNew to the blockchain in association with the second information identifier. Thus, it can be indicated that the additional question information QuestionNew is for the information corresponding to the second information identifier.
[0183] Based on the additional question information uploaded by the questioner, the answerer can continue to supplement the answer until the questioner has no more questions. Through this implementation, the questioner can continue to add additional questions.
[0184] In some optional implementations, in practice, in addition to corresponding to the attribute list including identity attributes, the answerer device may also correspond to the certification attributes issued by the certification body. For example, when an individual completes his studies at a university, he will obtain the corresponding academic qualifications and degree certifications, and in the physical world, he will obtain a paper certificate issued by an education-related certification body. In the digital world, the certification body should also issue academic qualifications and degree attributes to the device corresponding to the individual. Here, the certification body device can be a device used by some entities in society that can issue attributes to individuals. For example, entities related to education can issue academic qualifications and degree attributes, entities related to marriage registration affairs can issue marital status attributes, entities related to training can issue skill training attributes, and so on.
[0185] The certification authority device can upload the organization information of the certification authority to the blockchain 100, for example, directly. The organization information may include various information related to the organization, including but not limited to the type of organization, the level of the organization, the location of the organization, certificate information, certification materials, etc. In addition, the certification authority device can also upload the asymmetrically encrypted public key companyPK to the blockchain 100, and the certification authority device locally securely stores the private key companySK corresponding to companyPK. companyPK can be used for subsequent encrypted information transmission.
[0186] Here, the organization information uploaded by the certification authority device can also be used to register the organization's on-chain account on the blockchain. Based on this, the certification authority device can receive the on-chain account information returned by the blockchain 100, for example, the on-chain account ID. As an example, the certification authority device can also use the system public key systemPK to encrypt the organization information and upload the encrypted organization information to the blockchain 100. Taking ECIES as an example, encryption can be performed by calling ENCRYPT. Specifically,
[0187] companyInfoCipher=ECIES_ENCRYPT(systemPK, companyInfo).
[0188] Among them, companyInfo can represent the organization information. companyInfoCipher can represent the encrypted organization information. At this time, companyID can be generated by the following method:
[0189] companyID=RegisterCompany(companyInfoCipher,companyPK).
[0190] In practice, blockchain 100 can directly generate on-chain account information corresponding to the certification agency device based on the organization information uploaded by the certification agency device, and return the on-chain account information to the certification agency device. Blockchain 100 can also generate on-chain account information corresponding to the certification agency device based on the organization information after the management device 203 verifies the organization information uploaded by the certification agency device. Specifically, after the management device 203 monitors the RegisterCompany contract call event on the chain, it can obtain the organization information uploaded by the certification agency device. If the organization information obtained by the management device 203 is the encrypted organization information companyInfoCipher, the management device 203 can use the system private key systemSK to decrypt the obtained encrypted organization information. Specifically,
[0191] companyInfo=ECIES_DECRYPT(systemSK, companyInfoCipher).
[0192] Afterwards, the management device 203 can verify the organization information (for example, perform identity verification and authentication, etc.). After the verification is passed, the verification pass information is uploaded to the blockchain 100. After receiving the verification pass information, the blockchain can generate the on-chain account information corresponding to the certification organization device based on the organization information, and return the on-chain account information to the certification organization device.
[0193] After the management device 203 obtains the organization information uploaded by the certification agency device from the blockchain 100, it can determine the organization attribute label corresponding to the certification agency device based on the organization information, and generate the organization sub-private key of the certification agency device based on the organization attribute label, the master public key and the master private key, and upload the organization sub-private key to the blockchain 100.
[0194] Here, the institution attribute label can be the sum of a class of features, for example, the type of institution can include skill training, certificate training, early childhood interest training, etc.; the level of the institution can include provincial, municipal, etc.; the location of the institution: Shanghai, Beijing, Fujian, etc. After that, the management device 203 can generate the institution sub-private key of the certification authority device based on the institution attribute label, the master public key and the master private key. For example, the management device 203 can generate the institution sub-private key of the certification authority device by calling the KeyGen function of CP-ABE. The management device 203 can upload the generated institution sub-private key to the blockchain 100, for example, encrypting the institution attribute label and the institution sub-private key with the public key companyPK of the certification authority device and uploading it to the blockchain 100. The certification authority device can obtain the institution sub-private key from the blockchain 100. If the obtained institution sub-private key is an encrypted institution sub-private key, it can be decrypted to obtain the institution sub-private key. Through this implementation, the certification authority device can obtain the institution sub-private key.
[0195] In some optional implementations, based on digital identity, for knowledge question-answering scenarios, answerers can choose which of their attributes to disclose to prove that they have relevant expertise and experience. To achieve this goal:
[0196] First, the solver device can obtain the solver sub-private key and the first attribute list from the blockchain, and perform attribute signing based on the solver sub-private key and the second signature strategy to obtain a second signature.
[0197] Here, the second signature policy includes public attributes, and the second signature is used to prove that the first account owned by the solver has all the attributes included in the second signature policy.
[0198] For example, a certain answerer chooses to disclose his or her attributes of psychology and philosophy. In this regard, the answerer can set the public attribute of the corresponding blockchain account through the answerer device and set the corresponding second signature policy, wherein the second signature policy can include the public attribute and the blockchain account. Figure 6 As shown, Figure 6 A schematic diagram of a second signature policy for an example in which public attributes include "psychology" and "philosophy" is shown, where the second signature policy includes the blockchain account accountId of the solver device, "psychology" and "philosophy".
[0199] In this example, the solver device can perform attribute signature on the solver's blockchain account based on the second signature policy and the solver's child private key to obtain the second signature. Specifically,
[0200] Signature data data = accountId,
[0201] sign=ABS_Sign(sk, policy, data).
[0202] Afterwards, the solver device can upload the public attributes and the second signature to the blockchain.
[0203] Finally, the questioner device and other participant devices can obtain the blockchain account and public attributes uploaded by the answerer device from the blockchain. In addition, the questioner device and other participant devices can verify the second signature based on the pre-acquired master public key and the second signature strategy. If the verification is successful, it is determined that the first account has public attributes. The specific calculation can be as follows:
[0204] result=ABS_Verify(mpk, policy, data, sign).
[0205] When the result is true, it proves that the attribute disclosed by the blockchain account corresponding to the solver device is the attribute corresponding to the solver device. Through this implementation method, it can effectively prevent the solver device from disclosing attributes that are inconsistent with its own attributes, that is, prevent the solver device from disclosing false attributes.
[0206] In some optional implementations, the answerer can earn points in the question-and-answer session, which can be a reward transferred from the blockchain account of the questioner or other participants who can view the answer information to the blockchain account of the answerer. Taking the questioner as an example, the questioner device can send a transaction to the blockchain for transferring points to the blockchain account corresponding to the answerer device, wherein the transaction can include the number of points N. Afterwards, the node of the blockchain can execute the transaction, reduce the number of points N from the blockchain account of the questioner device, and add the number of points N to the blockchain account corresponding to the answerer device. It can be understood that the points of a blockchain account can be a number. If the account chooses to hide its own number of points, it can be maintained on the blockchain after homomorphic encryption, and other participants can use homomorphic addition and homomorphic subtraction to increase the points of the answerer's account and reduce the points of their own account.
[0207] like Figure 7 As shown, Figure 7The following is a schematic diagram showing the account information structure of a blockchain account, which includes accountId account ID, account public key accountPK, PublicAttributes public attributes and Points points. It can be understood that Figure 7 The account information structure shown is only for illustration and not for limitation. In practice, information can be added or removed from the account information structure according to actual needs, which will not be elaborated here.
[0208] Reviewing the above process, in the above embodiment of this specification, the knowledge question-answering system based on blockchain includes an answerer device, a questioner device, a management device and a blockchain, wherein the attribute information of the answerer is stored in the blockchain, the management device includes a master public key and a master private key for generating based on the attribute encryption algorithm, and the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and the first encryption strategy. The management device can obtain the attribute information of the answerer from the blockchain, generate the attribute list of the answerer based on the attribute information, and generate the answerer's sub-private key corresponding to the answerer based on the attribute list, the master public key and the master private key, and upload the answerer's sub-private key to the blockchain. The answerer device can obtain the answerer's sub-private key and the encrypted question information from the blockchain, and use the answerer's sub-private key to decrypt the encrypted question information. In the case where the attribute list conforms to the first encryption strategy, the decryption is successful and the question information is obtained. Afterwards, the answerer device receives the answer information input by the answerer for the question information, and uploads the answer information to the blockchain. In this way, the questioner device can obtain the answer information from the blockchain. In this system, only the answerer device whose attribute list conforms to the first encryption policy corresponding to the encrypted question information can successfully decrypt the encrypted question information and obtain the question information, thereby achieving protection of the question information. At the same time, the questioner device can specify the answerer device that answers the question by setting the first encryption policy.
[0209] This specification shows a method of knowledge question and answer based on blockchain in one embodiment, which can be applied to nodes of blockchain. Among them, the nodes of blockchain can be executed by any device, equipment, platform, and device cluster with computing and processing capabilities. Among them, the attribute information of the answerer is stored in the blockchain, and the management device includes a master public key and a master private key generated based on the attribute encryption algorithm. The encrypted question information stored in the blockchain can be obtained by the questioner device through attribute encryption based on the master public key and the first encryption strategy. Specifically, the questioner device can perform attribute encryption based on the master public key, the question information and the first encryption strategy to obtain the encrypted question information, and upload the encrypted question information to the blockchain.
[0210] Based on this, the blockchain-based knowledge question answering method may include the following steps:
[0211] Step 1: In response to a request sent by a management device, the attribute information of the solver is sent to the management device.
[0212] In this embodiment, the solver may have a first account in the blockchain. The solver's attribute information may include the solver's identity attribute and authentication attribute. Among them, the solver's attribute information may be generated in the following manner: 1) The management device obtains the solver information uploaded by the solver device from the blockchain, generates the solver's second attribute list and second sub-private key according to the solver information, and uploads the second sub-private key and second attribute list to the blockchain, wherein the second attribute list may include the first account and the solver's identity information (or identity attribute); 2) The solver device obtains the second sub-private key and second attribute list from the blockchain, and performs attribute signature based on the first signature strategy and the second sub-private key to obtain the first signature, and sends the first signature and the first signature strategy to the certification authority device; 3) The certification authority device verifies the first signature based on the pre-acquired master public key and the first signature strategy. In the case of passing the verification, the certification authority device uploads the authentication attribute corresponding to the first account to the blockchain; 4) The blockchain stores the authentication attribute in association with the first account. Among them, the identity attribute and the authentication attribute in the first attribute list belong to the solver's attribute information. By continuously adding authentication attributes, the attributes corresponding to the answerer will gradually become richer. The answerer's basic information, learning, social practice, skill certification and other attribute information can form a complete digital identity of the answerer.
[0213] Step 2: Receive the solver's sub-private key corresponding to the solver from the management device and store the solver's sub-private key in the blockchain.
[0214] In this embodiment, the node of the blockchain can receive the solver's sub-private key of the solver device from the management device and store it in the blockchain. The solver sub-private key is generated by the management device based on the solver's attribute information, the master public key and the master private key.
[0215] For example, the blockchain can store the encrypted sub-private key accountCipher generated for the solver device and uploaded by the management device into the contract state of the on-chain contract. For example, a list accountInfoList can be pre-set, and each piece of information stored in the list accountInfoList can include data {accountID, accountPK, accountCipher}.
[0216] Step three, in response to the request sent by the answerer device, the answerer sub-private key and the encrypted question information are sent to the answerer device.
[0217] In this embodiment, the answerer device may send a request to the blockchain for obtaining the answerer's sub-private key. In response to the request sent by the answerer device, the node of the blockchain may send the answerer's sub-private key to the answerer device. The answerer device may also send a request to the blockchain for obtaining encrypted question information. In response to the request sent by the answerer device, the node of the blockchain may send the encrypted question information to the answerer device. Afterwards, the answerer device may use the answerer's sub-private key to decrypt the encrypted question information. In the case where the basic attribute label conforms to the first encryption strategy, the decryption is successful and the question information is obtained.
[0218] Step 4: Receive the answer information sent by the answerer's device.
[0219] In this embodiment, the node of the blockchain can receive the answer information sent by the solver device. The answer information can be obtained by the solver device through the following process: First, the solver device can use the solver's sub-private key to decrypt the encrypted question information. When the first attribute list corresponding to the solver device meets the first encryption strategy, the decryption is successful and the question information is obtained. Then, the solver device can receive the answer information input by the solver for the question information.
[0220] Step 5: In response to the request sent by the questioner device, the answer information is sent to the questioner device.
[0221] In this embodiment, the questioner device may send a request for obtaining answer information to the node of the blockchain, and in response to the request sent by the questioner device, the node of the blockchain may send the answer information to the questioner device.
[0222] In some optional implementations, the answerer may have a first account in the blockchain, the attribute information includes identity information of the answerer, and the above blockchain-based knowledge question answering method may further include the step of: receiving an authentication attribute corresponding to the first account sent by the authentication authority device, wherein the authentication attribute is determined in the following manner:
[0223] 1) The management device obtains the identity information of the solver from the blockchain, creates a first account after verifying the identity information of the solver, and generates a second attribute list of the solver, which includes the first account and the identity information of the solver.
[0224] 2) The management device generates a second sub-private key based on the second attribute list, the master public key and the master private key, and uploads the second sub-private key and the second attribute list to the blockchain.
[0225] 3) The solver device obtains the second sub-private key and the second attribute list from the blockchain, performs attribute signature based on the first signature strategy and the second sub-private key to obtain a first signature, and sends the first signature to the certification authority device, wherein the first signature strategy includes the solver's identity information and the first account.
[0226] 4) The authentication authority device verifies the first signature based on the pre-acquired master public key, and if the verification passes, determines the authentication attribute corresponding to the first account.
[0227] In some optional implementations, the above blockchain-based knowledge question-answering method may further include the following contents:
[0228] First, a node of the blockchain may receive a transaction sent by a questioner device for transferring points to a blockchain account corresponding to an answerer device, wherein the transaction may include the amount of points.
[0229] The nodes of the blockchain can then execute transactions to reduce the number of points from the blockchain account of the questioner's device and increase the number of points to the corresponding blockchain account of the answerer's device.
[0230] In some optional implementations, the questioner can further add questions to the answer information of the answerer. As an example, the questioner device can send encrypted additional question information to the node of the blockchain, wherein the encrypted additional question information can be attribute-encrypted by the questioner device based on the master public key of the management device, the additional question information, and the third encryption strategy. As another example, the questioner device can send a second information identifier and additional question information to the node of the blockchain, wherein the second information identifier can be generated by the answerer device for the answer information.
[0231] This specification also shows a method for knowledge question answering based on blockchain in an embodiment, which can be applied to an answerer device, wherein the blockchain stores the attribute information of the answerer, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, and the encrypted question information stored in the blockchain can be obtained by the questioner device through attribute encryption based on the master public key and the first encryption strategy. Specifically, the questioner device can perform attribute encryption based on the master public key, the question information and the first encryption strategy to obtain the encrypted question information, and upload the encrypted question information to the blockchain.
[0232] Based on this, the blockchain-based knowledge question answering method may include the following steps:
[0233] Step 1), obtain the solver's sub-private key and encrypted question information from the blockchain.
[0234] In this embodiment, the solver device can obtain the solver sub-private key from the blockchain, wherein the solver sub-private key can be generated by the management device based on the solver's attribute information, the master public key and the master private key. In addition, the solver device can also obtain encrypted question information from the blockchain. Afterwards, the solver device can use the solver sub-private key to decrypt the encrypted question information. When the first attribute list corresponding to the solver device meets the first encryption strategy, the decryption is successful and the question information is obtained. The solver device can display the question information for the solver to view.
[0235] Step 2), receiving the answer information entered by the answerer for the question information, and sending the answer information to the blockchain.
[0236] In this embodiment, the answerer device can receive the answer information input by the answerer and send the answer information to the blockchain. For example, the answer information can be sent to the blockchain in plain text.
[0237] In some optional implementations, step 2) can also be specifically performed as follows: receiving the answer information input by the answerer to the question information, and performing attribute encryption based on the master public key, the answer information and the second encryption strategy to obtain the encrypted answer information, and uploading the encrypted answer information to the blockchain.
[0238] In some optional implementations, the solver has a first account in the blockchain, the attribute information includes identity information of the solver, and the method further includes:
[0239] First, obtain a second sub-private key and a second attribute list from the blockchain, wherein the second attribute list is generated by the management device based on the identity information of the solver obtained from the blockchain, and the second sub-private key is generated by the management device based on the second attribute list, the master public key and the master private key.
[0240] Then, an attribute signature is performed based on the first signature strategy and the second sub-private key to obtain a first signature, and the first signature is sent to the certification authority device, so that the certification authority device verifies the first signature based on the pre-acquired master public key and the first signature strategy. When the verification passes, the authentication attribute corresponding to the first account is uploaded to the blockchain, wherein the first signature strategy includes the identity information of the solver and the first account.
[0241] According to an embodiment of another aspect, a blockchain-based knowledge question-answering device is provided, which is set in a node of the blockchain, wherein the blockchain node can be deployed in any device, platform or device cluster with computing and processing capabilities.
[0242] Figure 8A schematic block diagram of a device for knowledge question and answer based on blockchain according to an embodiment is shown. The blockchain stores attribute information of the answerer, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and the first encryption strategy, and the device 800 includes: a first sending unit 801, configured to send the attribute information of the answerer to the management device in response to a request sent by the management device; a first receiving unit 802, configured to receive the answerer's sub-private key corresponding to the answerer from the management device, and store the answerer's sub-private key in the blockchain, wherein the answerer's sub-private key is generated based on the attribute information, the master public key and the master private key; a second sending unit 802, configured to receive the answerer's sub-private key corresponding to the answerer from the management device, and store the answerer's sub-private key in the blockchain, wherein the answerer's sub-private key is generated based on the attribute information, the master public key and the master private key; and a second sending unit 803, configured to receive the answerer's sub-private key corresponding to the answerer from the management device, and store the answerer's sub-private key in the blockchain. Unit 803 is configured to send the solver sub-private key and the encrypted question information to the solver device in response to the request sent by the solver device; the second receiving unit 804 is configured to receive the answer information sent by the solver device, wherein the answer information is obtained by the solver device through the following process: decrypting the encrypted question information using the solver sub-private key, and in the case that the first attribute list corresponding to the solver device conforms to the first encryption strategy, the decryption is successful to obtain the question information; receiving the answer information input by the solver for the question information; the third sending unit 805 is configured to send the answer information to the questioner device in response to the request sent by the questioner device.
[0243] In some optional implementations of this embodiment, the above-mentioned solver has a first account in the above-mentioned blockchain, and the above-mentioned attribute information includes the identity information of the above-mentioned solver. The above-mentioned device 800 also includes: a third receiving unit (not shown in the figure), configured to receive the authentication attribute corresponding to the above-mentioned first account sent by the authentication agency device, wherein the above-mentioned authentication attribute is determined in the following manner: the above-mentioned management device obtains the identity information of the above-mentioned solver from the above-mentioned blockchain, creates the first account after verifying the identity information of the above-mentioned solver, and generates a second attribute list of the above-mentioned solver, wherein the above-mentioned second attribute list includes the above-mentioned first account and the identity information of the above-mentioned solver; the above-mentioned management device obtains the identity information of the above-mentioned solver from the above-mentioned blockchain, creates the first account after verifying the identity information of the above-mentioned solver, and generates the second attribute list of the above-mentioned solver, wherein the above-mentioned second attribute list includes the above-mentioned first account and the identity information of the above-mentioned solver; The processing device generates a second sub-private key based on the second attribute list, the master public key and the master private key, and uploads the second sub-private key and the second attribute list to the blockchain; the solver device obtains the second sub-private key and the second attribute list from the blockchain, performs attribute signature based on the first signature strategy and the second sub-private key to obtain a first signature, and sends the first signature to the certification authority device, wherein the first signature strategy includes the identity information of the solver and the first account; the certification authority device verifies the first signature based on the pre-acquired master public key, and if the verification passes, determines the authentication attribute corresponding to the first account.
[0244] In some optional implementations of this embodiment, the above-mentioned device 800 also includes: a fourth receiving unit, configured to receive a transaction sent by the above-mentioned questioner device for transferring points to the blockchain account corresponding to the above-mentioned answerer device, wherein the above-mentioned transaction includes the number of points; an execution unit, configured to execute the above-mentioned transaction, reduce the points of the above-mentioned number of points from the blockchain account of the above-mentioned questioner device, and increase the points of the above-mentioned number of points to the blockchain account corresponding to the above-mentioned answerer device.
[0245] In some optional implementations of this embodiment, the above-mentioned device 800 also includes: a fifth receiving unit, configured to receive the encrypted additional question information sent by the above-mentioned questioner device, wherein the above-mentioned encrypted additional question information is obtained by the above-mentioned questioner device through attribute encryption based on the above-mentioned master public key, the additional question information and the third encryption strategy.
[0246] In some optional implementations of this embodiment, the apparatus 800 further includes: a sixth receiving unit configured to receive a second information identifier and additional question information sent by the questioner device, wherein the second information identifier is generated by the answerer device for the answer information.
[0247] According to an embodiment of another aspect, a blockchain-based knowledge question-and-answer apparatus is also provided, which is arranged on an answerer device.
[0248] Fig. 9A schematic block diagram of a knowledge question-answering device based on blockchain according to another embodiment is shown. The blockchain stores attribute information of the answerer, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy, and the device 900 includes: an information acquisition unit 901, configured to obtain the answerer's sub-private key and the encrypted question information from the blockchain, and use the answerer's sub-private key to decrypt the encrypted question information. In the case where the first attribute list corresponding to the answerer device conforms to the first encryption strategy, the decryption is successful to obtain the question information, wherein the answerer's sub-private key is generated by the management device based on the answerer's attribute information, the master public key and the master private key; an information receiving unit 902, configured to receive the answer information input by the answerer for the question information, and send the answer information to the blockchain.
[0249] In some optional implementations of this embodiment, the above-mentioned solver has a first account in the above-mentioned blockchain, the above-mentioned attribute information includes the identity information of the above-mentioned solver, and the above-mentioned device 900 also includes: a sub-private key acquisition unit, configured to obtain a second sub-private key and a second attribute list from the above-mentioned blockchain, wherein the above-mentioned second attribute list is generated by the above-mentioned management device based on the identity information of the above-mentioned solver obtained from the above-mentioned blockchain, and the above-mentioned second sub-private key is generated by the above-mentioned management device based on the above-mentioned second attribute list, the above-mentioned master public key and the master private key; a signature sending unit, configured to perform attribute signing based on the first signature strategy and the above-mentioned second sub-private key to obtain a first signature, and send the above-mentioned first signature to a certification authority device, so that the above-mentioned certification authority device verifies the above-mentioned first signature based on the pre-acquired master public key and the above-mentioned first signature strategy. If the verification passes, the authentication attribute corresponding to the above-mentioned first account is uploaded to the above-mentioned blockchain, wherein the above-mentioned first signature strategy includes the identity information of the above-mentioned solver and the above-mentioned first account.
[0250] In some optional implementations of this embodiment, the information receiving unit 902 is further configured to receive the answer information input by the above-mentioned answerer for the above-mentioned question information, and perform attribute encryption based on the above-mentioned master public key, the above-mentioned answer information and the second encryption strategy to obtain encrypted answer information, and upload the above-mentioned encrypted answer information to the above-mentioned blockchain.
[0251] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored. When the above-mentioned computer program is executed in a computer, the computer executes a knowledge question and answer method based on blockchain.
[0252] According to yet another embodiment, a computing device is provided, including a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, a knowledge question and answer method based on blockchain is implemented.
[0253] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0254] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0255] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present application does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0256] Although one or more embodiments of the present specification provide method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.
[0257] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0258] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0259] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0260] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0261] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0262] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0263] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0264] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0265] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0266] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.
[0267] The above description is only an example of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the scope of the claims.
Claims
1. A knowledge question-answering system based on blockchain, the system comprising an answerer device, a questioner device, a management device and a blockchain, wherein the blockchain stores the attribute information of the answerer, the management device comprises a master public key and a master private key generated based on an attribute encryption algorithm, and the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy; the first encryption strategy comprises a specified attribute, which is used to instruct the answerer device to decrypt the encrypted question information under the condition of having the specified attribute; The management device is used to obtain the attribute information of the solver from the blockchain, generate a first attribute list of the solver based on the attribute information, generate a solver sub-private key corresponding to the solver based on the first attribute list, the master public key and the master private key, and upload the solver sub-private key to the blockchain; The solver device is further used to obtain the solver sub-private key and the encrypted question information from the blockchain, and use the solver sub-private key to decrypt the encrypted question information. If the first attribute list conforms to the first encryption policy, the decryption is successful, and the question information is obtained; The answerer device is also used to receive answer information input by the answerer for the question information, and upload the answer information to the blockchain; The questioner device is used to obtain the answer information from the blockchain.
2. The system according to claim 1, wherein: The solver has a first account in the blockchain, the first attribute list includes the first account, the management device is further used to upload the first attribute list to the blockchain, and the blockchain is used to store the first attribute list and the solver sub-private key in association.
3. The system according to claim 2, wherein: When the blockchain stores the first attribute list and the solver sub-private key in association with each other, it is specifically used to: store, in association with the first account, a first ciphertext obtained by encrypting the solver sub-private key and the first attribute list of the first account, wherein the first ciphertext is generated by the management device using the public key of the first account for encryption.
4. The system according to claim 2, wherein: The system further includes a certification authority device, the attribute information includes identity information of the answerer, and The management device is further used to obtain the identity information of the solver from the blockchain, create a first account after verifying the identity information of the solver, and generate a second attribute list of the solver, wherein the second attribute list includes the first account and the identity information of the solver; Generate a second sub-private key based on the second attribute list, the master public key and the master private key, and upload the second sub-private key and the second attribute list to the blockchain; The solver device is further configured to obtain the second sub-private key and the second attribute list from the blockchain, perform attribute signing based on the first signature strategy and the second sub-private key to obtain a first signature, and send the first signature and the first signature strategy to the certification authority device, wherein the first signature strategy includes the identity information of the solver and the first account; The authentication authority device is used to verify the first signature based on the pre-acquired master public key and the first signature policy, and if the verification passes, upload the authentication attribute corresponding to the first account to the blockchain; The blockchain is further configured to store the authentication attribute in association with the first account.
5. The system according to claim 2, wherein: The solver device is further used to obtain the solver sub-private key and the first attribute list from the blockchain, perform attribute signing based on the solver sub-private key and the second signature strategy to obtain a second signature, and upload the public attributes and the second signature to the blockchain, wherein the second signature strategy includes public attributes, and the second signature is used to prove that the first account has all the attributes included in the second signature strategy; the public attributes are the attributes of the solver that are disclosed by the solver; The questioner device is used to verify the second signature based on the pre-acquired master public key and the second signature policy, and if the verification succeeds, it is determined that the first account has the public attribute.
6. The system according to claim 1, wherein: The answerer device is also used to receive answer information input by the answerer for the question information, and upload the answer information to the blockchain, including: The answerer device is used to receive the answer information input by the answerer in response to the question information, perform attribute encryption based on the master public key, the answer information and the second encryption strategy to obtain encrypted answer information, and upload the encrypted answer information to the blockchain.
7. The system according to claim 1, wherein: The blockchain also stores a first information identifier associated with the encrypted question information; The answerer device uploads the answer information to the blockchain, including: The answer information and the first information identifier are associated with each other and uploaded to the blockchain.
8. The system according to claim 1, wherein: The questioner device is further used to send a transaction to the blockchain for transferring points to the blockchain account corresponding to the answerer device, wherein the transaction includes the amount of points; The node of the blockchain executes the transaction, reduces the points of the number of points from the blockchain account of the questioner device, and increases the points of the number of points to the blockchain account corresponding to the answerer device.
9. The system according to claim 1, wherein: The questioner device is also used to perform attribute encryption based on the master public key, the additional question information and the third encryption strategy to obtain encrypted additional question information, and upload the encrypted additional question information to the blockchain.
10. The system according to claim 1, wherein: The answerer device is further used to generate a second information identifier for the answer information; The questioner device is further configured to send the additional question information and the second information identifier in association with each other to the blockchain.
11. The system according to claim 1, wherein: The system also includes a certification body device, which is used to upload the certification body's institutional information to the blockchain; The management device is used to obtain the organization information from the blockchain, determine the organization attribute label corresponding to the certification organization device based on the organization information, generate the organization sub-private key of the certification organization device based on the organization attribute label, the master public key and the master private key, and upload the organization sub-private key to the blockchain; The certification authority device is also used to obtain the institution sub-private key from the blockchain.
12. The system of claim 1, wherein: The attribute information includes the identity information of the solver, and the management device is also used to generate a system public key and a system private key, and upload the system public key to the blockchain; The solver device is also used to encrypt the solver's identity information using the system public key obtained from the blockchain, and upload the encrypted identity information to the blockchain.
13. A knowledge question-answering method based on blockchain, applied to a node of blockchain, wherein: The blockchain stores attribute information of the answerer, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy, the first encryption strategy includes a specified attribute, and is used to instruct the answerer device to decrypt the encrypted question information under the condition of having the specified attribute; The method comprises: In response to the request sent by the management device, sending the attribute information of the solver to the management device; Receiving an answerer sub-private key corresponding to the answerer from the management device, and storing the answerer sub-private key in the blockchain, wherein the answerer sub-private key is generated based on a first attribute list corresponding to the answerer device, the master public key, and the master private key, and the first attribute list is generated by the management device based on the attribute information; In response to a request sent by the answerer device, sending the answerer sub-private key and the encrypted question information to the answerer device; receiving answer information sent by the answerer device, wherein the answer information is obtained by the answerer device through the following process: decrypting the encrypted question information using the answerer sub-private key, and in the case where the first attribute list conforms to the first encryption policy, the decryption is successful, and the question information is obtained; receiving answer information input by the answerer for the question information; In response to the request sent by the questioner device, the answer information is sent to the questioner device.
14. The method according to claim 13, wherein: The solver has a first account in the blockchain, the attribute information includes identity information of the solver, and the method further includes: Receiving an authentication attribute corresponding to the first account sent by an authentication authority device, wherein the authentication attribute is determined in the following manner: The management device obtains the identity information of the solver from the blockchain, creates a first account after verifying the identity information of the solver, and generates a second attribute list of the solver, wherein the second attribute list includes the first account and the identity information of the solver; The management device generates a second sub-private key based on the second attribute list, the master public key and the master private key, and uploads the second sub-private key and the second attribute list to the blockchain; The solver device obtains the second sub-private key and the second attribute list from the blockchain, performs attribute signing based on the first signature strategy and the second sub-private key to obtain a first signature, and sends the first signature to the certification authority device, wherein the first signature strategy includes the solver's identity information and the first account; The authentication authority device verifies the first signature based on a pre-acquired master public key, and if the verification passes, determines the authentication attribute corresponding to the first account.
15. The method according to claim 13, wherein: The method further comprises: Receiving a transaction sent by the questioner device for transferring points to a blockchain account corresponding to the answerer device, wherein the transaction includes the amount of points; The transaction is executed to reduce the points of the number of points from the blockchain account of the questioner device and to increase the points of the number of points to the blockchain account corresponding to the answerer device.
16. The method according to claim 13, wherein: The method further comprises: The encrypted additional question information sent by the questioner device is received, wherein the encrypted additional question information is obtained by attribute encryption performed by the questioner device based on the master public key, the additional question information and a third encryption strategy.
17. The method according to claim 13, wherein: The method further comprises: A second information identifier and additional question information sent by the questioner device are received, wherein the second information identifier is generated by the answerer device with respect to the answer information.
18. A knowledge question-answering method based on blockchain, applied to an answerer device, wherein: The blockchain stores attribute information of the answerer, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy, the first encryption strategy includes a specified attribute, and is used to instruct the answerer device to decrypt the encrypted question information under the condition of having the specified attribute; The method comprises: Obtaining the solver sub-private key and the encrypted question information from the blockchain, decrypting the encrypted question information using the solver sub-private key, and in the case where the first attribute list corresponding to the solver device conforms to the first encryption policy, decryption succeeds to obtain the question information, wherein the solver sub-private key is generated by the management device based on the first attribute list, the master public key and the master private key, and the first attribute list is the attribute information of the solver obtained by the management device from the blockchain and generated based on the attribute information; Receive answer information input by the answerer in response to the question information, and send the answer information to the blockchain.
19. The method according to claim 18, wherein: The solver has a first account in the blockchain, the attribute information includes identity information of the solver, and the method further includes: Acquire a second sub-private key and a second attribute list from the blockchain, wherein the second attribute list is generated by the management device based on the identity information of the solver acquired from the blockchain, and the second sub-private key is generated by the management device based on the second attribute list, the master public key, and the master private key; A first signature is obtained by performing attribute signing based on a first signature strategy and the second sub-private key, and the first signature is sent to a certification authority device, so that the certification authority device verifies the first signature based on a pre-acquired master public key and the first signature strategy. If the verification passes, the authentication attribute corresponding to the first account is uploaded to the blockchain, wherein the first signature strategy includes the identity information of the solver and the first account.
20. The method according to claim 18, wherein: The receiving the answer information input by the solver in response to the question information, and sending the answer information to the blockchain, comprises: Receive the answer information input by the solver in response to the question information, perform attribute encryption based on the master public key, the answer information and the second encryption strategy to obtain encrypted answer information, and upload the encrypted answer information to the blockchain.
21. A knowledge question-answering device based on blockchain, arranged at a node of blockchain, wherein: The blockchain stores attribute information of the answerer, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy, the first encryption strategy includes a specified attribute, and is used to instruct the answerer device to decrypt the encrypted question information under the condition of having the specified attribute; The device comprises: A first sending unit, configured to send the attribute information of the answerer to the management device in response to a request sent by the management device; A first receiving unit is configured to receive a solver sub-private key corresponding to the solver from the management device, and store the solver sub-private key in the blockchain, wherein the solver sub-private key is generated based on a first attribute list corresponding to the solver device, the master public key, and the master private key, and the first attribute list is generated by the management device based on the attribute information; A second sending unit, configured to send the solver sub-private key and the encrypted question information to the solver device in response to a request sent by the solver device; a second receiving unit, configured to receive answer information sent by the answerer device, wherein the answer information is obtained by the answerer device through the following process: decrypting the encrypted question information using the answerer sub-private key, and in the case where the first attribute list conforms to the first encryption policy, the decryption is successful to obtain the question information; and receiving the answer information input by the answerer for the question information; The third sending unit is configured to send the answer information to the questioner device in response to the request sent by the questioner device.
22. A knowledge question-answering device based on blockchain, arranged on an answerer's device, wherein: The blockchain stores attribute information of the answerer, the management device includes a master public key and a master private key generated based on an attribute encryption algorithm, the encrypted question information stored in the blockchain is obtained by the questioner device through attribute encryption based on the master public key and a first encryption strategy, the first encryption strategy includes a specified attribute tag, and is used to instruct the answerer device to decrypt the encrypted question information under the condition of having the specified attribute tag; The device comprises: an information acquisition unit, configured to acquire a solver sub-private key and the encrypted question information from the blockchain, decrypt the encrypted question information using the solver sub-private key, and in the case where the first attribute list corresponding to the solver device complies with the first encryption policy, decryption succeeds to obtain question information, wherein the solver sub-private key is generated by the management device based on the first attribute list, the master public key and the master private key, and the first attribute list is the attribute information of the solver acquired by the management device from the blockchain and generated based on the attribute information; An information receiving unit is configured to receive answer information input by the answerer in response to the question information, and send the answer information to the blockchain.
23. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 13 to 20.
24. A computing device comprising a memory and a processor, characterized in that: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 13 to 20 is implemented.
Citation Information
Patent Citations
Improved attribute-based encryption scheme system and encryption algorithm thereof
CN114117475A
Block chain privacy protection method based on online and offline attribute encryption
CN114640468A