A demonstration of Paillier homomorphic encryption for secure computations
This project serves as a basic demonstration of the capabilities of homomorphic encryption. It showcases how sensitive data can be securely processed without compromising privacy.
- Key Generation: The client is responsible for generating a Paillier key pair consisting of public and private keys. These keys are essential for encryption and decryption operations. The keys are saved to a file named 'keypair.txt'.
- Data Encryption: The client encrypts a set of input data, including
age, sex, BMI, children, smoker, and region, using the Paillier public key. The encrypted data is stored in 'encrypted_data.txt'. - Result Retrieval: The client reads the encrypted result from 'results.txt' and decrypts it using the Paillier private key.
- Data Processing: The server reads the encrypted data from 'encrypted_data.txt'.
- Computation: It performs linear regression on the encrypted data using coefficients obtained from the model. The server ensures that all computations are performed on encrypted data.
- Result Storage: The server saves the encrypted result in 'results.txt'.
- Model Training: In this example it is a simple linear regression model on the preprocessed data to obtain coefficients.
- Coefficient Retrieval: The coefficients from the model are used by the server for computation.
- The project uses an insurance dataset for linear regression. This dataset has been preprocessed to ensure compatibility with the model.
- The client decrypts the encrypted results as received from the server data using the private key and displays the regression results.
- Data Privacy: Homomorphic encryption ensures that sensitive data remains encrypted throughout the computation, preserving privacy.