tiehuis / libhcs

A partially Homomorphic C library.
https://tiehuis.github.io/libhcs/
MIT License
31 stars 13 forks source link

djcs_t_share_decrypt needs private_key #6

Open robinhundt opened 3 years ago

robinhundt commented 3 years ago

Hi, we'd like to use this library to implement a secure multi party computation protocol for a paper. Looking at the source code, I stumbled over the djcs_t_share_decrypt method which needs the private key. https://github.com/tiehuis/libhcs/blob/0e1deeaca38617b7908b462747dbb80ae9f29d44/include/libhcs/djcs_t.h#L216-L228

This is in contrast to the equivalent method for the standard Paillier implementation here: https://github.com/tiehuis/libhcs/blob/0e1deeaca38617b7908b462747dbb80ae9f29d44/include/libhcs/pcs_t.h#L362-L374 which says private key in the doc string, but actually takes a public key.

I've looked at the local_ecample.c and there paillier is used with the share_decrypt method and the public key as a parameter. Intuitively this seems to be the correct way to me, since share_decrypt is intended to be used to 'partially' decrypt a ciphertext with the secret key share which the auth server holds, right?

Is my understanding of the intended functionality wrong and there is a reason why djcs_t_share_decrypt needs a private key, while for the Paillier equivalent the public key suffices?

Thanks for the library :)

robinhundt commented 3 years ago

If anyone stumbles over this: the fork at https://github.com/lemonviv/libhcs seemingly contains a fixed version of djcs. I've also started my own fork where I've mainly fixed up some of the C++ interfaces https://github.com/robinhundt/libhcs and will likely also incorporate the fix for djcs.