示例#1
0
    def keygen(self,scheme='paillier'):
        id = str(random.randint(0,2**32))
        r = requests.get('http://'+self.host+':'+self.port+'/keygen/'+id+'/'+scheme+'/')

        pk = PublicKey.deserialize(r.content.decode())
        pk.id = id
        return pk
示例#2
0
 def keygen(self, scheme='paillier'):
     id = str(random.randint(0, 2**32))
     task_kwargs = {
         "id": id,
         "scheme": scheme,
     }
     self.task_socket.send_string(
         str({
             "task": "create_keys",
             "task_kwargs": task_kwargs
         }))
     r = self.task_socket.recv()
     pk = PublicKey.deserialize(r)
     pk.id = id
     return pk