コード例 #1
0
ファイル: communicator.py プロジェクト: nidzo732/FileTransfer
 def handlePreSendRequestNoCrypt(self, socket, request):
     if (request.guid in self.peers) and self.peers[request.guid].sharedPassword:
         preSendRequest = JSONToObject(PreSendRequestNoCrypt, request.data)
         if askForConfirmation(self.parent,
                               "Accept file " + preSendRequest.fileName + " from " + self.peers[
                                   request.guid].name + " over insecure connection?"):
             self.preSendRegistrationsNoCrypt[request.guid] = preSendRequest
             socket.send(RESPONSE_OK)
         else:
             socket.send(RESPONSE_REJECT)
     else:
         socket.send(RESPONSE_NOT_PAIRED)
コード例 #2
0
ファイル: communicator.py プロジェクト: nidzo732/FileTransfer
 def handlePreSendRequest(self, socket, request):
     if (request.guid in self.peers) and self.peers[request.guid].sharedPassword:
         preSendRequest = JSONToObject(PreSendRequest, request.data)
         if not preSendRequest.publicKey.verifySignature(self.peers[request.guid].sharedPassword):
             socket.send(RESPONSE_BAD_SIGNATURE)
             return
         if askForConfirmation(self.parent,
                               "Accept file " + preSendRequest.fileName + " from " + self.peers[
                                   request.guid].name + "?"):
             self.preSendRegistrations[request.guid] = preSendRequest
             socket.send(RESPONSE_OK)
         else:
             socket.send(RESPONSE_REJECT)
     else:
         socket.send(RESPONSE_NOT_PAIRED)