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

增加secret_key构建hekit接口 #106

Closed
tarantula-leo opened this issue Nov 28, 2023 · 8 comments · Fixed by #107
Closed

增加secret_key构建hekit接口 #106

tarantula-leo opened this issue Nov 28, 2023 · 8 comments · Fixed by #107
Assignees
Labels
enhancement New feature or request

Comments

@tarantula-leo
Copy link

目前可从公钥构造destinationhekit,得到evaluator、encryptor,但在仅有sk场景下(实际使用中只会对sk/pk进行序列化,不会对hekit做序列化),无法构造hekit对密文进行解密;
可类似地提供如下接口:

setup(public_key: heu.heu.phe.SecretKey) -> heu.heu.phe.xxxHeKit
# Setup phe environment by an already generated secret key.
decryptor(self: [heu.heu.phe.xxxHeKit] → heu::lib::phe::Decryptor
# Get decryptor
@usafchn
Copy link
Member

usafchn commented Nov 28, 2023

好的,我们加一个从 sk 恢复 HeKit 的接口

@usafchn usafchn self-assigned this Nov 28, 2023
@usafchn usafchn added the enhancement New feature or request label Nov 28, 2023
@tarantula-leo
Copy link
Author

  1. 增加完成是否可以提供wheel包下载/pip更新?
  2. pk_buffer的接口在python中是否未开放:
DestinationHeKit::DestinationHeKit(std::shared_ptr<PublicKey> pk) {
  Setup(std::move(pk));
  public_key_->Visit(HE_DISPATCH(HE_SPECIAL_SETUP_BY_PK));
}

DestinationHeKit::DestinationHeKit(yacl::ByteContainerView pk_buffer) {
  auto pk = std::make_shared<PublicKey>();
  pk->Deserialize(pk_buffer);
  Setup(std::move(pk));
  public_key_->Visit(HE_DISPATCH(HE_SPECIAL_SETUP_BY_PK));
}

}  // namespace heu::lib::phe

@usafchn
Copy link
Member

usafchn commented Nov 28, 2023

  1. 增加完成是否可以提供wheel包下载/pip更新?
  2. pk_buffer的接口在python中是否未开放:
  1. 会提供
  2. Python 中直接 kit = phe.setup(pickle.loads(pk_buffer))

@tarantula-leo
Copy link
Author

DestinationHeKit::DestinationHeKit(yacl::ByteContainerView pk_buffer)
这个接口是在哪里会调用的?

@usafchn
Copy link
Member

usafchn commented Nov 28, 2023

@tarantula-leo 这个是开放给 C++ 应用的接口,如果是 Python 侧过来的请求不会用到这个接口

@usafchn
Copy link
Member

usafchn commented Nov 28, 2023

@tarantula-leo

Pip 包 https://pypi.org/project/sf-heu/0.5.0.dev20231128/

@tarantula-leo
Copy link
Author

看merge的内容,是通过pk和sk恢复Hekit,如果对于Decryptor的单独使用,是不是只需要sk就可以?是否会考虑增加一个单独的HeKit类,类似DestinationHekit供Encryptor/Evaluator使用。

@usafchn
Copy link
Member

usafchn commented Dec 11, 2023

看merge的内容,是通过pk和sk恢复Hekit,如果对于Decryptor的单独使用,是不是只需要sk就可以?是否会考虑增加一个单独的HeKit类,类似DestinationHekit供Encryptor/Evaluator使用。

这个不考虑,有些算法的 decrypt 依赖 pk 中的内容,所以 HEU 构造 Decryptor 的时候默认需要传入 pk 和 sk,上层多传一个 pk 应该不困难吧?

@usafchn usafchn closed this as completed Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants