Exemplo n.º 1
0
 def PutKey( self, rsaKey, data, updateLevel ) :
     self._initCount()
     signature = computeSignature( rsaKey, data, updateLevel )
     self.client.callPutKey( rsaKey.toDER_PublicKey(), data,
             updateLevel, signature, self.nodeAddr,
             self._onResult )
     self.reactor.run()
Exemplo n.º 2
0
 def onResult(nodes):
     obj.nodes = nodes
     obj.successCount = 0
     obj.putOps = {}
     obj.updateLevel = updateLevel + 1
     obj.signature = computeSignature(rsaKey, data, obj.updateLevel)
     for nodeAddr in obj.nodes:
         doPutKey(nodeAddr)
     op.setCanceler(cancelPuts)
     if not obj.putOps:
         doNotify()
Exemplo n.º 3
0
 def onResult( nodes ) :
     obj.nodes = nodes
     obj.successCount = 0
     obj.putOps = {}
     obj.updateLevel = updateLevel + 1
     obj.signature = computeSignature( rsaKey, data,
         obj.updateLevel )
     for nodeAddr in obj.nodes :
         doPutKey( nodeAddr )
     op.setCanceler( cancelPuts )
     if not obj.putOps :
         doNotify()
Exemplo n.º 4
0
 def onPut(putOp, err, payload):
     del obj.putOps[putOp]
     if err >= 0:
         result, oldData, oldUpdateLevel, oldSignature = payload
         if result >= 0:
             obj.successCount += 1
         elif oldUpdateLevel >= obj.updateLevel:
             if verifySignature(rsaKey, oldData, oldUpdateLevel, oldSignature):
                 obj.updateLevel = oldUpdateLevel + 1
                 cancelPuts()
                 obj.putOps.clear()
                 obj.successCount = 0
                 obj.signature = computeSignature(rsaKey, data, obj.updateLevel)
                 for nodeAddr in obj.nodes:
                     doPutKey(nodeAddr)
     if not obj.putOps:
         doNotify()
Exemplo n.º 5
0
 def onPut( putOp, err, payload ) :
     del obj.putOps[putOp]
     if err >= 0 :
         result,oldData,oldUpdateLevel,oldSignature = payload
         if result >= 0 :
             obj.successCount += 1
         elif oldUpdateLevel >= obj.updateLevel :
             if verifySignature(rsaKey,oldData,
                     oldUpdateLevel,oldSignature) :
                 obj.updateLevel = oldUpdateLevel + 1
                 cancelPuts()
                 obj.putOps.clear()
                 obj.successCount = 0
                 obj.signature = computeSignature( rsaKey, data,
                         obj.updateLevel )
                 for nodeAddr in obj.nodes :
                     doPutKey( nodeAddr )
     if not obj.putOps :
         doNotify()
Exemplo n.º 6
0
 def PutKey(self, rsaKey, data, updateLevel):
     self._initCount()
     signature = computeSignature(rsaKey, data, updateLevel)
     self.client.callPutKey(rsaKey.toDER_PublicKey(), data, updateLevel,
                            signature, self.nodeAddr, self._onResult)
     self.reactor.run()