A blockchain-based medical data multi-level encryption and permission management system and method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2026-08-11
AI Technical Summary
[0006]本发明提供基于区块链的医疗数据多级加密与权限管理系统及方法,以解决现有的缺少对医疗数据的加密,存在患者隐私泄露风险;上传医疗数据至区块链后没有验证医疗数据是否在上传过程中被篡改,无法保证医疗数据的完整;用户访问权限设置较为宽泛,难以保证医疗数据安全
[0050] 1. In the process of asymmetric encryption, public-key encryption technology is used. By using additional public and private key generation strategies, the symmetric key is encrypted, which enhances the security and complexity of data encryption. The public key can be publicly shared, while the confidentiality of the private key ensures that only authorized users can decrypt information, effectively preventing key leakage and thus increasing the difficulty of unauthorized decryption.
Smart Images

Figure CN118568747B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain, and in particular to a blockchain-based multi-level encryption and access control system and method for medical data. Background Technology
[0002] As the healthcare industry becomes increasingly digitalized, data breaches and security threats are becoming more serious, necessitating robust security mechanisms to protect data from unauthorized access. Blockchain-based multi-level encryption and access control systems and methods for healthcare data demonstrate unique technological advantages. The immutable records provided by blockchain technology effectively prevent unauthorized data modification. Each data record is added to the blockchain after network consensus; once written, it cannot be changed. The transparency of blockchain makes all transactions verifiable and difficult to forge, while maintaining user anonymity. Every data access and change is traceable, facilitating compliance checks.
[0003] The blockchain-based multi-level encryption and access control system for medical data leverages the core advantages of blockchain and combines it with modern encryption technology to provide a comprehensive solution for the secure storage, confidential transmission, and precise access control of medical data. This not only enhances the security and privacy protection of medical data but also improves the efficiency and quality of medical services.
[0004] Chinese patent application number CN202110016852.X, published on April 30, 2021, discloses a blockchain-based method for sharing medical records, including: S1. Consortium blockchain construction: Hospitals participating in medical data generation register as administrator users and join the blockchain, forming a consortium blockchain network; S2. User registration: All members in the consortium blockchain use the same client; S3. Medical data generation: After each patient visit, doctors write medical data; S4. Data upload: Doctors upload medical data with patient and doctor signatures (Sigdoc and Sigid) to the blockchain network; S5. User login; S6. Search strategy: Users search for disease codes to obtain all data for that disease in the system; S7. Online communication: After searching for medical records, users can communicate online with cases of interest. By running smart contracts to upload data that meets the conditions to the blockchain, it is propagated to various nodes to form blocks and spread throughout the network, allowing patients to anonymously obtain real and reliable treatment plans that have already occurred and communicate with other patients or doctors.
[0005] However, the above technical solutions have at least the following technical problems: lack of encryption for medical data, posing a risk of patient privacy leakage; no verification of whether medical data has been tampered with during the upload process after uploading to the blockchain, making it impossible to guarantee the integrity of medical data; and relatively broad user access permission settings, making it difficult to guarantee the security of medical data. Summary of the Invention
[0006] This invention provides a blockchain-based multi-level encryption and access control system and method for medical data, addressing the existing problems of lacking encryption for medical data, posing a risk of patient privacy leakage; failing to verify whether medical data has been tampered with during the upload process after being uploaded to the blockchain, thus failing to guarantee the integrity of the medical data; and having overly broad user access permission settings, making it difficult to ensure the security of medical data.
[0007] This invention discloses a blockchain-based multi-level encryption and access control system for medical data, comprising the following parts:
[0008] The medical data acquisition module is used to acquire medical data;
[0009] The medical data encryption module is used to receive medical data, process the medical data using a multi-level encryption strategy, and obtain encrypted medical data, encrypted symmetric key and initial hash value;
[0010] The blockchain network module is used to receive encrypted medical data, encrypted symmetric keys, and initial hash values; dynamically adjust the difficulty value of new blocks, verify them through the proof-of-work algorithm, generate new blocks, upload encrypted medical data, encrypted symmetric keys, and initial hash values to the new blocks in the blockchain, and re-hash the encrypted medical data and encrypted symmetric keys, comparing them with the initial hash value to verify that they have not been tampered with.
[0011] The permission management module is used to manage permissions based on the verification results of the blockchain network module by adding an alternative verification function.
[0012] The user processing module is used for authorization based on the permission management module. It uses the improved private key to decrypt the encrypted symmetric key to obtain the decrypted symmetric key, and uses the decrypted symmetric key to decrypt the encrypted medical data to obtain the decrypted medical data. The user then accesses and manages the medical data through the user interface.
[0013] Another embodiment of this application discloses a blockchain-based multi-level encryption and access control method for medical data, including the following steps:
[0014] S1. Obtain medical data and apply a multi-level encryption strategy to the medical data, including optimized symmetric encryption, improved asymmetric encryption and double hashing technology, to obtain encrypted medical data, encrypted symmetric key and initial hash value;
[0015] S2. The difficulty value of the new block is dynamically adjusted and verified by the proof-of-work algorithm to generate a new block. The encrypted medical data, encrypted symmetric key and initial hash value obtained by multi-level encryption strategy are uploaded to the new block in the blockchain. The encrypted medical data and encrypted symmetric key are hashed again and compared with the initial hash value obtained by double hashing technology to verify that they have not been tampered with.
[0016] S3. After verification, the smart contract based on blockchain technology is modified by adding a backup verification function to obtain an improved smart contract. The improved smart contract is then used for access control.
[0017] S4. After the access control verification is successful, the improved private key is used to decrypt the encrypted symmetric key to obtain the decrypted symmetric key. The decrypted symmetric key is then used to decrypt the encrypted medical data to obtain the decrypted medical data. The medical data can then be accessed and managed through the user interface.
[0018] As a specific implementation method, step S1, "applying a multi-level encryption strategy to medical data, including optimized symmetric encryption, improved asymmetric encryption, and double hashing technology," includes:
[0019] An optimized symmetric encryption algorithm is used to symmetrically encrypt the acquired medical data. This optimized algorithm not only relies on a symmetric key to encrypt the data but also incorporates a salt and a timestamp. The salt is a randomly generated data fragment used in the improved symmetric encryption process, and its addition increases the entropy of the encrypted medical data. The timestamp is a marker that clearly records the exact moment when the medical data is symmetricly encrypted. The introduction of a timestamp ensures the uniqueness of each symmetric encryption and prevents replay attacks.
[0020] As one specific implementation, step S1 further includes:
[0021] Introducing the mathematical function f(T) D This converts a timestamp into a random but predictable numerical value using the following formula:
[0022]
[0023] Among them, T D Represents a time stamp; log(T) D +1) indicates that the logarithm can smooth the growth of the timestamp; sin(·) is used to introduce periodic changes; This indicates that periodic power growth is introduced through modulo operations.
[0024] As a specific implementation, step S1 further includes "improving the key pair generated by the asymmetric encryption algorithm by introducing two additional prime number parameters u and v to obtain an improved public key and an improved private key," the specific steps of which are as follows:
[0025] The first step is to randomly select two large prime numbers p and q. The selection of p and q should be random enough and of moderate size to prevent them from being cracked.
[0026] The second step is to calculate the modulus m, which satisfies m = p × q. The modulus m will be used in both the public and private keys and is a publicly available part of the key.
[0027] The third step is to calculate the Euler's totient function φ(m) of the modulus m, which satisfies φ(m) = (p-1) × (q-1);
[0028] The fourth step is to select a number e that is coprime to φ(m). The smallest prime number e is selected. e is part of the public key and is used in the encryption process.
[0029] The fifth step is to calculate the decryption exponent d, where d is the inverse of e modulo φ(m) and satisfies e×d≡1(modφ(m)). d is a part of the private key used for decryption.
[0030] The sixth step introduces two additional prime number parameters, u and v, during the generation of the public and private keys. These prime number parameters u and v are randomly selected.
[0031] As one specific implementation, step S1 further includes:
[0032] A mathematical function based on symmetric key timestamps is introduced to enhance timeliness protection; an improved asymmetric encryption algorithm is obtained by combining the improved public key and the mathematical function based on symmetric key timestamps; the encrypted symmetric key is obtained by encrypting the symmetric key using the improved asymmetric encryption algorithm.
[0033] The specific formula for the mathematical function based on symmetric key timestamps is as follows:
[0034]
[0035] Among them, G(T) K ) is based on symmetric key timestamp T K mathematical functions; T K It is the timestamp of the symmetric key; log 10 (T K +1 indicates that a logarithmic function was used; This indicates that a sine function was used.
[0036] As a specific implementation method, step S1 further includes:
[0037] A hash function is applied to the encrypted medical data to generate the first hash value;
[0038] Perform a bitwise XOR operation between the encryption key and a randomly generated salt value, and then apply the hash function to the result of the bitwise XOR operation again to generate a second hash value;
[0039] Perform a bitwise XOR operation on the two generated hash values, and then perform another hash operation on the result to finally obtain the initial hash value.
[0040] As a specific implementation method, step S2 specifically includes:
[0041] The encrypted medical data, encrypted symmetric key, and initial hash value obtained through multi-level encryption strategies are uploaded to a new block in the blockchain. A hash function is then used to re-hash the encrypted medical data and encrypted symmetric key uploaded to the new block. The resulting new hash value is compared with the initial hash value stored in the blockchain to verify whether the newly uploaded encrypted medical data and symmetric key have been tampered with.
[0042] As one specific implementation, step S2 further includes,
[0043] The difficulty value of new blocks is dynamically adjusted to maintain the stability and response time of the blockchain network. The specific formula for the difficulty value is as follows:
[0044]
[0045] Where N is a key parameter used in the blockchain's proof-of-work algorithm to adjust the difficulty of generating new blocks; Δt n arg(Δt) represents the time interval required to generate the last n blocks; arg(Δt) is the average of the generation time intervals of the most recent n blocks; ΔT is the ideal block generation time interval preset by the blockchain network.
[0046] As a specific implementation method, in step S3, the specific formula for permission management using the improved smart contract is as follows:
[0047]
[0048] Where Ac represents the result of the improved smart contract's permission management, which is a Boolean value; A is the authorization result of the main verification channel, which is a Boolean value; C represents the backup verification function; W represents the user's trust level; Q represents special permissions in emergency situations; and ∧ represents the logical AND operator. The NOT operator represents the negation of A, indicating that the main verification channel failed; V represents the OR operator.
[0049] The beneficial effects of the technical solution of the present invention are:
[0050] 1. In the process of asymmetric encryption, public-key encryption technology is used. By using additional public and private key generation strategies, the symmetric key is encrypted, which enhances the security and complexity of data encryption. The public key can be publicly shared, while the confidentiality of the private key ensures that only authorized users can decrypt information, effectively preventing key leakage and thus increasing the difficulty of unauthorized decryption.
[0051] 2. By introducing salt and timestamps, the symmetric encryption algorithm is optimized. The optimized symmetric encryption algorithm significantly improves the encryption quality and security of medical data. Salt ensures that the encryption results will be different even if the data content is the same, thus effectively resisting brute-force attacks. The use of timestamps increases the uniqueness of the encryption results and prevents replay attacks (i.e., attackers use previous data packets to launch attacks).
[0052] 3. Double hashing technology is applied to process the encrypted medical data and key. Any illegal modification to the medical data will result in a hash value mismatch, which will be detected. This further strengthens the integrity and security of the medical data, which is especially important for the medical industry because the accuracy of the data is directly related to the effectiveness and safety of patient treatment.
[0053] 4. The encrypted medical data and symmetric key are re-hashed using the SHA-256 hash function, and the result is compared with the initial hash value stored in the blockchain. This verifies whether the data has been tampered with during storage or transmission, ensuring the integrity and consistency of the data.
[0054] 5. The dynamic adjustment of the difficulty value ensures the stability and response time of the blockchain, ensuring that the block generation speed can be maintained within an ideal average time interval regardless of changes in network computing power, thereby maintaining the healthy operation and scalability of the network.
[0055] 6. Smart contracts can automatically execute the authentication and permission mapping process, reducing the need for manual intervention and thus lowering the possibility of human error, making the management of medical data more efficient and transparent; the introduction of a backup authentication mechanism allows the system to authorize data access based on specific parameters in emergency situations, ensuring that permission issues can still be flexibly handled according to the actual situation even if the main authentication channel fails. Attached Figure Description
[0056] Figure 1 This is a module diagram of a blockchain-based multi-level encryption and access control system for medical data disclosed in an embodiment of the present invention;
[0057] Figure 2The flowchart below shows a blockchain-based multi-level encryption and access control method for medical data, as disclosed in another embodiment of the present invention. Detailed Implementation
[0058] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0060] The following describes in detail, with reference to the accompanying drawings, the specific scheme of the blockchain-based multi-level encryption and access control system and method for medical data provided in the embodiments of the present invention.
[0061] See attached document Figure 1 An embodiment of the present invention discloses a blockchain-based multi-level encryption and access control system for medical data, including a medical data acquisition module, a medical data encryption module, a blockchain network module, an access control module, and a user processing module.
[0062] The medical data acquisition module is used to acquire medical data and input the medical data into the medical data encryption module.
[0063] The medical data encryption module is used to process medical data acquired by the medical data acquisition module using a multi-level encryption strategy that includes optimized symmetric encryption, improved asymmetric encryption, and double hashing technology. This process yields encrypted medical data, an encrypted symmetric key, and an initial hash value, which are then uploaded to the blockchain network module.
[0064] The blockchain network module is used to dynamically adjust the difficulty value of new blocks, verify the generation of new blocks through the proof-of-work algorithm, and upload the encrypted medical data, encrypted symmetric key and initial hash value obtained through multi-level encryption strategy to the new block in the blockchain. The encrypted medical data and encrypted symmetric key are hashed again and compared with the initial hash value obtained by double hashing technology to verify whether the newly uploaded encrypted medical data and symmetric key have been tampered with.
[0065] The permission management module is used to verify the results of the blockchain network module. By adding an alternative verification function, an improved smart contract is obtained, and permission management is carried out using the improved smart contract.
[0066] The user processing module is used for authorization based on the permission management module. It uses the improved private key to decrypt the encrypted symmetric key to obtain the decrypted symmetric key. The decrypted symmetric key is then used to decrypt the encrypted medical data to obtain the decrypted medical data. The medical data can then be accessed and managed through the user interface.
[0067] See attached document Figure 2 Another embodiment of the present invention discloses a blockchain-based multi-level encryption and access control method for medical data, the method comprising the following steps:
[0068] S1. Obtain medical data and apply a multi-level encryption strategy to the medical data, including optimized symmetric encryption, improved asymmetric encryption, and double hashing technology, to obtain encrypted medical data, encrypted symmetric key, and initial hash value.
[0069] In this embodiment of the invention, a medical data acquisition module is used to acquire medical data, including hospital medication records, patient basic information, medical records, and medical images. A multi-level encryption strategy is applied to the medical data, including symmetric encryption, asymmetric encryption, and double hashing technology. This not only protects the security of the medical data during transmission but also verifies the integrity and origin of the medical data, greatly enhancing overall data security.
[0070] The specific steps of the multi-level encryption strategy are as follows:
[0071] The first step is optimized symmetric encryption;
[0072] The acquired medical data is symmetrically encrypted using an optimized symmetric encryption algorithm. This optimized algorithm not only relies on a symmetric key to encrypt the data, but also incorporates salt and time stamps, increasing the complexity and security of the symmetric encryption process.
[0073] Salt is a randomly generated data fragment used in the improved symmetric encryption process. The purpose of adding salt is to increase the entropy, or complexity, of the encrypted medical data, preventing the repeated encryption of the same medical data from producing the same result, thereby effectively preventing brute-force attacks.
[0074] A timestamp is a marker that precisely records the exact moment when medical data is encrypted. The introduction of timestamps ensures that each symmetric encryption is unique, preventing replay attacks (i.e., attackers reuse old data packets to deceive blockchain-based multi-level encryption and access control systems for medical data).
[0075] To further obfuscate and secure the encryption results, a mathematical function f(T) is introduced. D This is used to convert a time stamp into a random but predictable value. The specific formula is:
[0076]
[0077] Among them, T D Representing a time stamp, its purpose is to ensure that each encrypted output is different even with the same data and key, adding an extra layer of security; log(T) D +1) indicates that logarithmic scaling can smooth the growth of timestamps; adding 1 is to avoid T... D The problem of the logarithmic function being undefined when = 0; sin(·) is used to introduce periodic changes, making the encryption process change periodically with the timestamp, thus increasing complexity; This indicates that the modulo operation introduces periodic exponential growth, maintaining the range of value variation while adding randomness and unpredictability. The exponential function provides rapid growth characteristics, which can be used to amplify T. D The influence of this makes the ciphertext more time-dependent.
[0078] The optimized symmetric encryption algorithm performs a bitwise XOR operation on the acquired medical data, symmetric key, and salt value, and then multiplies the result of the XOR operation with the mathematical function f(T). D Multiplying the output of the data combines the effects of time stamps with the depth of medical data encryption, further enhancing the security and complexity of the ciphertext.
[0079] The specific formula for generating encrypted medical data using an optimized symmetric encryption algorithm is as follows:
[0080]
[0081] Among them, D e The encrypted medical data, or ciphertext, is generated using the encryption function E. K The processed output is designed to ensure the security of medical data and prevent unauthorized access; E K The encryption function using a symmetric key K is used to convert plaintext into ciphertext; D represents the medical data, i.e., the plaintext, which is the medical data to be encrypted; K is the symmetric key, shared between the sender and receiver of the medical data and must be kept confidential; S is a randomly generated salt value used to increase the entropy of the encrypted medical data during the encryption process, making the ciphertext more difficult to decrypt by brute force; it needs to be stored or sent with the ciphertext so that the receiver can use the same salt value when decrypting; T DThe purpose of this is to ensure that the output of each encryption is different even with the same data and key, adding an extra layer of security. It also needs to be shared with the receiver along with the ciphertext to ensure that the same timestamp is used during the decryption process. This represents a bitwise XOR operation used to combine input medical data D, the symmetric key K, and the salt value S; f(T) D ) is about time stamp T D The mathematical function is used to convert the time stamp into a random but predictable value, further obfuscating and securing the encryption result; × represents the multiplication operation, used to multiply the result of the XOR operation with the output of the time function, complicating the final ciphertext.
[0082] The acquired medical data is symmetrically encrypted using an optimized symmetric encryption algorithm to obtain encrypted medical data.
[0083] The second step is improved asymmetric encryption;
[0084] The symmetric key is encrypted using an asymmetric encryption algorithm. Asymmetric encryption algorithms are well-known techniques in the field and will not be elaborated upon here.
[0085] To increase the complexity of the key pairs generated by the asymmetric encryption algorithm and thus increase the difficulty of cracking it, two additional prime number parameters, u and v, are introduced to improve the key pairs generated by the asymmetric encryption algorithm, resulting in an improved public key and an improved private key. The specific steps are as follows:
[0086] First, two large prime numbers p and q are randomly selected. The selection of p and q should be random enough and of moderate size to prevent cracking. Next, the modulus m is calculated, satisfying m = p × q. The modulus m will be used in the public and private keys and is a publicly disclosed part. Then, the Euler's totient function φ(m) of m is calculated, requiring φ(m) = (p-1) × (q-1). A number e coprime to φ(m) is selected, and the value of e should be the smallest prime number. It is part of the public key and used in the encryption process. The decryption exponent d is calculated, which is the inverse of e modulo φ(m), satisfying e × d ≡ 1 (mod φ(m)). d is used for decryption and is part of the private key. Finally, two additional prime number parameters u and v are introduced in the process of generating the public and private keys. The prime number parameters u and v are randomly selected to increase the complexity of the key and increase the difficulty of cracking.
[0087] The specific formulas for constructing the improved public key and improved private key are as follows:
[0088] K p =(e, m, u)
[0089] K s = (d, m, v)
[0090] Among them, K p It is the public key, used for encryption, ensuring that only the user holding the corresponding private key can decrypt it; K s φ(m) is the private key used for decryption; m is the modulus shared by the public and private keys, satisfying m = p × q, where p and q are two randomly chosen large prime numbers; e is the encryption exponent, a number coprime to φ(m), taking the smallest prime number, φ(m) = (p-1) × (q-1); d is the decryption exponent, the inverse of e modulo φ(m), satisfying e × d ≡ 1 (mod φ(m)); u and v are two additional prime number parameters used to increase complexity and security.
[0091] To further enhance timeliness protection, a symmetric key-based timestamp T is introduced. K The mathematical function G(T) K The specific formula is:
[0092]
[0093] Among them, G(T) K ) is based on symmetric key timestamp T K A mathematical function is used to generate a time-varying factor to ensure the uniqueness of symmetric key transmission; T K It is the timestamp of the symmetric key, representing the specific point in time when the symmetric key was generated; log 10 (T K +1 indicates that a logarithmic function was used, adding non-linear processing to the symmetric key timestamp. This ensures that even small variations in the symmetric key timestamp will not lead to significant changes in the result. Adding 1 is to avoid T... K The problem of the logarithmic function being undefined when the logarithmic value is 0; This indicates the use of a sine function, combined with squaring operations, which further increases the complexity of the time factor. The sine function will produce a periodic output when the square of the symmetric key timestamp is used as input. Combined with the output of the logarithmic function, it forms a complex fluctuation pattern, increasing the difficulty of decryption.
[0094] Combining the improved public key and the symmetric key-based timestamp T K The mathematical function G(T) K This yields an improved asymmetric encryption algorithm. The specific formula for encrypting the symmetric key using the improved asymmetric encryption algorithm is as follows:
[0095]
[0096] Among them, K e It is the encrypted symmetric key; the asymmetric encryption process uses the public key K. p Complete, ensuring only those with the matching private key K are included.s Users can decrypt it; The representative uses public key K p The encryption function; K p It is the public key, used to encrypt the symmetric key K; G(T) K ) is based on symmetric key timestamp T K The mathematical function generates a time-varying factor to ensure the uniqueness of symmetric key transmission; · represents a multiplication operation used to multiply the symmetric key K with the time factor G(T). K This combination increases the complexity and security of symmetric keys.
[0097] By using an improved asymmetric encryption algorithm to encrypt the symmetric key, the encrypted symmetric key is obtained, further ensuring the security of medical data.
[0098] The third step is double hashing;
[0099] Double hashing is a method to improve the security of medical data, and it has significant application value, especially in ensuring the integrity and security of medical data.
[0100] The encrypted medical data D e By applying a hash function, such as SHA-256, to generate the initial hash value, attackers are guaranteed that even if the encrypted medical data is intercepted, they cannot directly obtain the medical data because it has already been encrypted.
[0101] Encryption key K e Performing a bitwise XOR operation with a randomly generated salt value S′, and then applying the hash function again to the result of the bitwise XOR operation to generate a second hash value, increases the complexity and uniqueness of the processing, which helps to prevent rainbow table hash attacks.
[0102] Perform a bitwise XOR operation on the two hash values generated above, and then perform another hash operation on the result to finally obtain the initial hash value h, which is used to verify the integrity of the medical data and prove that it has not been modified.
[0103] The specific formula for obtaining the initial hash value h using the double hash technique is as follows:
[0104]
[0105] Where h is the initial hash value, used to verify the integrity and unmodified proof of the medical data; hash is a hash function, such as SHA-256, used to convert the input medical data into a fixed-size hash value; D e The encrypted medical data, or ciphertext, is generated using the encryption function E. KThe processed output is designed to ensure the security of medical data and prevent unauthorized access. This represents the bitwise XOR operation, used to combine the results of two hash operations, increasing the security and uniqueness of the hash value; K e S is the encrypted symmetric key, shared between the sender and receiver of medical data and must be kept confidential; S′ is a randomly generated salt value. The salt value is added during the hashing process to increase the complexity and uniqueness of the hash, in order to prevent hash attacks such as rainbow table attacks.
[0106] The initial hash value is obtained through double hashing, which is used to verify the integrity of medical data and prove that it has not been modified, thereby enhancing the confidentiality and tamper-proof capabilities of medical data.
[0107] S2. The difficulty value of the new block is dynamically adjusted and verified by the proof-of-work algorithm to generate a new block. The encrypted medical data, encrypted symmetric key and initial hash value obtained by multi-level encryption strategy are uploaded to the new block in the blockchain. The encrypted medical data and encrypted symmetric key are hashed again and compared with the initial hash value obtained by double hashing technology to verify that they have not been tampered with.
[0108] Before generating new blocks, the main entities forming the consortium blockchain are determined, including medical institutions and government regulatory agencies, to ensure the reliability and stability of the blockchain network. The qualifications of the main entities are also reviewed, including credit rating, technical review, and security and compliance checks. A node admission mechanism is established, and a suitable consensus algorithm is selected. The specific algorithm can be set according to the specific implementation scenario and is not limited here.
[0109] The addition of a new block to the blockchain requires verification through the proof-of-work algorithm, which is a well-known technique in the field and will not be elaborated upon here.
[0110] The encrypted medical data, encrypted symmetric key, and initial hash value obtained through multi-level encryption strategies are uploaded to a new block in the blockchain, leveraging the immutability of the blockchain to protect data security.
[0111] The formula for representing a new block is as follows:
[0112] B=Block(h, T′, h′, N)
[0113] In this blockchain, B represents a new block, a new node that securely attaches encrypted medical data, an encrypted symmetric key, and an initial hash value to the existing blockchain. Block is the method for constructing a new block, integrating the initial hash value, block timestamp, the hash value of the previous block, and the difficulty value. This is verified using a proof-of-work algorithm; once verified, the new block is added to the blockchain. h is the initial hash value contained in the new block, a hash of the encrypted medical data and encrypted symmetric key, used to verify data integrity and as part of the connection between the old and new blocks. T′ represents the block timestamp, recording the specific time the new block was created, preventing double-spending and attacks, and aiding in block ordering. h′ represents the hash value of the previous block, a key characteristic of the blockchain ensuring continuity between blocks. N represents the difficulty value, a value used in the blockchain network to meet the requirements of the proof-of-work algorithm, ensuring the hash value of the new block meets the set difficulty target.
[0114] To maintain the stability and response time of the blockchain network, the difficulty value of new blocks is dynamically adjusted using the following formula:
[0115]
[0116] Here, N is a key parameter used in the blockchain's proof-of-work algorithm to adjust the difficulty of generating new blocks, ensuring that the average time for block generation matches the target time interval; Δt n arg(Δt) represents the time interval required to generate the last n blocks; arg(Δt) is the average of the generation time intervals of the most recent n blocks, reflecting the actual block generation speed under the current blockchain network conditions; ΔT is the ideal block generation time interval preset by the blockchain network.
[0117] To ensure that the encrypted medical data and encrypted symmetric key uploaded to the new block have not been tampered with, the encrypted medical data and encrypted symmetric key are re-hashd using the SHA-256 hash function and compared with the initial hash value already stored in the blockchain to obtain the verification result.
[0118] The specific formula for the verification process is expressed as follows:
[0119] V e =if SHA-256(D e ||K e )==hthen true else false
[0120] Among them, V e Validation result variable, used to indicate encrypted medical data D e and the encrypted symmetric key K eDoes the combined hash value match the initial hash value h? SHA-256 is a hash function used in blockchain technology to convert the input encrypted medical data into a 256-bit hash value; D e It is encrypted medical data; K e is the encrypted symmetric key, which, together with the encrypted medical data, is used to generate a new hash value to verify the integrity of the data and its tamper-proof state; || is a concatenation operator that joins the encrypted medical data and the encrypted symmetric key together to form a single, continuous input string used in the hash function; h is the initial hash value, used to compare with the new hash value, and is recorded in the blockchain after the medical data is encrypted and initially hashed, serving as a benchmark for future verification.
[0121] If the hash value matches, the verification result V e A true result indicates that the medical data has not been tampered with since encryption, and its integrity has been confirmed; if the hash value does not match, the verification result is false, indicating that the data has been tampered with and its security is threatened.
[0122] The tamper-proof encrypted medical data, the encrypted symmetric key, and the initial hash value are stored in a new block of the blockchain, accessible and manipulated only by authorized users.
[0123] S3. After verification, a backup verification function is added to the smart contract based on blockchain technology to obtain an improved smart contract, which is then used for permission management.
[0124] To further strengthen access control for medical data, smart contracts based on blockchain technology were introduced. The smart contracts check user identity and permissions according to predefined rules to ensure that only authorized users can access encrypted medical data. By leveraging the transparency and immutability of blockchain, the security of access control is increased.
[0125] The steps for automating access control on the blockchain using smart contracts are as follows:
[0126] The main authentication channel determines authorization through two parts: user authentication and permission mapping. During user authentication, the user's unique identifier U and authentication factor P are input. If U and P match, the authentication is successful; otherwise, the authentication fails.
[0127] The user's unique identifier, including username and user ID, is used to uniquely identify a user. Authentication factors, including password, fingerprint, and voice recognition, are used to verify the user's identity. During the access mapping process, the user's role identifier R and the requested medical data D are input. If R and D match, the verification is successful; otherwise, the verification fails. User role identifiers, such as doctor, nurse, patient, and administrative staff, define the user's responsibilities and access levels. The requested medical data includes hospital medication records, patient basic information, medical records, and medical images.
[0128] Only after user authentication and permission mapping are successful can the main authentication channel grant authorization. The specific formula is as follows:
[0129] A = g(U, P) ∧ q(R, D)
[0130] Here, A is a Boolean value representing the authorization result. If the user has passed authentication and meets the permission mapping conditions, it is true, and the authorization is successful; otherwise, it is false, and the authorization fails. g(U, P) is the user authentication function, which takes the user's unique identifier U and authentication factor P as input. If U and P match, the authentication is successful; otherwise, the authentication fails. U represents the user's unique identifier, such as username or user number, used to uniquely identify a user. P represents the user's authentication factor, including password, fingerprint, and voice recognition, used to verify the user's identity. q(R, D) is the permission mapping function, which takes the user role identifier R and the requested medical data D as input. If R and D match, the authentication is successful; otherwise, the authentication fails. R is the user role identifier, such as doctor, nurse, patient, or administrative staff, defining the user's responsibilities and permission level. D represents the requested medical data, including hospital medication records, patient basic information, medical records, and medical images.
[0131] To improve the flexibility of smart contracts and address the need for emergency access permissions, an alternative verification function is added to improve the smart contract, resulting in an improved smart contract.
[0132] An improved smart contract is used for access control to provide a backup verification channel when the primary verification channel fails, ensuring access is still possible under specific conditions. The backup verification channel uses a backup verification function C to determine whether to authorize access based on the user's trust level W and special permissions Q for emergency situations. The user's trust level includes the user's historical behavior and authentication level; the special permissions for emergency situations include system failures and high-risk operations. This ensures that access can still be granted through the backup verification channel even if authorization fails through the primary verification channel.
[0133] The improved formula for smart contract access control is as follows:
[0134]
[0135] Among them, Ac 代 The result of the improved smart contract's permission management is a Boolean value. If the user is authenticated and meets the dynamic permission mapping or the backup verification channel, this value is true, indicating successful authorization; otherwise, it is false, indicating authorization failure. A is the authorization result of the main verification channel, also a Boolean value. If the user is authenticated and meets the permission mapping conditions, this value is true, indicating successful authorization; otherwise, it is false, indicating authorization failure. C represents the backup verification function, which determines whether to authorize based on the user's trust level W and special permissions Q in emergency situations. This allows users to access specific data even if the main verification channel fails, improving the system's adaptability and flexibility. W represents the user's trust level, including their historical behavior and authentication level. Q represents special permissions in emergency situations, such as system failures or high-risk operations. ∧ represents the logical AND operator, confirming that authorization is only allowed if the backup verification function C(W, Q) passes authorization even if the main verification channel fails. The NOT operator indicates the negation of A, meaning the primary authentication channel failed; the OR operator ensures that access is authorized only if either the primary or backup authentication channel succeeds.
[0136] The improved smart contracts ensure that backup measures can be implemented in emergency situations, while maintaining strict control over access to medical data.
[0137] S4. After the access control verification is successful, the improved private key is used to decrypt the encrypted symmetric key to obtain the decrypted symmetric key. The decrypted symmetric key is then used to decrypt the encrypted medical data to obtain the decrypted medical data. The medical data can then be accessed and managed through the user interface.
[0138] After the user is authenticated and meets the dynamic permission mapping or through an alternative authentication channel, the user's private key K is used. s For the encrypted symmetric key K e Decryption is performed to recover the symmetric key K used to encrypt medical data. The specific formula is as follows:
[0139]
[0140] Where K is the symmetric key; This indicates the use of private key K. s The decryption function is used to decrypt the encrypted symmetric key; K e It is the encrypted symmetric key; G(T) K) represents a symmetric key timestamp T K The function;
[0141] The encrypted medical data D is encrypted using the decryption symmetric key K. e Decryption is performed to obtain the decrypted medical data. The specific formula for inverse XOR decryption is as follows:
[0142]
[0143] Where D represents the decrypted medical data; D e It is encrypted medical data; f(T) D () is a time-stamped mathematical function, which is based on the time stamp T used during encryption. D Generate a numerical value to adjust or transform the ciphertext during decryption, ensuring time synchronization and accurate correspondence between the decryption and encryption processes; T D It is a timestamp, which is the specific time when the encryption was performed, to ensure that the data can be matched at the same point in time during encryption and decryption, so as to correctly restore the data; This represents a bitwise XOR operation, increasing non-linearity and security; K is a symmetric key shared between the sender and receiver of medical data and must be kept confidential; S is the salt value used for encryption and is stored together with the ciphertext.
[0144] Users can access and manage decrypted medical data through a secure interface.
[0145] The order of the embodiments is for illustrative purposes only and does not represent the superiority or inferiority of the embodiments. The processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0146] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0147] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A blockchain-based multi-level encryption and access control method for medical data, characterized in that, Includes the following steps: S1. Obtain medical data and apply a multi-level encryption strategy, including optimized symmetric encryption, improved asymmetric encryption, and double hashing, to the medical data to obtain encrypted medical data, encrypted symmetric key, and initial hash value. The specific implementation steps are as follows: First, an optimized symmetric encryption algorithm is used to symmetrically encrypt the acquired medical data; In the optimized symmetric encryption algorithm, a salt value and a timestamp are introduced; the salt value is a randomly generated data fragment used in the improved symmetric encryption process; the timestamp refers to a marker that clearly records the exact moment when the medical data is subjected to symmetric encryption. Introducing the mathematical function f(T) D This converts a timestamp into a random but predictable numerical value using the following formula: Among them, T D Represents a time stamp; log(T) D +1) indicates that the logarithm can smooth the growth of the timestamp; sin(·) is used to introduce periodic changes; This indicates that periodic power-law growth is introduced through modulo operations; Based on the acquired medical data, symmetric key, salt value, and mathematical function f(T) D The output of ) yields encrypted medical data; Secondly, two additional prime number parameters, u and v, are introduced to improve the key pair generated by the asymmetric encryption algorithm, resulting in an improved public key and an improved private key. A mathematical function based on symmetric key timestamps is introduced, with the following formula: Among them, G(T) K ) is based on symmetric key timestamp T K mathematical functions; T K It is the timestamp of the symmetric key; log 10 (T K +1 indicates that a logarithmic function was used; This indicates that the sine function was used; By combining the improved public key and a mathematical function based on symmetric key timestamps, an improved asymmetric encryption algorithm is obtained; the symmetric key is then encrypted using the improved asymmetric encryption algorithm to obtain the encrypted symmetric key. Finally, a double hashing technique is used. First, a hash function is applied to the encrypted medical data to generate the first hash value. Then, a bitwise XOR operation is performed between the encrypted symmetric key and a randomly generated salt value. The result of the bitwise XOR operation is then applied to the hash function again to generate the second hash value. The two hash values generated above are then XORed together, and the result is hashed again to finally obtain the initial hash value. S2. The difficulty value of the new block is dynamically adjusted and verified by the proof-of-work algorithm to generate a new block. The encrypted medical data, encrypted symmetric key and initial hash value obtained by multi-level encryption strategy are uploaded to the new block in the blockchain. The encrypted medical data and encrypted symmetric key are hashed again and compared with the initial hash value obtained by double hashing technology to verify that they have not been tampered with. S3. After verification, the smart contract based on blockchain technology is modified by adding a backup verification function, resulting in an improved smart contract. This improved smart contract is then used for access control, with the specific formula as follows: Among them, A c The result of the improved smart contract's access control is represented by a Boolean value; A is the authorization result of the main verification channel, also a Boolean value; C represents the backup verification function; W represents the user's trust level; Q represents special permissions in emergency situations; ∧ represents the logical AND operator. The ∨ operator represents the logical NOT operator, used to negate A, meaning the main verification channel failed; the ∨ operator represents the logical OR operator. S4. After the access control verification is successful, the improved private key is used to decrypt the encrypted symmetric key to obtain the decrypted symmetric key. The decrypted symmetric key is then used to decrypt the encrypted medical data to obtain the decrypted medical data. The medical data can then be accessed and managed through the user interface.
2. The blockchain-based multi-level encryption and access control method for medical data as described in claim 1, characterized in that, Step S1 specifically includes, "Introducing two additional prime number parameters u and v to improve the key pair generated by the asymmetric encryption algorithm, obtaining an improved public key and an improved private key," with the specific steps as follows: The first step is to randomly select two large prime numbers p and q. The selection of p and q should be random enough and of moderate size to prevent them from being cracked. The second step is to calculate the modulus m, which satisfies m = p × q. The modulus m will be used in both the public and private keys and is a publicly available part of the key. The third step is to calculate the Euler's totient function φ(m) of the modulus m, which satisfies φ(m) = (p-1) × (q-1); The fourth step is to select a number e that is coprime to φ(m). The smallest prime number e is selected. e is part of the public key and is used in the encryption process. The fifth step is to calculate the decryption exponent d, where d is the inverse of e modulo φ(m) and satisfies e×d≡1(modφ(m)). d is a part of the private key used for decryption. The sixth step introduces two additional prime number parameters, u and v, during the generation of the public and private keys. These prime number parameters u and v are randomly selected.
3. The blockchain-based multi-level encryption and access control method for medical data as described in claim 1, characterized in that, Step S2 specifically includes: The encrypted medical data, encrypted symmetric key, and initial hash value obtained through multi-level encryption strategies are uploaded to a new block in the blockchain. A hash function is then used to re-hash the encrypted medical data and encrypted symmetric key uploaded to the new block. The resulting new hash value is compared with the initial hash value stored in the blockchain to verify whether the newly uploaded encrypted medical data and symmetric key have been tampered with.
4. The blockchain-based multi-level encryption and access control method for medical data as described in claim 3, characterized in that, Step S2 also includes, The difficulty value of new blocks is dynamically adjusted to maintain the stability and response time of the blockchain network. The specific formula for the difficulty value is as follows: Where N is a key parameter used in the blockchain's proof-of-work algorithm to adjust the difficulty of generating new blocks; Δt n arg(Δt) represents the time interval required to generate the last n blocks; arg(Δt) is the average of the generation time intervals of the most recent n blocks; ΔT is the ideal block generation time interval preset by the blockchain network.
5. A blockchain-based multi-level encryption and access control system for medical data, applied to the blockchain-based multi-level encryption and access control method for medical data as described in claim 1, characterized in that, Includes the following parts: The medical data acquisition module is used to acquire medical data; A medical data encryption module is used to receive the medical data, process the medical data using a multi-level encryption strategy, and obtain encrypted medical data, encrypted symmetric key, and initial hash value. The blockchain network module is used to receive encrypted medical data, encrypted symmetric keys, and initial hash values; dynamically adjust the difficulty value of new blocks, verify them through the proof-of-work algorithm, generate new blocks, upload encrypted medical data, encrypted symmetric keys, and initial hash values to the new blocks in the blockchain, and re-hash the encrypted medical data and encrypted symmetric keys, comparing them with the initial hash value to verify that they have not been tampered with. The permission management module is used to obtain an improved smart contract based on the verification results of the blockchain network module by adding a backup verification function, and to use the improved smart contract for permission management. The user processing module is used to decrypt the encrypted symmetric key using the improved private key based on the authorization of the permission management module, obtain the decrypted symmetric key, decrypt the encrypted medical data using the decrypted symmetric key, obtain the decrypted medical data, and access and manage the medical data through the user interface.
Citation Information
Patent Citations
A blockchain-based method, system, and private key storage medium for sharing medical records.
CN112733164B
Internet of Things equipment medical data management system based on block chain
CN117725055A
Medical data trusted security evidence storage system based on block chain
CN117874792A