Block chain-based EHR data security access and sharing system
By adopting blockchain technology, smart contracts, and agency re -encryption technologies in the medical data sharing system, the problem of data security and privacy protection in medical data sharing has been solved, and efficient and secure data sharing and access control have been achieved.
Patent Information
- Application Number
- CN202411412575.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-02-29
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing medical data sharing system has data security and privacy protection issues, and patients have limited control over their electronic health record (EHR) data, making it difficult to achieve efficient and secure data sharing and access control.
Blockchain -based EHR data security access and sharing systems are used to achieve efficient and secure data sharing and access control through intelligent contracts and agents to ensure the confidentiality and integrity of data.
Under the premise of ensuring data security and protection of privacy, efficient and secure EHR data sharing and access control have been achieved, and they have high performance, more complete solutions and resistance attack characteristics.
Smart Images

Figure CN119382856A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical data access and sharing, and in particular to a blockchain-based EHR data security access and sharing system. Background Art
[0002] In the context of the digital transformation of the medical industry, the use of Electronic Health Records (EHR) is becoming more and more common. The electronicization of medical data has promoted the sharing of medical data. Sharing medical data can not only improve the efficiency of doctors' diagnosis and treatment, provide data support for the research work of medical research institutions, but also assist insurance companies in insurance plan design and risk management.
[0003] EHR data has high-value attributes and contains a large amount of sensitive information about patients, making it vulnerable to various security threats, such as data tampering, privacy leakage, malicious sharing, etc. Data security and privacy protection have become an important issue in EHR sharing. In addition, EHR is highly dispersed among various medical institutions. For the sake of data security and privacy protection, it is difficult for medical institutions to share each other's EHR, resulting in "medical data islands". Furthermore, as a valuable asset of patients, patients should have full access control over their EHR and be able to observe activities related to their EHR at any time. However, in the existing healthcare system, patients have very limited control over their EHR data.
[0004] The regional blockchain technology has the characteristics of decentralization, immutability, and traceability, which can solve the problems of centralized storage, easy tampering, and process opacity in traditional medical data sharing. As a key technology in the blockchain, smart contracts allow users to interact through automatically executed programmable scripts without the need for a centralized trusted institution.
[0005] Based on this, some researchers have conducted relevant research and implemented access control to EHR through smart contracts. Some scholars have combined CP-ABE (Ciphertext-Policy Attribute-Based Encryption, CP-ABE) with blockchain technology to achieve fine-grained access control to EHR. However, in the healthcare system, patients usually need to share EHR data with different users or organizations, and these users and organizations usually have different attributes, so CP-ABE needs to maintain a large number of mapping relationships between attributes and keys, which increases the complexity of key management. In addition, in a multi-attribute environment, CP-ABE has a high computational overhead. Compared with CP-ABE, proxy re-encryption technology can realize ciphertext conversion without leaking data privacy, providing a more efficient and secure way of data sharing. Combining proxy re-encryption with smart contracts in blockchain can provide efficient and secure data sharing and access control solutions for healthcare systems.
[0006] In addition, the above solutions all use cloud services to alleviate the storage pressure of blockchain and improve the quality of healthcare services. However, storing data on cloud service providers or third-party servers also poses risks to data security and privacy protection. More importantly, these solutions do not consider the identity of the user who calls the smart contract, making the smart contract vulnerable to attacks by illegal users.
[0007] In order to avoid cumbersome key management operations, high-cost fine-grained access control and security risks of massive data storage, a large-scale EHR access and sharing system (BCAS) based on blockchain is proposed to share EHR data while ensuring data security and protecting patient privacy. Summary of the invention
[0008] The purpose of the present invention is to provide a blockchain-based EHR data security access and sharing system, which can share EHR data while ensuring data security and protecting privacy, and can provide an efficient and secure data sharing and access control solution for the healthcare system, with higher performance, more complete solutions and anti-attack characteristics.
[0009] To achieve the above-mentioned purpose, the present invention provides a blockchain-based EHR data security access and sharing system, where data viewers who are granted viewing permissions can view the patient's EHR by calling Client-API-view;
[0010] Patients grant or revoke other users' access to their EHR data by calling Client-API-permission;
[0011] After obtaining the write permission granted by the patient, the doctor calls Client-API-upload to upload the medical records generated after the patient's treatment;
[0012] Smart contracts are deployed on the blockchain’s channels;
[0013] The user provides personal information to the authorization agency for identity registration. Before calling the smart contract, the user needs to call Client-API-genToken to authenticate the identity of the authorization agency to obtain the token for calling the smart contract;
[0014] The trusted server within the hospital is selected as the CA center, and its internal equipment is used as nodes. Internal nodes are selected from each hospital to form a hospital alliance private IPFS network, which serves as off-chain distributed storage to complete user data storage. A data viewing module is also provided.
[0015] Preferably, the data viewers are doctors, insurance companies and research institutions, who are users who request to view the patient's EHR.
[0016] Preferably, the patient serves as the owner of the EHR.
[0017] Preferably, the authorization agency is a fully trusted entity.
[0018] Preferably, the specific operation steps of the identity registration are as follows:
[0019] Step 1: The user calls kpGen to generate a key pair kp and provides PK to the authorization agency i , Encrypted personal information cUserinfo and signature uSign request registration;
[0020] Step 2: The authorized institution verifies uSign and reviews the user information, and generates a virtual identity VID for the user who passes the review i , and upload REGUSER to the blockchain;
[0021] Step 3: Users are assigned based on their PK i Search on the blockchain to get its VID i .
[0022] Preferably, the specific steps of identity verification are as follows:
[0023] Step 1: User provides VID to the authorized institution i 、Contract Name SC Name 、Contract parameters SC Param And use the private key to sign the contract name and contract parameters to authenticate the result rSign;
[0024] Step 2: The authorization agency calls the algorithm to verify the user's identity. After the verification, the user is issued a blockchain access token, and the user can access the smart contract with the token;
[0025] Step 3: The user uses the token to access the smart contract. The blockchain executes the algorithm to verify the correctness of the token. If the verification passes, the user calls the smart contract SC.
[0026] Preferably, the specific operation steps of the data storage are as follows:
[0027] Step 1: The patient sees a doctor, and the doctor asks the patient to grant him / her write permission to the EHR data. The patient grants the write permission to the doctor.
[0028] Step 2: After obtaining authorization, the doctor uses the patient's public key to encrypt the EHR and uploads the encrypted EHR to IPFS to obtain the CID; the doctor signs the CID with his private key and uploads the ACCESS to the blockchain;
[0029] Step 3: The blockchain transmits the doctor’s visit information to the patient. The patient obtains the relevant information of his / her EHR through the blockchain, verifies the doctor’s signature to ensure that the EHR is written by the doctor himself / herself, and searches for the EHR in IPFS through the CID to decrypt and obtain his / her own EHR.
[0030] Preferably, the specific operation steps of viewing the data are as follows:
[0031] Step 1: The data viewer requests the patient to grant viewing permission;
[0032] Step 2: The data viewer uses his own private key SK V Re-decrypt the ciphertext to obtain the plaintext pEHR of EHR.
[0033] Preferably, step 1 is specifically as follows: the patient grants viewing permission to the data viewer. After granting viewing permission, the patient calls reKeyGen to generate a re-encryption key RK P→V Then, search IPFS according to CID to get pEHR (0) , the blockchain network calls reEnc to generate the re-encrypted ciphertext pEHR (P→V) And send it together with CID to VID V .
[0034] Preferably, step 2 is specifically as follows: inputting the obtained pEHR into a hash function H, calculating a hash value, comparing the hash value with the hash value of the pEHR stored on the chain to determine that the obtained pEHR has not been tampered with, and uploading ACCESS to the blockchain.
[0035] Therefore, the present invention adopts the above-mentioned blockchain-based EHR data security access and sharing system to share EHR data under the premise of ensuring data security and protecting privacy, and can provide an efficient and secure data sharing and access control solution for the healthcare system with higher performance, more complete solutions and anti-attack characteristics.
[0036] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a system architecture of an embodiment of a blockchain-based EHR data secure access and sharing system of the present invention;
[0038] Figure 2 It is a specific flow chart of identity registration of an embodiment of a blockchain-based EHR data security access and sharing system of the present invention;
[0039] Figure 3 It is a specific flow chart of identity authentication of an embodiment of a blockchain-based EHR data secure access and sharing system of the present invention;
[0040] Figure 4 It is a specific flow chart of data storage of an embodiment of a blockchain-based EHR data security access and sharing system of the present invention;
[0041] Figure 5 It is a specific flow chart of data viewing in an embodiment of a blockchain-based EHR data security access and sharing system of the present invention. DETAILED DESCRIPTION
[0042] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0043] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.
[0044] Embodiment 1
[0045] The present invention provides a blockchain-based EHR data security access and sharing system, which includes six participating entities, including data viewers, patients, doctors, authorized institutions, blockchains and off-chain storage. Figure 1 shown.
[0046] Data viewers can be doctors, insurance companies, research institutions, etc., who are users who request to view the patient's EHR. Data viewers who are granted viewing permissions can view the patient's EHR by calling Client-API-view;
[0047] As the owner of the EHR, the patient can grant or revoke other users' access to their EHR data by calling Client-API-permission;
[0048] After obtaining the write permission granted by the patient, the doctor calls Client-API-upload to upload the medical records generated after the patient's treatment;
[0049] The authorization agency is a fully trusted entity. Users register by providing personal information to the authorization agency. Before calling a smart contract, users need to call Client-API-genToken to authenticate the authorization agency and obtain a token for calling the smart contract.
[0050] Smart contracts are deployed on the blockchain channel. As a logically isolated environment, the channel ensures the privacy and security of the participants. As an organization, the hospital selects its internal trusted server as the CA center, and its internal networked devices with storage space and certain computing power as nodes. After CA certification, they are added to the blockchain, ensuring the legitimacy of the node identity and the security of the network.
[0051] As a network node that provides consensus services, the Orderer node sorts transactions in chronological order, packages them into blocks, and then broadcasts the blocks to all peer nodes on the channel; users can execute smart contracts, send transaction requests and interact with smart contracts by calling Client-API. Smart contracts will automatically execute after being called, process transaction requests according to preset rules and conditions, and record the results in the distributed ledger of the blockchain.
[0052] Specifically, off-chain storage is as follows: each hospital selects internal nodes to form a hospital alliance private IPFS network, which serves as off-chain distributed storage to store encrypted massive EHR data, thereby improving the sharing efficiency of the system.
[0053] Some of the symbols in this system and their related descriptions are shown in the following table.
[0054] Table 1 Symbols and their related descriptions
[0055]
[0056]
[0057] The core algorithms of the system mainly include registration algorithm register, contract access token generation algorithm genToken, identity authentication algorithm verifyToken, permission request algorithm requestPermission, permission grant algorithm grantPermission, permission revocation algorithm revokePermission, EHR upload algorithm uploadEHR, EHR viewing algorithm viewEHR and permission verification algorithm hasPermission.
[0058] Algorithm 1: Authorization agency generates tokens
[0059] Input: VID Requestor 、SC name (SC Name ), SC parameters (SC Param ) and rSign;
[0060] Output: Token for user to access smart contract;
[0061] Initialization: VID i Need to register in the system, SC Name It must be the name of an existing smart contract, and SC Param Must be a valid parameter of the specified smart contract
[0062] Procedure genToken
[0063] 1: Data = (VID Requestor , S.C. Name , S.C. Param )
[0064] 2: PK Request =selectPK(VID Requestor )
[0065] 3: if (verifySign(data, rSign, PK Request )==false), then
[0066] 4: Return "failed"
[0067] 5: x1, x2 = random 128 bits
[0068] 6: x3 = H (H (x1) + H (x2))
[0069] 7: x4 = H(VIDi + SC Name +SC Param )
[0070] 8: aSig = S(SKAu, x3, x4)
[0071] 9: token = (x1, x2, aSig)
[0072] 10: When (selectToken (token) in BC = null) is executed
[0073] 11: genToken(VID i , S.C. Name , S.C. Param )
[0074] 12: End while
[0075] 13: Return token
[0076] 14: End the program
[0077] Algorithm 2: Algorithm for verifying tokens through smart contracts
[0078] Input: VID of the user who calls the smart contract call , SC and Token
[0079] Output: Allow or deny VID call Visit
[0080] Initialization: For SC-C and SC-D, it is defined as SC=SC Name (SC Param )
[0081] 1: Process Authentication Token
[0082] 2: If (selectToken(token)in BC=null) then
[0083] 3: Access denied
[0084] 4: If it ends
[0085] 5: SC Name =SC.getName()
[0086] 6: SC Param =SC.getParam()
[0087] 7:(_x1, _x2, _aSign) = token
[0088] 8: Data = (H (H (x1) + H (x2)); H (VID call +SC Name +SC Param ))
[0089] 9: if (verifySign(data, _aSign, PKAu )==true), then
[0090] 10: Access allowed
[0091] 11: Otherwise
[0092] 12: Access denied
[0093] 13: If it ends
[0094] 14: End the program
[0095] The system involves the following operations: identity registration, identity authentication, data storage, and data viewing.
[0096] The specific process of identity registration is as follows: Figure 2 As shown in the figure, patients, doctors and data viewers need to submit their identity information to the authorized agency for registration. Only after successful registration can they access the system. The authorized agency generates a virtual identity VID for the user based on the user's identity information. i , in order to protect user privacy.
[0097] The specific steps for identity registration are as follows:
[0098] Step 1: The user calls Client-API-register to perform the following operations: kpGen generates a key pair kp = (PK i , S.K. i ), provide PK to the authorized institution i , encrypted personal information cUserinfo = encrypt(userinfo, PK Au ) and signature uSign = S(SK i ,userinfo) to request registration; personal information includes age, gender, role, name, date of birth, etc.
[0099] Step 2: The authorized institution verifies uSign and reviews the user information, and generates a virtual identity VID for the user who passes the review i , and set REGUSER = {VID i , PK i}Upload blockchain;
[0100] Step 3: Users are assigned based on their PK i Search on the blockchain to get its VID i .
[0101] The specific process of identity verification is as follows Figure 3As shown, users who want to call smart contracts must first send a contract call application to the authorization agency. After the authorization agency verifies the user's identity, it generates a one-time blockchain smart contract access token for the user. The user uses the token to access the smart contract.
[0102] The detailed steps of identity verification are as follows:
[0103] Step 1. The user calls Client-API-genToken to perform the following operations: Provide VID to the authorization agency i 、Contract Name SC Name 、Contract parameters SC Param And the result of signing the contract name and contract parameters with the private key rSign=S(SK i ,VID i, SC Name ,SC Param ) for identity authentication;
[0104] Step 2: The authorized institution verifies the identity of the user. After the verification, Algorithm 1 is called to issue a blockchain access token to the user. The user can access the smart contract with the token.
[0105] Step 3: The user uses the token to access the smart contract. The blockchain executes Algorithm 2 to verify the correctness of the token. If the verification passes, the user calls the smart contract SC=SC Name (SC Param ).
[0106] The default user for data storage and data viewing obtains a token through identity authentication and uses the correct token to access the smart contract.
[0107] The specific process of data storage is as follows Figure 4 As shown in the figure, the patient sees a doctor, and the doctor asks the patient to grant write permission. After obtaining authorization, the doctor encrypts the patient's EHR and uploads it to IPFS, calling the smart contract to upload the relevant information to the blockchain.
[0108] The specific steps for data storage are as follows:
[0109] Step 1: The patient sees a doctor. The doctor asks the patient to grant him / her the write permission to the EHR data. The patient calls Client-API-permission to grant the write permission to the doctor.
[0110] Step 2. After obtaining authorization, the doctor calls Client-API-upload to perform the following operations: encrypt the EHR with the patient's public key, and upload the encrypted EHR to IPFS to obtain the CID [the identifier of each file corresponding to IPFS]; the doctor signs the CID with his private key and sets ACCESS={uploadEHR,(VID P ,VID D ,CID,hVal,dSign,timestamp),token} upload blockchain;
[0111] Step 3: The blockchain transmits the doctor’s visit information to the patient. The patient obtains the relevant information of his / her EHR through the blockchain, verifies the doctor’s signature to ensure that the EHR is written by the doctor himself / herself, and searches for the EHR in IPFS through the CID to decrypt and obtain his / her own EHR.
[0112] Step 4: The patient can revoke the doctor's write permission at any time.
[0113] The specific process of data viewing is as follows Figure 5 As shown in the figure, if the data viewer wants to view the patient's EHR, he needs to inform the patient of the purpose of viewing and request the patient to grant permission. After obtaining authorization, the blockchain network will perform proxy re-encryption and send the EHR to the data viewer in the form of re-encrypted ciphertext. After the data viewer decrypts, the integrity of the EHR is verified through the blockchain.
[0114] The specific steps for viewing data are as follows:
[0115] Step 1: The data viewer requests the patient to grant viewing permission, and then the patient calls Client-API-permission to grant viewing permission to the data viewer. After granting viewing permission, the patient calls reKeyGen(SK P ,PK V )→RK P→V After generating the re-encryption key, search IPFS according to CID to get pEHR (0) , the blockchain network calls reEnc(pEHR (0) , R.K. P→V )→pEHR (P→V) Generate re-encrypted ciphertext EHR (P→V) And send it together with CID to VID V .
[0116] Step 2: The data viewer uses his own private key SK VRe-decrypt the ciphertext to obtain the plaintext of pEHR, input the obtained pEHR into the hash function H, calculate a hash value, compare the hash value with the hash value of the pEHR stored on the chain to determine that the obtained pEHR has not been tampered with, and set ACCESS = {ViewEHR, (VID V ,VID P ,CID,timestamp),token} are uploaded to the blockchain. Patients can view their EHR access records through the blockchain.
[0117] Step 3: The patient can revoke the data viewer's viewing rights at any time.
[0118] In the system, all EHRs are encrypted and stored in IPFS. To view the EHR of a specific patient, the data viewer must obtain the patient's authorization before obtaining the re-encrypted data sent by the blockchain network. Only the patient himself and the data viewer who is granted viewing permission can decrypt and obtain the EHR content. Although attacker A can obtain any message of the blockchain network, he cannot decrypt and obtain the patient's EHR content because he does not have the correct private key. Therefore, the system can ensure the confidentiality of EHR data and prevent unauthorized visitors from obtaining data.
[0119] In the system, doctors can upload the CID, S(SK) of EHR stored in IPFS by calling the smart contract uploadEHR. D , CID) and H (EHR) are uploaded to the blockchain. IPFS can help detect tampering or corruption of data because each file has a unique CID in IPFS, and IPFS uses content addressing to identify and retrieve data. Participants can verify the doctor's signature with the doctor's public key to verify the doctor's identity. This method associates the uploaded data with a specific doctor and provides a mechanism to verify the doctor's identity. Data viewers can verify the integrity of the data by comparing the hash value of the EHR. If the EHR is tampered with during transmission, its hash value will change, based on which data tampering can be detected. In addition, an access control mechanism is implemented to allow only users authorized by the patient to access specific EHRs.
[0120] By combining the storage and retrieval functions of IPFS, the doctor's signature verification, the hash comparison of data integrity, and the access control mechanism, the system can ensure the data integrity of EHR. Any tampered or damaged EHR can be discovered, thereby improving the credibility of the data and the security of the system.
[0121] In the system, users need to submit their identity information to the authorized agency for registration. The authorized agency will review the user's information and assign a unique virtual identity VID to the user who passes the review. In each process, the user uses this VID to interact instead of the real identity information. Therefore, the system ensures the privacy protection of the user's identity while allowing secure interaction between users.
[0122] In the system, all operations such as user registration, doctor uploading EHR, and data viewer accessing EHR are recorded in the blocks of the blockchain. Each block contains a collection of transactions that occurred over a period of time. These transactions are sorted, packaged, and signed, hashed, timestamps, and other metadata are added to form a Merkle Tree. This design ensures the traceability of operations, and users cannot deny previously recorded operations. The immutability of the blockchain ensures the integrity and credibility of the records. Each block contains the hash value of the previous block, forming a chain structure. Any tampering with the blockchain will cause the hash value of the block to not match, which will be detected by the system. In addition, each block in the blockchain has a timestamp, based on which the order in which the operations occurred can be determined, further enhancing non-repudiation. By viewing the records on the blockchain, all operations can be verified and audited at any time to prevent users from denying or repudiating their past actions.
[0123] The system uses blockchain to record and protect the immutability of operations, ensuring the credibility of data records and the traceability of user behavior, thereby providing strong non-repudiation.
[0124] DDoS attack resistance: In this attack, the attacker sends network traffic that overloads the target system to prevent it from operating normally. The system adopts an on-chain and off-chain distributed storage structure. Blockchain and IPFS can effectively avoid single points of failure and centralized attack targets, thereby resisting DDos attacks. Through an effective registration and identity authentication mechanism, it can prevent attackers from forging registered entities and unauthorized access to the system, thereby improving data confidentiality and system security.
[0125] In summary, the system has data confidentiality, data integrity, good privacy protection, non-repudiation and attack resistance.
[0126] Therefore, the present invention adopts the above-mentioned blockchain-based EHR data security access and sharing system to share EHR data under the premise of ensuring data security and protecting privacy, and can provide an efficient and secure data sharing and access control solution for the healthcare system with higher performance, more complete solutions and anti-attack characteristics.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A blockchain-based EHR data secure access and sharing system, characterized by: Data viewers who are granted viewing permissions view the patient's EHR by calling Client-API-view; Patients grant or revoke other users' access to their EHR data by calling Client-API-permission; After obtaining the write permission granted by the patient, the doctor calls Client-API-upload to upload the medical records generated after the patient's treatment; Smart contracts are deployed on the blockchain’s channels; The user provides personal information to the authorization agency for identity registration. Before calling the smart contract, the user needs to call Client-API-genToken to authenticate the identity of the authorization agency to obtain the token for calling the smart contract; The trusted server within the hospital is selected as the CA center, and its internal equipment is used as nodes. Internal nodes are selected from each hospital to form a hospital alliance private IPFS network, which serves as off-chain distributed storage to complete user data storage. A data viewing module is also provided.
2. A blockchain-based EHR data secure access and sharing system according to claim 1, characterized in that: The data viewers are doctors, insurance companies, and research institutions, who are users who request to view the patient's EHR.
3. A blockchain-based EHR data secure access and sharing system according to claim 1, characterized in that: The patient acts as the owner of the EHR.
4. A blockchain-based EHR data secure access and sharing system according to claim 1, characterized in that: The authorization agency is a fully trusted entity.
5. According to claim 1, a blockchain-based EHR data security access and sharing system is characterized in that: The specific steps of identity registration are as follows: Step 1: The user calls kpGen to generate a key pair kp and provides PK to the authorization agency i , Encrypted personal information cUserinfo and signature uSign request registration; Step 2: The authorized institution verifies uSign and reviews the user information, and generates a virtual identity VID for the user who passes the review i , and upload REGUSER to the blockchain; Step 3: Users are assigned based on their PK i Search on the blockchain to get its VID i .
6. According to claim 1, a blockchain-based EHR data security access and sharing system is characterized in that: The specific steps of the identity authentication are as follows: Step 1: User provides VID to the authorized institution i 、Contract Name SC Name 、Contract parameters SC Param And use the private key to sign the contract name and contract parameters to authenticate the result rSign; Step 2: The authorization agency calls the algorithm to verify the user's identity. After the verification, the user is issued a blockchain access token, and the user can access the smart contract with the token; Step 3: The user uses the token to access the smart contract. The blockchain executes the algorithm to verify the correctness of the token. If the verification passes, the user calls the smart contract SC.
7. According to claim 1, a blockchain-based EHR data security access and sharing system is characterized in that: The specific operation steps of the data storage are as follows: Step 1: The patient sees a doctor, and the doctor asks the patient to grant him / her write permission to the EHR data. The patient grants the write permission to the doctor. Step 2: After obtaining authorization, the doctor uses the patient's public key to encrypt the EHR and uploads the encrypted EHR to IPFS to obtain the CID; the doctor signs the CID with his private key and uploads the ACCESS to the blockchain; Step 3: The blockchain transmits the doctor’s visit information to the patient. The patient obtains the relevant information of his / her EHR through the blockchain, verifies the doctor’s signature to ensure that the EHR is written by the doctor himself / herself, and searches for the EHR in IPFS through the CID to decrypt and obtain his / her own EHR.
8. According to the blockchain-based EHR data security access and sharing system of claim 1, it is characterized in that: The specific steps for viewing the data are as follows: Step 1: The data viewer requests the patient to grant viewing permission; Step 2: The data viewer uses his own private key SK V Re-decrypt the ciphertext to obtain the plaintext pEHR of EHR.
9. A blockchain-based EHR data security access and sharing system according to claim 8, characterized in that: Step 1 is as follows: the patient grants viewing permission to the data viewer. After granting viewing permission, the patient calls reKeyGen to generate the re-encryption key RK P→V Then, search IPFS according to CID to get pEHR (0) , the blockchain network calls reEnc to generate the re-encrypted ciphertext pEHR (P→V) And send it together with CID to VID V .
10. According to claim 8, a blockchain-based EHR data security access and sharing system is characterized in that: Step 2 is specifically as follows: input the obtained pEHR into the hash function H, calculate a hash value, compare the hash value with the hash value of the pEHR stored on the chain to determine that the obtained pEHR has not been tampered with, and upload ACCESS to the blockchain.