microsoft / SealPIR

Example implementation of the SealPIR protocol
MIT License
137 stars 53 forks source link

Cannot Decrypt #36

Closed czh-rot closed 1 month ago

czh-rot commented 1 month ago

I apologize for disturbing you again. I am doing some interesting things with your library, but I have encountered the following difficulties:

(1) Regarding the two encoding methods: A: vector message(N) --> plaintext = encoder.encode(message) --> ciphertext = encryptor.encrypt(plaintext); B: plaintext(N, 0) --> plaintext[?] = ? --> ciphertext = encryptor.encrypt(plaintext); What is the difference between these two methods? I previously observed that the multiplication of ciphertexts in method A essentially performs a vector dot product; whereas the latter seems to be the method used by SealPIR, which performs polynomial multiplication. I would really like to understand the fundamental differences between these two methods.

(2) Regarding method B, for some reason, as shown in the following code, it throws an Aborted error when it reaches decryption. image Any insights would be very helpful to me, thank you very much!

czh-rot commented 1 month ago

I've seen how Plan B works. You circumvent the iNTT inside Encode and treat the input as if it were a coefficient representation of a polynomial. However, why is it unable to perform decryption?

sga001 commented 1 month ago

Sorry I don't have much time right now to delve deeply into your question as I'm traveling. When I'm back I can take a closer look but I'll need more than just that screenshot (unless that screenshot fully reproduces the error). From quick inspection, it doesn't seem to be a question about SealPIR itself but rather a question about the SEAL homomorphic library? If so, perhaps ask in the SEAL git repo as you might be able to get a quicker answer there.

czh-rot commented 1 month ago

Thank you very much for your reply. I am not in a hurry about this question, but I am just curious why it cannot be decrypted at this time. image

czh-rot commented 1 month ago

I was busy with other things in the past, so I didn't reply in time. I've figured out what the problem is, and a mismatch between the parameter input for decrypt and pt actually causes it.