Data protection method based on multi-key homomorphic encryption and block chain reputation weight
Through multi-key homomorphic encryption and blockchain reputation weight mechanism, the problems of participant isolation and privacy leakage in the federated learning system are solved, the sound compensation and recovery of the model are achieved, the robustness and fairness of the system are improved, and the data privacy protection effect is enhanced.
Patent Information
- Application Number
- CN202511019938.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-10-17
AI Technical Summary
In existing federated learning systems, traditional single-key encryption schemes cannot achieve true isolation between participants, posing a risk of privacy leakage. It is difficult to prevent tampering or forgery by malicious participants during model aggregation, and it is difficult to achieve effective compensation and model recovery when participants are interrupted or disconnected, affecting the robustness and fairness of the model.
It adopts multi-key homomorphic encryption and blockchain reputation weight mechanism, generates security parameters and public parameters through the server, and the participants generate key combinations and upload them to the blockchain for evidence storage. The server screens and homomorphically aggregates local model parameters, dynamically adjusts the reputation value, realizes sound compensation and recovery, and ensures data confidentiality and transparency.
It enhances the system's anti-attack capabilities and data privacy protection, improves the fairness and accuracy of the model, avoids unauthorized access or tampering of data by third parties, and ensures the fairness and transparency of data processing.
Smart Images

Figure CN120811566A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data protection, in particular to a data protection method based on multi-key homomorphic encryption and blockchain reputation weight. BACKGROUND
[0002] With the rapid development of information technology, the medical industry has gradually entered the era of digitization and intelligentization. Medical data is growing exponentially, and how to efficiently and securely share and utilize these medical data has become the core key to promoting medical research and precision medicine development. However, medical data has high sensitivity and personal privacy attributes, and its leakage will seriously threaten patient rights and even cause ethical and legal risks. Therefore, while promoting the sharing of medical data, privacy protection must be the prerequisite for building a safe and reliable data circulation and collaboration mechanism.
[0003] In the prior art, federated learning is used as a new type of privacy protection machine learning framework, allowing multiple data owners to collaboratively train a global model without sharing raw data, thereby realizing intelligent analysis while meeting data privacy protection.
[0004] In the prior art, few combine blockchain and multi-key homomorphic encryption to realize data ciphertext transmission and encryption in the federated learning system to protect data privacy. As a decentralized distributed ledger technology, blockchain can record participants' public keys, identity, historical behavior and computing contribution in a blockchain smart contract, and can build a verifiable and trustworthy collaborative training environment. At the same time, the reputation value mechanism is introduced, and the weight of each node in model aggregation is dynamically adjusted according to the behavior quality, historical upload model accuracy and other factors, which helps to prevent external security threats. However, traditional homomorphic encryption methods only use a single key for encryption scheme, which has limitations in federated learning: since all participants share a public key, any entity with a private key can decrypt all model information, which cannot achieve real isolation between participants and is not conducive to system accountability. At the same time, there is a risk of privacy leakage in the process of uploading local model parameters by traditional federated learning parties, especially in the case of untrusted servers or model inversion attacks, and the model aggregation process cannot prevent malicious participants from uploading tampered or fake model parameters, thereby affecting the accuracy and robustness of the global model. And when some participating nodes have problems such as interruption, disconnection, late reporting, etc., it is difficult to achieve effective compensation and model recovery. Therefore, there is an urgent need for a medical data privacy protection method that combines multi-key homomorphic encryption, blockchain smart contract and reputation weighting mechanism, which can not only guarantee the confidentiality of data in the model training process, but also improve the robustness and fairness of the aggregated model, while taking into account the scalability and usability of the system. SUMMARY
[0005] In order to overcome the above problems, the present application provides a data protection method based on multi-key homomorphic encryption and blockchain reputation weight, which constructs a federated learning framework, the server generates security parameters and public parameters, and uploads them to the blockchain, the participants obtain the security parameters and public parameters to generate corresponding key combinations, and upload them to the blockchain for storage, the server distributes the initial global model parameters to the participants, and the participants encrypt and send the ciphertext of the local model parameters to the server according to the global model parameters and weighted processing; the server checks and filters the participants according to the key combinations, obtains the ciphertext of the corresponding local model parameters, homomorphically aggregates all the ciphertext of the local model parameters, obtains the new global model parameters aggregated and encrypted by the multi-key homomorphic encryption algorithm, and the new reputation value corresponding to each participant; if there is a participant who drops out, the server generates the local model parameters for compensation after encryption processing through the corresponding historical reputation value and the local model parameters, so as to aggregate the ciphertext of the local model parameters of all participants in the same round in the subsequent, realize sound compensation and recovery, and ensure that the server has robustness and fairness; each participant decrypts the encrypted new global model parameters using the corresponding private key, obtains the new global model parameters, re-trains to obtain and update the local model parameters, and uploads the new reputation value to the blockchain for storage, the decentralized blockchain network and the multi-key homomorphic encryption protection ensure the fairness and transparency of the data processing of multiple participants, avoid the problem of unauthorized access or tampering of data by a third party, and greatly enhance the anti-attack ability of the system and the effect of data privacy protection.
[0006] In order to achieve the above purpose, the present application provides a data protection method based on multi-key homomorphic encryption and blockchain reputation weight, which comprises: constructing a federated learning framework; The server generates security parameters and public parameters using a parameter generation method, and uploads them to the blockchain; The participants obtain the security parameters and public parameters to generate corresponding key combinations, and upload them to the blockchain for storage; The server generates initial global model parameters and distributes them to the participants; The participants train to obtain local model parameters according to the global model parameters, and encrypt and send them to the server after weighted processing; The server checks and filters the participants according to the key combinations, and obtains the ciphertext of the corresponding local model parameters; The server homomorphically aggregates all the ciphertext of the local model parameters to obtain the new global model parameters aggregated and encrypted by the multi-key homomorphic encryption algorithm, and the new reputation value corresponding to each participant; Each participant uses the corresponding private key to decrypt the encrypted new global model parameters, obtain the new global model parameters, retrain to obtain and update the local model parameters, and upload the new reputation value to the blockchain for evidence storage.
[0007] Preferably, constructing a federated learning framework includes establishing trusted transmission channels between the server, participants and blockchain, wherein the trusted transmission channel between the server and the participants is used for the initial global model parameters and local model parameters and ciphertext, and the trusted transmission channel between the participants and the blockchain, and the trusted transmission channel between the server and the blockchain are used to transmit public keys and reputation values.
[0008] Preferably, the participants obtain security parameters and public parameters to generate corresponding key combinations and upload them to the blockchain for evidence storage, including: Based on the common parameters, the polynomial ring is constructed using formula (1). , (1) in, is a polynomial ring, is the initial modulus, is a formal variable, is the degree of the polynomial; Selecting a random number distribution from a polynomial ring , noise distribution and key distribution ; Participants generate corresponding key pairs based on public parameters , use formula (2)-(3) to obtain the private key of the participant, , (2) , (3) in, For the The private keys of each participant, For the Key parameters of the private keys of each participant; Use formula (4)-(5) to obtain the public key of the participant. , (4) , (5) in, For the The public keys of the participants, For the The random parameters of the public keys of the participants, For the The noise parameter of the public key of each participant, For the The random parameters of the public keys of the participants and For the The public key value calculated from the noise parameters of the public keys of the participants; The homomorphic multiplication operation based on ciphertext uses formulas (6)-(9) to obtain the evaluation key. , (6) , (7) , (8) , (9) in, For the The evaluation keys of the participants, For the The third component of the evaluation key of each participant, For the the first component of the evaluation key of each participant, For the The second component of the evaluation key of each participant, for The modulus after multiplication, is the generator, is the first random polynomial, For the The noise parameter of the third component of the evaluation key of each participant, For the The noise parameter of the second component of the evaluation key of the participants, For the a noise parameter of the first component of the evaluation key of each participant; The homomorphic multiplication operation based on the ciphertext uses formulas (10)-(11) to obtain the relinearization key. , (10) , (11) in, For the The relinearization keys of the parties; The participants will upload the corresponding public key, participant identification and public parameters to the blockchain for evidence storage. At the same time, the blockchain defaults the participant's initial credibility value to 1.
[0009] Preferably, the server generates initial global model parameters and distributes them to participants, including: The server initializes global model parameters ; The server will initialize the global model parameters Sent to all parties involved.
[0010] Preferably, the participants use the local model to train to obtain local model parameters, perform weighted processing, and encrypt and send them to the server, including: Participants obtain initial global model parameters ; Participants randomly select local data sets and divide them into several training set groups; Participants adjust the initial global model parameters Perform gradient calculation on the training set group, obtain the corresponding gradient parameters according to the calculated loss function, and clip the gradient parameters to obtain the clipped gradient parameters , The participants obtain the clipping gradient parameters corresponding to several training set groups and average them to obtain the average clipping gradient parameters of the local model; The participants use the stochastic gradient descent method SGD to iteratively update the average clipping gradient parameters, repeatedly select local data sets for training, and obtain the required local model parameters. , The participant determines whether the current reputation value is greater than the reputation threshold value; When the current reputation value is greater than the reputation threshold, the participant uses formula (12) to weight the local model parameters. , (12) in, For the The weighted local model parameters of each participant, For the The reputation value of each participant.
[0011] The weighted local model parameters are encoded, mapped to the complex domain through FFT and quantized to obtain a quantized element set, and the plaintext polynomial is constructed based on the inverse FFT of the quantized element set. ; The participants use the public key to calculate the plaintext polynomial according to formulas (13)-(15). Encryption is performed to obtain the local ciphertext of the local model parameters. , (13) , (14) , (15) in, For the The local ciphertext of each participant, No. The first polynomial of the local ciphertext of each participant, For the The second polynomial of the local ciphertext of each participant, is a random mask polynomial, 、 is a random noise polynomial; The participants send the encrypted local ciphertext to the server; When the current reputation value is less than or equal to the reputation threshold value, the participant removes the local model parameters without performing weighting processing.
[0012] Preferably, the server obtains a key combination to verify and screen the participants, and obtains the ciphertext of the corresponding local model parameters, including: The server obtains the key combination of each participant, which includes the participant's public key, the participant's identifier, and the participant's reputation value; The server verifies and screens the participants based on their reputation values; The server determines whether any participant is offline; In the case that no participant is offline, the server obtains the local ciphertext of the local model parameters encrypted and sent by the qualified participant; In the case where a participant is offline, the server generates compensated local model parameters based on the offline participant and encrypts them to generate compensated ciphertext, and obtains the local ciphertexts of the local model parameters encrypted and sent by the remaining qualified participants.
[0013] Preferably, the server homomorphically aggregates the ciphertexts of all local model parameters obtained to obtain new global model parameters and new reputation values corresponding to each participant after aggregation and encryption using a multi-key homomorphic encryption algorithm, including: The server uses formula (16) to expand the local ciphertext of a single participant into a local ciphertext in a multi-key format. , (16) in, For the The local ciphertext of each participant in the multi-key format, For the The public component of the 0th position of the local ciphertext of each participant, For the The private key component of the first position of the local ciphertext of each participant, is the number of participants; The joint key is constructed based on the local ciphertext in the extended multi-key format of all participants using formula (17). , (17) in, is the joint key, For the The master private key of each participant; The server uses formula (18) to obtain the encrypted cosine similarity of the local ciphertext between the participant and the rest of the participants, , (18) in, For the Participants and The encrypted cosine similarity of the local ciphertexts between the participants, For the Participants and The encrypted dot product of the local ciphertexts between the participants, For the Participants and The encrypted inverse norm of the local ciphertext between the participants; The server uses the relinearization key to perform relinearization and dimension compression on the encrypted cosine similarity, and distributes the processed encrypted cosine similarity ciphertext to the corresponding participants in the calculation, and uses threshold decryption to restore the plaintext similarity. Based on the plaintext similarity, the server uses formula (19) to define and obtain the original reputation value of the participant. , (19) in, For the The original reputation value of each participant, For the Participants and The similarity of plaintext between participants; Formula (20) is used to obtain the final required credibility value for the original credibility value of the participants and distribute it to the corresponding participants. , (20) in, is the final required reputation value; The server uses formula (21) to obtain the global ciphertext of the global model parameters based on the local ciphertext of the local model parameters of each participant. ,(twenty one) in, is the global ciphertext of the global model parameters; The server uses formula (22) to convert the global ciphertext of the global model parameters into the public key global ciphertext of the global model parameters encrypted with the public key corresponding to each participant. , and send all public key global ciphertexts to all participants, ,(twenty one) in, is the global ciphertext of the global model parameters, is the global ciphertext of the public key of the first participant, For the The global ciphertext of the public key of each participant.
[0014] Preferably, each participant uses the corresponding private key to decrypt the encrypted new global model parameters, obtain the new global model parameters, retrain to obtain and update the local model parameters, and upload the new reputation value to the blockchain for evidence storage, including: Each participant uses the corresponding public key to decrypt the corresponding public key global ciphertext to obtain the global ciphertext of the global model parameters. The global ciphertext includes the local ciphertext aggregation in the multi-key format. Each participant uses the master private key to obtain the secret fragment according to the formula (22)-(23) in the multi-key format. ,(twenty two) ,(twenty three) in, It is a local ciphertext aggregation in multi-key format. is the sum of the components at position 0 of the local ciphertext of all participants in the multi-key format, is the sum of the first position of the local ciphertext of all participants in the multi-key format, The first ciphertext of the local ciphertext in the multi-key format for all participants The sum of the position components, For the The corresponding secret fragments obtained by each participant, The local ciphertext in multi-key format The sum of the position components, For the The master private key of each participant corresponds to the local ciphertext in multi-key format. The master private key component of the location; The server obtains all secret fragments and uses formula (24) to obtain the intermediate plaintext of the local ciphertext aggregation ,(twenty four) in, The intermediate plaintext of the local ciphertext aggregation; The server processes the intermediate plaintext to obtain the encoded plaintext, and obtains the required global model parameters according to formulas (25)-(26). , (25) , (26) in, is the encoded plaintext, are global model parameters; Each participant re-trains based on the new global model parameters to obtain new local model parameters, and the new reputation values are uploaded to the blockchain for storage.
[0015] Preferably, in the case where there is a participant in the offline state, the server generates compensated local model parameters based on the offline participant and encrypts to generate compensated ciphertext, and obtains the local ciphertext of the local model parameters encrypted and sent by the remaining qualified participants, including: The server obtains the reputation value and the local model parameters of the offline participant in the last round of update from the blockchain; According to the reputation value and the local model parameters in the last round of update, the final compensated local model parameters are obtained by using formulas (27)-(28), , (27) , (27) Wherein, is the original compensated local model parameters of the offline participant in the first round, the local model parameters of the offline participant in the first round, is a scaling factor, is the reputation value of the offline participant in the first round, is the global model parameters in the first round, is the final compensated local model parameters of the offline participant in the first round; The compensated local model parameters are encrypted to generate compensated ciphertext, and the local ciphertext of the local model parameters encrypted and sent by the remaining qualified participants is obtained.
[0016] By the technical scheme, the data protection method facilitates collaborative training of various platforms by constructing a federated learning framework, the server generates corresponding parameters and uploads them to the blockchain, the participants obtain the parameters from the blockchain, generate and upload corresponding key combinations to the blockchain for storage, ensuring the information unforgeability and transparency, the participants train based on the global model parameters to obtain initial local model parameters, a reputation value threshold is set, the participants ensure that the qualified reputation value is subjected to weighted processing of the local model parameters to obtain final local model parameters for encryption, ensuring the data security and system transparency; the participants send the encrypted local model parameters to the server, the server performs multi-key homomorphic aggregation based on the encrypted local model parameters, and dynamically adjusts the new reputation value of the participants according to the cosine similarity between the participants, establishes a trusted dynamic evaluation mechanism, effectively avoids the influence of malicious participants on model training, and improves the fairness and accuracy of the model; the server extends and aggregates the ciphertext of the local model parameters, performs key switching on the aggregated multi-key ciphertext, facilitates the participants to obtain the aggregated multi-key ciphertext by using the corresponding public key, and the participants obtain new global model parameters by using the corresponding master private key based on the aggregated multi-key ciphertext, so that the participants can train based on the new global model parameters to obtain new local model parameters, to realize continuous circulation of data, improve the security, avoid the problem of unauthorized access or tampering of data by a third party, and greatly enhance the anti-attack ability of the system and the effect of data privacy protection. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 is a flow chart of a data protection method based on multi-key homomorphic encryption and blockchain reputation weight according to an embodiment of the application. DETAILED DESCRIPTION
[0018] The specific embodiments of the embodiments of the application will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to illustrate and explain the embodiments of the application, and are not used to limit the embodiments of the application.
[0019] As Figure 1 is a flow chart of a data protection method based on multi-key homomorphic encryption and blockchain reputation weight according to an embodiment of the application. In Figure 1 , the data protection method can include: In step S10, a federated learning framework is constructed; In step S11, the server generates security parameters and public parameters by using a parameter generation method, and uploads them to the blockchain; In step S12, the participants obtain the security parameters and public parameters to generate corresponding key combinations, and upload them to the blockchain for storage; In step S13, the server generates initial global model parameters and distributes them to the participants; In step S14, the participants train local model parameters according to the global model parameters, and send them to the server after weighting and encryption; In step S15, the server obtains the key combination to check and screen the participants, and obtains the ciphertext of the corresponding local model parameters; In step S16, the server homomorphically aggregates all the ciphertexts of the local model parameters to obtain the new global model parameters aggregated and encrypted by the multi-key homomorphic encryption algorithm and the new reputation values of the participants; In step S17, each participant decrypts the encrypted new global model parameters using the corresponding private key, obtains the new global model parameters, re-trains to obtain and update the local model parameters, and uploads the new reputation values to the blockchain for storage.
[0020] In the method as shown in Figure 1 Step S10 can be used to build a federated learning framework by the server, the participants and the blockchain for transmitting information between each two of them.
[0021] Step S11 generates initial multi-key homomorphic encryption security parameters and public parameters by the server using a parameter generation method, and uploads them to the blockchain.
[0022] Step S12 generates the corresponding key combination by the participants using the security parameters and public parameters, uploads the public key, participant identifier and initial reputation value to the blockchain for storage.
[0023] Step S13 generates initial global model parameters by the server and sends them to the participants for training; Step S14 trains the local model parameters by the participants according to the global model parameters, and performs weighting processing according to the initial reputation value, and sends them to the server after encryption according to the public key of the participant; Step S15 checks and screens the participants by the server using the key combination obtained from the blockchain, ensures that only the participants with reputation values meeting the standards can upload the local model ciphertext, and obtains the ciphertext of the corresponding local model parameters.
[0024] Step S16 generates the local model parameter ciphertext in the multi-key format by the server by extending all the local model parameter ciphertexts, thereby performing homomorphic aggregation to obtain the ciphertext of the aggregated global model parameters, performing key conversion based on the ciphertext of the aggregated global model parameters to generate the ciphertext of the global model parameters based on public key encryption, and calculating the reputation values based on the cosine similarity between the participants to obtain the new reputation values of the participants.
[0025] Step S17 obtains the ciphertext of the global model parameter by each participant using the corresponding public key to decrypt the ciphertext of the public key encrypted global model parameter, and uses the corresponding private key to threshold decrypt the ciphertext of the encrypted new global model parameter to obtain the corresponding secret fragment, obtains the new global model parameter after decryption and scaling, re-trains to obtain and update the local model parameter, and uploads the new reputation value to the blockchain for storage.
[0026] The data protection method constructs a federated learning framework, the server generates security parameters and public parameters, and uploads them to the blockchain, the participants obtain the security parameters and public parameters to generate corresponding key combinations, and upload them to the blockchain for storage, the server distributes the initial global model parameters to the participants, the participants encrypt and send the ciphertext of the local model parameter to the server according to the global model parameters and weighted processing; the server checks and filters the participants to obtain the ciphertext of the corresponding local model parameter, and homomorphically aggregates all the ciphertexts of the local model parameters to obtain the new global model parameter aggregated and encrypted by the multi-key homomorphic encryption algorithm and the new reputation value corresponding to each participant; if there is a participant who drops out, the server generates a compensatory local model parameter by using the corresponding historical reputation value and the local model parameter, and then encrypts it, so as to subsequently aggregate the ciphertexts of the local model parameters of all participants in the same round, realize sound compensation and recovery, and ensure that the server has robustness and fairness; each participant uses the corresponding private key to decrypt the encrypted new global model parameter to obtain the new global model parameter, re-trains to obtain and update the local model parameter, and uploads the new reputation value to the blockchain for storage, the decentralized blockchain network and the multi-key homomorphic encryption protection ensure the fairness and transparency of the data processing of multiple participants, avoid the problem of unauthorized access or tampering of data by a third party, and greatly enhance the anti-attack ability of the system and the effect of data privacy protection.
[0027] Considering the construction of trusted information transmission between the server, the participants and the blockchain, the required federated learning framework is constructed, in an embodiment of the present application, the federated learning framework is constructed, including building trusted transmission channels between the server, the participants and the blockchain, wherein the trusted transmission channel between the server and the participants is used for the initial global model parameters and the local model parameters and the ciphertext, the trusted transmission channel between the participants and the blockchain, and the trusted transmission channel between the server and the blockchain are used for transmitting public keys and reputation values. Under the whole trusted transmission channel, the transmission of information is convenient for the protection of the ciphertext in the subsequent, and the data confidentiality is ensured.
[0028] Considering the generation of the required key combination and uploading to the blockchain for storage; in an embodiment of the present application, the participants obtain the security parameters and public parameters to generate corresponding key combinations, and upload them to the blockchain for storage, including the following steps: Based on the common parameters, the polynomial ring is constructed using formula (1). , (1) in, is a polynomial ring, is the initial modulus, is a formal variable, is the degree of the polynomial; Selecting a random number distribution from a polynomial ring , noise distribution and key distribution ; Participants generate corresponding key pairs based on public parameters , use formula (2)-(3) to obtain the private key of the participant, , (2) , (3) in, For the The private keys of each participant, For the Key parameters of the private keys of each participant; Use formula (4)-(5) to obtain the public key of the participant. , (4) , (5) in, For the The public keys of the participants, For the The random parameters of the public keys of the participants, For the The noise parameter of the public key of each participant, For the The random parameters of the public keys of the participants and For the The public key value calculated from the noise parameters of the public keys of the participants; The homomorphic multiplication operation based on ciphertext uses formulas (6)-(9) to obtain the evaluation key. , (6) , (7) , (8) , (9) in, For the The evaluation keys of the participants, For the The third component of the evaluation key of each participant, For the the first component of the evaluation key of each participant, For the The second component of the evaluation key of each participant, for The modulus after multiplication, is the generator, is the first random polynomial, For the The noise parameter of the third component of the evaluation key of each participant, For the The noise parameter of the second component of the evaluation key of the participants, For the a noise parameter of the first component of the evaluation key of each participant; The homomorphic multiplication operation based on the ciphertext uses formulas (10)-(11) to obtain the relinearization key. , (10) , (11) in, For the The relinearization keys of the parties; The participants upload the corresponding public key, participant identification, and public parameters to the blockchain for evidence storage. At the same time, the blockchain defaults the participant's initial reputation value to 1. By using security parameters, the participants generate their own exclusive key combination, which facilitates the subsequent protection of the server's information on the participants.
[0029] Considering that the participants need to input unified parameters when conducting the first model training to ensure global consistency during training and strengthen collaborative training; in one embodiment of the present invention, the server generates the initial global model parameters and distributes them to the participants, which may include the following steps: The server initializes the global model parameters , the server will initialize the global model parameters Sent to all parties involved.
[0030] In order to realize the generation of local model parameters of the participants, in one embodiment of the present invention, Participants use the local model to train and obtain local model parameters, perform weighted processing, and encrypt and send them to the server. The following steps may be included: In step S200, the participants obtain the initial global model parameters ; In step S201, the participant randomly selects a local data set and divides it into several training set groups; In step S202, the participants adjust the initial global model parameters Perform gradient calculation on the training set group, obtain the corresponding gradient parameters according to the calculated loss function, and clip the gradient parameters to obtain the clipped gradient parameters , In step S203, the participant obtains the clipping gradient parameters corresponding to several training set groups and averages them to obtain the average clipping gradient parameter of the local model; In step S204, the participants use the stochastic gradient descent method SGD to iteratively update the average clipping gradient parameters, repeatedly select the local data set for training, and obtain the required local model parameters. , In step S205, the participant determines whether the current credibility value is greater than the credibility threshold value; In step S206, when the current reputation value is greater than the reputation threshold value, the participant uses formula (12) to perform weighted processing on the local model parameters. , (12) in, For the The weighted local model parameters of each participant, For the The reputation value of each participant.
[0031] In step S207, the weighted local model parameters are encoded, mapped to the complex domain by FFT and quantized to obtain a quantized element set, and an inverse FFT is performed based on the quantized element set to construct a plaintext polynomial. ; In step S208, the participants use the public key to encrypt the plaintext polynomial according to formulas (13)-(15). Encryption is performed to obtain the local ciphertext of the local model parameters. , (13) , (14) , (15) in, For the The local ciphertext of each participant, No. The first polynomial of the local ciphertext of each participant, For the The second polynomial of the local ciphertext of each participant, is a random mask polynomial, , is a random noise polynomial; In step S209, the participant sends the encrypted local ciphertext to the server; In step S210, in the case that the current reputation value is less than or equal to the reputation threshold value, the participant performs the elimination processing on the local model parameter and does not perform the weighting processing.
[0032] The participant obtains the required final local model parameter by performing gradient calculation on the initial global model parameter given by the server and the local training set group and then using the stochastic gradient descent method to perform update iteration, sets the reputation threshold value to screen different participants, ensures that only the high-trust participant can perform the processing, avoids the influence of malicious participants on the training, and constructs the local ciphertext of the local model parameter to facilitate subsequent aggregation processing.
[0033] Considering that the participant in the offline state cannot perform the uploading of the local model parameter, compensation and recovery can be performed, the screening of the participants is met, and in an embodiment of the present application, the server obtains the key combination to check and screen the participants, and obtains the ciphertext of the corresponding local model parameter, which can include the following steps: The server obtains the key combination of each participant, and the key combination includes the public key of the participant, the identifier of the participant, and the reputation value of the participant; The server checks and screens the participants based on the reputation value of the participant; The server determines whether there is a participant in the offline state; In the case that there is no participant in the offline state, the server obtains the local ciphertext of the local model parameter encrypted and sent by the qualified participant; In the case that there is a participant in the offline state, the server generates a compensation local model parameter based on the participant in the offline state and performs encryption to generate a compensation ciphertext, and obtains the local ciphertext of the local model parameter encrypted and sent by the remaining qualified participant.
[0034] By verifying the identifier of the participant and the reputation value of the participant, the ciphertext of the corresponding local model parameter is obtained, and meanwhile, considering that the participant in the offline state cannot perform the uploading of the parameter, the previous local model parameter and the reputation value of the participant in the offline state are adjusted, a compensation local model parameter is generated and encrypted to generate a compensation ciphertext.
[0035] In order to realize the multi-key homomorphic aggregation and dynamically adjust the reputation value of the participant, in an embodiment of the present application, the server performs homomorphic aggregation on all the ciphertexts of the local model parameters obtained to obtain new global model parameters and new reputation values corresponding to each participant after being aggregated and encrypted by the multi-key homomorphic encryption algorithm, which can include the following steps: In step S30, the server uses formula (16) to expand the local ciphertext of a single participant into a local ciphertext in a multi-key format. , (16) in, For the The local ciphertext in multi-key format of each participant, For the The public component of the 0th position of the local ciphertext of each participant, For the The private key component of the first position of the local ciphertext of each participant, is the number of participants; In step S31, the joint key is constructed using formula (17) based on the local ciphertext in the extended multi-key format of all participants. , (17) in, is the joint key, For the The master private key of each participant; In step S32, the server uses formula (18) to obtain the encrypted cosine similarity of the local ciphertext between the participant and the rest of the participants, , (18) in, For the Participants and The encrypted cosine similarity of the local ciphertexts between the participants, For the Participants and The encrypted dot product of the local ciphertexts between the participants, For the Participants and The encrypted inverse norm of the local ciphertext between the participants; In step S33, the server uses the relinearization key to perform relinearization and dimension compression on the encrypted cosine similarity, and distributes the processed encrypted cosine similarity ciphertext to the corresponding participants in the calculation, and uses threshold decryption to restore the plaintext similarity. Based on the plaintext similarity, the server uses formula (19) to define and obtain the original reputation value of the participant. , (19) in, For the The original reputation value of each participant, For the Participants and The similarity of plaintext between participants; In step S34, the original reputation value of the participant is used to obtain the final required reputation value using formula (20) and distributed to the corresponding participant. , (20) in, is the final required reputation value; The server uses formula (21) to obtain the global ciphertext of the global model parameters based on the local ciphertext of the local model parameters of each participant. ,(twenty one) in, is the global ciphertext of the global model parameters; In step S35, the server uses formula (22) to convert the global ciphertext of the global model parameters into the public key global ciphertext of the global model parameters encrypted with the public key corresponding to each participant. , and send all public key global ciphertexts to all participants, ,(twenty one) in, is the global ciphertext of the global model parameters, is the global ciphertext of the public key of the first participant, For the The global ciphertext of the public key of each participant.
[0036] The server can generate local ciphertexts that are convenient for homomorphic aggregation by expanding the local ciphertexts of individual participants in a multi-key format, generate a master private key that is convenient for participants to decrypt based on the expanded local ciphertexts, and at the same time calculate the encrypted cosine similarity based on the expanded local ciphertexts between the participants, relinearize and dimensionally compress the encrypted cosine similarity, perform threshold decryption on the ciphertext of the encrypted cosine similarity to obtain the plaintext similarity, and perform normalization based on the plaintext similarity to obtain the updated reputation value of the participant; at the same time, obtain the global ciphertext of the global model parameters based on the homomorphic aggregation of the local ciphertexts in the expanded multi-key format, and use the key conversion method for the global ciphertext of the global model parameters to obtain the public key global ciphertext encrypted by the public key of the participant, so as to facilitate the participants to obtain the global model parameters separately.
[0037] In order to obtain the encrypted global model parameters and facilitate the participants to retrain the local model parameters, in one embodiment of the present invention, each participant uses the corresponding private key to decrypt the encrypted new global model parameters, obtain the new global model parameters, retrain to obtain and update the local model parameters, and upload the new reputation value to the blockchain for evidence storage, which may include the following steps: Each participant uses the corresponding public key to decrypt the corresponding public key global ciphertext to obtain the global ciphertext of the global model parameters. The global ciphertext includes the local ciphertext aggregation in the multi-key format. Each participant uses the master private key to obtain the secret fragment according to the formula (22)-(23) in the multi-key format. ,(twenty two) ,(twenty three) in, It is a local ciphertext aggregation in multi-key format. is the sum of the components at position 0 of the local ciphertext of all participants in the multi-key format, is the sum of the first position of the local ciphertext of all participants in the multi-key format, The first ciphertext of the local ciphertext in the multi-key format for all participants The sum of the position components, For the The corresponding secret fragments obtained by each participant, The first ciphertext of the local ciphertext in multi-key format The sum of the position components, For the The master private key of each participant corresponds to the local ciphertext in multi-key format. The master private key component of the location; The server obtains all secret fragments and uses formula (24) to obtain the intermediate plaintext of the local ciphertext aggregation ,(twenty four) in, The intermediate plaintext of the local ciphertext aggregation; The server processes the intermediate plaintext to obtain the encoded plaintext, and obtains the required global model parameters according to formulas (25)-(26). , (25) , (26) in, is the encoded plaintext, is the global model parameter; Each participant retrains based on the new global model parameters to obtain new local model parameters, and the new reputation value is uploaded to the blockchain for evidence storage.
[0038] The participants use the public key to decrypt and obtain the global ciphertext of the global model parameters, and use the master private key to obtain the secret fragments. The server decrypts the local ciphertext based on the obtained secret fragments to obtain the final global model parameters. At the same time, the participants adjust the required new local model parameters according to the new global model parameters and upload the corresponding reputation value to the blockchain for evidence storage.
[0039] In consideration of the credibility of the generated compensated local model parameters, the compensated local model parameters are used in cooperation with the remaining local model parameters; in an embodiment of the application, in the case where there is a participant in the offline state, the server generates compensated local model parameters based on the offline participant and generates compensated ciphertext by encryption, and obtains the local ciphertext of the local model parameters encrypted and sent by the remaining qualified participants, which can include the following steps: The server obtains the reputation value and the local model parameters of the last round of update of the offline participant from the blockchain; According to the reputation value and the local model parameters of the last round of update, the final compensated local model parameters are obtained by using formulas (27)-(28), , (27) , (27) Wherein, is the original compensated local model parameters of the offline participant at the first round of time, is the local model parameters of the offline participant at the first round of time, is the scaling coefficient, is the reputation value of the offline participant at the first round of time, is the global model parameters at the first round of time, is the final compensated local model parameters of the offline participant at the first round of time; The compensated local model parameters are encrypted to generate compensated ciphertext, and the local ciphertext of the local model parameters encrypted and sent by the remaining qualified participants is obtained.
[0040] The server compensates based on the qualified reputation value and the local model parameters of the last round of the offline participant, and encrypts the generated local model parameters for compensation and the local ciphertext of the local model parameters encrypted and sent by the qualified participants as the same round for subsequent processing.
[0041] Through the technical solution, the data protection method facilitates collaborative training of various platforms by constructing a federated learning framework, the server generates corresponding parameters and uploads them to the blockchain, and the participants obtain the parameters from the blockchain, generate and upload corresponding key combinations to the blockchain for storage, ensuring the non-tamperability and transparency of information, the participants train based on the global model parameters to obtain initial local model parameters, set a reputation value threshold, and the participants ensure that the qualified reputation value is subjected to weighted processing of the local model parameters to obtain the final local model parameters for encryption, ensuring the security of the data and the transparency of the system; the participants send the encrypted local model parameters to the server, the server performs multi-key homomorphic aggregation based on the encrypted local model parameters, and dynamically adjusts the new reputation value of the participants according to the cosine similarity between the participants, establishes a trusted dynamic evaluation mechanism, effectively avoids the influence of malicious participants on model training, and improves the fairness and accuracy of the model; the server extends and aggregates the ciphertext of the local model parameters, performs key switching on the aggregated multi-key ciphertext, facilitates the participants to obtain the aggregated multi-key ciphertext by using the corresponding public key, and the participants obtain new global model parameters based on the aggregated multi-key ciphertext by using the corresponding master private key, so that the participants can train based on the new global model parameters to obtain new local model parameters, to realize the continuous circulation of data, improve the security, avoid the problem of unauthorized access or tampering of data by a third party, and greatly enhance the anti-attack ability of the system and the effect of data privacy protection.
[0042] The preferred embodiments of the present application are described in detail above in combination with the drawings, but the present application is not limited to the specific details in the above-described embodiments, and various simple modifications can be made to the technical solutions of the present application within the technical concept of the present application, and these simple modifications all belong to the protection scope of the present application. In addition, it should be noted that various specific technical features described in the above-described specific embodiments can be combined in any appropriate manner without contradiction, and in order to avoid unnecessary repetition, the present application will not further describe various possible combination manners.
[0043] In addition, various different embodiments of the present application can also be combined in any appropriate manner, as long as they do not deviate from the idea of the present application, and they should also be considered as disclosed by the present application.
Claims
1. A data protection method based on multi-key homomorphic encryption and blockchain reputation weight, characterized in that: The data protection method includes: Build a federated learning framework; The server uses the parameter generation method to generate security parameters and public parameters and uploads them to the blockchain; The participants obtain security parameters and public parameters to generate corresponding key combinations and upload them to the blockchain for evidence storage; The server generates initial global model parameters and distributes them to participants; Participants train the global model parameters to obtain local model parameters, perform weighted processing, and encrypt and send them to the server; The server obtains the key combination to verify and screen the participants, and obtains the ciphertext of the corresponding local model parameters; The server homomorphically aggregates the ciphertexts of all local model parameters it has obtained to obtain new global model parameters and the new reputation values corresponding to each participant after aggregation and encryption using a multi-key homomorphic encryption algorithm. Each participant uses the corresponding private key to decrypt the encrypted new global model parameters, obtain the new global model parameters, retrain to obtain and update the local model parameters, and upload the new reputation value to the blockchain for evidence storage.
2. The data protection method according to claim 1, wherein: Constructing a federated learning framework includes establishing trusted transmission channels between servers, participants, and blockchains. The trusted transmission channel between the server and participants is used for the initial global model parameters, local model parameters, and ciphertext. The trusted transmission channel between participants and blockchains, and the trusted transmission channel between servers and blockchains are used to transmit public keys and reputation values.
3. The data protection method according to claim 1, wherein: Participants obtain security parameters and public parameters to generate corresponding key combinations and upload them to the blockchain for evidence storage, including: Based on the common parameters, the polynomial ring is constructed using formula (1). ,(1) in, is a polynomial ring, is the initial modulus, is a formal variable, is the degree of the polynomial; Selecting a random number distribution from a polynomial ring , noise distribution and key distribution ; Participants generate corresponding key pairs based on public parameters , use formula (2)-(3) to obtain the private key of the participant, ,(2) ,(3) in, For the The private keys of each participant, For the Key parameters of the private keys of each participant; Use formula (4)-(5) to obtain the public key of the participant. ,(4) ,(5) in, For the The public keys of the participants, For the The random parameters of the public keys of the participants, For the The noise parameter of the public key of each participant, For the The random parameters of the public keys of the participants and For the The public key value calculated from the noise parameters of the public keys of the participants; The homomorphic multiplication operation based on ciphertext uses formulas (6)-(9) to obtain the evaluation key. ,(6) ,(7) ,(8) ,(9) in, For the The evaluation keys of the participants, For the The third component of the evaluation key of each participant, For the the first component of the evaluation key of each participant, For the the second component of the evaluation key of each participant, for The modulus after multiplication, is the generator, is the first random polynomial, For the The noise parameter of the third component of the evaluation key of each participant, For the The noise parameter of the second component of the evaluation key of the participants, For the a noise parameter of the first component of the evaluation key of each participant; The homomorphic multiplication operation based on the ciphertext uses formulas (10)-(11) to obtain the relinearization key. ,(10) ,(11) in, For the The relinearization keys of the parties; The participants will upload the corresponding public key, participant identification and public parameters to the blockchain for evidence storage. At the same time, the blockchain defaults the participant's initial credibility value to 1.
4. The data protection method according to claim 1, wherein: The server generates initial global model parameters and distributes them to participants, including: The server initializes global model parameters ; The server will initialize the global model parameters Sent to all parties involved.
5. The data protection method according to claim 1, wherein: Participants use local models for training to obtain local model parameters, perform weighted processing, and encrypt and send them to the server, including: Participants obtain initial global model parameters ; Participants randomly select local data sets and divide them into several training set groups; Participants adjust the initial global model parameters Perform gradient calculation on the training set group, obtain the corresponding gradient parameters according to the calculated loss function, and clip the gradient parameters to obtain the clipped gradient parameters , The participants obtain the clipping gradient parameters corresponding to several training set groups and average them to obtain the average clipping gradient parameters of the local model; The participants use the stochastic gradient descent method SGD to iteratively update the average clipping gradient parameters, repeatedly select local data sets for training, and obtain the required local model parameters. , The participant determines whether the current reputation value is greater than the reputation threshold value; When the current reputation value is greater than the reputation threshold, the participant uses formula (12) to weight the local model parameters. ,(12) in, For the The weighted local model parameters of each participant, For the The reputation value of each participant; The weighted local model parameters are encoded, mapped to the complex domain through FFT and quantized to obtain a quantized element set, and the plaintext polynomial is constructed based on the inverse FFT of the quantized element set. ; The participants use the public key to calculate the plaintext polynomial according to formulas (13)-(15). Encryption is performed to obtain the local ciphertext of the local model parameters. ,(13) ,(14) ,(15) in, For the The local ciphertext of each participant, No. The first polynomial of the local ciphertext of each participant, For the The second polynomial of the local ciphertext of each participant, is a random mask polynomial, 、 is a random noise polynomial; The participants send the encrypted local ciphertext to the server; When the current reputation value is less than or equal to the reputation threshold value, the participant removes the local model parameters without performing weighting processing.
6. The data protection method according to claim 1, wherein: The server obtains the key combination to verify and screen the participants, and obtains the corresponding ciphertext of the local model parameters, including: The server obtains the key combination of each participant, which includes the participant's public key, the participant's identifier, and the participant's reputation value; The server verifies and screens the participants based on their reputation values; The server determines whether any participant is offline; In the case that no participant is offline, the server obtains the local ciphertext of the local model parameters encrypted and sent by the qualified participant; In the case where a participant is offline, the server generates compensated local model parameters based on the offline participant and encrypts them to generate compensated ciphertext, and obtains the local ciphertexts of the local model parameters encrypted and sent by the remaining qualified participants.
7. The data protection method according to claim 1, wherein: The server homomorphically aggregates the ciphertexts of all local model parameters it has obtained to obtain new global model parameters and the corresponding new reputation values of each participant, which are aggregated and encrypted using a multi-key homomorphic encryption algorithm. These values include: The server uses formula (16) to expand the local ciphertext of a single participant into a local ciphertext in a multi-key format. ,(16) in, For the The local ciphertext in multi-key format of each participant, For the The public component of the 0th position of the local ciphertext of each participant, For the The private key component of the first position of the local ciphertext of each participant, is the number of participants; The joint key is constructed based on the local ciphertext in the extended multi-key format of all participants using formula (17). ,(17) in, is the joint key, For the The master private key of each participant; The server uses formula (18) to obtain the encrypted cosine similarity of the local ciphertext between the participant and the rest of the participants, ,(18) in, For the Participants and The encrypted cosine similarity of the local ciphertexts between the participants, For the Participants and The encrypted dot product of the local ciphertexts between the participants, For the Participants and The encrypted inverse norm of the local ciphertext between the participants; The server uses the relinearization key to perform relinearization and dimension compression on the encrypted cosine similarity, and distributes the processed encrypted cosine similarity ciphertext to the corresponding participants in the calculation, and uses threshold decryption to restore the plaintext similarity. Based on the plaintext similarity, the server uses formula (19) to define and obtain the original reputation value of the participant. ,(19) in, For the The original reputation value of each participant, For the Participants and The similarity of plaintext between participants; Formula (20) is used to obtain the final required credibility value for the original credibility value of the participants and distribute it to the corresponding participants. ,(20) in, is the final required reputation value; The server uses formula (21) to obtain the global ciphertext of the global model parameters based on the local ciphertext of the local model parameters of each participant. ,(21) in, is the global ciphertext of the global model parameters; The server uses formula (22) to convert the global ciphertext of the global model parameters into the public key global ciphertext of the global model parameters encrypted with the public key corresponding to each participant. , and send all public key global ciphertexts to all participants, ,(21) in, is the global ciphertext of the global model parameters, is the global ciphertext of the public key of the first participant, For the The global ciphertext of the public key of each participant.
8. The data protection method according to claim 7, characterized in that: Each participant uses the corresponding private key to decrypt the encrypted new global model parameters, obtain the new global model parameters, retrain to obtain and update the local model parameters, and upload the new reputation value to the blockchain for evidence storage, including: Each participant uses the corresponding public key to decrypt the corresponding public key global ciphertext to obtain the global ciphertext of the global model parameters. The global ciphertext includes the local ciphertext aggregation in the multi-key format. Each participant uses the master private key to obtain the secret fragment according to the formula (22)-(23) in the multi-key format. ,(22) ,(23) in, It is a local ciphertext aggregation in multi-key format. is the sum of the components at position 0 of the local ciphertext of all participants in the multi-key format, is the sum of the first position of the local ciphertext of all participants in the multi-key format, The first ciphertext of the local ciphertext in the multi-key format for all participants The sum of the position components, For the The corresponding secret fragments obtained by each participant, The local ciphertext in multi-key format The sum of the position components, For the The master private key of each participant corresponds to the local ciphertext in multi-key format. The master private key component of the location; The server obtains all secret fragments and uses formula (24) to obtain the intermediate plaintext of the local ciphertext aggregation ,(24) in, The intermediate plaintext of the local ciphertext aggregation; The server processes the intermediate plaintext to obtain the encoded plaintext, and obtains the required global model parameters according to formulas (25)-(26). ,(25) ,(26) in, is the encoded plaintext, is the global model parameter; Each participant retrains based on the new global model parameters to obtain new local model parameters, and the new reputation value is uploaded to the blockchain for evidence storage.
9. The data protection method according to claim 6, characterized in that: In the event that a participant is offline, the server generates compensated local model parameters based on the offline participant and encrypts them to generate compensation ciphertext, and obtains the local ciphertext of the local model parameters encrypted and sent by the remaining qualified participants, including: The server obtains the last updated reputation value and local model parameters of the offline participant from the blockchain; According to the reputation value and local model parameters updated in the last round, the final compensated local model parameters are obtained using formulas (27)-(28). ,(27) ,(27) in, For disconnected participants No. The local model parameters of the original compensation of the round time, Participants who are disconnected No. Local model parameters at round time, is the scaling factor, For disconnected participants No. Credibility during the round, For the The global model parameters of the round time, For disconnected participants No. Local model parameters for the final compensation of round time; The compensated local model parameters are encrypted to generate a compensation ciphertext, and the local ciphertexts of the local model parameters encrypted and sent by the remaining qualified participants are obtained.