Skip to content

Commit

Permalink
Fixes bug in Capsule.attach_cfrag that allowed to attach incorrect CFrag
Browse files Browse the repository at this point in the history
  • Loading branch information
cygnusv committed Jun 4, 2018
1 parent 48a7c86 commit 0d28fa6
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions umbral/pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,11 @@ def verify(self) -> bool:
return s * g == v + (h * e)

def attach_cfrag(self, cfrag: CapsuleFrag) -> None:
self.verify_cfrag(cfrag)
self._attached_cfrags.append(cfrag)

def verify_cfrag(self, cfrag):
return cfrag.verify_correctness(self,
self._cfrag_correctness_keys["delegating"],
self._cfrag_correctness_keys["receiving"],
self._cfrag_correctness_keys["verifying"],
)
if cfrag.verify_correctness(self):
self._attached_cfrags.append(cfrag)
else:
error_msg = "CFrag is not correct and cannot be attached to the Capsule"
raise UmbralCorrectnessError(error_msg, [cfrag])

def original_components(self) -> Tuple[Point, Point, CurveBN]:
return self._point_e, self._point_v, self._bn_sig
Expand Down

0 comments on commit 0d28fa6

Please sign in to comment.