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)
评论列表
文章目录