Key tamper-proofing method based on block chain

By hashing and storing the ciphertext and decryption permission list of database access information (key) on the blockchain, the immutable characteristics of the blockchain are verified to verify the integrity and consistency of the keys, and the keys in the existing technology are solved by using the keys that are not tampered with. The problem of insufficient tamper-proof capability improves the security of key use and system trust.

CN119449265APending Publication Date: 2025-02-14上海市大数据中心
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411511208.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art has problems such as fragility in encryption algorithms, insufficient security of password managers, internal threats, risks of cryptographic text tampering and insufficient multi-factor authentication when protecting database access information (keys), resulting in insufficient anti-tampering capabilities of account information.

Method used

Adopt the anti-tampering method of keys based on blockchain, and hash the ciphertext and decryption permission list generated by key encryption and then write it to the blockchain. Taking advantage of the tamper-free nature of the blockchain, it can be used to hash the key when using the key. Computes the hash value on the blockchain to verify the integrity and consistency of the key.

Benefits of technology

Through the immutability of blockchain, the keys are ensured that they have not been tampered with, which improves the security of key usage, enhances data integrity and system trust.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449265A_ABST
    Figure CN119449265A_ABST
Patent Text Reader

Abstract

The invention discloses a key tamper-proofing method based on a block chain, and the method comprises the following steps: S1, encrypting a key, hashing a generated key ciphertext and a decryption permission list, and writing the key ciphertext and the decryption permission list into a block; and S2, comparing the key with a hash value on the block chain after hash calculation when the key is used, so as to verify the integrity and consistency of the key. According to the key tamper-proofing method based on the block chain provided by the invention, the non-tampering characteristic of the block chain is utilized, the generated key ciphertext and the decryption permission list are written into the block after being hashed, and the key is compared with the hash value on the block chain after being subjected to hash calculation when the key is used, so that the key is not tampered; and the use safety of the key is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a key anti-tampering method, and in particular to a key anti-tampering method based on blockchain. Background Art

[0002] In recent years, as data privacy issues have received increasing attention, how to achieve effective privacy protection in blockchain has become a new research focus. Researchers have discussed the privacy protection methods of blockchain in terms of transaction addresses, oracles, and smart contracts, and summarized the privacy strategies of blockchain in protecting basic elements. Cryptographic techniques such as homomorphic encryption, secure multi-party computation (SMPC), and zero-knowledge proof (ZKP) can realize data calculation and verification while protecting data privacy. Homomorphic encryption allows calculations to be performed on ciphertext and obtain the same calculation results as plaintext; SMPC allows multiple parties to perform joint calculations while protecting the privacy of their respective inputs; ZKP allows one party to prove to others that a statement is correct without revealing any other information; see: A Review of Privacy Protection Technologies in Blockchain Cryptography, Journal of Network and Information Security, 2022, 8(4): 29-44 doi: 10.11959 / j.issn.2096-109x.2022054.

[0003] Hash algorithms are used in blockchain to ensure that transactions cannot be tampered with. The structure of blockchain is formed by generating a data summary from transaction information and linking the hash value of the previous block in the block. Hash functions play an important role in privacy protection technology. For example, in secure multi-party computing (SMPC) and homomorphic encryption, hash functions can perform secure calculations on encrypted data to protect data privacy. Hash algorithms are not only used in the field of cryptography, but are also widely used in multiple scenarios such as identity authentication, data integrity verification, digital signatures, and deduplication.

[0004] The leakage of database access information (mainly including user name, password, address, port, JDBC connection string, etc., which is defined as a key for the convenience of description) will bring about a relatively large security risk. Although technical means such as encryption and authentication of account passwords can improve security, there are still the following problems: Vulnerability of encryption algorithms: With the improvement of computing power, some encryption algorithms that were relatively secure in the past may no longer be secure now.

[0005] Security of password managers: Although password managers can improve password security, if they are cracked, they will lead to a large number of account risks.

[0006] Insider threats: Insiders may abuse their privileges and bypass security measures to access sensitive information.

[0007] Ciphertext tampering: Even if the plaintext is encrypted, there is a risk that the ciphertext may be tampered with, making it unusable after resolution.

[0008] Prevalence of multi-factor authentication: Not all systems have multi-factor authentication implemented, or users may turn off the feature because it is too troublesome.

[0009] Based on the above problems, it is necessary to make further improvements and breakthroughs in solving the technical problems of account information tampering prevention, and to demonstrate its technical advantages and potential in improving overall system security, simplifying operating procedures, and responding to emerging technological challenges. Summary of the invention

[0010] The technical problem to be solved by the present invention is to provide a key anti-tampering method based on blockchain, which can ensure that the key has not been tampered with and improve the security of key use.

[0011] The technical solution adopted by the present invention to solve the above technical problems is to provide a key anti-tampering method based on blockchain, including the following steps: S1, encrypting the key, and hashing the generated key ciphertext and decryption permission list and writing them into the block; S2, when using the key, comparing it with the hash value on the blockchain after hash calculation to verify the integrity and consistency of the key.

[0012] Furthermore, the step S1 includes: S11, submitting key plaintext information; S12, generating a random key for symmetric encryption; S13, adopting the national secret algorithm to encrypt the key plaintext using the above random key to generate a key ciphertext; S14, calling the cryptographic machine to use the public key of the user with decryption authority to perform encryption calculation on the random key, and generate a decryption authority list; S15, hashing the key ciphertext and the decryption authority list to obtain a hash value; S16, calling the smart contract to write the hash value obtained by the above calculation into the blockchain, and at the same time write the key ciphertext and the decryption authority list into the database.

[0013] Furthermore, the key ciphertext in step S13 is SM4{key (user name, password), random key}, the decryption permission list in step S14 is SM2{public key of user with decryption permission, random key}, and the hash value in step S15 is HASH{key ciphertext, decryption permission list}.

[0014] Furthermore, there are multiple user public keys with decryption authority.

[0015] Furthermore, the step S2 includes: S21, traversing the key ciphertext and decryption permission list in the database; S22, checking whether the current user has decryption permission, and obtaining the random key ciphertext corresponding to the current user through the user private key. If not found, it means that the current user does not have the permission to decrypt the data, and the process ends; S23, hashing the key ciphertext and the decryption permission list to obtain a hash value; S24, calling the smart contract to obtain the hash value on the blockchain and performing a consistency check with the above-obtained hash value. If it fails, the process ends; S25, calling the cipher machine to decrypt the above-mentioned random key ciphertext and obtain plaintext; S26, using the above-mentioned random key plaintext to decrypt the key ciphertext to obtain the key plaintext.

[0016] Furthermore, the hash value in step S23 is HASH{key ciphertext, decryption permission list}, the random key plaintext in step S25 is SM2{random key ciphertext, user private key with decryption permission}, and the key plaintext in step S26 is SM4{random number, key ciphertext}.

[0017] Compared with the prior art, the present invention has the following beneficial effects: the blockchain-based key anti-tampering method provided by the present invention utilizes the tamper-proof property of the blockchain, hashes the generated key ciphertext and decryption permission list and writes them into the block, and compares them with the hash value on the blockchain after hash calculation when using the key to ensure that the key has not been tampered with, thereby improving the security of key use. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 This is a schematic diagram of key encryption based on blockchain in the present invention; Figure 2 This is a schematic diagram of the use of blockchain-based keys in the present invention. DETAILED DESCRIPTION

[0019] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0020] The blockchain-based key anti-tampering method provided by the present invention is different from the traditional key encryption and decryption technology. It borrows the characteristics of blockchain anti-tampering technology, generates a hash for the key ciphertext and writes it into the block. When in use, a unique hash is obtained through a smart contract as a verification code, thereby providing guarantees for key anti-tampering and decryption consistency.

[0021] (1) Ciphertext hash generation: First, generate a hash value for the key ciphertext. This step utilizes the one-way and collision-resistant properties of the hash algorithm to ensure the uniqueness and security of the ciphertext.

[0022] (2) Block writing: Write the generated hash value into the block of the blockchain. The immutability of the blockchain means that once the data is written into the block, it cannot be easily changed or deleted.

[0023] (3) Smart contract verification: When using the key, the hash value stored in the blockchain is obtained through the smart contract. This hash value is used as a verification code to verify the integrity and consistency of the key.

[0024] (4) Anti-tampering: Since each block in the blockchain contains the hash value of the previous block, any tampering of historical data will cause inconsistencies in the blockchain, which will be detected and rejected by other nodes in the network.

[0025] See also Figure 1 As a preferred implementation, the key encryption process based on blockchain of the present invention is as follows: S11. Submit the key plaintext information.

[0026] S12. The system generates a random key for use in symmetric encryption.

[0027] S13. Use the national secret algorithm SM4 to use the above random key to encrypt the key plaintext to generate key ciphertext, where the key ciphertext = SM4{key (user name, password), random key}.

[0028] S14. Call the cryptographic machine to use the public key of the user with decryption authority to perform encryption calculation on the random key, and generate a decryption authority list. The decryption authority list = SM2{public key of the user with decryption authority, random key} (multiple user public keys can be added here).

[0029] S15. Perform hash calculation on the key ciphertext and the decryption permission list to obtain a hash value, where the hash value = HASH{key ciphertext, decryption permission list}.

[0030] S16. Call the smart contract to write the hash value obtained by the above calculation into the blockchain, and write the key ciphertext and decryption permission list into the database.

[0031] Please continue to see Figure 2 As a preferred implementation, the key usage process based on blockchain of the present invention is as follows: S21. Traverse the key ciphertext and decryption permission list in the database.

[0032] S22. Check whether the current user has decryption authority, and obtain the random key ciphertext corresponding to the current user through the user private key. If not found, it means that the current user does not have the authority to decrypt data, and the process ends.

[0033] S23. Hash the key ciphertext and the decryption permission list to obtain a hash value, where the hash value = HASH{key ciphertext, decryption permission list}.

[0034] S24. Call the smart contract to obtain the hash value on the blockchain and perform a consistency check with the hash value obtained above. If it fails, the process ends.

[0035] S25. Call the cryptographic machine to decrypt the random key ciphertext and obtain the plaintext. The random key plaintext = SM2{random key ciphertext, private key of the user with decryption authority}.

[0036] S26. Use the above random key plaintext to decrypt the key ciphertext to obtain the key plaintext, where the key plaintext = SM4{random number, key ciphertext}.

[0037] In summary, the present invention has not only achieved a breakthrough in solving the technical problem of account information tampering prevention, but also demonstrated its technical advantages and potential in improving overall system security, simplifying operation procedures, and responding to emerging technological challenges. The specific advantages are as follows: (1) Improved security: By storing the hash value of the account ciphertext in the blockchain, the tamper-proof nature of the blockchain is utilized to enhance the security of the account. Any tampering with the ciphertext will be immediately discovered due to the inconsistency of the hash value, thereby protecting the security of the account information.

[0038] (2) Enhanced data integrity: The hash algorithm ensures the integrity of the data. Once the data is tampered with during transmission or storage, the change in the hash value will be detected, ensuring the originality and integrity of the data.

[0039] (3) Simplified key management: Using blockchain technology to store the hash value of the key simplifies the key management process, reduces the risk of key leakage, and reduces management costs and complexity.

[0040] (4) Improving system trust: The transparency and decentralization of blockchain technology increase users’ trust in the system, making them more confident in using the system for transactions and data exchange.

[0041] (5) Ensuring decryption consistency: The introduction of smart contracts ensures the consistency and correctness of key usage. The unique hash value is used as a verification code to ensure the accuracy and consistency of the key decryption process.

[0042] Although the present invention has been disclosed as above with preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art may make some modifications and improvements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be based on the definition of the claims.

Claims

1. A key tamper-proof method based on blockchain, characterized in that: The steps include: S1. Encrypt the key, hash the generated key ciphertext and decryption permission list, and write them into the block; S2. When using the key, the hash value is compared with the hash value on the blockchain to verify the integrity and consistency of the key.

2. The blockchain-based key tamper-proof method according to claim 1, characterized in that: The step S1 comprises: S11. Submit key plaintext information; S12, generating a random key for symmetric encryption; S13, using the national secret algorithm to encrypt the key plaintext using the above random key to generate the key ciphertext; S14, calling the cryptographic machine to use the public key of the user with decryption authority to perform encryption calculation on the random key and generate a decryption authority list; S15, performing hash calculation on the key ciphertext and the decryption permission list to obtain a hash value; S16. Call the smart contract to write the hash value obtained by the above calculation into the blockchain, and write the key ciphertext and decryption permission list into the database.

3. The blockchain-based key tamper-proof method according to claim 2, characterized in that: The key ciphertext in step S13 is SM4{key (user name, password), random key}, the decryption permission list in step S14 is SM2{public key of user with decryption permission, random key}, and the hash value in step S15 is HASH{key ciphertext, decryption permission list}.

4. The blockchain-based key tamper-proof method according to claim 3, characterized in that: The number of the user public keys having decryption authority is multiple.

5. The blockchain-based key tamper-proof method according to claim 1, characterized in that: The step S2 comprises: S21, traverse the key ciphertext and decryption permission list in the database; S22, check whether the current user has the decryption permission, and obtain the random key ciphertext corresponding to the current user through the user private key. If it is not found, it means that the current user does not have the permission to decrypt the data, and the process ends; S23, hashing the key ciphertext and the decryption permission list to obtain a hash value; S24, calling the smart contract to obtain the hash value on the blockchain and performing a consistency check on the hash value obtained above, if it fails, the process ends; S25, calling the cryptographic machine to decrypt the random key ciphertext to obtain the plaintext; S26. Use the above random key plaintext to decrypt the key ciphertext to obtain the key plaintext.

6. The blockchain-based key tamper-proof method according to claim 5, characterized in that: The hash value in step S23 is HASH{key ciphertext, decryption permission list}, the random key plaintext in step S25 is SM2{random key ciphertext, user private key with decryption permission}, and the key plaintext in step S26 is SM4{random number, key ciphertext}.