14 * Description: EAP and WLAN authentication protocols. |
14 * Description: EAP and WLAN authentication protocols. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 /* |
18 /* |
19 * %version: 35 % |
19 * %version: 24.1.2 % |
20 */ |
20 */ |
21 |
21 |
22 // This is enumeration of EAPOL source code. |
22 // This is enumeration of EAPOL source code. |
23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
24 #undef EAP_FILE_NUMBER_ENUM |
24 #undef EAP_FILE_NUMBER_ENUM |
25 #define EAP_FILE_NUMBER_ENUM 428 |
25 #define EAP_FILE_NUMBER_ENUM 428 |
26 #undef EAP_FILE_NUMBER_DATE |
26 #undef EAP_FILE_NUMBER_DATE |
27 #define EAP_FILE_NUMBER_DATE 1127594498 |
27 #define EAP_FILE_NUMBER_DATE 1127594498 |
28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
29 |
29 |
30 //#include "EapTlsPeapUtils.h" |
30 #include "EapTlsPeapUtils.h" |
31 #include <EapTlsPeapUiConnection.h> |
31 #include <EapTlsPeapUiConnection.h> |
32 #include <EapTlsPeapUiDataConnection.h> |
32 #include <EapTlsPeapUiDataConnection.h> |
33 #include <EapTlsPeapUiCipherSuites.h> |
33 #include <EapTlsPeapUiCipherSuites.h> |
34 #include <EapTlsPeapUiEapTypes.h> |
34 #include <EapTlsPeapUiEapTypes.h> |
35 #include <EapTlsPeapUiCertificates.h> |
35 #include <EapTlsPeapUiCertificates.h> |
36 #include <AbsEapTlsPeapUiCertificates.h> |
36 #include <AbsEapTlsPeapUiCertificates.h> |
37 #include "EapTraceSymbian.h" |
37 #include "eap_am_trace_symbian.h" |
38 |
38 |
39 #ifdef USE_PAC_STORE |
39 #ifdef USE_PAC_STORE |
40 #include "EapFastPacStore.h" |
40 #include "pac_store_db_symbian.h" |
41 #endif |
41 #endif |
42 |
|
43 // ---------------------------------------------------------- |
|
44 |
42 |
45 CEapTlsPeapUiConnection::CEapTlsPeapUiConnection( |
43 CEapTlsPeapUiConnection::CEapTlsPeapUiConnection( |
46 const TIndexType aIndexType, |
44 const TIndexType aIndexType, |
47 const TInt aIndex, |
45 const TInt aIndex, |
48 const TEapExpandedType aTunnelingType, |
46 const TInt aTunnelingType, |
49 const TEapExpandedType aEapType) |
47 const TInt aEapType) |
50 : iIndexType(aIndexType) |
48 : iIndexType(aIndexType) |
51 , iIndex(aIndex) |
49 , iIndex(aIndex) |
52 , iTunnelingType(aTunnelingType) |
50 , iTunnelingType(aTunnelingType) |
53 , iEapType(aEapType) |
51 , iEapType(aEapType) |
|
52 , iIsConnected(EFalse) |
54 , iDataConn(NULL) |
53 , iDataConn(NULL) |
55 , iCipherSuites(NULL) |
54 , iCipherSuites(NULL) |
56 , iEapTypes(NULL) |
55 , iEapTypes(NULL) |
57 , iCertificates(NULL) |
56 , iCertificates(NULL) |
58 , iPacStoreDb(NULL) |
57 , iPacStoreDb(NULL) |
59 { |
58 { |
60 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::CEapTlsPeapUiConnection()\n"))); |
59 } |
61 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::CEapTlsPeapUiConnection()\n")); |
60 |
62 |
|
63 } |
|
64 |
|
65 // ---------------------------------------------------------- |
|
66 |
61 |
67 CEapTlsPeapUiConnection::~CEapTlsPeapUiConnection() |
62 CEapTlsPeapUiConnection::~CEapTlsPeapUiConnection() |
68 { |
63 { |
69 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::~CEapTlsPeapUiConnection()\n"))); |
|
70 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::~CEapTlsPeapUiConnection()\n")); |
|
71 |
|
72 #ifdef USE_PAC_STORE |
64 #ifdef USE_PAC_STORE |
73 delete iPacStoreDb; |
65 delete iPacStoreDb; |
74 #endif |
66 #endif |
75 } |
67 } |
76 |
68 |
77 // ---------------------------------------------------------- |
|
78 |
|
79 TInt CEapTlsPeapUiConnection::Connect() |
69 TInt CEapTlsPeapUiConnection::Connect() |
80 { |
70 { |
81 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::Connect()\n"))); |
71 if(iIsConnected) |
82 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::Connect()\n")); |
72 { |
83 |
73 // Already connected. |
|
74 return KErrNone; |
|
75 } |
|
76 |
84 TRAPD(err, ConnectL()); |
77 TRAPD(err, ConnectL()); |
85 if(err == KErrNone) |
78 if(err == KErrNone) |
86 { |
79 { |
|
80 iIsConnected = ETrue; |
87 } |
81 } |
88 |
82 |
89 return err; |
83 return err; |
90 } |
84 } |
91 |
85 |
92 // ---------------------------------------------------------- |
|
93 |
|
94 void CEapTlsPeapUiConnection::ConnectL() |
86 void CEapTlsPeapUiConnection::ConnectL() |
95 { |
87 { |
96 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::ConnectL()\n"))); |
88 #ifdef USE_EAP_EXPANDED_TYPES |
97 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::ConnectL()\n")); |
89 |
|
90 eap_type_value_e tunnelingType(static_cast<eap_type_ietf_values_e>(iTunnelingType)); |
|
91 eap_type_value_e eapType(static_cast<eap_type_ietf_values_e>(iEapType)); |
|
92 |
|
93 #else |
|
94 |
|
95 eap_type_value_e tunnelingType = static_cast<eap_type_value_e>(iTunnelingType); |
|
96 eap_type_value_e eapType = static_cast<eap_type_value_e>(iEapType); |
|
97 |
|
98 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
98 |
99 |
99 #ifdef USE_PAC_STORE |
100 #ifdef USE_PAC_STORE |
100 #ifdef USE_FAST_EAP_TYPE |
101 #ifdef USE_FAST_EAP_TYPE |
101 |
102 |
102 if(iEapType == *EapExpandedTypeFast.GetType() && iPacStoreDb == NULL) |
103 if(iEapType == eap_type_fast && iPacStoreDb == NULL) |
103 { |
104 { |
104 EAP_TRACE_DEBUG_SYMBIAN( |
105 iPacStoreDb = CPacStoreDatabase::NewL(); |
105 (_L("CEapTlsPeapUiConnection::ConnectL() CEapFastPacStore::NewL()"))); |
|
106 iPacStoreDb = CEapFastPacStore::NewL(); |
|
107 User::LeaveIfNull(iPacStoreDb); |
106 User::LeaveIfNull(iPacStoreDb); |
108 |
107 |
109 EAP_TRACE_DEBUG_SYMBIAN( |
108 EAP_TRACE_DEBUG_SYMBIAN( |
110 (_L("CEapTlsPeapUiConnection::Connect Created PAC store"))); |
109 (_L("CEapTlsPeapUiConnection::Connect Created PAC store"))); |
111 |
110 |
112 iPacStoreDb->OpenPacStoreL(); |
111 iPacStoreDb->OpenPacStoreL(); |
113 |
112 iPacStoreDb->CreateDeviceSeed( NULL ); |
114 EAP_TRACE_DEBUG_SYMBIAN( |
113 EAP_TRACE_DEBUG_SYMBIAN( |
115 (_L("CEapTlsPeapUiConnection::Connect Opened PAC store"))); |
114 (_L("CEapTlsPeapUiConnection::Connect Opened PAC store"))); |
116 |
|
117 iPacStoreDb->CreateDeviceSeedL(); |
|
118 |
|
119 EAP_TRACE_DEBUG_SYMBIAN( |
|
120 (_L("CEapTlsPeapUiConnection::Connect Created device seed"))); |
|
121 } |
115 } |
122 |
116 |
123 #endif // End: #ifdef USE_FAST_EAP_TYPE |
117 #endif // End: #ifdef USE_FAST_EAP_TYPE |
124 #endif // End: #ifdef USE_PAC_STORE |
118 #endif // End: #ifdef USE_PAC_STORE |
125 |
119 |
126 } |
120 // Open or create the databse where all the settings are stored. |
127 |
121 EapTlsPeapUtils::OpenDatabaseL( |
128 // ---------------------------------------------------------- |
122 iDbNamedDatabase, |
|
123 iDbs, |
|
124 iIndexType, |
|
125 iIndex, |
|
126 tunnelingType, |
|
127 eapType); |
|
128 } |
|
129 |
129 |
130 |
130 TInt CEapTlsPeapUiConnection::Close() |
131 TInt CEapTlsPeapUiConnection::Close() |
131 { |
132 { |
132 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::Close()\n"))); |
133 if (iIsConnected) |
133 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::Close()\n")); |
134 { |
134 |
135 |
135 #ifdef USE_PAC_STORE |
136 #ifdef USE_PAC_STORE |
136 |
137 |
137 #ifdef USE_FAST_EAP_TYPE |
138 #ifdef USE_FAST_EAP_TYPE |
138 |
139 |
139 if(iEapType == *EapExpandedTypeFast.GetType() |
140 if(iEapType == eap_type_fast && iPacStoreDb != NULL) |
140 && iPacStoreDb != NULL) |
141 { |
141 { |
142 iPacStoreDb->Close(); |
142 delete iPacStoreDb; |
143 } |
143 iPacStoreDb = NULL; |
|
144 } |
|
145 |
|
146 #endif // End: #ifdef USE_FAST_EAP_TYPE |
144 #endif // End: #ifdef USE_FAST_EAP_TYPE |
147 |
145 |
148 #endif // End: #ifdef USE_PAC_STORE |
146 #endif // End: #ifdef USE_PAC_STORE |
|
147 |
|
148 iDbNamedDatabase.Close(); |
|
149 |
|
150 iDbs.Close(); // Both the Dbs are closed and server can be closed now. |
|
151 } |
149 |
152 |
|
153 iIsConnected = EFalse; |
|
154 |
150 return KErrNone; |
155 return KErrNone; |
151 } |
156 } |
152 |
157 |
153 // ---------------------------------------------------------- |
|
154 |
158 |
155 CEapTlsPeapUiDataConnection * CEapTlsPeapUiConnection::GetDataConnection() |
159 CEapTlsPeapUiDataConnection * CEapTlsPeapUiConnection::GetDataConnection() |
156 { |
160 { |
157 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetDataConnection()\n"))); |
|
158 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetDataConnection()\n")); |
|
159 |
|
160 if (!iDataConn) |
161 if (!iDataConn) |
161 { |
162 { |
162 iDataConn = new CEapTlsPeapUiDataConnection(this); |
163 iDataConn = new CEapTlsPeapUiDataConnection(this); |
163 } |
164 } |
164 |
165 |
165 return iDataConn; |
166 return iDataConn; |
166 } |
167 } |
167 |
168 |
168 // ---------------------------------------------------------- |
|
169 |
169 |
170 CEapTlsPeapUiCipherSuites * CEapTlsPeapUiConnection::GetCipherSuiteConnection() |
170 CEapTlsPeapUiCipherSuites * CEapTlsPeapUiConnection::GetCipherSuiteConnection() |
171 { |
171 { |
172 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetCipherSuiteConnection()\n"))); |
|
173 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetCipherSuiteConnection()\n")); |
|
174 |
|
175 if (!iCipherSuites) |
172 if (!iCipherSuites) |
176 { |
173 { |
177 iCipherSuites = new CEapTlsPeapUiCipherSuites(this); |
174 iCipherSuites = new CEapTlsPeapUiCipherSuites(this); |
178 } |
175 } |
179 |
176 |
180 return iCipherSuites; |
177 return iCipherSuites; |
181 } |
178 } |
182 |
179 |
183 // ---------------------------------------------------------- |
180 |
184 |
|
185 CEapTlsPeapUiCertificates * CEapTlsPeapUiConnection::GetCertificateConnection(MEapTlsPeapUiCertificates * const aParent) |
181 CEapTlsPeapUiCertificates * CEapTlsPeapUiConnection::GetCertificateConnection(MEapTlsPeapUiCertificates * const aParent) |
186 { |
182 { |
187 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetCertificateConnection()\n"))); |
|
188 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetCertificateConnection()\n")); |
|
189 |
|
190 if (!iCertificates) |
183 if (!iCertificates) |
191 { |
184 { |
192 iCertificates = new CEapTlsPeapUiCertificates(this, aParent); |
185 iCertificates = new CEapTlsPeapUiCertificates(this, aParent); |
193 } |
186 } |
194 |
187 |
195 return iCertificates; |
188 return iCertificates; |
196 } |
189 } |
197 |
190 |
198 // ---------------------------------------------------------- |
191 |
199 |
|
200 |
|
201 CEapTlsPeapUiEapTypes * CEapTlsPeapUiConnection::GetEapTypeConnection() |
192 CEapTlsPeapUiEapTypes * CEapTlsPeapUiConnection::GetEapTypeConnection() |
202 { |
193 { |
203 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetEapTypeConnection()\n"))); |
|
204 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetEapTypeConnection()\n")); |
|
205 |
|
206 if (!iEapTypes) |
194 if (!iEapTypes) |
207 { |
195 { |
208 iEapTypes = new CEapTlsPeapUiEapTypes(this); |
196 iEapTypes = new CEapTlsPeapUiEapTypes(this); |
209 } |
197 } |
210 |
198 |
211 return iEapTypes; |
199 return iEapTypes; |
212 } |
200 } |
213 |
201 |
214 // ---------------------------------------------------------- |
202 |
|
203 TInt CEapTlsPeapUiConnection::GetDatabase(RDbNamedDatabase & aDatabase) |
|
204 { |
|
205 if (iIsConnected == EFalse) |
|
206 { |
|
207 return KErrSessionClosed; |
|
208 } |
|
209 |
|
210 aDatabase = iDbNamedDatabase; |
|
211 return KErrNone; |
|
212 } |
|
213 |
215 |
214 |
216 TIndexType CEapTlsPeapUiConnection::GetIndexType() |
215 TIndexType CEapTlsPeapUiConnection::GetIndexType() |
217 { |
216 { |
218 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetIndexType()\n"))); |
|
219 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetIndexType()\n")); |
|
220 |
|
221 return iIndexType; |
217 return iIndexType; |
222 } |
218 } |
223 |
219 |
224 // ---------------------------------------------------------- |
|
225 |
220 |
226 TInt CEapTlsPeapUiConnection::GetIndex() |
221 TInt CEapTlsPeapUiConnection::GetIndex() |
227 { |
222 { |
228 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetIndex()\n"))); |
|
229 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetIndex()\n")); |
|
230 |
|
231 return iIndex; |
223 return iIndex; |
232 } |
224 } |
233 |
225 |
234 // ---------------------------------------------------------- |
226 TInt CEapTlsPeapUiConnection::GetTunnelingType() |
235 |
227 { |
236 TEapExpandedType CEapTlsPeapUiConnection::GetTunnelingType() |
|
237 { |
|
238 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetTunnelingType()\n"))); |
|
239 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetTunnelingType()\n")); |
|
240 |
|
241 return iTunnelingType; |
228 return iTunnelingType; |
242 } |
229 } |
243 |
230 |
244 // ---------------------------------------------------------- |
231 TInt CEapTlsPeapUiConnection::GetEapType() |
245 |
232 { |
246 TEapExpandedType CEapTlsPeapUiConnection::GetEapType() |
|
247 { |
|
248 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetEapType()\n"))); |
|
249 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetEapType()\n")); |
|
250 |
|
251 return iEapType; |
233 return iEapType; |
252 } |
234 } |
253 |
235 |
254 // ---------------------------------------------------------- |
|
255 |
236 |
256 TBool CEapTlsPeapUiConnection::IsPacStoreMasterKeyPresentL() |
237 TBool CEapTlsPeapUiConnection::IsPacStoreMasterKeyPresentL() |
257 { |
238 { |
258 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::IsPacStoreMasterKeyPresentL()\n"))); |
|
259 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::IsPacStoreMasterKeyPresentL()\n")); |
|
260 |
|
261 TBool status(EFalse); |
239 TBool status(EFalse); |
262 |
240 |
263 #ifdef USE_FAST_EAP_TYPE |
241 #ifdef USE_FAST_EAP_TYPE |
264 |
242 |
265 if(iEapType == *EapExpandedTypeFast.GetType()) |
243 if(iEapType == eap_type_fast) |
266 { |
244 { |
267 if (iPacStoreDb == 0) |
245 if (iIsConnected == EFalse) |
268 { |
246 { |
269 User::Leave(KErrSessionClosed); |
247 User::Leave(KErrSessionClosed); |
270 } |
248 } |
271 |
249 |
272 status = iPacStoreDb->IsMasterKeyPresentL(); |
250 status = iPacStoreDb->IsMasterKeyPresentL(); |
313 { |
286 { |
314 return KErrNotSupported; |
287 return KErrNotSupported; |
315 } |
288 } |
316 } |
289 } |
317 |
290 |
318 // ---------------------------------------------------------- |
|
319 |
|
320 TBool CEapTlsPeapUiConnection::VerifyPacStorePasswordL( |
291 TBool CEapTlsPeapUiConnection::VerifyPacStorePasswordL( |
321 const TDesC& aPacStorePw) |
292 const TDesC& aPacStorePw) |
322 { |
293 { |
323 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL()\n"))); |
294 if(aPacStorePw.Size() <= 0) |
324 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::VerifyPacStorePasswordL()\n")); |
|
325 |
|
326 if(aPacStorePw.Length() <= 0) |
|
327 { |
295 { |
328 EAP_TRACE_DEBUG_SYMBIAN( |
296 EAP_TRACE_DEBUG_SYMBIAN( |
329 (_L("ERROR: CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PAC store PW can not be EMPTY!"))); |
297 (_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL: PAC store PW can not be EMPTY!"))); |
330 |
298 |
331 User::Leave(KErrArgument); |
299 User::Leave(KErrArgument); |
332 } |
300 } |
333 |
301 |
334 TBool status(EFalse); |
302 TBool status(EFalse); |
335 |
303 |
336 #ifdef USE_FAST_EAP_TYPE |
304 #ifdef USE_FAST_EAP_TYPE |
337 |
305 |
338 if(iEapType == *EapExpandedTypeFast.GetType()) |
306 if(iEapType == eap_type_fast) |
339 { |
307 { |
340 if (iPacStoreDb == 0) |
308 if (iIsConnected == EFalse) |
341 { |
309 { |
342 User::Leave(KErrSessionClosed); |
310 User::Leave(KErrSessionClosed); |
343 } |
311 } |
344 |
312 |
345 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
313 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
346 ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PW from caller (16bits)", |
314 ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL:PW from caller (16bits)", |
347 aPacStorePw.Ptr(), |
315 aPacStorePw.Ptr(), |
348 aPacStorePw.Size())); |
316 aPacStorePw.Size())); |
349 |
317 |
350 HBufC8* pacStorePWBuf8 = HBufC8::NewLC(aPacStorePw.Size()); |
318 HBufC8* pacStorePWBuf8 = HBufC8::NewLC(aPacStorePw.Size()); |
351 TPtr8 pacStorePWPtr8 = pacStorePWBuf8->Des(); |
319 TPtr8 pacStorePWPtr8 = pacStorePWBuf8->Des(); |
352 pacStorePWPtr8.Copy(aPacStorePw); |
320 pacStorePWPtr8.Copy(aPacStorePw); |
353 |
321 |
354 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
322 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
355 ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PW used for masterkey verification (8bits)", |
323 ("CEapTlsPeapUiConnection::VerifyPacStorePasswordL:PW used for masterkey verification (8bits)", |
356 pacStorePWPtr8.Ptr(), |
324 pacStorePWPtr8.Ptr(), |
357 pacStorePWPtr8.Size())); |
325 pacStorePWPtr8.Size())); |
358 |
326 |
359 status = iPacStoreDb->IsMasterKeyAndPasswordMatchingL(pacStorePWPtr8); |
327 status = iPacStoreDb->IsMasterKeyAndPasswordMatchingL(pacStorePWPtr8); |
360 |
328 |
363 if (status) |
331 if (status) |
364 { |
332 { |
365 // Password and master key are matching. |
333 // Password and master key are matching. |
366 // Means, This is the password used to create the master key. |
334 // Means, This is the password used to create the master key. |
367 EAP_TRACE_DEBUG_SYMBIAN( |
335 EAP_TRACE_DEBUG_SYMBIAN( |
368 (_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL(): PAC store PW verified OK (true) \n"))); |
336 (_L("CEapTlsPeapUiConnection::VerifyPacStorePasswordL PAC store PW verified OK (true) \n"))); |
369 } |
337 } |
370 } |
338 } |
371 else |
339 else |
372 #endif // End: #ifdef USE_FAST_EAP_TYPE |
340 #endif // End: #ifdef USE_FAST_EAP_TYPE |
373 { |
341 { |
374 User::Leave(KErrNotSupported); |
342 User::Leave(KErrNotSupported); |
375 } |
343 } |
376 |
344 |
377 return status; |
345 return status; |
378 } |
346 } |
379 |
|
380 // ---------------------------------------------------------- |
|
381 |
347 |
382 TInt CEapTlsPeapUiConnection::CreatePacStoreMasterKey( |
348 TInt CEapTlsPeapUiConnection::CreatePacStoreMasterKey( |
383 const TDesC& aPacStorePw) |
349 const TDesC& aPacStorePw) |
384 { |
350 { |
385 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey()\n"))); |
351 if(aPacStorePw.Size() <= 0) |
386 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::CreatePacStoreMasterKey()\n")); |
|
387 |
|
388 if(aPacStorePw.Length() <= 0) |
|
389 { |
352 { |
390 EAP_TRACE_DEBUG_SYMBIAN( |
353 EAP_TRACE_DEBUG_SYMBIAN( |
391 (_L("ERROR: CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): PAC store PW can not be EMPTY!"))); |
354 (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey PAC store PW can not be EMPTY!"))); |
392 |
355 |
393 return KErrArgument; |
356 return KErrArgument; |
394 } |
357 } |
395 |
358 |
396 #ifdef USE_FAST_EAP_TYPE |
359 #ifdef USE_FAST_EAP_TYPE |
397 |
360 |
398 if(iEapType == *EapExpandedTypeFast.GetType()) |
361 if(iEapType == eap_type_fast) |
399 { |
362 { |
400 if (iPacStoreDb == 0) |
363 if (iIsConnected == EFalse) |
401 { |
364 { |
402 return KErrSessionClosed; |
365 return KErrSessionClosed; |
403 } |
366 } |
404 |
367 |
405 TInt creationStatus(KErrNone); |
368 TInt creationStatus(KErrNone); |
406 |
369 |
407 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
370 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
408 ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): PW from caller (16bits)", |
371 ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:PW from caller (16bits)", |
409 aPacStorePw.Ptr(), |
372 aPacStorePw.Ptr(), |
410 aPacStorePw.Size())); |
373 aPacStorePw.Size())); |
411 |
374 |
412 HBufC8* pacStorePWBuf8 = NULL; |
375 HBufC8* pacStorePWBuf8 = NULL; |
413 TRAPD(err, pacStorePWBuf8 = HBufC8::NewL(aPacStorePw.Size())); |
376 TRAPD(err, pacStorePWBuf8 = HBufC8::NewL(aPacStorePw.Size())); |
414 if (err != KErrNone) |
377 if (err != KErrNone) |
415 { |
378 { |
416 EAP_TRACE_DEBUG_SYMBIAN( |
379 EAP_TRACE_DEBUG_SYMBIAN( |
417 (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): Allocation failed\n"))); |
380 (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:Allocation failed\n"))); |
418 return KErrNoMemory; |
381 return KErrNoMemory; |
419 } |
382 } |
420 |
383 |
421 TPtr8 pacStorePWPtr8 = pacStorePWBuf8->Des(); |
384 TPtr8 pacStorePWPtr8 = pacStorePWBuf8->Des(); |
422 pacStorePWPtr8.Copy(aPacStorePw); |
385 pacStorePWPtr8.Copy(aPacStorePw); |
423 |
386 |
424 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
387 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
425 ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): PW used for masterkey creation (8bits)", |
388 ("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:PW used for masterkey creation (8bits)", |
426 pacStorePWPtr8.Ptr(), |
389 pacStorePWPtr8.Ptr(), |
427 pacStorePWPtr8.Size())); |
390 pacStorePWPtr8.Size())); |
428 |
391 |
429 TRAPD(error, creationStatus = iPacStoreDb->CreateAndSaveMasterKeyL(pacStorePWPtr8)); |
392 TRAPD(err1, creationStatus = iPacStoreDb->CreateAndSaveMasterKeyL(pacStorePWPtr8)); |
430 |
393 |
431 delete pacStorePWBuf8; |
394 delete pacStorePWBuf8; |
432 |
395 |
433 if(error != KErrNone) |
396 if(err1 != KErrNone) |
434 { |
397 { |
435 EAP_TRACE_DEBUG_SYMBIAN( |
398 EAP_TRACE_DEBUG_SYMBIAN( |
436 (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): Creation failed %d\n"), error)); |
399 (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey:Creation failed %d\n"), err1)); |
437 } |
400 } |
438 |
401 |
439 if (creationStatus == KErrNone) |
402 if (creationStatus == KErrNone) |
440 { |
403 { |
441 EAP_TRACE_DEBUG_SYMBIAN( |
404 EAP_TRACE_DEBUG_SYMBIAN( |
442 (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey(): Master key created OK\n"))); |
405 (_L("CEapTlsPeapUiConnection::CreatePacStoreMasterKey Master key created OK\n"))); |
443 } |
406 } |
444 return creationStatus; |
407 return creationStatus; |
445 } |
408 } |
446 else |
409 else |
447 #endif // End: #ifdef USE_FAST_EAP_TYPE |
410 #endif // End: #ifdef USE_FAST_EAP_TYPE |
448 { |
411 { |
449 return KErrNotSupported; |
412 return KErrNotSupported; |
450 } |
413 } |
451 } |
414 } |
452 |
415 |
453 // ---------------------------------------------------------- |
416 CPacStoreDatabase * CEapTlsPeapUiConnection::GetPacStoreDb() |
454 |
417 { |
455 void CEapTlsPeapUiConnection::GetPacStorePasswordL( |
418 #ifdef USE_FAST_EAP_TYPE |
456 TDes8 & /* aPassword8 */) |
419 |
457 { |
420 if(iEapType == eap_type_fast) |
458 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::GetPacStorePasswordL()\n"))); |
421 { |
459 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::GetPacStorePasswordL()\n")); |
422 return iPacStoreDb; |
460 |
|
461 #ifdef USE_FAST_EAP_TYPE |
|
462 if(iEapType == *EapExpandedTypeFast.GetType()) |
|
463 { |
|
464 //iPacStoreDb->GetPacStorePasswordL(aPassword8); |
|
465 } |
423 } |
466 else |
424 else |
467 #endif // End: #ifdef USE_FAST_EAP_TYPE |
425 #endif // End: #ifdef USE_FAST_EAP_TYPE |
468 { |
426 { |
469 User::Leave(KErrNotSupported); |
427 return NULL; |
470 } |
428 } |
471 } |
429 } |
472 |
430 |
473 // ---------------------------------------------------------- |
|
474 |
|
475 void CEapTlsPeapUiConnection::SetPacStorePasswordL( |
|
476 const TDesC8 & aPassword8) |
|
477 { |
|
478 EAP_TRACE_DEBUG_SYMBIAN((_L("CEapTlsPeapUiConnection::SetPacStorePasswordL()\n"))); |
|
479 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapTlsPeapUiConnection::SetPacStorePasswordL()\n")); |
|
480 |
|
481 if(aPassword8.Length() <= 0) |
|
482 { |
|
483 EAP_TRACE_DEBUG_SYMBIAN( |
|
484 (_L("ERROR: CEapTlsPeapUiConnection::SetPacStorePasswordL(): PAC store PW can not be EMPTY!"))); |
|
485 return; |
|
486 //User::Leave(KErrArgument); |
|
487 } |
|
488 |
|
489 #ifdef USE_FAST_EAP_TYPE |
|
490 if(iEapType == *EapExpandedTypeFast.GetType()) |
|
491 { |
|
492 iPacStoreDb->SetPacStorePasswordL(aPassword8); |
|
493 } |
|
494 else |
|
495 #endif // End: #ifdef USE_FAST_EAP_TYPE |
|
496 { |
|
497 User::Leave(KErrNotSupported); |
|
498 } |
|
499 } |
|
500 |
|
501 |
|
502 // ---------------------------------------------------------- |
|
503 // End of file |
431 // End of file |