Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key switching on encrypted data #76

Closed
j-bo opened this issue Nov 15, 2019 · 5 comments
Closed

Key switching on encrypted data #76

j-bo opened this issue Nov 15, 2019 · 5 comments

Comments

@j-bo
Copy link

j-bo commented Nov 15, 2019

Hi,
First of all thanks for the work you've done and the quality of it's presentation 👏 .

I have the following working scenario which currently uses the SEAL library :

  • Generate pair of keys (Ppub, Ppriv)
  • Encrypt data V1 using Ppub and send it to server
  • Encrypt data V2 using Ppub and send it to server
  • Perform operations using V1 and V2 on server and return Result to client
  • Decrypt Result client side using Ppriv

I would like to know if the following scenario, which I understood should be working in theory, can be implemented using SEAL library :

  • Step 1 :
    • Generate pair of keys (P1pub, P1priv)
    • Encrypt data V1 using P1pub and send it to server along with P1pub
  • Step 2 :
    • Generate new pair of keys (P2pub, P2priv)
    • Encrypt data V2 using P2pub and send it to server along with P2pub
  • Step 3 :
    • Perform key switching on V2 to use P1pub
    • Perform operations using V1 and V2 on server to get result
    • Perform key switching on Result to use P2pub and return to client
  • Step 4 :
    • Decrypt result client side using P2priv

What I could not find in the SEAL library are the mechanisms to perform the public key switching on encrypted data.

Many thanks for your answers and help,
Jérémy

@WeiDaiWD
Copy link
Contributor

Hi Jeremy,

Your scenario can be implemented with SEAL, however, you need to write your own key switching function. In Evaluator we provided a general method switch_key_inplace that performs key switching using a KSwitchKeys. In public API we only expose relinearization and rotation that both utilize key switching. In your scenario, you would want to:

  1. generate a new key switching key that correspond to the encryption of P1priv using P2priv,
  2. create a new method (wrapper) that calls switch_key_inplace with your desired type of inputs.

A few comments on your scenario:

Perform key switching on V2 to use P1pub

This is less correct. We perform key switching on V2 to make it decryptable using P1priv.

the mechanisms to perform the public key switching on encrypted data

Keyswitching switches the private/secret key required for decryption.

  • Step 3 :
    • Perform key switching on V2 to use P1pub
    • Perform operations using V1 and V2 on server to get result
    • Perform key switching on Result to use P2pub and return to client

This whole step can be simplified as following. Generate a key switching key that corresponds to the encryption of P1priv using P2priv. Perform key switching on V1 to make it decryptable using P2priv. Perform operation on V1 and V2 and return the result to client.

@j-bo
Copy link
Author

j-bo commented Nov 18, 2019

Hi Wai,
Thanks for your answer and for the correction of my desired scenario.

@j-bo j-bo closed this as completed Nov 18, 2019
@felixpk
Copy link

felixpk commented Feb 4, 2020

Hi, I am currently researching the usability of HE-libraries.
I am particularly interested in the previously mentioned use case.
Is there any resource which could help me implement the key switching part in MS SEAL?
I appreciate any feedback and or resources that help me understand this topic.

@Shaedul
Copy link

Shaedul commented Dec 26, 2022

Hi,
@j-bo @WeiDaiWD
I am confused about key switching. Can I get an example of key switching function?
Thanks in advance

@ekampp
Copy link

ekampp commented Oct 16, 2023

For future reference, @WeiDaiWD, this is the method you're referring to, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants