Beispiel #1
0
        def sendSignedInterest(self,command):
                self.count = self.count +1
                time.sleep(self.cfg.refreshInterval)
                fullURI = self.cfg.appPrefix + command
                print fullURI
                i = Interest.Interest()
                #self.state = NameCrypto.new_state()
                #build keyLocator to append to interest for NameCrypto on upcall
                keyLoc = Key.KeyLocator(self.key)
                keyLocStr = _pyccn.dump_charbuf(keyLoc.ccn_data)
                nameAndKeyLoc = Name.Name(str(fullURI))
                #print("there are "+str(len(nameAndKeyLoc))+" components")
                nameAndKeyLoc += keyLocStr
                #print("there are "+str(len(nameAndKeyLoc))+" components after adding keyLocStr")

                #symmetric
                authName = NameCrypto.authenticate_command(self.state, nameAndKeyLoc, self.cfg.appName, self.cryptoKey)

                #asymmetric
                #authName = NameCrypto.authenticate_command_sig(self.state, nameAndKeyLoc, self.cfg.appName, self.key)

                #print authName.components


                co = self.handle.expressInterest(authName,self)
Beispiel #2
0
    def put(self, content):
        name = str(self._sequence)
        self._sequence += 1

        of = open(os.path.join(self.import_loc, name), "wb")
        of.write(_pyccn.dump_charbuf(content.ccn_data))
        of.close()

        self.handle.expressInterest(pyccn.Name(self.name + name), self, self.interest_tpl)
Beispiel #3
0
    def put(self, content):
        name = str(self._sequence)
        self._sequence += 1

        of = open(os.path.join(self.import_loc, name), "wb")
        of.write(_pyccn.dump_charbuf(content.ccn_data))
        of.close()

        self.handle.expressInterest(pyccn.Name(self.name + name), self,
                                    self.interest_tpl)
Beispiel #4
0
	def sendSignedInterest(self,command):
		fullURI = self.cfg.appPrefix + command
		print fullURI
		i = Interest.Interest()
		
		#build keyLocator to append to interest for NameCrypto on upcall
		keyLoc = Key.KeyLocator(self.key)
		keyLocStr = _pyccn.dump_charbuf(keyLoc.ccn_data)
		nameAndKeyLoc = Name.Name(str(fullURI))
		#print("there are "+str(len(nameAndKeyLoc))+" components")
		nameAndKeyLoc += keyLocStr
		#print("there are "+str(len(nameAndKeyLoc))+" components after adding keyLocStr")
		authName = NameCrypto.authenticate_command(self.state, nameAndKeyLoc, self.cfg.appName, self.cryptoKey)
		#print authName.components
		
		co = self.handle.get(authName,i,500)
		if not not co: 
			#if co is not empty,  print result for debugging
			print("interest "+str(co.content))
Beispiel #5
0
	def sendSignedInterest(self,command):
		fullURI = self.cfg.appPrefix + command
		#print fullURI
		i = Interest()
		
		#build keyLocator to append to interest for NameCrypto on upcall
		keyLoc = pyccn.KeyLocator(self.key)
		keyLocStr = _pyccn.dump_charbuf(keyLoc.ccn_data)
		nameAndKeyLoc = Name(str(fullURI))
		#print("there are "+str(len(nameAndKeyLoc))+" components")
		nameAndKeyLoc += keyLocStr
		#print("there are "+str(len(nameAndKeyLoc))+" components after adding keyLocStr")
		
		t0 = time()
		authName = NameCrypto.authenticate_command(self.state, nameAndKeyLoc, self.cfg.appName, self.cryptoKey)
		t1 = time()
		
		#print "elapsed sign", t1-t0
		#print authName.components
		
		t0 = time()
		co = self.handle.expressInterest(authName,self)
		t1 = time()
Beispiel #6
0
	def put(self, content):
		self.sock.send(_pyccn.dump_charbuf(content.ccn_data))
		self.handle.put(content)
 def put(self, content):
     self.sock.send(_pyccn.dump_charbuf(content.ccn_data))