Addressing RFCs

pull/219/head
David Núñez 2018-11-19 16:09:36 +01:00
parent 5245f50db9
commit a4977252a1
3 changed files with 15 additions and 15 deletions

View File

@ -105,7 +105,7 @@ def wrap_key(key_to_wrap: bytes,
:param password:
:return:
"""
if all((password, wrapping_key)) or not any((password, wrapping_key)):
if not(bool(password) ^ bool(wrapping_key)):
raise ValueError("Either password or wrapping_key must be passed")
wrapped_key = b''
@ -213,7 +213,7 @@ class UmbralPrivateKey:
key_bytes = self.bn_key.to_bytes()
if any((wrapping_key, password)):
if wrapping_key or password:
key_bytes = wrap_key(key_to_wrap=key_bytes,
wrapping_key=wrapping_key,
password=password,

View File

@ -30,12 +30,10 @@ from umbral.signing import Signature
from umbral.params import UmbralParameters
from umbral.curve import Curve
from constant_sorrow.constants import NO_KEY, DELEGATING_ONLY, RECEIVING_ONLY, DELEGATING_AND_RECEIVING
NO_KEY(b'\x00')
DELEGATING_ONLY(b'\x01')
RECEIVING_ONLY(b'\x02')
DELEGATING_AND_RECEIVING(b'\x03')
NO_KEY = b'\x00'
DELEGATING_ONLY = b'\x01'
RECEIVING_ONLY = b'\x02'
DELEGATING_AND_RECEIVING = b'\x03'
class KFrag(object):

View File

@ -421,13 +421,15 @@ def _decapsulate_reencrypted(receiving_privkey: UmbralPrivateKey, capsule: Capsu
dh_point = priv_key * precursor
# Combination of CFrags via Shamir's Secret Sharing reconstruction
xs = [hash_to_curvebn(precursor,
pub_key,
dh_point,
bytes(constants.X_COORDINATE),
cfrag.kfrag_id,
params=params)
for cfrag in capsule._attached_cfrags]
xs = list()
for cfrag in capsule._attached_cfrags:
x = hash_to_curvebn(precursor,
pub_key,
dh_point,
bytes(constants.X_COORDINATE),
cfrag.kfrag_id,
params=params)
xs.append(x)
e_summands, v_summands = list(), list()
for cfrag, x in zip(capsule._attached_cfrags, xs):