eapol/eapol_framework/eapol_symbian/am/include/eap_am_type_tls_peap_symbian.h
changeset 33 938269283a16
parent 2 1c7bc153c08e
child 34 ad1f037f1ac2
equal deleted inserted replaced
22:093cf0757204 33:938269283a16
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 86.1.2 %
    19 * %version: 109 %
    20 */
    20 */
    21 
    21 
    22 #if !defined(_EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_)
    22 #if !defined(_EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_)
    23 #define _EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_
    23 #define _EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_
    24 
    24 
    31 #include <d32dbms.h>
    31 #include <d32dbms.h>
    32 #include <EapType.h>
    32 #include <EapType.h>
    33 #include <unifiedcertstore.h>
    33 #include <unifiedcertstore.h>
    34 #include <mctwritablecertstore.h>
    34 #include <mctwritablecertstore.h>
    35 #include <pkixcertchain.h>
    35 #include <pkixcertchain.h>
    36 #include "EapTlsPeapNotifierStructs.h"
    36 #include "eap_auth_notifier.h"
       
    37 
    37 #include "EapTlsPeapUtils.h"
    38 #include "EapTlsPeapUtils.h"
    38 #include <bigint.h>
    39 #include <bigint.h>
    39 
    40 
    40 #if defined(USE_FAST_EAP_TYPE)
    41 #if defined(USE_FAST_EAP_TYPE)
    41 #include "EapFastNotifierStruct.h"
    42 #include "EapFastNotifierStruct.h"
    46 
    47 
    47 class CX509Certificate;
    48 class CX509Certificate;
    48 class CEapTlsPeapCertInterface;
    49 class CEapTlsPeapCertInterface;
    49 class eap_am_tools_symbian_c;
    50 class eap_am_tools_symbian_c;
    50 class abs_tls_am_application_eap_fast_c;
    51 class abs_tls_am_application_eap_fast_c;
    51 #if defined(USE_FAST_EAP_TYPE)
    52 
    52 class CEapFastActive;
    53 
    53 #endif
       
    54 class CEapTtlsPapActive;
       
    55 
    54 
    56 #ifdef USE_PAC_STORE
    55 #ifdef USE_PAC_STORE
    57 class CPacStoreDatabase;
    56 class CPacStoreDatabase;
    58 struct SInfoEntry;
    57 class SInfoEntry;
    59 #endif
    58 #endif
    60 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
    59 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
    61 class eap_file_config_c;
    60 class eap_file_config_c;
    62 #endif
    61 #endif
    63 
    62 
    71 #endif
    70 #endif
    72 
    71 
    73 /// This class is interface to adaptation module of EAP/TLS and PEAP.
    72 /// This class is interface to adaptation module of EAP/TLS and PEAP.
    74 class EAP_EXPORT eap_am_type_tls_peap_symbian_c
    73 class EAP_EXPORT eap_am_type_tls_peap_symbian_c
    75 : public CActive, public eap_am_type_tls_peap_c
    74 : public CActive, public eap_am_type_tls_peap_c
    76 ,public abs_eap_base_timer_c 
    75 ,public abs_eap_base_timer_c
       
    76 	, public MNotificationCallback
       
    77 
       
    78 
    77 {
    79 {
    78 
    80 
    79 public:
    81 public:
    80 
    82 
    81 #if defined(USE_FAST_EAP_TYPE)
    83 #if defined(USE_FAST_EAP_TYPE)
    86     };
    88     };
    87 #endif
    89 #endif
    88 private: // data
    90 private: // data
    89 //--------------------------------------------------
    91 //--------------------------------------------------
    90 
    92 
    91 	RDbs m_session;
    93 	RFs m_session;
    92 
    94 
    93 	RDbNamedDatabase m_database;
    95 	RDbNamedDatabase m_database;
    94 
    96 
    95 	enum TState 
    97 	enum TState 
    96 	{
    98 	{
    97 		EHandlingIdentityQuery,           /* 0 */
    99 		EHandlingIdentityQuery,           /* 0 */
    98 		EHandlingManualIdentityQuery,     /* 1 */
   100 		EHandlingManualIdentityQuery,     /* 1 */
    99 		EHandlingChainQuery,              /* 2 */
   101 		EHandlingChainQuery,              /* 2 */
   100 		EHandlingCipherSuiteQuery,        /* 3 */
   102 		EHandlingCipherSuiteQuery,        /* 3 */
   101 #if defined(USE_FAST_EAP_TYPE)            /* 4 */
   103     EHandlingDeviceSeedQuery,        /* 4 */
   102 		EHandlingNotifierQuery,           /* 5 */
   104 #if defined(USE_FAST_EAP_TYPE)            /* 5 */
   103 		EPasswordQuery,                   /* 6 */
   105 		EHandlingNotifierQuery,           /* 6 */
   104 		EWrongPassword,                   /* 7 */
   106 		EPasswordQuery,                   /* 7 */
   105 		EFilePasswordQuery,               /* 8 */
   107 		EWrongPassword,                   /* 8 */
   106 		EMasterkeyQuery,                  /* 9 */
   108 		EFilePasswordQuery,               /* 9 */
   107 		EPasswordCancel,                  /* 10 */
   109 		EMasterkeyQuery,                  /* 10 */
   108 		EShowProvSuccesstNote,            /* 11 */
   110 		EPasswordCancel,                  /* 11 */
   109 		EShowProvNotSuccesstNote,         /* 12 */
   111 		EShowProvSuccesstNote,            /* 12 */
   110 		ENone                             /* 13 */
   112 		EShowProvNotSuccesstNote,         /* 13 */
       
   113 		ENotifierComplete,				/*14 */
   111 #endif //#if defined(USE_FAST_EAP_TYPE)
   114 #endif //#if defined(USE_FAST_EAP_TYPE)
       
   115 		EPapUserNameAndPassword, /* 15 */
       
   116 		EPapChallenge, /* 16 */
       
   117 		ENone                             /* 17 */
   112 		
   118 		
   113 	};
   119 	};
   114 	
   120 	
   115 	TState m_state;
   121 	TState m_state;
   116 	TState m_prev_state;
   122 	TState m_prev_state;
   128 
   134 
   129 	abs_tls_am_services_c * m_tls_am_partner;
   135 	abs_tls_am_services_c * m_tls_am_partner;
   130 
   136 
   131 #if defined(USE_FAST_EAP_TYPE)
   137 #if defined(USE_FAST_EAP_TYPE)
   132 	abs_tls_am_application_eap_fast_c * m_tls_application;
   138 	abs_tls_am_application_eap_fast_c * m_tls_application;
   133 	CEapFastActive* iEapFastActiveWaitNote;
   139 
   134 	CEapFastActive* iEapFastActiveNotes;
       
   135 	
       
   136 	enum TAlterTableCmd
   140 	enum TAlterTableCmd
   137 	    {
   141 	    {
   138 	    EAddColumn,
   142 	    EAddColumn,
   139 	    ERemoveColumn
   143 	    ERemoveColumn
   140 	    };
   144 	    };
   144 	bool m_is_valid;
   148 	bool m_is_valid;
   145 	bool m_is_client;
   149 	bool m_is_client;
   146 
   150 
   147 	eap_type_value_e m_current_eap_type;
   151 	eap_type_value_e m_current_eap_type;
   148 
   152 
   149 	// These are the vendor-types for EAP type and tunneling EAP type.
       
   150 	// Valid for both expanded and non-expanded EAP types.
       
   151 	u32_t m_current_eap_vendor_type;
       
   152 	u32_t m_tunneling_vendor_type;
       
   153 
       
   154 	TBufC<KMaxDatabaseTableName> m_db_table_name;
   153 	TBufC<KMaxDatabaseTableName> m_db_table_name;
   155 	TBufC<KMaxDatabaseTableName> m_db_user_cert_table_name;
   154 	TBufC<KMaxDatabaseTableName> m_db_user_cert_table_name;
   156 	TBufC<KMaxDatabaseTableName> m_db_ca_cert_table_name;
   155 	TBufC<KMaxDatabaseTableName> m_db_ca_cert_table_name;
   157 	TBufC<KMaxDatabaseTableName> m_db_cipher_suite_table_name;
   156 	TBufC<KMaxDatabaseTableName> m_db_cipher_suite_table_name;
   158 	TBufC<KMaxDatabaseTableName> m_db_name;
   157 	TBufC<KMaxDatabaseTableName> m_db_name;
   159 
   158 
   160 #if defined (USE_FAST_EAP_TYPE)	
   159 #if defined (USE_FAST_EAP_TYPE)	
   161 TBufC<KMaxDatabaseTableName> m_db_fast_special_table_name;
   160 	TBufC<KMaxDatabaseTableName> m_db_fast_special_table_name;
   162 RArray<SInfoEntry> m_info_array;
   161 	RPointerArray<SInfoEntry> m_info_array;
   163 #endif	
   162 #endif	
   164 
   163 
   165 	u32_t m_max_count_of_session_resumes;
   164 	u32_t m_max_count_of_session_resumes;
   166 	
   165 	
   167 	tls_cipher_suites_e m_cipher_suite;
   166 	tls_cipher_suites_e m_cipher_suite;
   172 	
   171 	
   173 	CX509Certificate* m_peer_certificate;
   172 	CX509Certificate* m_peer_certificate;
   174 
   173 
   175 	CEapTlsPeapCertInterface* m_cert_if;	
   174 	CEapTlsPeapCertInterface* m_cert_if;	
   176 
   175 
   177 	SCertEntry m_own_certificate_info;
   176 	EapCertificateEntry m_own_certificate_info;
   178 
   177 
   179 	eap_am_network_id_c m_receive_network_id;
   178 	eap_am_network_id_c m_receive_network_id;
   180 
   179 
   181 	u8_t m_eap_identifier;
   180 	u8_t m_eap_identifier;
   182 
   181 
   183 	TKeyIdentifier m_subject_key_id;
   182 	TKeyIdentifier m_subject_key_id;
   184 
   183 
   185 	RArray<SCertEntry> m_allowed_ca_certs;
   184 	RPointerArray<EapCertificateEntry> m_allowed_ca_certs;
   186 
   185 
   187 	RArray<SCertEntry> m_allowed_user_certs;
   186 	RPointerArray<EapCertificateEntry> m_allowed_user_certs;
   188 	
   187 	
   189 	RArray<SCertEntry> m_allowed_server_certs;
   188 	RPointerArray<EapCertificateEntry> m_allowed_server_certs;
   190 
   189 
   191 	RArray<TUint> m_allowed_cipher_suites;
   190 	RArray<TUint> m_allowed_cipher_suites;
   192 
   191 
   193 	eap_variable_data_c m_peer_public_key;
   192 	eap_variable_data_c m_peer_public_key;
   194 	
   193 	
   196 	eap_variable_data_c m_param_q;
   195 	eap_variable_data_c m_param_q;
   197 	eap_variable_data_c m_param_g;
   196 	eap_variable_data_c m_param_g;
   198 	
   197 	
   199 	bool m_shutdown_was_called;
   198 	bool m_shutdown_was_called;
   200 
   199 
   201 #ifdef USE_EAP_EXPANDED_TYPES
       
   202 
       
   203 	/// Tunneling EAP configuration data from EAP database.
   200 	/// Tunneling EAP configuration data from EAP database.
   204 	RExpandedEapTypePtrArray m_enabled_tunneling_exp_eap_array;
   201 	RPointerArray<TEapExpandedType> m_enabled_tunneling_exp_eap_array;
   205 	RExpandedEapTypePtrArray m_disabled_tunneling_exp_eap_array;
   202 	RPointerArray<TEapExpandedType> m_disabled_tunneling_exp_eap_array;
   206 
   203 
   207 #else
   204 
   208 
       
   209 	/// Tunneling EAP configuration data from EAP database.
       
   210 	TEapArray m_iap_eap_array;
       
   211 
       
   212 #endif  // #ifdef USE_EAP_EXPANDED_TYPES
       
   213 	TIdentityInfo* m_identity_info; 
       
   214 	
       
   215 	TBuf8<4> m_selector_output;
   205 	TBuf8<4> m_selector_output;
   216 
   206 
   217 	eap_type_value_e m_tunneled_type;
   207 	eap_type_value_e m_tunneled_type;
   218 	
   208 	
   219 	bool m_verify_certificate_realm;	
   209 	bool m_verify_certificate_realm;	
   227 
   217 
   228 	bool m_use_manual_realm;
   218 	bool m_use_manual_realm;
   229 	eap_variable_data_c m_manual_realm;
   219 	eap_variable_data_c m_manual_realm;
   230 	
   220 	
   231 	bool m_tls_peap_server_authenticates_client_policy_flag;
   221 	bool m_tls_peap_server_authenticates_client_policy_flag;
       
   222 
       
   223 	bool m_use_automatic_ca_certificate;
   232 
   224 
   233 	/// This flag prevents double configuration. This can happen when 
   225 	/// This flag prevents double configuration. This can happen when 
   234 	/// this class implements many interfaces.
   226 	/// this class implements many interfaces.
   235 	bool m_configured;
   227 	bool m_configured;
   236 
   228 
   262 	eap_array_c<eap_fast_pac_store_data_c> m_new_references_and_data_blocks;
   254 	eap_array_c<eap_fast_pac_store_data_c> m_new_references_and_data_blocks;
   263 	eap_array_c<eap_fast_pac_store_data_c> m_ready_references_and_data_blocks;
   255 	eap_array_c<eap_fast_pac_store_data_c> m_ready_references_and_data_blocks;
   264 	
   256 	
   265 	bool m_serv_unauth_prov_mode;
   257 	bool m_serv_unauth_prov_mode;
   266 	bool m_serv_auth_prov_mode;
   258 	bool m_serv_auth_prov_mode;
   267 	
   259 #endif
   268 	// For FAST notifiers
   260 	
   269 	RNotifier m_notifier;	
   261 
   270 	bool m_is_notifier_connected; // Tells if notifier server is connected.
   262 
   271 
   263 	CEapAuthNotifier::TEapDialogInfo * m_notifier_data_to_user;
   272 	TEapFastNotifierStruct * m_notifier_data_to_user;
   264 
   273 	TPckg<TEapFastNotifierStruct> * m_notifier_data_pckg_to_user;	
   265 	TPckg<CEapAuthNotifier::TEapDialogInfo> * m_notifier_data_pckg_to_user;
   274 
       
   275 	TEapFastNotifierStruct * m_notifier_data_from_user;
       
   276 	TPckg<TEapFastNotifierStruct> * m_notifier_data_pckg_from_user;	
       
   277 
   266 
   278     /* For MMETEL */
   267     /* For MMETEL */
       
   268 #if defined(USE_FAST_EAP_TYPE)
   279     
   269     
   280 	// ETel connection.
   270 	// ETel connection.
   281     RTelServer iServer;
   271     RTelServer iServer;
   282     RMobilePhone iPhone;
   272     RMobilePhone iPhone;
   283     
   273     
   285     // revision and serial number
   275     // revision and serial number
   286     RMobilePhone::TMobilePhoneIdentityV1 iDeviceId; 
   276     RMobilePhone::TMobilePhoneIdentityV1 iDeviceId; 
   287     	
   277     	
   288     // Tells if MMETEL is connected already or not.
   278     // Tells if MMETEL is connected already or not.
   289     TBool iMMETELConnectionStatus;    
   279     TBool iMMETELConnectionStatus;    
       
   280 
   290     TBool m_completed_with_zero;   
   281     TBool m_completed_with_zero;   
   291 	TBool m_verificationStatus;
   282 	TBool m_verificationStatus;
   292 
   283 
   293 	HBufC8* m_pacStorePWBuf8;
   284 	HBufC8* m_pacStorePWBuf8;
   294 	EEapFastNotifierUserAction m_userAction;
   285 	EEapFastNotifierUserAction m_userAction;
   295 	eap_pac_store_data_type_e m_pacStoreDataRefType;
   286 	eap_pac_store_data_type_e m_pacStoreDataRefType;
   296 	eap_fast_pac_store_data_c m_data_reference;
   287 	eap_fast_pac_store_data_c m_data_reference;
   297 	TBool m_notifier_complete;
       
   298 	eap_variable_data_c m_userResponse;
   288 	eap_variable_data_c m_userResponse;
   299 	eap_fast_pac_store_pending_operation_e m_pending_operation;
   289 	eap_fast_pac_store_pending_operation_e m_pending_operation;
   300 	TInt m_both_completed;
   290 	TInt m_both_completed;
   301 	TInt m_both_asked;
   291 	TInt m_both_asked;
   302 	TUint m_ready_references_array_index;
   292 	TUint m_ready_references_array_index;
   314 	* The value is given later in complete call.
   304 	* The value is given later in complete call.
   315 	*/
   305 	*/
   316 	eap_fast_initialize_pac_store_completion_e iCompletion;
   306 	eap_fast_initialize_pac_store_completion_e iCompletion;
   317 
   307 
   318 #endif //#if defined(USE_FAST_EAP_TYPE)
   308 #endif //#if defined(USE_FAST_EAP_TYPE)
       
   309 	TBool m_notifier_complete;
   319 
   310 
   320 #ifdef USE_PAC_STORE
   311 #ifdef USE_PAC_STORE
   321 	CPacStoreDatabase * iPacStoreDb;
   312 	CPacStoreDatabase * iPacStoreDb;
   322 #endif
   313 #endif
   323 
   314 
   336 
   327 
   337 	/**
   328 	/**
   338 	* Provides asynch services used by the caller such as
   329 	* Provides asynch services used by the caller such as
   339     * query for TTLS-PAP user name and password.
   330     * query for TTLS-PAP user name and password.
   340     */
   331     */
   341 	CEapTtlsPapActive* iEapTtlsPapActive;
   332 
       
   333  //   eap_am_type_tls_peap_symbian_c* iCaller;
       
   334     
       
   335     eap_variable_data_c* iPacStoreDeviceSeed;
       
   336 
       
   337 #ifdef USE_PAC_STORE
       
   338 #endif
       
   339 
       
   340 	CEapAuthNotifier* iEapAuthNotifier;
       
   341 
   342 
   342 
   343 	
   343 	
   344 //--------------------------------------------------
   344 //--------------------------------------------------
   345 private: // methods
   345 private: // methods
   346 //--------------------------------------------------
   346 //--------------------------------------------------
   458 	
   458 	
   459 	void WritePACStoreDataL(
   459 	void WritePACStoreDataL(
   460 		const eap_fast_pac_store_pending_operation_e in_pending_operation,
   460 		const eap_fast_pac_store_pending_operation_e in_pending_operation,
   461 		EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references_and_data_blocks);
   461 		EAP_TEMPLATE_CONST eap_array_c<eap_fast_pac_store_data_c> * const in_references_and_data_blocks);
   462 		
   462 		
   463 	eap_status_e ShowNotifierItemAndGetResponse(
   463 
   464 		EEapFastNotifierUiItem aNotifierUiItem, TBool aSetActive );
       
   465 
   464 
   466 	eap_status_e RemoveIAPReference();
   465 	eap_status_e RemoveIAPReference();
   467 
   466 
   468 	eap_status_e ImportFilesL();
   467 	eap_status_e ImportFilesL();
   469 	
   468 	
   560 	*/ 
   559 	*/ 
   561 	TBool CheckTtlsPapSessionValidity(
   560 	TBool CheckTtlsPapSessionValidity(
   562 		const TInt64& aInMaxSessionTime,
   561 		const TInt64& aInMaxSessionTime,
   563 		const TInt64& aInLastFullAuthTime );
   562 		const TInt64& aInLastFullAuthTime );
   564 	
   563 	
       
   564 #ifdef USE_FAST_EAP_TYPE    
       
   565     TInt CreateMMETelConnectionL();
       
   566 
       
   567     void DisconnectMMETel();    
       
   568 
       
   569     eap_status_e CreateDeviceSeedAsync();
       
   570     
       
   571     void CompleteCreateDeviceSeedL( TInt aStatus );
       
   572 #endif
   565 	
   573 	
   566 //--------------------------------------------------
   574 //--------------------------------------------------
   567 protected: // methods
   575 protected: // methods
   568 //--------------------------------------------------
   576 //--------------------------------------------------
   569 
   577 
   600 		const bool aIsClient,
   608 		const bool aIsClient,
   601 		const eap_am_network_id_c * const receive_network_id);
   609 		const eap_am_network_id_c * const receive_network_id);
   602 
   610 
   603 	EAP_FUNC_IMPORT virtual ~eap_am_type_tls_peap_symbian_c();
   611 	EAP_FUNC_IMPORT virtual ~eap_am_type_tls_peap_symbian_c();
   604 
   612 
   605 	EAP_FUNC_EXPORT eap_status_e shutdown();
   613 	EAP_FUNC_IMPORT eap_status_e shutdown();
   606 
   614 
   607 	EAP_FUNC_IMPORT void set_is_valid();
   615 	EAP_FUNC_IMPORT void set_is_valid();
   608 
   616 
   609 	EAP_FUNC_IMPORT bool get_is_valid();
   617 	EAP_FUNC_IMPORT bool get_is_valid();
   610 
   618 
   816 	eap_status_e complete_read_ca_certificate(
   824 	eap_status_e complete_read_ca_certificate(
   817 		const RPointerArray<CX509Certificate>& aCertChain, eap_status_e aStatus);
   825 		const RPointerArray<CX509Certificate>& aCertChain, eap_status_e aStatus);
   818 
   826 
   819 	void complete_validate_chain(CPKIXValidationResult& aValidationResult, eap_status_e aStatus);
   827 	void complete_validate_chain(CPKIXValidationResult& aValidationResult, eap_status_e aStatus);
   820 
   828 
   821 	void complete_get_matching_certificates(CArrayFixFlat<SCertEntry>& aMatchingCerts, eap_status_e aStatus);
   829 	void complete_get_matching_certificates(RPointerArray<EapCertificateEntry>& aMatchingCerts, eap_status_e aStatus);
   822 
   830 
   823 	void complete_sign(const RInteger& aR, const RInteger& aS, eap_status_e aStatus);
   831 	void complete_sign(const RInteger& aR, const RInteger& aS, eap_status_e aStatus);
   824 
   832 
   825 	void complete_decrypt(TDes8& aData, eap_status_e aStatus);
   833 	void complete_decrypt(TDes8& aData, eap_status_e aStatus);
   826 	
   834 	
  1014 	
  1022 	
  1015 #if defined(USE_FAST_EAP_TYPE)
  1023 #if defined(USE_FAST_EAP_TYPE)
  1016 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
  1024 #if defined(USE_EAP_CONFIGURATION_TO_SKIP_USER_INTERACTIONS)
  1017  	eap_status_e ReadFileConfig();
  1025  	eap_status_e ReadFileConfig();
  1018 #endif
  1026 #endif
  1019 #endif 	
  1027 
       
  1028 #endif 
       
  1029 
       
  1030 	EAP_FUNC_IMPORT void DlgComplete( TInt aStatus );
       
  1031 
       
  1032 	
  1020 }; // class eap_am_type_tls_peap_symbian_c
  1033 }; // class eap_am_type_tls_peap_symbian_c
  1021 
  1034 
  1022 
  1035 
  1023 #endif //#if !defined(_EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_)
  1036 #endif //#if !defined(_EAP_AM_TYPE_TLS_PEAP_SYMBIAN_H_)
  1024 
  1037