|
1 /* |
|
2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #if !defined(_EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_) |
|
22 #define _EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_ |
|
23 |
|
24 #include "eap_tools.h" |
|
25 #include "eap_variable_data.h" |
|
26 #include "eap_am_export.h" |
|
27 #include "abs_eap_am_type_tls_peap.h" |
|
28 #include "eap_am_type_tls_peap.h" |
|
29 #include "eap_am_network_id.h" |
|
30 #include <d32dbms.h> |
|
31 #include <EapType.h> |
|
32 #include <unifiedcertstore.h> |
|
33 #include <mctwritablecertstore.h> |
|
34 #include <pkixcertchain.h> |
|
35 #include "EapTlsPeapNotifierStructs.h" |
|
36 #include "EapTlsPeapUtils.h" |
|
37 #include <bigint.h> |
|
38 |
|
39 #if defined(USE_FAST_EAP_TYPE) |
|
40 #include "EapFastNotifierStruct.h" |
|
41 #include <etelmm.h> |
|
42 #endif |
|
43 |
|
44 #include "EapTtlsPapDbInfoStruct.h" |
|
45 |
|
46 class CX509Certificate; |
|
47 class CEapTlsPeapCertInterface; |
|
48 class eap_am_tools_symbian_c; |
|
49 class abs_tls_am_application_eap_fast_c; |
|
50 #if defined(USE_FAST_EAP_TYPE) |
|
51 class CEapFastActive; |
|
52 #endif |
|
53 class CEapTtlsPapActive; |
|
54 |
|
55 #ifdef USE_PAC_STORE |
|
56 class CPacStoreDatabase; |
|
57 struct SInfoEntry; |
|
58 #endif |
|
59 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
|
60 class eap_file_config_c; |
|
61 #endif |
|
62 |
|
63 const TInt KMaxLabelLength = 64; |
|
64 const TInt KMaxDatabaseTableName = 64; |
|
65 |
|
66 #if defined(USE_FAST_EAP_TYPE) |
|
67 const char KEapFastPacProvisResultKey[] = "eap_am_type_tls_peap_symbian_c prov. result"; |
|
68 const TInt KEapFastPacProvisResultType = 1; |
|
69 const u32_t KEapFastPacProvisResultDefaultTimeout = 10000; // in milliseconds = 10 seconds |
|
70 #endif |
|
71 |
|
72 /// This class is interface to adaptation module of EAP/TLS and PEAP. |
|
73 class EAP_EXPORT eap_am_type_tls_peap_symbian_c |
|
74 : public CActive, public eap_am_type_tls_peap_c |
|
75 ,public abs_eap_base_timer_c |
|
76 { |
|
77 |
|
78 public: |
|
79 |
|
80 #if defined(USE_FAST_EAP_TYPE) |
|
81 enum TEapFastPacProvisResultValue |
|
82 { |
|
83 EEapFastPacProvisResultFailure, /* 0 */ |
|
84 EEapFastPacProvisResultSuccess /* 1 */ |
|
85 }; |
|
86 #endif |
|
87 private: // data |
|
88 //-------------------------------------------------- |
|
89 |
|
90 RDbs m_session; |
|
91 |
|
92 RDbNamedDatabase m_database; |
|
93 |
|
94 enum TState |
|
95 { |
|
96 EHandlingIdentityQuery, /* 0 */ |
|
97 EHandlingManualIdentityQuery, /* 1 */ |
|
98 EHandlingChainQuery, /* 2 */ |
|
99 EHandlingCipherSuiteQuery, /* 3 */ |
|
100 #if defined(USE_FAST_EAP_TYPE) /* 4 */ |
|
101 EHandlingNotifierQuery, /* 5 */ |
|
102 EPasswordQuery, /* 6 */ |
|
103 EWrongPassword, /* 7 */ |
|
104 EFilePasswordQuery, /* 8 */ |
|
105 EMasterkeyQuery, /* 9 */ |
|
106 EPasswordCancel, /* 10 */ |
|
107 EShowProvSuccesstNote, /* 11 */ |
|
108 EShowProvNotSuccesstNote, /* 12 */ |
|
109 ENone /* 13 */ |
|
110 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
111 |
|
112 }; |
|
113 |
|
114 TState m_state; |
|
115 TState m_prev_state; |
|
116 |
|
117 TIndexType m_index_type; |
|
118 |
|
119 TInt m_index; |
|
120 |
|
121 eap_type_value_e m_tunneling_type; |
|
122 |
|
123 abs_eap_base_type_c *m_partner; |
|
124 eap_am_tools_symbian_c *m_am_tools; |
|
125 |
|
126 abs_eap_am_type_tls_peap_c *m_am_partner; |
|
127 |
|
128 abs_tls_am_services_c * m_tls_am_partner; |
|
129 |
|
130 #if defined(USE_FAST_EAP_TYPE) |
|
131 abs_tls_am_application_eap_fast_c * m_tls_application; |
|
132 CEapFastActive* iEapFastActiveWaitNote; |
|
133 CEapFastActive* iEapFastActiveNotes; |
|
134 |
|
135 enum TAlterTableCmd |
|
136 { |
|
137 EAddColumn, |
|
138 ERemoveColumn |
|
139 }; |
|
140 |
|
141 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
142 |
|
143 bool m_is_valid; |
|
144 bool m_is_client; |
|
145 |
|
146 eap_type_value_e m_current_eap_type; |
|
147 |
|
148 // These are the vendor-types for EAP type and tunneling EAP type. |
|
149 // Valid for both expanded and non-expanded EAP types. |
|
150 u32_t m_current_eap_vendor_type; |
|
151 u32_t m_tunneling_vendor_type; |
|
152 |
|
153 TBufC<KMaxDatabaseTableName> m_db_table_name; |
|
154 TBufC<KMaxDatabaseTableName> m_db_user_cert_table_name; |
|
155 TBufC<KMaxDatabaseTableName> m_db_ca_cert_table_name; |
|
156 TBufC<KMaxDatabaseTableName> m_db_cipher_suite_table_name; |
|
157 TBufC<KMaxDatabaseTableName> m_db_name; |
|
158 |
|
159 #if defined (USE_FAST_EAP_TYPE) |
|
160 TBufC<KMaxDatabaseTableName> m_db_fast_special_table_name; |
|
161 RArray<SInfoEntry> m_info_array; |
|
162 #endif |
|
163 |
|
164 u32_t m_max_count_of_session_resumes; |
|
165 |
|
166 tls_cipher_suites_e m_cipher_suite; |
|
167 |
|
168 CX509Certificate* m_ca_certificate; |
|
169 |
|
170 CX509Certificate* m_own_certificate; |
|
171 |
|
172 CX509Certificate* m_peer_certificate; |
|
173 |
|
174 CEapTlsPeapCertInterface* m_cert_if; |
|
175 |
|
176 SCertEntry m_own_certificate_info; |
|
177 |
|
178 eap_am_network_id_c m_receive_network_id; |
|
179 |
|
180 u8_t m_eap_identifier; |
|
181 |
|
182 TKeyIdentifier m_subject_key_id; |
|
183 |
|
184 RArray<SCertEntry> m_allowed_ca_certs; |
|
185 |
|
186 RArray<SCertEntry> m_allowed_user_certs; |
|
187 |
|
188 RArray<SCertEntry> m_allowed_server_certs; |
|
189 |
|
190 RArray<TUint> m_allowed_cipher_suites; |
|
191 |
|
192 eap_variable_data_c m_peer_public_key; |
|
193 |
|
194 eap_variable_data_c m_param_p; |
|
195 eap_variable_data_c m_param_q; |
|
196 eap_variable_data_c m_param_g; |
|
197 |
|
198 bool m_shutdown_was_called; |
|
199 |
|
200 #ifdef USE_EAP_EXPANDED_TYPES |
|
201 |
|
202 /// Tunneling EAP configuration data from EAP database. |
|
203 RExpandedEapTypePtrArray m_enabled_tunneling_exp_eap_array; |
|
204 RExpandedEapTypePtrArray m_disabled_tunneling_exp_eap_array; |
|
205 |
|
206 #else |
|
207 |
|
208 /// Tunneling EAP configuration data from EAP database. |
|
209 TEapArray m_iap_eap_array; |
|
210 |
|
211 #endif // #ifdef USE_EAP_EXPANDED_TYPES |
|
212 TIdentityInfo* m_identity_info; |
|
213 |
|
214 TBuf8<4> m_selector_output; |
|
215 |
|
216 eap_type_value_e m_tunneled_type; |
|
217 |
|
218 bool m_verify_certificate_realm; |
|
219 |
|
220 bool m_allow_subdomain_matching; |
|
221 |
|
222 tls_alert_description_e m_latest_alert_description; |
|
223 |
|
224 bool m_use_manual_username; |
|
225 eap_variable_data_c m_manual_username; |
|
226 |
|
227 bool m_use_manual_realm; |
|
228 eap_variable_data_c m_manual_realm; |
|
229 |
|
230 bool m_tls_peap_server_authenticates_client_policy_flag; |
|
231 |
|
232 /// This flag prevents double configuration. This can happen when |
|
233 /// this class implements many interfaces. |
|
234 bool m_configured; |
|
235 |
|
236 // This holds the max session time read from the configuration file. |
|
237 TInt64 m_max_session_time; |
|
238 |
|
239 #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
240 /// This flag allows use of session ticket, see RFC 4507. |
|
241 bool m_use_session_ticket; |
|
242 #endif //#if defined(USE_EAP_TLS_SESSION_TICKET) |
|
243 |
|
244 #if defined(USE_FAST_EAP_TYPE) |
|
245 tls_extension_c * m_received_tunnel_pac_in_session_ticket; |
|
246 tls_extension_c * m_received_user_authorization_pac_in_session_ticket; |
|
247 eap_fast_pac_type_e m_saved_pac_type; |
|
248 eap_fast_completion_operation_e m_completion_operation; |
|
249 eap_status_e m_verification_status; |
|
250 eap_fast_pac_type_e m_pac_type; |
|
251 eap_variable_data_c m_PAC_store_password; |
|
252 eap_variable_data_c m_imported_PAC_data_password; |
|
253 eap_variable_data_c m_PAC_store_path; |
|
254 eap_variable_data_c m_EAP_FAST_IAP_reference; |
|
255 eap_variable_data_c m_EAP_FAST_Group_reference; |
|
256 eap_variable_data_c m_EAP_FAST_import_path; |
|
257 |
|
258 eap_status_e m_eap_fast_completion_status; |
|
259 eap_fast_pac_store_pending_operation_e m_eap_fast_pac_store_pending_operation; |
|
260 eap_array_c<eap_fast_pac_store_data_c> m_references_and_data_blocks; |
|
261 eap_array_c<eap_fast_pac_store_data_c> m_new_references_and_data_blocks; |
|
262 eap_array_c<eap_fast_pac_store_data_c> m_ready_references_and_data_blocks; |
|
263 |
|
264 bool m_serv_unauth_prov_mode; |
|
265 bool m_serv_auth_prov_mode; |
|
266 |
|
267 // For FAST notifiers |
|
268 RNotifier m_notifier; |
|
269 bool m_is_notifier_connected; // Tells if notifier server is connected. |
|
270 |
|
271 TEapFastNotifierStruct * m_notifier_data_to_user; |
|
272 TPckg<TEapFastNotifierStruct> * m_notifier_data_pckg_to_user; |
|
273 |
|
274 TEapFastNotifierStruct * m_notifier_data_from_user; |
|
275 TPckg<TEapFastNotifierStruct> * m_notifier_data_pckg_from_user; |
|
276 |
|
277 /* For MMETEL */ |
|
278 |
|
279 // ETel connection. |
|
280 RTelServer iServer; |
|
281 RMobilePhone iPhone; |
|
282 |
|
283 // Stores the last queried Phone identities like manufacturer, model, |
|
284 // revision and serial number |
|
285 RMobilePhone::TMobilePhoneIdentityV1 iDeviceId; |
|
286 |
|
287 // Tells if MMETEL is connected already or not. |
|
288 TBool iMMETELConnectionStatus; |
|
289 TBool m_completed_with_zero; |
|
290 TBool m_verificationStatus; |
|
291 |
|
292 HBufC8* m_pacStorePWBuf8; |
|
293 EEapFastNotifierUserAction m_userAction; |
|
294 eap_pac_store_data_type_e m_pacStoreDataRefType; |
|
295 eap_fast_pac_store_data_c m_data_reference; |
|
296 TBool m_notifier_complete; |
|
297 eap_variable_data_c m_userResponse; |
|
298 eap_fast_pac_store_pending_operation_e m_pending_operation; |
|
299 TInt m_both_completed; |
|
300 TInt m_both_asked; |
|
301 TUint m_ready_references_array_index; |
|
302 eap_fast_completion_operation_e m_provisioning_mode; |
|
303 |
|
304 /** |
|
305 * This member is used to store completion operation value |
|
306 * in initialize_PAC_store() call from common side. |
|
307 * The value is given later in complete call. |
|
308 */ |
|
309 eap_fast_completion_operation_e iCompletionOperation; |
|
310 /** |
|
311 * This member is used to store initialize-pac-store-completion value |
|
312 * in initialize_PAC_store() call from common side. |
|
313 * The value is given later in complete call. |
|
314 */ |
|
315 eap_fast_initialize_pac_store_completion_e iCompletion; |
|
316 |
|
317 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
318 |
|
319 #ifdef USE_PAC_STORE |
|
320 CPacStoreDatabase * iPacStoreDb; |
|
321 #endif |
|
322 |
|
323 #ifdef USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS |
|
324 TBool m_skip_user_interactions; |
|
325 /// This is object to handle file configuration. |
|
326 eap_file_config_c * m_fileconfig; |
|
327 #endif |
|
328 |
|
329 |
|
330 |
|
331 /** |
|
332 * Maximum TTLS-PAP session time read from the configuration file. |
|
333 */ |
|
334 TInt64 iEapTtlsPapMaxSessionConfigTime; |
|
335 |
|
336 /** |
|
337 * Provides asynch services used by the caller such as |
|
338 * query for TTLS-PAP user name and password. |
|
339 */ |
|
340 CEapTtlsPapActive* iEapTtlsPapActive; |
|
341 |
|
342 |
|
343 //-------------------------------------------------- |
|
344 private: // methods |
|
345 //-------------------------------------------------- |
|
346 |
|
347 |
|
348 EAP_FUNC_IMPORT abs_tls_am_services_c * get_tls_am_partner(); |
|
349 |
|
350 abs_eap_am_type_tls_peap_c * get_am_partner(); |
|
351 |
|
352 void type_configure_readL( |
|
353 eap_config_string field, |
|
354 const u32_t field_length, |
|
355 eap_variable_data_c * const data); |
|
356 |
|
357 void verify_certificate_chainL( |
|
358 EAP_TEMPLATE_CONST eap_array_c<eap_variable_data_c> * const certificate_chain, |
|
359 const tls_cipher_suites_e required_cipher_suite); |
|
360 |
|
361 void WriteBinaryParamL( |
|
362 eap_config_string field, |
|
363 const u32_t field_length, |
|
364 const eap_variable_data_c * const data); |
|
365 |
|
366 void WriteIntParamL( |
|
367 eap_config_string field, |
|
368 const u32_t field_length, |
|
369 eap_variable_data_c * const data); |
|
370 |
|
371 void WriteIntParamL( |
|
372 eap_config_string field, |
|
373 const u32_t field_length, |
|
374 const u32_t value); |
|
375 |
|
376 void get_identity_from_alternative_nameL( |
|
377 const CX509Certificate * const aCertificate, |
|
378 eap_variable_data_c * const aIdentity); |
|
379 |
|
380 void get_identities_from_distinguished_namesL( |
|
381 const CX509Certificate * const aCertificate, |
|
382 eap_variable_data_c * const aSubjectIdentity, |
|
383 eap_variable_data_c * const aIssuerIdentity); |
|
384 |
|
385 eap_status_e load_module( |
|
386 const eap_type_value_e type, |
|
387 const eap_type_value_e /* tunneling_type */, |
|
388 abs_eap_base_type_c * const partner, |
|
389 eap_base_type_c ** const eap_type, |
|
390 const bool is_client_when_true, |
|
391 const eap_am_network_id_c * const receive_network_id); |
|
392 |
|
393 eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type); |
|
394 |
|
395 eap_status_e get_eap_type_list( |
|
396 eap_array_c<eap_type_value_e> * const eap_type_list); |
|
397 |
|
398 eap_status_e unload_module(const eap_type_value_e type); |
|
399 |
|
400 void complete_signL(const RInteger& aR, const RInteger& aS, eap_status_e aStatus); |
|
401 |
|
402 eap_status_e get_realms_from_certificate( |
|
403 CX509Certificate* certificate, |
|
404 eap_variable_data_c * const subject_realm, |
|
405 eap_variable_data_c * const issuer_realm); |
|
406 |
|
407 void authentication_finishedL( |
|
408 const bool true_when_successful, |
|
409 const tls_session_type_e tls_session_type); |
|
410 |
|
411 void read_dsa_parametersL(); |
|
412 |
|
413 eap_status_e SaveManualIdentityL( |
|
414 const TBool use_manual_username, |
|
415 TDesC& manual_username, |
|
416 const TBool use_manual_realm, |
|
417 TDesC& manual_realm); |
|
418 |
|
419 void send_error_notification(const eap_status_e error); |
|
420 |
|
421 eap_status_e show_certificate_selection_dialog(); |
|
422 |
|
423 eap_status_e show_manual_identity_dialog(); |
|
424 |
|
425 void ResetSessionIdL(); |
|
426 |
|
427 /** |
|
428 * Returns true if the full authenticated session is valid. |
|
429 * It finds the difference between current time and the |
|
430 * last full authentication time. If the difference is less than the |
|
431 * Maximum Session Validity Time, then session is valid, returns true. |
|
432 * Otherwise returns false. |
|
433 * Full authentication should be done if the session is not valid. |
|
434 */ |
|
435 bool is_session_validL(); |
|
436 |
|
437 /** |
|
438 * Stores current universal time as the the full authentication time |
|
439 * in the database. Returns KErrNone if storing succeeds. |
|
440 */ |
|
441 void store_authentication_timeL(); |
|
442 |
|
443 #ifdef USE_PAC_STORE |
|
444 |
|
445 void GetPacStoreDbDataL( |
|
446 const eap_pac_store_data_type_e aPacStoreDataType, |
|
447 eap_variable_data_c * aPacStoreData, |
|
448 const eap_variable_data_c * const aPacStoreReference = NULL); |
|
449 |
|
450 #endif // End: #ifdef USE_PAC_STORE |
|
451 |
|
452 #if defined(USE_FAST_EAP_TYPE) |
|
453 |
|
454 void ReadPACStoredataL( |
|
455 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
|
456 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references); |
|
457 |
|
458 void WritePACStoreDataL( |
|
459 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
|
460 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references_and_data_blocks); |
|
461 |
|
462 eap_status_e ShowNotifierItemAndGetResponse( |
|
463 EEapFastNotifierUiItem aNotifierUiItem, TBool aSetActive ); |
|
464 |
|
465 eap_status_e RemoveIAPReference(); |
|
466 |
|
467 eap_status_e ImportFilesL(); |
|
468 |
|
469 eap_status_e PasswordQueryL(); |
|
470 |
|
471 eap_status_e CompletePasswordQueryL(); |
|
472 |
|
473 eap_status_e CompleteFilePasswordQueryL(); |
|
474 |
|
475 eap_status_e CompleteNotifierL(); |
|
476 |
|
477 eap_status_e CompleteFilePasswordQuery(); |
|
478 |
|
479 eap_status_e FinalCompleteReadPACStoreDataL(eap_status_e status); |
|
480 |
|
481 void ConvertUnicodeToAsciiL(const TDesC16& aFromUnicode, TDes8& aToAscii); |
|
482 |
|
483 void UpdatePasswordTimeL(); |
|
484 |
|
485 void CheckPasswordTimeValidityL(); |
|
486 |
|
487 /** |
|
488 * Alter table: remove/add columns. |
|
489 * |
|
490 * @param aDb Reference to database. |
|
491 * @param aCmd Action type: remove/add column. |
|
492 * @param aTableName Name of table to be altered. |
|
493 * @param aColumnName Name of column. |
|
494 * @param aColumnDef Drop-column-set. |
|
495 */ |
|
496 void AlterTableL( RDbNamedDatabase& aDb, |
|
497 TAlterTableCmd aCmd, |
|
498 const TDesC& aTableName, |
|
499 const TDesC& aColumnName, |
|
500 const TDesC& aColumnDef = KNullDesC ); |
|
501 |
|
502 /** |
|
503 * Fix old tables for password identity time. |
|
504 * |
|
505 * Remove password identity time from fast table; |
|
506 * add password identity time to PAC store table; |
|
507 * update password identity time. |
|
508 */ |
|
509 void FixOldTablesForPwdIdentityTimeL(); |
|
510 |
|
511 /** |
|
512 * Add PAC_store_initialized to PAC store |
|
513 * if it does not exists. |
|
514 */ |
|
515 void FixOldTableForPacStoreInitL(); |
|
516 |
|
517 /** |
|
518 * Read integer column value. |
|
519 * |
|
520 * @param aDb Reference to database. |
|
521 * @param aColumnName Name of the target column. |
|
522 * @param aSqlStatement SQL statement to be used. |
|
523 * @return Column value. |
|
524 **/ |
|
525 TInt64 ReadIntDbValueL( RDbNamedDatabase& aDb, |
|
526 const TDesC& aColumnName, |
|
527 const TDesC& aSqlStatement ); |
|
528 |
|
529 eap_status_e ConfigureL(); |
|
530 |
|
531 eap_status_e CreateMasterkeyL(); |
|
532 |
|
533 eap_status_e QueryUserPermissionForAIDL( |
|
534 const eap_fast_variable_data_c * const in_pac_attribute_A_ID_info, |
|
535 const eap_fast_variable_data_c * const in_pac_attribute_A_ID); |
|
536 |
|
537 void CompleteAddImportedPACFileL( |
|
538 const eap_variable_data_c * const in_imported_PAC_filename, |
|
539 const eap_variable_data_c * const out_used_group_reference); |
|
540 |
|
541 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
542 |
|
543 |
|
544 |
|
545 /** |
|
546 * Check whether password is older than allowed |
|
547 * by max TTLS-PAP session timeout. |
|
548 * |
|
549 * @return ETrue - session is valid, EFalse - otherwise. |
|
550 */ |
|
551 TBool IsTtlsPapSessionValidL(); |
|
552 |
|
553 |
|
554 /** |
|
555 * Check TTLS-PAP session validity. |
|
556 * |
|
557 * @return ETrue if currentTime < aInLastFullAuthTime + aInMaxSessionTime, |
|
558 * EFalse - otherwise. |
|
559 */ |
|
560 TBool CheckTtlsPapSessionValidity( |
|
561 const TInt64& aInMaxSessionTime, |
|
562 const TInt64& aInLastFullAuthTime ); |
|
563 |
|
564 |
|
565 //-------------------------------------------------- |
|
566 protected: // methods |
|
567 //-------------------------------------------------- |
|
568 |
|
569 |
|
570 eap_am_type_tls_peap_symbian_c( |
|
571 abs_eap_am_tools_c * const aTools, |
|
572 abs_eap_base_type_c * const aPartner, |
|
573 const TIndexType aIndexType, |
|
574 const TInt aIndex, |
|
575 const eap_type_value_e aTunnelingType, |
|
576 const eap_type_value_e aEapType, |
|
577 const bool aIsClient, |
|
578 const eap_am_network_id_c * const receive_network_id); |
|
579 |
|
580 void ConstructL(); |
|
581 |
|
582 void RunL(); |
|
583 |
|
584 void DoCancel(); |
|
585 |
|
586 |
|
587 //-------------------------------------------------- |
|
588 public: // methods |
|
589 //-------------------------------------------------- |
|
590 |
|
591 // |
|
592 static eap_am_type_tls_peap_symbian_c* NewL( |
|
593 abs_eap_am_tools_c * const aTools, |
|
594 abs_eap_base_type_c * const aPartner, |
|
595 const TIndexType aIndexType, |
|
596 const TInt aIndex, |
|
597 const eap_type_value_e aTunnelingType, |
|
598 const eap_type_value_e aEapType, |
|
599 const bool aIsClient, |
|
600 const eap_am_network_id_c * const receive_network_id); |
|
601 |
|
602 EAP_FUNC_IMPORT virtual ~eap_am_type_tls_peap_symbian_c(); |
|
603 |
|
604 EAP_FUNC_EXPORT eap_status_e shutdown(); |
|
605 |
|
606 EAP_FUNC_IMPORT void set_is_valid(); |
|
607 |
|
608 EAP_FUNC_IMPORT bool get_is_valid(); |
|
609 |
|
610 EAP_FUNC_IMPORT void set_tls_am_partner(abs_tls_am_services_c * const tls_am_partner); |
|
611 |
|
612 #if defined(USE_FAST_EAP_TYPE) |
|
613 /// This function sets pointer to application of TLS. See abs_tls_am_application_eap_fast_c. |
|
614 EAP_FUNC_IMPORT void set_tls_application(abs_tls_am_application_eap_fast_c * const tls_application); |
|
615 |
|
616 |
|
617 /** |
|
618 * Check provisioning mode. |
|
619 * |
|
620 * @return ETrue - authenticated provisioning mode, |
|
621 * EFalse - unauthenticated provisioning mode. |
|
622 */ |
|
623 TBool IsProvisioningMode(); |
|
624 |
|
625 /** |
|
626 * Send error notification to common side. |
|
627 * |
|
628 * @param aUserAction EEapFastNotifierUserActionOk or |
|
629 * EEapFastNotifierUserActionCancel. |
|
630 * @return EAP status. |
|
631 */ |
|
632 eap_status_e CompleteQueryUserPermissionForAid( |
|
633 EEapFastNotifierUserAction aUserAction ); |
|
634 |
|
635 |
|
636 void ContinueInitializePacStore(); |
|
637 |
|
638 |
|
639 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
640 |
|
641 /** |
|
642 * Send error notification to common side. |
|
643 * |
|
644 * @param aError EAP status. |
|
645 */ |
|
646 void SendErrorNotification( const eap_status_e aError ); |
|
647 |
|
648 EAP_FUNC_IMPORT void notify_configuration_error( |
|
649 const eap_status_e configuration_status); |
|
650 |
|
651 EAP_FUNC_IMPORT eap_status_e configure(); |
|
652 |
|
653 void set_am_partner(abs_eap_am_type_tls_peap_c * const partner); |
|
654 |
|
655 /** Client calls this function. |
|
656 * EAP-TLS/PEAP AM could do finishing operations to databases etc. based on authentication status and type. |
|
657 */ |
|
658 EAP_FUNC_IMPORT eap_status_e reset(); |
|
659 |
|
660 /** Client calls this function. |
|
661 * EAP-TLS/PEAP AM could make some fast operations here, heavy operations should be done in the reset() function. |
|
662 */ |
|
663 EAP_FUNC_IMPORT eap_status_e authentication_finished( |
|
664 const bool true_when_successfull, |
|
665 const tls_session_type_e tls_session_type); |
|
666 |
|
667 /** Client calls this function. |
|
668 * AM must copy identity to output parameters if call is syncronous. |
|
669 * This function could be completed asyncronously with abs_eap_am_type_tls_peap_c::complete_query_eap_identity_query() function call. |
|
670 */ |
|
671 EAP_FUNC_IMPORT eap_status_e query_eap_identity( |
|
672 eap_variable_data_c * const identity, |
|
673 const eap_am_network_id_c * const receive_network_id, |
|
674 const u8_t eap_identifier, |
|
675 bool * const use_manual_username, |
|
676 eap_variable_data_c * const manual_username, |
|
677 bool *const use_manual_realm, |
|
678 eap_variable_data_c * const manual_realm); |
|
679 |
|
680 /** Client calls this function. |
|
681 * This call cancels asyncronous query_SIM_IMSI_or_pseudonym_or_reauthentication_id() function call. |
|
682 * AM must not complete query_SIM_IMSI_or_pseudonym_or_reauthentication_id() |
|
683 * with abs_eap_am_type_gsmsim_c::complete_SIM_IMSI_or_pseudonym_or_reauthentication_id_query() after |
|
684 * cancel_SIM_IMSI_or_pseudonym_or_reauthentication_id_query() call. |
|
685 */ |
|
686 EAP_FUNC_IMPORT eap_status_e cancel_identity_query(); |
|
687 |
|
688 // |
|
689 EAP_FUNC_IMPORT eap_status_e timer_expired( |
|
690 const u32_t id, void *data); |
|
691 |
|
692 // |
|
693 EAP_FUNC_IMPORT eap_status_e timer_delete_data( |
|
694 const u32_t id, void *data); |
|
695 |
|
696 /** |
|
697 * The type_configure_read() function reads the configuration data identified |
|
698 * by the field string of field_length bytes length. Adaptation module must direct |
|
699 * the query to some persistent store. |
|
700 * @param field is generic configure string idenfying the required configure data. |
|
701 * @param data is pointer to existing eap_variable_data object. |
|
702 */ |
|
703 EAP_FUNC_IMPORT eap_status_e type_configure_read( |
|
704 const eap_configuration_field_c * const field, |
|
705 eap_variable_data_c * const data); |
|
706 |
|
707 /** |
|
708 * The type_configure_write() function writes the configuration data identified |
|
709 * by the field string of field_length bytes length. Adaptation module must direct |
|
710 * the action to some persistent store. |
|
711 * @param field is generic configure string idenfying the required configure data. |
|
712 * @param data is pointer to existing eap_variable_data object. |
|
713 */ |
|
714 EAP_FUNC_IMPORT eap_status_e type_configure_write( |
|
715 const eap_configuration_field_c * const field, |
|
716 eap_variable_data_c * const data); |
|
717 |
|
718 EAP_FUNC_IMPORT eap_status_e alert_received( |
|
719 const tls_alert_level_e alert_level, |
|
720 const tls_alert_description_e alert_description); |
|
721 |
|
722 EAP_FUNC_IMPORT eap_status_e query_cipher_suites_and_previous_session(); |
|
723 |
|
724 #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
725 EAP_FUNC_IMPORT eap_status_e query_new_session_ticket(); |
|
726 #endif //#if defined(USE_EAP_TLS_SESSION_TICKET) |
|
727 |
|
728 EAP_FUNC_IMPORT eap_status_e select_cipher_suite_and_check_session_id( |
|
729 EAP_TEMPLATE_CONST eap_array_c<u16_t> * const cipher_suite_proposal, |
|
730 const eap_variable_data_c * const session_id |
|
731 #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
732 , const tls_extension_c * const session_ticket |
|
733 #endif //#if defined(USE_EAP_TLS_SESSION_TICKET) |
|
734 ); |
|
735 |
|
736 |
|
737 EAP_FUNC_IMPORT eap_status_e verify_certificate_chain( |
|
738 EAP_TEMPLATE_CONST eap_array_c<eap_variable_data_c> * const certificate_chain, |
|
739 const tls_cipher_suites_e required_cipher_suite); |
|
740 |
|
741 EAP_FUNC_IMPORT eap_status_e query_certificate_chain( |
|
742 EAP_TEMPLATE_CONST eap_array_c<eap_variable_data_c> * const certificate_authorities, |
|
743 EAP_TEMPLATE_CONST eap_array_c<u8_t> * const certificate_types, |
|
744 const tls_cipher_suites_e required_cipher_suite); |
|
745 |
|
746 EAP_FUNC_IMPORT eap_status_e query_certificate_authorities_and_types(); |
|
747 |
|
748 EAP_FUNC_IMPORT eap_status_e query_dh_parameters( |
|
749 EAP_TEMPLATE_CONST eap_array_c<eap_variable_data_c> * const certificate_chain, |
|
750 const tls_cipher_suites_e required_cipher_suite); |
|
751 |
|
752 EAP_FUNC_IMPORT eap_status_e query_realm( |
|
753 EAP_TEMPLATE_CONST eap_array_c<eap_variable_data_c> * const certificate_chain); |
|
754 |
|
755 // This is always syncronous call. |
|
756 EAP_FUNC_IMPORT eap_status_e save_tls_session( |
|
757 const eap_variable_data_c * const session_id, |
|
758 const eap_variable_data_c * const master_secret, |
|
759 const tls_cipher_suites_e used_cipher_suite |
|
760 #if defined(USE_EAP_TLS_SESSION_TICKET) |
|
761 , const tls_extension_c * const new_session_ticket |
|
762 #endif //#if defined(USE_EAP_TLS_SESSION_TICKET) |
|
763 ); |
|
764 |
|
765 /// This is always syncronous call. |
|
766 /// Function encrypts data with own RSA private key. |
|
767 EAP_FUNC_IMPORT eap_status_e rsa_encrypt_with_public_key( |
|
768 const eap_variable_data_c * const premaster_secret); |
|
769 |
|
770 /// This is always syncronous call. |
|
771 /// Function decrypts data with own RSA private key. |
|
772 EAP_FUNC_IMPORT eap_status_e rsa_decrypt_with_private_key( |
|
773 const eap_variable_data_c * const encrypted_premaster_secret); |
|
774 |
|
775 /// Function signs data with own PKI private key. |
|
776 /// NOTE this is syncronous at moment. Asyncronous completion needs many changes. |
|
777 EAP_FUNC_IMPORT eap_status_e sign_with_private_key( |
|
778 const eap_variable_data_c * const message_hash); |
|
779 |
|
780 /// Function verifies signed data with peer PKI public key. |
|
781 /// NOTE this is syncronous at moment. Asyncronous completion needs many changes. |
|
782 EAP_FUNC_IMPORT eap_status_e verify_with_public_key( |
|
783 const eap_variable_data_c * const message_hash, |
|
784 const eap_variable_data_c * const signed_message_hash); |
|
785 |
|
786 |
|
787 EAP_FUNC_IMPORT eap_status_e cancel_query_cipher_suites_and_previous_session(); |
|
788 |
|
789 EAP_FUNC_IMPORT eap_status_e cancel_select_cipher_suite_and_check_session_id(); |
|
790 |
|
791 EAP_FUNC_IMPORT eap_status_e cancel_verify_certificate_chain(); |
|
792 |
|
793 EAP_FUNC_IMPORT eap_status_e cancel_query_certificate_chain(); |
|
794 |
|
795 EAP_FUNC_IMPORT eap_status_e cancel_query_certificate_authorities_and_types(); |
|
796 |
|
797 EAP_FUNC_IMPORT eap_status_e cancel_query_dh_parameters(); |
|
798 |
|
799 EAP_FUNC_IMPORT eap_status_e cancel_query_realm(); |
|
800 |
|
801 EAP_FUNC_IMPORT eap_status_e cancel_query_dsa_parameters(); |
|
802 |
|
803 EAP_FUNC_IMPORT eap_status_e cancel_rsa_encrypt_with_public_key(); |
|
804 |
|
805 EAP_FUNC_IMPORT eap_status_e cancel_rsa_decrypt_with_private_key(); |
|
806 |
|
807 EAP_FUNC_IMPORT eap_status_e cancel_sign_with_private_key(); |
|
808 |
|
809 EAP_FUNC_IMPORT eap_status_e cancel_verify_with_public_key(); |
|
810 |
|
811 |
|
812 eap_status_e complete_read_own_certificate( |
|
813 const RPointerArray<CX509Certificate>& aCertChain, eap_status_e aStatus); |
|
814 |
|
815 eap_status_e complete_read_ca_certificate( |
|
816 const RPointerArray<CX509Certificate>& aCertChain, eap_status_e aStatus); |
|
817 |
|
818 void complete_validate_chain(CPKIXValidationResult& aValidationResult, eap_status_e aStatus); |
|
819 |
|
820 void complete_get_matching_certificates(CArrayFixFlat<SCertEntry>& aMatchingCerts, eap_status_e aStatus); |
|
821 |
|
822 void complete_sign(const RInteger& aR, const RInteger& aS, eap_status_e aStatus); |
|
823 |
|
824 void complete_decrypt(TDes8& aData, eap_status_e aStatus); |
|
825 |
|
826 /** |
|
827 * Returns true if the full authenticated session is valid. |
|
828 * It finds the difference between current time and the |
|
829 * last full authentication time. If the difference is less than the |
|
830 * Maximum Session Validity Time, then session is valid, returns true. |
|
831 * Otherwise returns false. |
|
832 * Full authentication should be done if the session is not valid. |
|
833 */ |
|
834 bool is_session_valid(); |
|
835 |
|
836 EAP_FUNC_IMPORT void set_peap_version( |
|
837 const peap_version_e peap_version, |
|
838 const bool use_tppd_tls_peap, |
|
839 const bool use_tppd_peapv1_acknowledge_hack); |
|
840 |
|
841 #if defined(USE_FAST_EAP_TYPE) |
|
842 |
|
843 // This is commented in tls_am_application_eap_fast_c::read_authority_identity(). |
|
844 // Parameter is the authority identity (A-ID). |
|
845 EAP_FUNC_IMPORT eap_status_e read_authority_identity(eap_variable_data_c * const authority_identity); |
|
846 |
|
847 // This is commented in tls_am_application_eap_fast_c::query_pac_of_type(). |
|
848 EAP_FUNC_IMPORT eap_status_e query_pac_of_type(const eap_fast_pac_type_e pac_type); |
|
849 |
|
850 #if defined(USE_EAP_CORE_SERVER) |
|
851 /** |
|
852 * This function call is always asyncronous. |
|
853 * It will be completed always with complete_verify_pac() function call. |
|
854 * Function verifies the received PAC is valid. |
|
855 */ |
|
856 EAP_FUNC_IMPORT eap_status_e verify_pac(const eap_fast_variable_data_c * const tlv_pac); |
|
857 #endif //#if defined(USE_EAP_CORE_SERVER) |
|
858 |
|
859 // This is commented in eap_am_fast_pac_store_services_c::query_user_permission_for_A_ID(). |
|
860 EAP_FUNC_IMPORT eap_status_e query_user_permission_for_A_ID( |
|
861 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
|
862 const eap_fast_variable_data_c * const in_pac_attribute_A_ID_info, |
|
863 const eap_fast_variable_data_c * const in_pac_attribute_A_ID); |
|
864 |
|
865 // This is commented in eap_am_fast_pac_store_services_c::read_PAC_store_data(). |
|
866 EAP_FUNC_IMPORT eap_status_e read_PAC_store_data( |
|
867 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
|
868 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references); |
|
869 |
|
870 // This is commented in eap_am_fast_pac_store_services_c::write_PAC_store_data(). |
|
871 EAP_FUNC_IMPORT eap_status_e write_PAC_store_data( |
|
872 const bool when_true_must_be_synchronous_operation, |
|
873 const eap_fast_pac_store_pending_operation_e in_pending_operation, |
|
874 EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references_and_data_blocks); |
|
875 |
|
876 // This is commented in eap_am_fast_pac_store_services_c::complete_add_imported_PAC_file(). |
|
877 EAP_FUNC_IMPORT eap_status_e complete_add_imported_PAC_file( |
|
878 const eap_status_e in_completion_status, |
|
879 const eap_variable_data_c * const in_imported_PAC_filename, |
|
880 const eap_variable_data_c * const out_used_group_reference); |
|
881 |
|
882 // This is commented in eap_am_fast_pac_store_services_c::complete_remove_PAC(). |
|
883 EAP_FUNC_IMPORT eap_status_e complete_remove_PAC( |
|
884 const eap_status_e completion_status, |
|
885 const eap_variable_data_c * const out_used_group_reference); |
|
886 |
|
887 // This is commented in eap_am_fast_pac_store_services_c::complete_remove_IAP_reference(). |
|
888 EAP_FUNC_IMPORT eap_status_e complete_remove_IAP_reference( |
|
889 const eap_status_e completion_status); |
|
890 |
|
891 // This is commented in eap_am_fast_pac_store_services_c::cancel_PAC_store_operations(). |
|
892 EAP_FUNC_IMPORT eap_status_e cancel_PAC_store_operations(); |
|
893 |
|
894 /** |
|
895 * This function initializes PAC store. |
|
896 * Imported PACs and other configuration can be done within this function call. |
|
897 * If asyncronous operations are needed the operations must be completed |
|
898 * by complete_initialize_PAC_store() function call. |
|
899 */ |
|
900 EAP_FUNC_IMPORT eap_status_e initialize_PAC_store( |
|
901 const eap_fast_completion_operation_e aCompletionOperation, |
|
902 const eap_fast_initialize_pac_store_completion_e aCompletion ); |
|
903 |
|
904 |
|
905 /** |
|
906 * Indicate provisioning start. |
|
907 * |
|
908 * Common side indicates that PAC provisioning started. |
|
909 * Waiting note is displayed. |
|
910 * |
|
911 * @param provisioning_mode Authenticated or unauthenticated provisioning mode. |
|
912 * @param pac_type PAC type provisioned by server. |
|
913 */ |
|
914 EAP_FUNC_IMPORT eap_status_e indicates_eap_fast_provisioning_starts( |
|
915 const eap_fast_completion_operation_e provisioning_mode, |
|
916 const eap_fast_pac_type_e pac_type ); |
|
917 |
|
918 /** |
|
919 * Indicate provisioning end. |
|
920 * |
|
921 * Common side indicates that PAC provisioning ended. |
|
922 * Waiting note is stopped. Provisioning result note is displayed. |
|
923 * |
|
924 * @param provisioning_successfull True if provisioning is successful, |
|
925 * false - otherwise. |
|
926 * @param provisioning_mode Authenticated or unauthenticated provisioning mode. |
|
927 * @param pac_type PAC type provisioned by server. |
|
928 */ |
|
929 EAP_FUNC_IMPORT eap_status_e indicates_eap_fast_provisioning_ends( |
|
930 const bool provisioning_successfull, |
|
931 const eap_fast_completion_operation_e provisioning_mode, |
|
932 const eap_fast_pac_type_e pac_type ); |
|
933 |
|
934 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
935 |
|
936 |
|
937 // from tls_am_services_c |
|
938 |
|
939 /** |
|
940 * Check whether the PAP password is still valid or |
|
941 * should we prompt user again to enter the password. |
|
942 * @return True - password is valid, false - otherwise. |
|
943 */ |
|
944 EAP_FUNC_IMPORT bool is_ttls_pap_session_valid(); |
|
945 |
|
946 /** |
|
947 * From interface tls_am_services_c. |
|
948 * |
|
949 * The interface is defined in common part. Request asynchronously |
|
950 * user name and password for TTLS-PAP authentication. |
|
951 * Complete request with abs_tls_am_services_c:: |
|
952 * complete_query_ttls_pap_username_and_password( ... ). |
|
953 * * |
|
954 * @param aInSrvChallenge Server challenge. It could be empty. |
|
955 * @return EAP status. |
|
956 */ |
|
957 EAP_FUNC_IMPORT eap_status_e query_ttls_pap_username_and_password( |
|
958 const eap_variable_data_c * const aInSrvChallenge ); |
|
959 |
|
960 /** |
|
961 * The method has empty implementation which is defined for |
|
962 * compilation purpose. |
|
963 */ |
|
964 eap_status_e verify_ttls_pap_username_and_password( |
|
965 const eap_variable_data_c * const aUserName, |
|
966 const eap_variable_data_c * const aUserPassword); |
|
967 |
|
968 // new |
|
969 |
|
970 /** |
|
971 * Complete asynch query for TTLS-PAP user name and password. |
|
972 * |
|
973 * @param aEapStatus Status of asynch. query completion. |
|
974 * @param aUserName PAP user name. |
|
975 * @param aPassword PAP password. |
|
976 * @return EAP status. |
|
977 */ |
|
978 eap_status_e CompleteQueryTtlsPapUserNameAndPassword( |
|
979 eap_status_e aEapStatus, |
|
980 const TDesC8& aUserNameUtf8, |
|
981 const TDesC8& aPasswordUtf8 ); |
|
982 |
|
983 /** |
|
984 * Delegate the task to m_am_tools. |
|
985 * |
|
986 * @param aErr Symbian general error. |
|
987 * @return Eapol error converted from aErr. |
|
988 */ |
|
989 eap_status_e ConvertAmErrorToEapolError( TInt aErr ); |
|
990 |
|
991 /** |
|
992 * Read TTLS-PAP database. |
|
993 * |
|
994 * @param aOutDbInfo Reference to structure containing TTLS-PAP |
|
995 * database information. |
|
996 */ |
|
997 void ReadTtlsPapDbL( TTtlsPapDbInfo& aOutDbInfo ); |
|
998 |
|
999 /** |
|
1000 * Update TTLS-PAP database. |
|
1001 * |
|
1002 * @param aInDbInfo Reference to structure containing TTLS-PAP |
|
1003 * database information. |
|
1004 */ |
|
1005 void WriteTtlsPapDbL( const TTtlsPapDbInfo& aInDbInfo ); |
|
1006 |
|
1007 /** |
|
1008 * Set value of specified column to NULL. |
|
1009 * |
|
1010 * @param aColName Reference to column name. |
|
1011 */ |
|
1012 void SetTtlsPapColumnToNullL( const TDesC& aColName ); |
|
1013 |
|
1014 #if defined(USE_FAST_EAP_TYPE) |
|
1015 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS) |
|
1016 eap_status_e ReadFileConfig(); |
|
1017 #endif |
|
1018 #endif |
|
1019 }; // class eap_am_type_tls_peap_symbian_c |
|
1020 |
|
1021 |
|
1022 #endif //#if !defined(_EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_) |
|
1023 |
|
1024 //-------------------------------------------------- |
|
1025 |
|
1026 |
|
1027 |
|
1028 // End. |