api.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:nucypher-kms 作者: nucypher 项目源码 文件源码
def ecies_split_rekey(
        privkey_a: Union[bytes, elliptic_curve.ec_element],
        privkey_b: Union[bytes, elliptic_curve.ec_element],
        min_shares: int,
        total_shares: int
) -> List[umbral.RekeyFrag]:
    """
    Performs a split-key re-encryption key generation where a minimum
    number of shares `min_shares` are required to reproduce a rekey.
    Will split a rekey into `total_shares`.

    :param privkey_a: Privkey to re-encrypt from
    :param privkey_b: Privkey to re-encrypt to
    :param min_shares: Minimum shares needed to reproduce rekey
    :param total_shares: Total shares to generate from split-rekey gen

    :return: A list of RekeyFrags to distribute
    """
    if type(privkey_a) == bytes:
        privkey_a = priv_bytes2ec(privkey_a)
    if type(privkey_b) == bytes:
        privkey_b = priv_bytes2ec(privkey_b)
    umbral_rekeys = PRE.split_rekey(privkey_a, privkey_b,
                                    min_shares, total_shares)
    return [KFrag(umbral_kfrag=u) for u in umbral_rekeys]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号