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