Пример #1
0
 def test_mutual_challenge_response_simple(self):
     ocra_client = OCRAMutualChallengeResponseClient(self.key32, self.mut_suite)
     ocra_server = OCRAMutualChallengeResponseServer(self.key32, self.mut_suite)
     qc = ocra_client.compute_client_challenge()
     rs, qs = ocra_server.compute_server_response(qc)
     self.assertTrue(ocra_client.verify_server_response(rs, qs))
     rc = ocra_client.compute_client_response()
     self.assertTrue(ocra_server.verify_client_response(rc))
Пример #2
0
 def test_mutual_challenge_response_simple(self):
     ocra_client = OCRAMutualChallengeResponseClient(self.key32,
             self.mut_suite)
     ocra_server = OCRAMutualChallengeResponseServer(self.key32,
             self.mut_suite)
     qc = ocra_client.compute_client_challenge()
     rs, qs = ocra_server.compute_server_response(qc)
     self.assertTrue(ocra_client.verify_server_response(rs, qs))
     rc = ocra_client.compute_client_response()
     self.assertTrue(ocra_server.verify_client_response(rc))
Пример #3
0
 def test_mutual_challenge_response_rfc(self):
     for test in self.mut_tests:
         for server_instance in test['challenges']:
             ocra_client = OCRAMutualChallengeResponseClient(test['key'],
                     test['client_ocrasuite'], test['server_ocrasuite'])
             ocra_server = OCRAMutualChallengeResponseServer(test['key'],
                     test['server_ocrasuite'], test['client_ocrasuite'])
             Q = server_instance['params']['Q']
             qc, qs = Q[:8], Q[8:]
             # ignore computed challenge
             ocra_client.compute_client_challenge(Qc=qc)
             rs, qs = ocra_server.compute_server_response(qc, Qs=qs)
             self.assertEqual(rs, server_instance['server_result'])
             self.assertTrue(ocra_client.verify_server_response(rs, qs))
             kwargs = {}
             if ocra_client.ocrasuite.data_input.P:
                 kwargs['P'] = self.pin
             rc = ocra_client.compute_client_response(**kwargs)
             self.assertEqual(rc, server_instance['client_result'])
             self.assertTrue(ocra_server.verify_client_response(rc, **kwargs))
Пример #4
0
 def test_mutual_challenge_response_rfc(self):
     for test in self.mut_tests:
         for server_instance in test['challenges']:
             ocra_client = OCRAMutualChallengeResponseClient(
                 test['key'], test['client_ocrasuite'], test['server_ocrasuite']
             )
             ocra_server = OCRAMutualChallengeResponseServer(
                 test['key'], test['server_ocrasuite'], test['client_ocrasuite']
             )
             Q = server_instance['params']['Q']
             qc, qs = Q[:8], Q[8:]
             # ignore computed challenge
             ocra_client.compute_client_challenge(Qc=qc)
             rs, qs = ocra_server.compute_server_response(qc, Qs=qs)
             self.assertEqual(rs, server_instance['server_result'])
             self.assertTrue(ocra_client.verify_server_response(rs, qs))
             kwargs = {}
             if ocra_client.ocrasuite.data_input.P:
                 kwargs['P'] = self.pin
             rc = ocra_client.compute_client_response(**kwargs)
             self.assertEqual(rc, server_instance['client_result'])
             self.assertTrue(ocra_server.verify_client_response(rc, **kwargs))