Sentiment Analysis On Encrypted Data Using Homomorphic Encryption

Step 1: Generate the keys

  • The private key is used to encrypt and decrypt the data and shall never be shared.
  • The evaluation key is a public key that the server needs to process encrypted data.

Step 2: Provide a message

Client Side: Enter a sensitive text message you received and would like to do sentiment analysis on (ideas: the last text message of your boss.... or lover).

Step 3: Encode the message with the private key

Step 4: Run the FHE evaluation

Server Side: The encrypted value is received by the server. Thanks to the evaluation key and to FHE, the server can compute the (encrypted) prediction directly over encrypted values. Once the computation is finished, the server returns the encrypted prediction to the client.

Step 5: Decrypt the sentiment

Client Side: The encrypted sentiment is sent back to client, who can finally decrypt it with its private key. Only the client is aware of the original tweet and the prediction.