def sign(self, publicKey, privateKey):
     flat = binaryXML.serialize(self.__data, format=1)
     flatArray = array.array("B")
     flatArray.extend(flat)
     data = flatArray.tostring()
     hash = md5.new(data).hexdigest()
     self.__data = [("block", [("hash", hash)], self.__data)]
     self.__signBlocks(publicKey, privateKey)
Example #2
0
	def sign(self, publicKey, privateKey):
		flat= binaryXML.serialize(self.__data, format= 1)
		flatArray= array.array('B')
		flatArray.extend(flat)
		data= flatArray.toString()
		hash= md5.new(data).hexdigest()
		signed= rsa.sign(data, privateKey)
		key= "%s08x:%08x"%(publicKey['e'], publicKey['n'])
		self.__data= [("signed",[("key",key),("md5",hash),("signature",signed)],self.__data)]
 def serialize(self):
     return binaryXML.serialize(self.__data)