Check that params match when setting correctness keys

pull/159/head
David Núñez 2018-05-31 14:32:04 +02:00
parent 03b4138229
commit c98f723eec
1 changed files with 4 additions and 2 deletions

View File

@ -57,8 +57,8 @@ class Capsule(object):
"Passing both is also fine.")
self._cfrag_correctness_keys = {"delegating": delegating_pubkey,
"receiving": receiving_pubkey,
"verifying": verifying_pubkey}
"receiving": receiving_pubkey,
"verifying": verifying_pubkey}
self._point_e = point_e
self._point_v = point_v
@ -132,6 +132,8 @@ class Capsule(object):
if current_key is None:
if key is None:
raise TypeError("The {} key is not set and you didn't pass one.".format(key_type))
elif self._umbral_params != key.params:
raise TypeError("You are trying to set a key with different UmbralParameters.")
else:
self._cfrag_correctness_keys[key_type] = key
return True