Пример #1
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()
     self.__data = [("block", [("hash", hash)], self.__data)]
     self.__signBlocks(publicKey, privateKey)
Пример #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)]
Пример #3
0
 def serialize(self):
     return binaryXML.serialize(self.__data)