Search

CN-121980605-A - Block chain data encryption query method, device, equipment and medium

CN121980605ACN 121980605 ACN121980605 ACN 121980605ACN-121980605-A

Abstract

The invention relates to the technical field of blockchain and discloses a blockchain data encryption query method, a device, equipment and a medium, wherein the method comprises the steps of extracting data content information of data to be uplinked, and carrying out encryption processing on the data content information by utilizing a homomorphic encryption algorithm to obtain ciphertext content information; the method comprises the steps of taking ciphertext content information and corresponding ciphertext hash values as chain evidence data to be stored in a block chain in a uplink mode, carrying out association mapping on the chain evidence data and ciphertext access rules through an intelligent contract to generate authority association rules corresponding to the chain evidence data, carrying out authority verification on access authorities in a data query request based on the authority association rules, carrying out homomorphic encryption state query on the chain evidence data according to the data query request after the authority verification is passed to obtain an encryption query result, and carrying out decryption processing on the encryption query result to obtain target plaintext query data. The invention can improve the reliability of data encryption inquiry.

Inventors

  • CHEN JIANGANG
  • ZHU GENGLIANG
  • LI ZONGJIN
  • LONG XIYANG
  • Cheng Yefeng

Assignees

  • 招商局金融科技有限公司

Dates

Publication Date
20260505
Application Date
20251230

Claims (10)

  1. 1. A method for encryption query of blockchain data, the method comprising: Extracting data content information of preset data to be uplink, and carrying out encryption processing on the data content information by using a preset homomorphic encryption algorithm to obtain ciphertext content information; calculating a ciphertext hash value of the ciphertext content information, and taking the ciphertext content information and the ciphertext hash value as on-chain certificate data to be stored in a preset blockchain in an uplink manner; Invoking a pre-deployed intelligent contract in the blockchain, and performing association mapping on the on-chain certificate storage data and a preset ciphertext access rule through the intelligent contract to generate a permission association rule corresponding to the on-chain certificate storage data; receiving a data query request initiated by a user, and performing authority verification on access authorities in the data query request based on the authority association rule; when the authority verification is passed, inquiring the on-chain certificate storage data in the blockchain in a homomorphic encryption state according to the data inquiry request to obtain a corresponding encryption inquiry result; and carrying out decryption processing on the encrypted query result to obtain target plaintext query data.
  2. 2. The blockchain data encryption query method of claim 1, wherein the encrypting the data content information using a preset homomorphic encryption algorithm to obtain ciphertext content information comprises: acquiring a key generation parameter corresponding to the homomorphic encryption algorithm, and generating a public key and a private key of the homomorphic encryption algorithm based on the key generation parameter; carrying out standardized encapsulation on the data content information according to a preset data structure specification to obtain a data block to be encrypted; homomorphic encryption is carried out on the data block to be encrypted by utilizing the homomorphic encryption algorithm and the corresponding public key, and initial ciphertext information is generated; And correlating the initial ciphertext information with the index information of the private key to obtain ciphertext content information.
  3. 3. The method of claim 1, wherein the step of storing the ciphertext content information and the ciphertext hash value as an on-chain authenticated data uplink to a predetermined blockchain comprises: Performing association packaging on the ciphertext content information and the ciphertext hash value to generate a certification data packet; Carrying out format serialization on the evidence storage data packet to generate a standard evidence storage data packet meeting the requirement of the block chain evidence storage format; Carrying out digital signature on the standard certificate storing data packet to generate a broadcasted signature certificate storing; Broadcasting the signature deposit certificate to the block chain, and triggering a consensus node in the block chain to perform consensus verification on the signature deposit certificate; and responding to the signature verification and the successful verification of the standard verification data packet to a new block in the blockchain, acquiring a unique verification hash value corresponding to the current verification from the blockchain, and taking the standard verification data packet and the unique verification hash value as on-chain verification data.
  4. 4. The blockchain data encryption query method of claim 1, wherein the performing association mapping on the on-chain forensic data and a preset ciphertext access rule through the smart contract to generate the rights association rule corresponding to the on-chain forensic data includes: Analyzing a preset ciphertext access rule according to the intelligent contract to obtain a corresponding access subject identifier and an access operation authority, and taking the access subject identifier and the access operation authority as rule parameter objects; generating a rule index identifier corresponding to the on-chain certificate storage data according to a preset hash algorithm; constructing key value pairs taking the rule index mark as keys and the rule parameter object as a value; And carrying out association mapping on the on-chain evidence-storing data and the ciphertext access rule according to the key value to obtain an authority association rule corresponding to the on-chain evidence-storing data.
  5. 5. The blockchain data encryption query method of claim 1, wherein the performing the permission verification on the access permission in the data query request based on the permission association rule includes: Responding to a data query request initiated by a user, analyzing access rights in the data query request, and obtaining a corresponding request main body identifier, a request operation type, a data resource identifier for requesting access and a request timestamp; taking the request main body identification, the request operation type, the data resource mark of the request access and the request timestamp as permission verification parameters; Matching the permission association rule based on the data resource identifier to obtain a target permission association rule; performing authority verification on the authority verification parameter and the target authority association rule; Judging whether the request subject identifier belongs to a subject range allowed by the target authority association rule, whether the request operation type accords with the operation authority limited by the target authority association rule, and judging whether the request timestamp is in an effective access period set by the target authority association rule; And if the request subject identifier belongs to the subject range allowed by the target authority association rule, the request operation type accords with the operation authority limited by the target authority association rule, and the request time stamp is in the effective access period set by the target authority association rule, judging that the authority verification of the data query request is passed.
  6. 6. The method for encrypting and querying the blockchain data according to claim 1, wherein after the authority verification is passed, querying the blockchain in the homomorphic encryption state according to the data query request to obtain a corresponding encrypted query result comprises: extracting a plaintext query condition in the data query request; Homomorphic encryption is carried out on the plaintext inquiry condition by utilizing the public key of the homomorphic encryption algorithm, so that an encryption inquiry instruction which can be directly executed in a ciphertext state is generated; positioning on the block chain according to a target data resource identifier in the data query request and acquiring a corresponding on-chain evidence-storing ciphertext of the on-chain evidence-storing data; and executing inquiry under the ciphertext state on the chain evidence-stored ciphertext based on the homomorphic encryption algorithm and the encryption inquiry instruction to obtain a corresponding encryption inquiry result.
  7. 7. The blockchain data encryption query method of claim 1, wherein the decrypting the encrypted query result to obtain the target plaintext query data comprises: Obtaining a decryption algorithm and a decryption key corresponding to the homomorphic encryption algorithm; Performing decryption operation on the encryption inquiry result according to the decryption algorithm and the decryption key to obtain initial plaintext data; and performing format conversion on the initial plaintext data to obtain target plaintext query data.
  8. 8. A blockchain data encryption querying device, the device comprising: the data homomorphic encryption module is used for extracting data content information of preset data to be uplinked, and carrying out encryption processing on the data content information by utilizing a preset homomorphic encryption algorithm to obtain ciphertext content information; The data homomorphic encryption module is used for calculating a ciphertext hash value of the ciphertext content information, and taking the ciphertext content information and the ciphertext hash value as on-chain evidence-storing data to be stored in a preset blockchain in an uplink manner; The authority rule association module is used for calling a pre-deployed intelligent contract in the blockchain, carrying out association mapping on the on-chain evidence-storing data and a preset ciphertext access rule through the intelligent contract, and generating an authority association rule corresponding to the on-chain evidence-storing data; the permission verification matching module is used for receiving a data query request initiated by a user and verifying the access permission in the data query request based on the permission association rule; The data homomorphic inquiry module is used for inquiring the on-chain certificate-storing data in the block chain in a homomorphic encryption state according to the data inquiry request after the permission verification is passed, so as to obtain a corresponding encryption inquiry result; and the encrypted data decryption module is used for decrypting the encrypted query result to obtain target plaintext query data.
  9. 9. An electronic device, the electronic device comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the blockchain data encryption querying method of any of claims 1 to 7.
  10. 10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the blockchain data encryption querying method of any of claims 1 to 7.

Description

Block chain data encryption query method, device, equipment and medium Technical Field The present invention relates to the field of blockchain, and in particular, to a blockchain data encryption query method, device, apparatus, and medium. Background In the digital age, the importance of data is increasingly highlighted, and the safe storage and efficient query thereof become key requirements. The blockchain technology provides reliable guarantee for data storage by virtue of the characteristics of non-tampering, traceability and the like, but privacy leakage risks exist when plaintext data is directly stored on the blockchain. However, the conventional data encryption method can improve the data security, but brings a plurality of limitations to data query, for example, the data after conventional encryption can be queried only by decrypting, and can not be directly calculated and queried in a ciphertext state, so that the calculation cost is increased, the data can be possibly subjected to security threat in the decryption process, and the severe requirement on data privacy protection in a blockchain environment is difficult to meet. Therefore, how to improve the security and reliability of encrypted data query is a urgent issue to be resolved. Disclosure of Invention The invention provides a block chain data encryption query method, a device, equipment and a medium, which mainly aim to solve the problem of low reliability of encryption data query. In order to achieve the above object, the present invention provides a blockchain data encryption query method, including: Extracting data content information of preset data to be uplink, and carrying out encryption processing on the data content information by using a preset homomorphic encryption algorithm to obtain ciphertext content information; calculating a ciphertext hash value of the ciphertext content information, and taking the ciphertext content information and the ciphertext hash value as on-chain certificate data to be stored in a preset blockchain in an uplink manner; Invoking a pre-deployed intelligent contract in the blockchain, and performing association mapping on the on-chain certificate storage data and a preset ciphertext access rule through the intelligent contract to generate a permission association rule corresponding to the on-chain certificate storage data; receiving a data query request initiated by a user, and performing authority verification on access authorities in the data query request based on the authority association rule; when the authority verification is passed, inquiring the on-chain certificate storage data in the blockchain in a homomorphic encryption state according to the data inquiry request to obtain a corresponding encryption inquiry result; and carrying out decryption processing on the encrypted query result to obtain target plaintext query data. In a second aspect, the present invention also provides a blockchain data encryption query device, including: the data homomorphic encryption module is used for extracting data content information of preset data to be uplinked, and carrying out encryption processing on the data content information by utilizing a preset homomorphic encryption algorithm to obtain ciphertext content information; the on-chain data storage module is used for calculating a ciphertext hash value of the ciphertext content information, and taking the ciphertext content information and the ciphertext hash value as on-chain evidence storage data to be stored in a preset blockchain in an uplink manner; The authority rule association module is used for calling a pre-deployed intelligent contract in the blockchain, carrying out association mapping on the on-chain evidence-storing data and a preset ciphertext access rule through the intelligent contract, and generating an authority association rule corresponding to the on-chain evidence-storing data; the permission verification matching module is used for receiving a data query request initiated by a user and verifying the access permission in the data query request based on the permission association rule; The data homomorphic inquiry module is used for inquiring the on-chain certificate-storing data in the block chain in a homomorphic encryption state according to the data inquiry request after the permission verification is passed, so as to obtain a corresponding encryption inquiry result; and the encrypted data decryption module is used for decrypting the encrypted query result to obtain target plaintext query data. In a third aspect, the present invention also provides an electronic device, including: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the blockchain data encryption querying method described above. In a fourth aspect, the present invention also provides a com