|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Tests ETelMM's SmartCardAuthenticate API. This uses |
|
15 // the dummy TSY (dmmtsy.tsy) to run basic tests on the |
|
16 // RMobileSmartCardEap. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 */ |
|
24 |
|
25 |
|
26 #include <e32test.h> |
|
27 |
|
28 #include "TE_EtelMMTestStepBase.h" |
|
29 #include "te_mmsmartcardauth.h" |
|
30 #include "testdef.h" |
|
31 |
|
32 /** |
|
33 Each test step initialises it's own name |
|
34 */ |
|
35 CTestSmartCardAuthenticate::CTestSmartCardAuthenticate() |
|
36 { |
|
37 // store the name of this test case |
|
38 // this is the name that is used by the script file |
|
39 SetTestStepName(_L("TestMMSmartCardAuthenticate")); |
|
40 } |
|
41 |
|
42 /** |
|
43 Test RMobilePhone::SmartCardAuthenticate() for default (U)SIM and for a |
|
44 specific AID. |
|
45 */ |
|
46 enum TVerdict CTestSmartCardAuthenticate::doTestStepL() |
|
47 { |
|
48 INFO_PRINTF1(_L("Test SmartCard Application based EAP Functionality")); |
|
49 |
|
50 RMobilePhone mmPhone; |
|
51 TInt ret = mmPhone.Open(iTelServer, DMMTSY_PHONE_NAME); |
|
52 TEST(ret == KErrNone); |
|
53 |
|
54 //Test SmartCardAuthenticate (Default AID) |
|
55 RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData; |
|
56 authenticateData.iAUTN = DMMTSY_PHONE_SC_AUTN_IN; |
|
57 authenticateData.iRAND = DMMTSY_PHONE_SC_RAND_IN; |
|
58 |
|
59 // asynchronous |
|
60 INFO_PRINTF1(_L("Test - RMobilePhone::SmartCardAuthenticate async.")); |
|
61 TRequestStatus reqStatus; |
|
62 |
|
63 RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckgd(authenticateData); |
|
64 mmPhone.SmartCardAuthenticate(reqStatus, authenticateDataPckgd); |
|
65 User::WaitForRequest(reqStatus); |
|
66 TEST(reqStatus == KErrNone); |
|
67 TEST(authenticateData.iAUTN == DMMTSY_PHONE_SC_AUTN_OUT); |
|
68 TEST(authenticateData.iRAND == DMMTSY_PHONE_SC_RAND_OUT); |
|
69 TEST(authenticateData.iRES == DMMTSY_PHONE_SC_RES_OUT); |
|
70 TEST(authenticateData.iIK == DMMTSY_PHONE_SC_IK_OUT); |
|
71 TEST(authenticateData.iCK == DMMTSY_PHONE_SC_CK_OUT); |
|
72 TEST(authenticateData.iAUTS == DMMTSY_PHONE_SC_AUTS_OUT); |
|
73 TEST(authenticateData.iKc == DMMTSY_PHONE_SC_KC_OUT); |
|
74 |
|
75 // asynchronous & cancel |
|
76 authenticateData.iAUTN = DMMTSY_PHONE_SC_AUTN_IN; |
|
77 authenticateData.iRAND = DMMTSY_PHONE_SC_RAND_IN; |
|
78 |
|
79 mmPhone.SmartCardAuthenticate(reqStatus, authenticateDataPckgd); |
|
80 mmPhone.CancelAsyncRequest(EMobilePhoneSmartCardAuthenticate); |
|
81 User::WaitForRequest(reqStatus); |
|
82 TEST(reqStatus == KErrCancel); |
|
83 |
|
84 //Test SmartCardAuthenticate with specific AID |
|
85 RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData2; |
|
86 authenticateData2.iAUTN = DMMTSY_PHONE_SC_AUTN_IN; |
|
87 authenticateData2.iRAND = DMMTSY_PHONE_SC_RAND_IN; |
|
88 |
|
89 RMobilePhone::TAID scAppAID = DMMTSY_PHONE_EAPAPP_AID(); |
|
90 |
|
91 // asynchronous |
|
92 INFO_PRINTF1(_L("Test - RMobilePhone::SmartCardAuthenticate async with AID.")); |
|
93 |
|
94 RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckgd2(authenticateData2); |
|
95 mmPhone.SmartCardAuthenticate(reqStatus, scAppAID, authenticateDataPckgd2); |
|
96 User::WaitForRequest(reqStatus); |
|
97 TEST(reqStatus == KErrNone); |
|
98 TEST(authenticateData2.iAUTN == DMMTSY_PHONE_SC_AUTN_OUT); |
|
99 TEST(authenticateData2.iRAND == DMMTSY_PHONE_SC_RAND_OUT); |
|
100 TEST(authenticateData2.iRES == DMMTSY_PHONE_SC_RES_OUT); |
|
101 TEST(authenticateData2.iIK == DMMTSY_PHONE_SC_IK_OUT); |
|
102 TEST(authenticateData2.iCK == DMMTSY_PHONE_SC_CK_OUT); |
|
103 TEST(authenticateData2.iAUTS == DMMTSY_PHONE_SC_AUTS_OUT); |
|
104 TEST(authenticateData2.iKc == DMMTSY_PHONE_SC_KC_OUT); |
|
105 |
|
106 // asynchronous & cancel |
|
107 authenticateData2.iAUTN = DMMTSY_PHONE_SC_AUTN_IN; |
|
108 authenticateData2.iRAND = DMMTSY_PHONE_SC_RAND_IN; |
|
109 |
|
110 mmPhone.SmartCardAuthenticate(reqStatus, scAppAID, authenticateDataPckgd2); |
|
111 mmPhone.CancelAsyncRequest(EMobilePhoneSmartCardAuthenticate); |
|
112 User::WaitForRequest(reqStatus); |
|
113 TEST(reqStatus == KErrCancel); |
|
114 |
|
115 mmPhone.Close(); |
|
116 return TestStepResult(); |
|
117 } |