intel / pailliercryptolib

Intel Paillier Cryptosystem Library is an open-source library which provides accelerated performance of a partial homomorphic encryption (HE), named Paillier cryptosystem, by utilizing Intel® IPP-Crypto on AVX512IFMA instructions. Intel Paillier Cryptosystem Library is certified for ISO compliance.
Apache License 2.0
69 stars 18 forks source link

How to shuffle ciphertexts? #79

Open lzjluzijie opened 4 months ago

lzjluzijie commented 4 months ago

Hi, I am new to homomorphic encryption. I didn't find how to shuffle ciphertexts in this library. Is there any way to do it? Thank you.

justalittlenoob commented 4 months ago

Hi @lzjluzijie This library does not have shuffle functionality. If you want to improve ciphertext security, how about using this ?https://github.com/intel/pailliercryptolib/blob/fdc21350302117103452968ababc2f9676f0d383/ipcl/include/ipcl/pub_key.hpp#L91

lzjluzijie commented 4 months ago

What exactly is this function doing? My current use case is that Alice holds the private key and an array of ciphertext, sent the ciphertext of the array to Bob. Bob adds the an array of data to the ciphertext, shuffles the result ciphertext, and send back to Alice. So Alice and decrypt the results, but don't know what Bob's array is, since the order is changed.

justalittlenoob commented 4 months ago

In your usage scenario, the result returned by Bob cannot be decrypted. As you said, the order is changed. This library can adapt to this scenario:

lzjluzijie commented 4 months ago

Sorry I didn't explain my needs clearly. The steps you mentioned is exactly want I am doing now. However, I don't want Alice to decrypt the RES like this directly, since Alice would learn the values of B by RES-A. If Bob can shuffle CT_RES to CT_RES', Alice can still decrypt the same results RES', a permutation of RES, but in a different order, so Alice cannot compute B directly since RES'-A is meaningless.

justalittlenoob commented 4 months ago

Okay, I think I got your point. This library doesn't provide any related functions (shuffle), so you can only implement it yourself.

lzjluzijie commented 4 months ago

I see. Can you give me any hint about how to get started?