microsoft / SEAL

Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
https://www.microsoft.com/en-us/research/group/cryptography-research/
MIT License
3.61k stars 709 forks source link

Evaluator Issue. #547

Closed macknight closed 2 years ago

macknight commented 2 years ago
SEALContext context(parms);
print_parameters(context);
cout << endl;

KeyGenerator keygen(context);
auto secret_key = keygen.secret_key();
PublicKey public_key;
keygen.create_public_key(public_key);
RelinKeys relin_keys;
keygen.create_relin_keys(relin_keys);
GaloisKeys gal_keys;
keygen.create_galois_keys(gal_keys);
**Encryptor encryptor(context, public_key);
Evaluator evaluator(context);
Decryptor decryptor(context, secret_key);**

====above is the basic CKKS example in SEAL's code. So I have a thought, the evaluator has only one param which is the context. so would below computation run well? There are only one context object, only one evaluator object, two encryptors, two decryptors.

Context ctx = a context object;// only one context

Encryptor ept1 = Encryptor(ctx, pk1); Decryptor dpt1 = Decryptor(ctx, sk1); Ciphertext ct1 = ept1.encrypt(a);

Encryptor ept2 = Encryptor(ctx, pk2); Decryptor dpt2 = Decryptor(ctx, sk2); Ciphertext ct2 = ept2.encrypt(a);

Evaluator evt(ctx);// only one evalueator

encrypted_result = evt.multi_cipher(ct1, ct2); //ct1 is encrypted by ept1, and ct2 is encrypted by ep2. ept1 and ept2 are different encryptor, while evt is the only evaluator here, would this multi_cipher function run well?

plaindata = dpt1.decrypt(encrypted_result );// would this run well?

plaintdata' = dpt2.decrypt(encrypted_result); // would this run well?

WeiDaiWD commented 2 years ago

Ciphertext multiplication will run. Both decryption will fail.

macknight commented 2 years ago

Ciphertext multiplication will run. Both decryption will fail.

Fine.. that's the same as I guess as using different public key for encryption.

Well... is any way to do this? I mean each user has his own public key/private key, and encrypted his data, then any way for a cloud service to do HE computations over these encrypted data together, and at least the cloud service could decrypt the output result? no need for each user to decrypt.

For example, Alice and Bob and Cloud Service addition in Azure. Alice has a number 1, and pk1, the number 1 is encrypted into encrypted data a; Bob has a number 2, and pk2; the number 2 is encrypted into encrypted data b; a and b are sent to the Cloud Service addition in Azure for computing sum, and get a encrypted c, then the cloud service itself decrypt this c, and get the number 3. Could this be done in any ways? The point is Alice and Bob doesn't reveal his/her own number, while they don't care about the sum which is 3 in plaintext.

BR

WeiDaiWD commented 2 years ago

HE alone offers data privacy to the secret key owner. What you want is a 2-party secure computing protocol, which may or may not be instantiated with HE. If HE 's involvement is a must, search for multi-key or multi-party homomorphic encryption works.

macknight commented 2 years ago

great, thanks for your answer.

BR