Fill out _ecies_gen_ephemeral_key

pull/83/head
tuxxy 2017-10-19 01:04:02 -06:00
parent ec3f95e62f
commit fd54c6bf38
No known key found for this signature in database
GPG Key ID: 7BB971A0E89144D9
1 changed files with 8 additions and 3 deletions

View File

@ -5,12 +5,17 @@ from npre import elliptic_curve
def _ecies_gen_ephemeral_key(
recp_pubkey: Union[bytes, elliptic_curve.ec_element]
) -> Tuple[bytes, bytes]:
) -> Tuple[bytes, Tuple[bytes, bytes]]:
"""
Generates and encrypts an ephemeral key for the `recp_pubkey`.
:param recp_pubkey: Recipient's pubkey
:return: Tuple of encrypted symmetric key, and encrypted ephemeral privkey
:return: Tuple of the eph_privkey, and a tuple of the encrypted symmetric
key, and encrypted ephemeral privkey
"""
pass
symm_key, enc_symm_key = API.ecies_encapsulate(recp_pubkey)
eph_privkey = API.ecies_gen_priv()
enc_eph_privkey = API.symm_encrypt(symm_key, eph_privkey)
return (eph_privkey, (enc_symm_key, enc_eph_privkey))