Пример #1
0
	def getKeys(self):
		'''
		ottiene la prf, da essa estrae le chiavi KEK,KCK,TK,authenticatorMicKey,supplicantMicKey e ritorna una tupla che contiene le tre chiavi nel seguente ordine [KEK,KCK,TK,authenticatorMicKey,supplicantMicKey]
		'''
		prf = self.prf()
		kck = base_crypto_utility.left(prf,0,16)
		kek = base_crypto_utility.left(prf,16,16)
		tk = base_crypto_utility.left(prf,32,32)
		authenticatorMicKey = base_crypto_utility.left(prf,48,8)
		supplicantMicKey = base_crypto_utility.left(prf,56,8)
		return [kck,kek,tk,authenticatorMicKey,supplicantMicKey]
Пример #2
0
	def testLeft_ValoriIntermedi(self):
		'''
		test della funzione L con valori intermedi
		'''
		mex = "ciaociao"
		result = "aoci"
		leftPart = base_crypto_utility.left(mex,2,4)
		self.assertEqual(leftPart,result)
Пример #3
0
	def testLeft_PrimoByte(self):
		'''
		test della funzione L prendendo il primo byte del messaggio
		'''
		mex = "ciaociao"
		result = "c"
		leftPart = base_crypto_utility.left(mex,0,1)
		self.assertEqual(leftPart,result)		
Пример #4
0
	def testLeft_TuttoIlMessaggio(self):
		'''
		test della funzione L prendendo il messaggio intero
		'''
		mex = "ciaociao"
		result = "ciaociao"
		leftPart = base_crypto_utility.left(mex,0,len(mex))
		self.assertEqual(leftPart,result)		
Пример #5
0
	def curtailPmk(cls,pmk,start,end):
		'''
		Se la pmk è troppo lunga, la seleziona tra start e start+end
		'''
		return base_crypto_utility.left(pmk,start,end)