Electronic medical record cloud database storage and query method and system based on homomorphic encryption

By using homomorphic encryption technology and polynomial function to calculate storage location in the electronic medical record cloud database, the problem of insufficient privacy of index information in the prior art is solved, and high-security storage and query of electronic medical record data is achieved.

CN120180496APending Publication Date: 2025-06-20BEIJING AEROSPACE IMPLICIT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510308897.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

The prior art cannot effectively ensure the privacy of indexed information when storing electronic medical record data on a cloud server, and there are security risks, especially in the case of database leakage or network hijacking.

Method used

A method based on homomorphic encryption is adopted to encrypt electronic medical record data through the administrator and user side, and a public-private key pair is generated using a homomorphic encryption algorithm to ensure the privacy of index words and ciphertext data, and to calculate storage locations on the cloud server through polynomial functions to avoid leaking keys.

Benefits of technology

It realizes the privacy protection of electronic medical record data index information, prevents data leakage and hijacking, and ensures the privacy and security of the data query process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120180496A_ABST
    Figure CN120180496A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data security, in particular to an electronic medical record cloud database storage and query method based on homomorphic encryption, during storage, an administrator side and a user side cooperatively encrypt electronic medical record data and index terms, and the encrypted index terms Ti, ciphertext data Ci and secret keys AiBi are stored in a cloud server in a one-to-one correspondence manner; during query, the administrator side encrypts the index term Ti again to obtain RTi; the cloud server calculates the ciphertext form of the storage position of the electronic medical record ciphertext data Ci; after the administrator side decrypts the storage position Pi in a plaintext form, the cloud server returns ciphertext data Ci and a secret key AiBi corresponding to the position Pi to the administrator side; the administrator side decrypts the real data and the user side key Bi, re-encrypts the data by adopting the Bi, and sends the data to the user side; and the user side decrypts the received ciphertext data by using the local key Bi. The privacy of the index information can be ensured, and data leakage caused by database leakage or network hijacking can be prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data security, and more specifically, to a method and system for storing and querying electronic medical record cloud databases based on homomorphic encryption. Background Art

[0002] An electronic health record (EHR) is a digital medical record generated during the diagnosis and treatment processes in medical institutions. It details important information such as a patient's basic information, medical history, examination results, medical orders, treatment plans, etc. With the development of information technology, EHRs have played an important role in improving medical quality, promoting medical collaboration, reducing medical errors, etc.

[0003] Since electronic medical records contain a large amount of personal privacy of users, the leakage of this information not only violates the privacy rights of patients but may also lead to problems such as medical fraud and discrimination. Storing the original data in plain text on a public cloud is very insecure.

[0004] Currently, the approach taken is to encrypt the original electronic medical record data and then store the ciphertext in a cloud server. The problem with this is that when a user wants to query the required data from the cloud server, it is quite difficult. To solve this problem, a searchable encryption method can be used to quickly return the user's query results through keyword queries. However, in most existing solutions, the privacy of index information and index patterns cannot be guaranteed, and there are still some security risks. Summary of the Invention

[0005] In view of this, the present invention provides a method and system for storing and querying electronic medical record cloud databases based on homomorphic encryption, which can ensure the privacy of index information and prevent data leakage caused by database leakage or network hijacking.

[0006] To achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a method for storing and querying an electronic medical record cloud database based on homomorphic encryption, including the following steps:

[0008] For any electronic medical record data i, set a key A at the administrator side i , set a key B at the user side i , combine the key A i and the key B i into a key A i B i , and store it in the cloud server;

[0009] At the administrator side, use the key A iEncrypt the electronic medical record data into ciphertext data C i and use the local key S i to encrypt the index terms of the electronic medical record data into Ti, and encrypt the encrypted index terms T i , ciphertext data C i and key A i B i and store them in one-to-one correspondence in the cloud server;

[0010] When the client needs to query the electronic medical record data, send a query request to the administrator side;

[0011] The administrator side uses the local key S i to encrypt the index terms into T i , then use the homomorphic encryption algorithm to generate a pair of public and private keys (pk, sk), and use the public key pk to encrypt T i again to get RT i , and send RT i and the public key pk to the cloud server;

[0012] The cloud server calculates the storage location POS i of the electronic medical record ciphertext data C i according to RT i and returns it to the administrator side;

[0013] The administrator side uses the local private key sk to decrypt the ciphertext form of POS i into the plaintext form P i and then sends it to the cloud server again;

[0014] The cloud server returns the ciphertext data C i corresponding to the position of P i and key A i B i to the administrator side;

[0015] The administrator side uses key A i to decrypt the ciphertext data C i , and then decrypts the key B i according to key A i B i , and uses key B i to re-encrypt the electronic medical record data and send it to the client; i The client uses key B

[0016] to decrypt the received ciphertext data to obtain the real data of the electronic medical record data. i The client uses key B

[0017] Further, on the administrator side, for all electronic medical record data, respective secret keys {A1, A2,..., A n} are generated; the user side includes a doctor side and a patient side. On the patient side, according to the patient information bound to the login account, a secret key B for the electronic medical record data of the bound patient is generated respectively i ; on the doctor side, secret keys {B1, B2,..., B n} for the electronic medical record data of all visiting patients are generated.

[0018] Further, when the user side needs to query the electronic medical record data of a certain patient, the electronic medical visit card information of the patient is sent to the administrator side, and the administrator side generates an index term for the electronic medical record data of the patient according to the electronic medical visit card information of the patient.

[0019] Further, when storing the ciphertext data of the electronic medical record data in the cloud server, the ciphertext data of each electronic medical record data is stored in the corresponding position, and for the encrypted index term of each electronic medical record data, a polynomial function is respectively constructed, and the association between each ciphertext data and the corresponding polynomial function is recorded in the cloud server.

[0020] Further, assuming that the cloud server stores a total of n pieces of electronic medical record data, and the i-th ciphertext data is stored in the P i -th position, then for the encrypted index term T i , its polynomial function is: where a represents the coefficient and n is the order of the polynomial.

[0021] Further, when the administrator side needs to retrieve a certain electronic medical record data i, after the cloud server receives the re-encrypted index term RT i and the public key pk, the storage position of the ciphertext C i is calculated using the polynomial function: The storage position POS i of the ciphertext C i is returned to the administrator side.

[0022] Further, the homomorphic encryption algorithm used by the administrator side is the CKKS encryption algorithm, the BGV algorithm, or the FHEW algorithm.

[0023] Further, it also includes:

[0024] When no query request from the user side is received, but the electronic medical record data corresponding to the patient visit card bound to the user side account is updated, the administrator side retrieves the ciphertext data of the corresponding electronic medical record data from the cloud server, decrypts and re-encrypts it accordingly, and then distributes the corresponding re-encrypted data to the specified user side.

[0025] Furthermore, on the administrator side, an asymmetric encryption algorithm is used to encrypt and decrypt electronic medical record data.

[0026] In a second aspect, the present invention provides an electronic medical record cloud database storage and query system based on homomorphic encryption, which is applicable to the method described above and includes:

[0027] A data storage management module, which is used to set a key A on the administrator side for any electronic medical record data i i , set a key B on the user side i , combine the key A i and the key B i into a key A i B i , and store it in the cloud server; on the administrator side, use the key A i to encrypt the electronic medical record data into ciphertext data C i , and use the local key S i to encrypt the index term of the electronic medical record data into Ti, and encrypt the encrypted index term T i , the ciphertext data C i and the key A i B i and store them in the cloud server in a one-to-one correspondence;

[0028] A data query request module, which is used to send a query request to the administrator side when the user side needs to query the electronic medical record data;

[0029] An index term encryption module, which is used to encrypt the index term into T i using the local key S on the administrator side i , then generate a pair of public and private keys (pk, sk) using the homomorphic encryption algorithm, and use the public key pk to encrypt T i again to obtain RT i , and send RT i and the public key pk to the cloud server;

[0030] A storage location calculation module, which is used to calculate the storage location POS i of the electronic medical record ciphertext data C i in the cloud server according to RT i , and return it to the administrator side; on the administrator side, use the local private key sk to decrypt the ciphertext form of POS i into the plaintext form P i and then send it to the cloud server again;

[0031] A data retrieval and re-encryption module, which is used to retrieve the ciphertext data C i corresponding to the position of P i and the key Ai B i Return to the administrator side; use key A at the administrator side i to decrypt the ciphertext data C i and then, according to key A i and key A i B i decrypt key B i and use key B i to re-encrypt the electronic medical record data and send it to the user side;

[0032] The user-side data decryption module is used to decrypt the received ciphertext data with key B at the user side i to obtain the real data of the electronic medical record data.

[0033] As can be seen from the above technical solutions, compared with the prior art, the present invention has the following beneficial effects:

[0034] 1. The present invention encrypts each electronic medical record data through the cooperation of the administrator side and the user side, and the ciphertext data stored in the cloud server is encrypted by the key generated by the administrator side. The stored key is the combined key of the administrator side and the user side. By storing the data in this way without retaining the key, it can prevent the data from being decrypted by hackers and hijacked.

[0035] At the same time, when the user side needs to query a certain electronic medical record data or the administrator side needs to send a certain electronic medical record data to a specified user side, the administrator side first decrypts the ciphertext data with the local key, then decrypts the user-side key from the combined key with the local key, and then re-encrypts the decrypted electronic medical record data with the user-side key and sends it to the specified user side. The user side can only decrypt the re-encrypted ciphertext data with the local key to obtain the real electronic medical record data, ensuring the privacy of the data query process; even if the data is sent to other user sides by mistake or the ciphertext data is hijacked, without the decryption key being mastered by other user sides, the real electronic medical record data cannot be obtained.

[0036] 2. The present invention encrypts the index words of all electronic medical record data, and the cloud server cannot obtain the relevant information of the real index words. When querying a certain electronic medical record data, even if the same index word is used each time, the public and private keys generated by the homomorphic encryption algorithm are different each time, but the index word RT i encrypted with the public key is also different. Furthermore, the ciphertext storage location POS i calculated by the cloud server according to the index word RT i is also different, and the storage location P iThey are the same. Therefore, it can be ensured that every time a query is made, the administrator side can obtain the true storage location of the electronic medical record data, but the cloud server cannot infer the one-to-one correspondence between the index term, the ciphertext data, and the storage location. For the same index term, the ciphertext storage locations calculated by the cloud server are all different. Therefore, the privacy of the indexing process on the administrator side can be guaranteed, and the security of data storage can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0038] Figure 1 It is a flowchart of the method for storing and querying an electronic medical record cloud database based on homomorphic encryption provided by the present invention;

[0039] Figure 2 It is an interaction schematic diagram of the user side, the administrator side, and the cloud server of the method for storing and querying an electronic medical record cloud database based on homomorphic encryption provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.

[0041] As Figure 1 - Figure 2 shown, the embodiments of the present invention disclose a method for storing and querying an electronic medical record cloud database based on homomorphic encryption, including the following steps:

[0042] S1. For any electronic medical record data i, set a secret key A i at the administrator side, set a secret key B i at the user side, combine the secret key A i and the secret key B i into a secret key A i B i , and store it in the cloud server;

[0043] S2. Encrypt the electronic medical record data into ciphertext data C i using the secret key A i at the administrator side, and use the local secret key S iThe index term of the electronic medical record data is encrypted as Ti, and the encrypted index term T i , the ciphertext data C i and the key A i B i are stored in the cloud server in one-to-one correspondence;

[0044] S3. When the client needs to query the electronic medical record data, it sends a query request to the administrator side;

[0045] S4. The administrator side uses the local key S i to encrypt the index term as T i , then uses the homomorphic encryption algorithm to generate a pair of public and private keys (pk, sk), and uses the public key pk to encrypt T i again to obtain RT i , and sends RT i and the public key pk to the cloud server;

[0046] S5. The cloud server calculates the storage location POS i of the ciphertext data C i of the electronic medical record according to RT i , and returns it to the administrator side;

[0047] S6. The administrator side uses the local private key sk to decrypt the ciphertext form of POS i into the plaintext form P i , and then sends it to the cloud server again;

[0048] S7. The cloud server returns the ciphertext data C i corresponding to the position of P i and the key A i B i to the administrator side;

[0049] S8. The administrator side uses the key A i to decrypt the ciphertext data C i , and then decrypts the key B i according to the key A i and the key A i B i , and re-encrypts the electronic medical record data with the key B i and sends it to the client;

[0050] S9. The client uses the key B i to decrypt the received ciphertext data to obtain the real data of the electronic medical record data.

[0051] The following further explains the above steps.

[0052] S1. At the administrator side, for all electronic medical record data, respective secret keys {A1, A2,..., A n} are generated, where n represents that a total of n pieces of electronic medical record data need to be stored; the user side includes the doctor side and the patient side. At the patient side, according to the patient information bound to the login account, a secret key B for the electronic medical record data of the bound patient is generated respectively. i One or more patients can be bound under each user side account. According to the number of patients, a unique secret key for the electronic medical record data of each patient is generated respectively; at the doctor side, secret keys {B1, B2,..., B n} for the electronic medical record data of all treated patients are generated. For the convenience of query, the doctor side has the access right to access the electronic medical record data of all treated patients in the current hospital, so the doctor side has the secret keys of all electronic medical record data.

[0053] S2. At the administrator side, using the secret key A i encrypt any electronic medical record data into ciphertext data C i , and use the local secret key S i to encrypt the index term of this electronic medical record data into Ti. Encrypted index term T i , ciphertext data C i and secret key A i B i are stored in the cloud server one by one in a corresponding manner.

[0054] When storing the ciphertext data of the electronic medical record data in the cloud server, the ciphertext data of each electronic medical record data is stored in the corresponding position. For the encrypted index term of each electronic medical record data, a polynomial function is constructed respectively, and the association between each ciphertext data and the corresponding polynomial function is recorded in the cloud server.

[0055] Suppose the cloud server stores a total of n pieces of electronic medical record data, and the i-th ciphertext data is stored in the P i -th position. Then for the encrypted index term T i , its polynomial function is: where a represents the coefficient, which can be obtained according to the Lagrange interpolation method or the Newton interpolation method, and n is the order of the polynomial.

[0056] S3. When the user side needs to query this electronic medical record data, a query request is sent to the administrator side; at the user side, according to the bound patient information, each patient has interface information. When it is necessary to query the medical record data of a certain bound patient, first enter the treatment interface of this patient and send a query request to the administrator side. At this time, the electronic medical card information of this patient will be automatically sent to the administrator side, and the administrator side determines the index term of the electronic medical record data of this patient according to the electronic medical card information of the patient.

[0057] S4. After the administrator terminal receives the query request and determines the index terms, it uses the local key S i to encrypt the index terms into T i . Then, it uses the homomorphic encryption algorithm to generate a pair of public and private keys (pk, sk), and uses the public key pk to encrypt T i again to obtain RT i . It sends RT i and the public key pk to the cloud server. The homomorphic encryption algorithm used by the administrator terminal is the CKKS encryption algorithm, the BGV algorithm, or the FHEW algorithm.

[0058] S5. The cloud server calculates the storage location POS i of the ciphertext data C i of this electronic medical record based on RT i and the public key pk, and returns it to the administrator terminal.

[0059] Specifically, when the administrator terminal needs to retrieve a certain electronic medical record data i, after the cloud server receives the re-encrypted index term RT i and the public key pk, it calculates the storage location of the ciphertext C i using a polynomial function: It returns the storage location POS i of the ciphertext C i to the administrator terminal.

[0060] According to the properties of the homomorphic encryption algorithm, the storage location POS i calculated by the cloud server based on the re-encrypted index term RT i is the ciphertext form of the real location P i . In this way, the server can be prevented from learning the correspondence between the storage location and the index term.

[0061] S6. The administrator terminal uses the local private key sk to decrypt the ciphertext form of POS i into the plaintext form P i , and then sends it to the cloud server again. The administrator terminal only needs to use the private key sk stored locally to decrypt POS i to obtain the real location P i .

[0062] S7. The cloud server returns the ciphertext data C i corresponding to the location P i and the keys A i B i to the administrator terminal.

[0063] S8. The administrator terminal uses the key A i to decrypt the ciphertext data C iDecrypt it, and then according to the key A i and the key A i B i decrypt the key B i , and use the key B i to re-encrypt the electronic medical record data and send it to the user side.

[0064] S9. The user side uses the key B i to decrypt the received ciphertext data to obtain the real data of the electronic medical record data. Specifically, an asymmetric encryption algorithm is used to encrypt and decrypt the electronic medical record data.

[0065] In other embodiments, the present invention can also implement the distribution function of the electronic medical record data. When the query request from the user side is not received, but the electronic medical record data corresponding to the patient visit card bound under the user side account is updated, the administrator side retrieves the ciphertext data of the corresponding electronic medical record data from the cloud server, decrypts and re-encrypts it accordingly, and then distributes the corresponding re-encrypted data to the specified user side.

[0066] In this step, the methods for the administrator side to encrypt and decrypt the index words and the ciphertext data, and the method for the cloud server to calculate the storage location of the medical record data are all executed with reference to S4 - S8.

[0067] In other embodiments, the present invention also provides an electronic medical record cloud database storage and query system based on homomorphic encryption, which is applicable to the method as described above, including:

[0068] A data storage management module, which is used to set the key A i at the administrator side for any electronic medical record data i, set the key B i at the user side, combine the key A i and the key B i into the key A i B i , and store it in the cloud server; encrypt the electronic medical record data into ciphertext data C i using the key A i at the administrator side, and encrypt the index word of the electronic medical record data into Ti using the local key S i , and store the encrypted index word T i , the ciphertext data C i and the key A i B i in one-to-one correspondence in the cloud server;

[0069] A data query request module, which is used to send a query request to the administrator side when the user side needs to query the electronic medical record data;

[0070] An index word encryption module, which is used to use the local key S at the administrator sidei Encrypt the index term as T i , then use the homomorphic encryption algorithm to generate a pair of public and private keys (pk, sk), and use the public key pk to encrypt T i again to obtain RT i , and send RT i and the public key pk to the cloud server;

[0071] The storage location calculation module is used to calculate the storage location POS of the ciphertext data C of this electronic medical record according to RT i and the public key pk in the cloud server i , and return it to the administrator side; at the administrator side, use the local private key sk to decrypt the ciphertext-form POS i into the plaintext form P i , and then send it to the cloud server again; i

[0072] The data retrieval and re-encryption module is used to return the ciphertext data C corresponding to the position of P i and the key A i B i to the administrator side in the cloud server; at the administrator side, use the key A i to decrypt the ciphertext data C i , and then decrypt the key B according to the key A i and the key A i and the key A i B i , and use the key B i to re-encrypt the electronic medical record data and send it to the user side; i

[0073] The user-side data decryption module is used to decrypt the received ciphertext data with the key B i at the user side to obtain the real data of this electronic medical record data.

[0074] In this specification, each embodiment is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0075] ​​The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for storing and querying an electronic medical record cloud database based on homomorphic encryption, characterized in that: The following steps are involved: For any electronic medical record data i, set the key A on the administrator side i , set key B on the user side i , key A i and key B i Combination of key A i B i , and store it in the cloud server; Use key A on the administrator side i Encrypt the electronic medical record data into ciphertext data C i , and use the local key S i The index word of the electronic medical record data is encrypted as Ti, and the encrypted index word T i 、Ciphertext data C i and key A i B i One-to-one storage to the cloud server; When the user needs to query the electronic medical record data, a query request is sent to the administrator; The administrator uses the local key S i Encrypt the index word as T i , and then use the homomorphic encryption algorithm to generate a pair of public and private keys (pk, sk), and use the public key pk to i Encrypt again to get RT i , RT i And the public key pk is sent to the cloud server; Cloud server based on RT i And the public key pk calculates the electronic medical record ciphertext data C i Storage location POS i , and returns to the administrator side; The administrator uses the local private key sk to convert the encrypted POS i Decrypted to plaintext form P i After that, it is sent to the cloud server again; The cloud server will P i The ciphertext data C corresponding to the position i and key A i B i Return to the administrator side; The administrator uses key A i For the ciphertext data C i Decrypt, and then use key A i and key A i B i Decrypt key B i , using key B i The electronic medical record data is re-encrypted and sent to the user end; The user uses key B i The received ciphertext data is decrypted to obtain the real data of the electronic medical record data.

2. The method for storing and querying an electronic medical record cloud database based on homomorphic encryption according to claim 1 is characterized in that: On the administrator side, for all electronic medical record data, generate their own secret keys {A1, A2, ..., A n The user side includes the doctor side and the patient side. On the patient side, according to the patient information bound to the login account, the key B for the electronic medical record data of the bound patient is generated. i ; On the doctor side, generate the key {B1, B2, ..., B n }.

3. The electronic medical record cloud database storage and query method based on homomorphic encryption according to claim 2 is characterized in that: When the user needs to query the electronic medical record data of a patient, the electronic medical card information of the patient is sent to the administrator, and the administrator generates an index word for the electronic medical record data of the patient based on the electronic medical card information of the patient.

4. The method for storing and querying an electronic medical record cloud database based on homomorphic encryption according to claim 1 is characterized in that: When the cloud server stores the ciphertext data of the electronic medical record data, the ciphertext data of each electronic medical record data is stored in the corresponding location, a polynomial function is constructed for each encrypted index word of the electronic medical record data, and the association between each ciphertext data and the corresponding polynomial function is recorded in the cloud server.

5. The method for storing and querying an electronic medical record cloud database based on homomorphic encryption according to claim 4 is characterized in that: Assume that the cloud server stores n electronic medical record data in total, and the i-th ciphertext data is stored in the Pth i positions, then for the encrypted index term T i , its polynomial function is: P i =a1 T i +a2 T i 2 +…+a n-1 T i n-1 +a0, where a represents the coefficient and n is the order of the polynomial.

6. The method for storing and querying an electronic medical record cloud database based on homomorphic encryption according to claim 5 is characterized in that: When the administrator needs to retrieve a certain electronic medical record data i, the cloud server receives the re-encrypted index term RT i After the public key pk is calculated, the ciphertext C is obtained using the polynomial function i Storage location: POS i =a1RT i +a2RT i 2 +…+a n-1 RT i n-1 +a0, the ciphertext C i Storage location POS i Return to the administrator side.

7. The electronic medical record cloud database storage and query method based on homomorphic encryption according to claim 1 is characterized in that: The homomorphic encryption algorithm used by the administrator is the CKKS encryption algorithm, the BGV algorithm, or the FHEW algorithm.

8. The method for storing and querying an electronic medical record cloud database based on homomorphic encryption according to claim 1 is characterized in that: Also includes: When no query request is received from the user, but the electronic medical record data corresponding to the patient's medical card bound to the user's account is updated, the administrator retrieves the ciphertext data of the corresponding electronic medical record data from the cloud server, decrypts and re-encrypts it, and then distributes the corresponding re-encrypted data to the designated user.

9. The method for storing and querying an electronic medical record cloud database based on homomorphic encryption according to claim 1, characterized in that: On the administrator side, an asymmetric encryption algorithm is used to encrypt and decrypt electronic medical record data.

10. An electronic medical record cloud database storage and query system based on homomorphic encryption, characterized in that: It is applicable to the method according to any one of claims 1 to 9, comprising: The data storage management module is used to set the key A on the administrator side for any electronic medical record data i. i , set key B on the user side i , key A i and key B i Combination of key A i B i , and store it in the cloud server; the administrator uses key A i Encrypt the electronic medical record data into ciphertext data C i , and use the local key S i The index word of the electronic medical record data is encrypted as Ti, and the encrypted index word T i 、Ciphertext data C i and key A i B i One-to-one storage to the cloud server; The data query request module is used to send a query request to the administrator when the user needs to query the electronic medical record data; Index word encryption module, used to use local key S on the administrator side i Encrypt the index word as T i , and then use the homomorphic encryption algorithm to generate a pair of public and private keys (pk, sk), and use the public key pk to i Encrypt again to get RT i , RT i And the public key pk is sent to the cloud server; Storage location calculation module, used to calculate the location of the cloud server according to RT i And the public key pk calculates the electronic medical record ciphertext data C i Storage location POS i , and returns it to the administrator; the administrator uses the local private key sk to convert the encrypted POS i Decrypted to plaintext form P i After that, it is sent to the cloud server again; Data retrieval and re-encryption module, used to transfer P i The ciphertext data C corresponding to the position i and key A i B i Return to the administrator side; use key A on the administrator side i For the ciphertext data C i Decrypt, and then use key A i and key A i B i Decrypt key B i , using key B i The electronic medical record data is re-encrypted and sent to the user end; The user-side data decryption module is used to use the key B at the user side i The received ciphertext data is decrypted to obtain the real data of the electronic medical record data.