From ab26133ff7cf0a4efa32ce4cc560b26e49351fd5 Mon Sep 17 00:00:00 2001 From: Dominik Date: Fri, 1 Aug 2014 20:29:01 +0200 Subject: [PATCH] Fix one of the SE test cases The SE API has changed so that all the old tests will need to be fixed. This is the first step in this direction. --- .../vpicc/virtualsmartcard/tests/SmartcardSAM_test.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/tests/SmartcardSAM_test.py b/virtualsmartcard/src/vpicc/virtualsmartcard/tests/SmartcardSAM_test.py index 5fa9cde..92ac21b 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/tests/SmartcardSAM_test.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/tests/SmartcardSAM_test.py @@ -26,6 +26,8 @@ class TestSmartcardSAM(unittest.TestCase): def setUp(self): self.password = "DUMMYKEYDUMMYKEY" self.myCard = SAM("1234", "1234567890") + self.secEnv = Security_Environment(None, self.myCard) #TODO: Set CRTs + self.secEnv.ht.algorithm = "SHA" def test_incorrect_pin(self): with self.assertRaises(SwError): @@ -58,9 +60,14 @@ class TestSmartcardSAM(unittest.TestCase): print ("After external authenticate: " + result_data) self.assertEquals(sw, SW["NORMAL"]) + def test_security_environment(self): + print "Testvektor = %s" % self.password + hash = self.secEnv.hash(0x90, 0x80, self.password) + #The API should be changed so that the hash function returns SW_NORMAL + if __name__ == "__main__": unittest.main() - #SE = Security_Environment(None) + #testvektor = "foobar" #print "Testvektor = %s" % testvektor #sw, hash = SE.hash(0x90,0x80,testvektor)