574
社区成员
发帖
与我相关
我的任务
分享PSI定义:PSI是安全多方计算中一个比较实用的协议,其允许参与方输入各自的隐私集合并联合计算集合交集,除接收方获取交集结果外不泄露额外信息。
PSI分类:

隐私PSI对功能进行分层,其协议的具体实现在SPU层,在协议实现过程中需要实用的基础密码算子在YACL层,开发者也可利用底层算子设计自己的PSI协议。SPU往上,隐语对PSI做了一个bucket的封装,主要是为了屏蔽不同协议之间的差距,使用户能够统一调用不同PSI协议。secretflow 是python封装层,通过python语法调用PSI,并指定输入文件的格式。



EC-OPRF-based

SHE-based



bucket_psi 调用参数:
message BucketPsiConfig {
//
///////////////////////////////////////
// Basic
///////////////////////////////////////
// The psi type.
PsiType psi_type = 1;
// Specified the receiver rank. Receiver can get psi result.
uint32 receiver_rank = 2;
// Whether to broadcast psi result to all parties.
bool broadcast_result = 3;
// The input parameters of psi.
InputParams input_params = 4;
// The output parameters of psi.
OutputParams output_params = 5;
///////////////////////////////////////
// Advanced
///////////////////////////////////////
// Optional, specified elliptic curve cryptography used in psi when needed.
CurveType curve_type = 6;
// Optional, specified the hash bucket size used in psi.
uint32 bucket_size = 7;
// Optional,the path of offline preprocess file.
string preprocess_path = 8;
// Optional,secret key path of ecdh_oprf, 256bit/32bytes binary file.
string ecdh_secret_key_path = 9;
// Optional,params for dp-psi
DpPsiParams dppsi_params = 10;
}
memory_psi调用参数
message MemoryPsiConfig {
//
///////////////////////////////////////
// Basic
///////////////////////////////////////
// The psi type.
PsiType psi_type = 1;
// Specified the receiver rank. Receiver can get psi result.
uint32 receiver_rank = 2;
// Whether to broadcast psi result to all parties.
bool broadcast_result = 3;
///////////////////////////////////////
// Advanced
///////////////////////////////////////
// Optional, specified elliptic curve cryptography used in psi when needed.
CurveType curve_type = 4;
// Optional,Params for dp-psi
DpPsiParams dppsi_params = 5;
}
现有隐语PSI python接口主要是通过secretflow进行调用。secretflow 有集群仿真模式和生产模式两种部署模式。
启动ray集群

初始化secretflow


初始化secretflow 主要是配置各个参与方的ip地址和监听端口。

启动SPU的link和监听端口。
reports=spu.psi(
key=select_keys, # 指定求交关键字
input_path=input_path, # 输入文件路径
output_path=output_path, # 输出文件路径
receiver='alice', # 指定接收方
# KKRT_PSI_2PC BC22_PSI_2PC ..
protocol='ECDH_PSI_2PC' # 选择具体的协议
curve_type='CURVE_25519' # 选择椭圆曲线类型
broadcast_result=False, # 是否将交集结果广播给其他参与方
)

使用secretnote动手开发PSI协议。。。。