api.py 文件源码

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

项目:nucypher-kms 作者: nucypher 项目源码 文件源码
def ecies_ephemeral_split_rekey(
        privkey_a: Union[bytes, elliptic_curve.ec_element],
        pubkey_b: Union[bytes, elliptic_curve.ec_element],
        min_shares: int,
        total_shares: int
) -> Tuple[List[umbral.RekeyFrag], Tuple[bytes, bytes]]:
    """
    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 inot `total_shares`.
    This also generates an ephemeral keypair for the recipient as `pubkey_b`.

    :param privkey_a: Privkey to re-encrypt from
    :param pubkey_b: Public key to re-encrypt for (w/ ephemeral key)
    :param min_shares: Minium shares needed to reproduce a rekey
    :param total_shares: Total shares to generate from split-rekey gen

    :return: A tuple containing a list of rekey frags, and a tuple of the
             encrypted ephemeral key data (enc_symm_key, enc_eph_privkey)
    """
    eph_privkey, (encrypted_key, encrypted_message) = _internal._ecies_gen_ephemeral_key(pubkey_b)
    kfrags = ecies_split_rekey(privkey_a, eph_privkey, min_shares, total_shares)
    pfrag = PFrag(ephemeral_data_as_bytes=None, encrypted_key=encrypted_key, encrypted_message=encrypted_message)

    return (kfrags, pfrag)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号