A tamper-proof electronic medical record storage method based on improved RSA
By improving the RSA algorithm and blockchain technology and combining it with distributed storage, we have achieved high security and efficient storage of electronic medical records, solved the problem of electronic medical record storage being easily damaged and tampered with, and improved the security and speed of data storage.
Patent Information
- Application Number
- CN202211553186.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-12-06
AI Technical Summary
Existing technologies make it difficult to store and protect electronic medical records securely and efficiently. Paper medical records are easily damaged and tampered with, and traditional RSA encryption algorithms have defects in security and efficiency.
An improved RSA algorithm is combined with blockchain technology and distributed storage. Keys are generated through multi-prime RSA, and the Chinese remainder theorem is used to accelerate decryption. The "on-chain index, off-chain storage" model is adopted to store encrypted medical records on the IPFS network and transaction data on the alliance blockchain to ensure that the data cannot be tampered with.
It achieves high security and efficient storage of electronic medical records, improves the security and speed of data storage, reduces the storage pressure of the blockchain system, and solves the problems of insufficient data capacity and throughput.
Smart Images

Figure CN116015660B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of information technology and data storage, and relates to an anti-tampering electronic medical record storage method based on improved RSA. Background Art
[0002] With the advent of the big data era, hospitals are generating vast amounts of medical data. This data may include electronic medical records, medication quality, typical illnesses, and more. Electronic medical records (EMRs) contain a wealth of personal and private information, such as basic user information, examination reports, doctor's recommendations, and selected ultrasound images. These data are generated daily. Securely storing EMRs has long been a difficult problem. Many medical institutions still use paper medical records to store medical data. This method is not only difficult to store for long periods of time, but also prone to tampering or corruption.
[0003] The concept of blockchain originated with Bitcoin, proposed by Satoshi Nakamoto in 2008. It's not a new technology that emerged out of thin air, but rather an integration of existing technologies such as cryptography, peer-to-peer (P2P), and timestamps, ensuring that data cannot be tampered with or forged during transmission and storage. Blockchains are categorized into three types based on whether system control and transaction information are public: public, consortium, and private. Consortium chains fall somewhere in between these two types.
[0004] The RSA encryption algorithm is a public key encryption algorithm. The public key is required for encryption during the encryption process, and the private key is required for decryption. The private key is generally kept by the encryptor. However, traditional RSA encryption methods have certain defects in security and efficiency. Summary of the Invention
[0005] In order to solve the problems existing in the background technology, the present invention provides a tamper-proof electronic medical record storage method based on improved RSA, which introduces a multi-prime RSA algorithm to replace the traditional RSA algorithm to encrypt the original electronic medical record information, thereby improving the security of encryption; the Chinese remainder theorem (CRT) is used in the decryption stage of the improved RSA algorithm to improve the speed of RSA decryption, thereby improving the data storage speed; the "on-chain index, off-chain storage" method is adopted to effectively reduce the storage pressure of the blockchain system. The present invention improves the RSA algorithm and combines blockchain technology and distributed storage technology to invent a tamper-proof electronic medical record storage method based on improved RSA, that is, using an improved RSA encryption algorithm to encrypt the data to be stored, and then storing the encrypted ciphertext in the distributed file system IPFS, and the IPFS address corresponding to the ciphertext and other information are packaged as a transaction and stored in the alliance blockchain network. The Merkle tree in the blockchain manages these transaction transactions to ensure that the electronic medical record cannot be tampered with.
[0006] The present invention provides a tamper-proof electronic medical record storage method based on improved RSA, comprising:
[0007] S1: Use the server as a node to build the Hyperledger Fabric blockchain network and IPFS network respectively;
[0008] S2: Generate the master key, the patient's public key, and the patient's private key using the improved RSA key generation algorithm;
[0009] S3: Encrypt the medical records uploaded by the patient using the improved RSA encryption algorithm based on the patient's public key, store the encrypted medical records in the IPFS network, and generate an access address for the patient's medical records;
[0010] S4: Generate the patient's medical record information transaction data using a hash algorithm based on the access address of the patient's medical record information, the current timestamp, and the patient's public key, and upload it to the Hyperledger Fabric blockchain network for storage;
[0011] S5: The user obtains the patient's medical record information transaction data through the Hyperledger Fabric blockchain network, and uses the patient's medical record information transaction data to obtain the patient's encrypted medical record information from the IPFS network. Then, based on the master key and the patient's private key, the user uses the Chinese remainder theorem and the improved RSA decryption algorithm to decrypt the patient's encrypted medical record information and obtain the patient's medical record information.
[0012] The present invention has at least the following beneficial effects
[0013] This invention utilizes a tamper-proof electronic medical record storage method based on blockchain and IPFS, offering enhanced security and storage efficiency. Adopting an "on-chain indexing, off-chain storage" model, the method stores original electronic medical records on the IPFS network, while IPFS addresses and metadata are stored on a consortium blockchain. This addresses the issues of insufficient capacity and throughput for blockchain-based medical data, improving data storage efficiency. The introduction of an improved RSA algorithm enhances data security and speeds decryption, thereby accelerating system operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 is a flow chart of the method of the present invention;
[0015] Figure 2 This is a schematic diagram of the storage and downloading of patient electronic medical records in the present invention;
[0016] Figure 3 This is a flowchart for uploading patient medical record information transaction data to the chain in the present invention. DETAILED DESCRIPTION
[0017] The technical solutions of the present invention will be described clearly and in detail below in conjunction with the accompanying drawings of the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention and cannot be used to limit the scope of the present invention.
[0018] See also Figure 1 The present invention provides a tamper-proof electronic medical record storage method based on improved RSA, comprising:
[0019] S1: Use the server as a node to build the Hyperledger Fabric blockchain network and the IPFS network respectively; the server is an intelligent hardware device with computer functions, and the Hyperledger Fabric blockchain network and the IPFS network can be built by running the corresponding software program on the server.
[0020] S2: Generate the master key, the patient's public key, and the patient's private key using the improved RSA key generation algorithm;
[0021] Preferably, the step of generating the patient's public key and private key using an improved RSA key generation algorithm comprises:
[0022] S21: Randomly select four unequal large prime numbers p, q, r and s as the master key;
[0023] S22: Select a positive integer e based on the master key and use the RSA key generation algorithm to generate the patient's public key and the patient's private key.
[0024] Preferably, the patient's public key includes:
[0025] PK=<e,n>
[0026] n=pqrs
[0027] Φ(n)=(p-1)(q-1)(r-1)(s-1)
[0028] 1<e<n, GCD(e,Φ(n))=1
[0029] Where p, q, r, and s represent master keys, e represents a positive integer, GCD(e, Φ(n)) represents the greatest common divisor of e and Φ(n), and PK represents the patient's public key.
[0030] Preferably, the patient's private key includes:
[0031] SK=<d,n>
[0032] n=pqrs
[0033] Φ(n)=(p-1)(q-1)(r-1)(s-1)
[0034] e×d≡1mod(Φ(n))
[0035] Wherein, p, q, r, and s represent master keys, e represents a positive integer, SK represents the patient's private key, and mod() represents the modulo function.
[0036] S3: Encrypt the medical records uploaded by the patient using the improved RSA encryption algorithm based on the patient's public key, store the encrypted medical records in the IPFS network, and generate an access address for the patient's medical records;
[0037] Preferably, the encrypted patient medical record information includes:
[0038] C=M e mod(n)
[0039] Among them, e and n represent the patient's public key, M represents the medical record information uploaded by the patient, mod() represents the modulus function, and C represents the encrypted patient medical record information.
[0040] S4: Generate the patient's medical record information transaction data using a hash algorithm based on the access address of the patient's medical record information, the current timestamp, and the patient's public key, and upload it to the Hyperledger Fabric blockchain network for storage;
[0041] Preferably, the patient's medical record information transaction data includes:
[0042] T x ={PK, ipfs h ,ts,Sig h , tid h}
[0043] Sig h =H(PK, Ts, ipfs h ), tid h =H(PK, ts, ipfs h , Sig h )
[0044] Among them, PK represents the patient's public key, ts represents the timestamp of the current moment, H(·) is the SHA-256 hash generation algorithm, ipfs h represents the access address of the hth patient's medical record information, T x Represents transaction data of patient medical record information.
[0045] like Figure 3 As shown, the patient's medical record information transaction data T xUploading to the Hyperledger Fabric blockchain involves the following steps:
[0046] (1) The application client calls the certificate authority (CA) service through the SDK to register and obtain an identity certificate.
[0047] (2) The application client initiates a transaction proposal to the blockchain network through the SDK. The transaction proposal sends information such as the contract identifier, contract method and parameter information to be called for this transaction, and the client signature to the endorsing node.
[0048] (3) After receiving the transaction proposal, the endorsement node verifies the signature and determines whether the submitter has the authority to perform the operation. At the same time, it simulates the execution of the smart contract according to the endorsement policy and returns the result and its respective CA certificate signature to the application client.
[0049] (4) After receiving the information returned by the endorsement node, the application client determines whether the proposal result is consistent and whether it is executed in accordance with the specified endorsement policy. If there is not enough endorsement, the processing is terminated; otherwise, the application client packages the data together to form a transaction, signs it, and sends it to the Orderer node.
[0050] (5) The Orderer node sorts the received transactions in the order in which they arrive at the Orderer node, and then packages a batch of transactions together according to the block generation strategy to generate a new block and send it to the Committer node.
[0051] (6) After receiving the block, the committer node will verify each transaction in the block and check whether the input and output that the transaction depends on are consistent with the current state of the blockchain. After completion, it will append the block to the local blockchain and modify the blockchain state.
[0052] See also Figure 2 ,S5: The user obtains the patient's medical record information transaction data through the Hyperledger Fabric blockchain network, and uses the patient's medical record information transaction data to obtain the patient's encrypted medical record information from the IPFS network, and then uses the Chinese remainder theorem and the improved RSA decryption algorithm based on the master key and the patient's private key to decrypt the patient's encrypted medical record information and obtain the patient's medical record information.
[0053] Preferably, decrypting the patient's encrypted medical record information using the Chinese remainder theorem and an improved RSA decryption algorithm according to the master key and the patient's private key includes:
[0054] S71: Calculate the remaining M of the patient's medical record information using the improved RSA decryption algorithm based on the master key and the patient's private key p, M q , M r , M S ;
[0055]
[0056] Among them, M p , M q , M r , M s represents the remainder of the patient's medical record information, p, q, r, and s represent the master key, d and n represent the patient's private key, C represents the encrypted patient's medical record information, and mod() represents the modulo function.
[0057] S72: Calculate the patient's medical record information M using the Chinese Remainder Theorem (CRT) based on the remainder of the patient's medical record information.
[0058]
[0059] M=(M p (qrs) p-1 +M q (prs) q-1 +M r (qps) r-1 +M s (pqr) s-1 )mod(n)
[0060] Among them, M represents the patient's medical record information, p, q, r and s represent the master key, (M p , M q , M r , M s ) represents the remainder of the patient’s medical record information, and n represents the patient’s private key.
[0061] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solutions, which should all be included in the scope of the claims of the present invention.
Claims
1. A tamper-proof electronic medical record storage method based on improved RSA, characterized in that: include: S1: Use the server as a node to build the Hyperledger Fabric blockchain network and IPFS network respectively; S2: Generate the master key, the patient's public key, and the patient's private key using the improved RSA key generation algorithm; S3: Encrypt the medical records uploaded by the patient using the improved RSA encryption algorithm based on the patient's public key, store the encrypted medical records in the IPFS network, and generate an access address for the patient's medical records; S4: Generate the patient's medical record information transaction data using a hash algorithm based on the access address of the patient's medical record information, the current timestamp, and the patient's public key, and upload it to the Hyperledger Fabric blockchain network for storage; S5: The user obtains the patient's medical record information transaction data through the Hyperledger Fabric blockchain network, and uses the patient's medical record information transaction data to obtain the patient's encrypted medical record information from the IPFS network. The user then uses the Chinese remainder theorem and the improved RSA decryption algorithm based on the master key and the patient's private key to decrypt the patient's encrypted medical record information and obtain the patient's medical record information; Decrypting the patient's encrypted medical record information using the Chinese remainder theorem and the improved RSA decryption algorithm based on the master key and the patient's private key includes: S71: Calculate the remaining M of the patient's medical record information using the improved RSA decryption algorithm based on the master key and the patient's private key p ,M q ,M r ,M s ; The remaining M of the patient's medical record information p ,M q ,M r ,M s include: Among them, M p ,M q ,M r ,M s represents the remainder of the patient's medical record information, p, q, r, and s represent the master key, d and n represent the patient's private key, C represents the encrypted patient's medical record information, and mod() represents the modulo function; S72: Calculate the patient's medical record information M using the Chinese remainder theorem based on the remainder of the patient's medical record information; The patient's medical record information M includes: M=(M p (qrs) p-1 +M q (prs) q-1 +M r (qps) r-1 +M s (pqr) s-1 )mod(n) Among them, M represents the patient's medical record information, p, q, r and s represent the master key, M p ,M q ,M r ,M s represents the remainder of the patient's medical record information, and n represents the patient's private key.
2. The tamper-proof electronic medical record storage method based on improved RSA according to claim 1, characterized in that: The method of generating the patient's public key and private key by using the improved RSA key generation algorithm includes: S21: Randomly select four unequal large prime numbers p, q, r and s as the master key; S22: Select a positive integer e based on the master key and use the RSA key generation algorithm to generate the patient's public key and the patient's private key.
3. The tamper-proof electronic medical record storage method based on improved RSA according to claim 2, characterized in that: The patient's public key includes: PK= <e,n> n=pqrs Φ(n)=(p-1)(q-1)(r-1)(s-1) 1 <e<n,GCD(e,Φ(n))=1 Where p, q, r, and s represent master keys, e represents a positive integer, GCD(e, Φ(n)) represents the greatest common divisor of e and Φ(n), and PK represents the patient's public key.
4. The tamper-proof electronic medical record storage method based on improved RSA according to claim 3, characterized in that: The patient's private key includes: SK=<d,n> n=pqrs Φ(n)=(p-1)(q-1)(r-1)(s-1) e×d≡1mod(Φ(n)) Wherein, p, q, r, and s represent master keys, e represents a positive integer, SK represents the patient's private key, and mod() represents the modulo function.
5. The tamper-proof electronic medical record storage method based on improved RSA according to claim 3, characterized in that: The encrypted patient medical record information includes: C=M e mod(n) Among them, e and n represent the patient's public key, M represents the medical record information uploaded by the patient, mod() represents the modulus function, and C represents the encrypted patient medical record information.
6. The tamper-proof electronic medical record storage method based on improved RSA according to claim 3, characterized in that: The patient's medical record information transaction data includes: T x ={PK,ipfs h ,ts,Sig h ,time h } Sig h =H(PK,Ts,ipfs h ),tid h =H(PK,ts,ipfs h ,Sig h ) Among them, PK represents the patient's public key, ts represents the timestamp of the current moment, H(·) is the SHA-256 hash generation algorithm, ipfs h represents the access address of the hth patient's medical record information, T x Represents transaction data of patient medical record information.
Citation Information
Patent Citations
Electronic medical record sharing method based on national cryptographic algorithm and IPFS
CN114553582A