|
@@ -37,9 +37,10 @@ class RelayDescriptor:
|
|
|
signed = signingkey.sign(serialized.encode("ascii"))
|
|
|
self.descdict["sig"] = signed.signature
|
|
|
|
|
|
- def verify(self):
|
|
|
- serialized = self.__str__(False)
|
|
|
- self.descdict["idkey"].verify(serialized.encode("ascii"), self.descdict["sig"])
|
|
|
+
|
|
|
+def verify_relaydesc(desc):
|
|
|
+ serialized = desc.__str__(False)
|
|
|
+ desc.descdict["idkey"].verify(serialized.encode("ascii"), desc.descdict["sig"])
|
|
|
|
|
|
|
|
|
# A consensus is a dict containing:
|
|
@@ -81,12 +82,13 @@ class Consensus:
|
|
|
self.consdict['sigs'].extend([None] * (index+1-len(self.consdict['sigs'])))
|
|
|
self.consdict['sigs'][index] = signed.signature
|
|
|
|
|
|
- def verify(self, verifkeylist):
|
|
|
- """Use the given list of verification keys to check the
|
|
|
- signatures on the consensus."""
|
|
|
- serialized = self.__str__(False)
|
|
|
- for i, vk in enumerate(verifkeylist):
|
|
|
- vk.verify(serialized.encode("ascii"), self.consdict['sigs'][i])
|
|
|
+
|
|
|
+def verify_consensus(consensus, verifkeylist):
|
|
|
+ """Use the given list of verification keys to check the
|
|
|
+ signatures on the consensus."""
|
|
|
+ serialized = consensus.__str__(False)
|
|
|
+ for i, vk in enumerate(verifkeylist):
|
|
|
+ vk.verify(serialized.encode("ascii"), consensus.consdict['sigs'][i])
|
|
|
|
|
|
|
|
|
class DirAuthNetMsg(network.NetMsg):
|