14 * Description: EAP and WLAN authentication protocols. |
14 * Description: EAP and WLAN authentication protocols. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 /* |
18 /* |
19 * %version: 37 % |
19 * %version: 22.1.2 % |
20 */ |
20 */ |
21 |
21 |
22 #ifndef _EAPTLSPEAPUTILS_H_ |
22 #ifndef _EAPTLSPEAPUTILS_H_ |
23 #define _EAPTLSPEAPUTILS_H_ |
23 #define _EAPTLSPEAPUTILS_H_ |
24 |
24 |
25 // INCLUDES |
25 // INCLUDES |
26 #include <d32dbms.h> |
26 #include <d32dbms.h> |
27 #include <EapType.h> |
27 #include <EapType.h> |
28 #include "eap_am_tools_symbian.h" |
28 #include "eap_am_tools_symbian.h" |
29 #include <EapSettings.h> |
29 #include <CertEntry.h> |
30 |
30 |
31 #include <unifiedcertstore.h> |
31 #include <unifiedcertstore.h> |
32 #include <mctwritablecertstore.h> |
32 #include <mctwritablecertstore.h> |
33 |
33 |
|
34 #ifndef USE_EAP_EXPANDED_TYPES |
|
35 // This dependencay is needed only for non-expanded EAP types. |
|
36 #include <wdbifwlansettings.h> |
|
37 #endif //#ifndef USE_EAP_EXPANDED_TYPES |
|
38 |
34 #include "eap_type_tls_peap_types.h" |
39 #include "eap_type_tls_peap_types.h" |
35 #include "eap_header.h" |
40 #include "eap_header.h" |
36 |
41 |
37 // LOCAL CONSTANTS |
42 // LOCAL CONSTANTS |
38 |
43 |
39 // For EAP-TLS, EAP-PEAP, EAP-TTLS, EAP-FAST private database. Database will be in the private folder of EAP-server (20026FCB). |
44 #ifdef USE_EAP_EXPANDED_TYPES |
40 // The maximum length of database name is 0x40 (KDbMaxName), which is defined in d32dbms.h. |
45 |
41 |
46 // Size of Expanded EAP Type |
42 _LIT(KTlsDatabaseName, "eaptls.dat"); |
47 const TUint8 KExpandedEAPTypeSize = 8; |
43 _LIT(KPeapDatabaseName, "eappeap.dat"); |
48 |
44 _LIT(KTtlsDatabaseName, "eapttls.dat"); |
49 struct SExpandedEAPType |
45 _LIT(KFastDatabaseName, "eapfast.dat"); |
50 { |
46 |
51 // Unique ID for an expanded EAp type. |
|
52 // This includes, Type (1 byte), Vendor-Id (3bytes) and Vendor-Type (4bytes). |
|
53 TBuf8<KExpandedEAPTypeSize> iExpandedEAPType; |
|
54 }; |
|
55 |
|
56 typedef RPointerArray<SExpandedEAPType> RExpandedEapTypePtrArray; |
|
57 |
|
58 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
59 |
|
60 #ifdef SYMBIAN_SECURE_DBMS |
|
61 // For EAP TLS, PEAP, TTLS, FAST secure databases. |
|
62 // Full path is not needed. The database eaptls.dat will be saved in the |
|
63 // data cage path for DBMS. So it will be in "\private\100012a5\eaptls.dat" in C: drive. |
|
64 // The maximum length of database name is 0x40 (KDbMaxName) , which is defined in d32dbms.h. |
|
65 |
|
66 _LIT(KTlsDatabaseName, "c:eaptls.dat"); |
|
67 _LIT(KPeapDatabaseName, "c:eappeap.dat"); |
|
68 _LIT(KTtlsDatabaseName, "c:eapttls.dat"); |
|
69 _LIT(KFastDatabaseName, "c:eapfast.dat"); |
|
70 |
|
71 _LIT(KSecureUIDFormat, "SECURE[102072e9]"); // For the security policy. |
|
72 |
|
73 #else |
|
74 |
|
75 _LIT(KTlsDatabaseName, "c:\\system\\data\\eaptls.dat"); |
|
76 _LIT(KPeapDatabaseName, "c:\\system\\data\\eappeap.dat"); |
|
77 _LIT(KTtlsDatabaseName, "c:\\system\\data\\eapttls.dat"); |
|
78 _LIT(KFastDatabaseName, "c:\\system\\data\\eapfast.dat"); |
|
79 |
|
80 #endif // #ifdef SYMBIAN_SECURE_DBMS |
47 |
81 |
48 // For TLS. |
82 // For TLS. |
49 _LIT(KTlsDatabaseTableName, "eaptls"); |
83 _LIT(KTlsDatabaseTableName, "eaptls"); |
50 _LIT(KTlsAllowedUserCertsDatabaseTableName, "eaptls_usercerts"); |
84 _LIT(KTlsAllowedUserCertsDatabaseTableName, "eaptls_usercerts"); |
51 _LIT(KTlsAllowedCACertsDatabaseTableName, "eaptls_cacerts"); |
85 _LIT(KTlsAllowedCACertsDatabaseTableName, "eaptls_cacerts"); |
70 _LIT(KFastAllowedCACertsDatabaseTableName, "eapfast_cacerts"); |
104 _LIT(KFastAllowedCACertsDatabaseTableName, "eapfast_cacerts"); |
71 _LIT(KFastAllowedCipherSuitesDatabaseTableName, "eapfast_ciphersuites"); |
105 _LIT(KFastAllowedCipherSuitesDatabaseTableName, "eapfast_ciphersuites"); |
72 |
106 |
73 enum TAlterTableCmd |
107 enum TAlterTableCmd |
74 { |
108 { |
75 EAddColumn, |
109 EAddColumn, |
76 ERemoveColumn |
110 ERemoveColumn |
77 }; |
111 }; |
78 |
112 |
79 // CLASS DECLARATION |
113 // CLASS DECLARATION |
80 class EapTlsPeapUtils |
114 class EapTlsPeapUtils |
81 { |
115 { |
82 |
|
83 public: |
116 public: |
84 |
|
85 static void OpenDatabaseL( |
117 static void OpenDatabaseL( |
86 RDbNamedDatabase& aDatabase, |
118 RDbNamedDatabase& aDatabase, |
87 RFs& aFileServerSession, |
119 RDbs& aSession, |
88 const TIndexType aIndexType, |
120 const TIndexType aIndexType, |
89 const TInt aIndex, |
121 const TInt aIndex, |
90 const eap_type_value_e aTunnelingType, |
122 const eap_type_value_e aTunnelingType, |
91 eap_type_value_e aEapType); |
123 eap_type_value_e aEapType); |
92 |
124 |
93 /** |
125 /** |
140 eap_am_tools_symbian_c * const aTools, |
172 eap_am_tools_symbian_c * const aTools, |
141 const TDesC& aTableName, |
173 const TDesC& aTableName, |
142 const TIndexType aIndexType, |
174 const TIndexType aIndexType, |
143 const TInt aIndex, |
175 const TInt aIndex, |
144 const eap_type_value_e aTunnelingType, |
176 const eap_type_value_e aTunnelingType, |
145 RPointerArray<EapCertificateEntry>& aArray); |
177 RArray<SCertEntry>& aArray); |
146 |
178 |
147 static void ReadUintRowsToArrayL( |
179 static void ReadUintRowsToArrayL( |
148 RDbNamedDatabase& aDatabase, |
180 RDbNamedDatabase& aDatabase, |
149 eap_am_tools_symbian_c * const aTools, |
181 eap_am_tools_symbian_c * const aTools, |
150 const TDesC& aTableName, |
182 const TDesC& aTableName, |
152 const TIndexType aIndexType, |
184 const TIndexType aIndexType, |
153 const TInt aIndex, |
185 const TInt aIndex, |
154 const eap_type_value_e aTunnelingType, |
186 const eap_type_value_e aTunnelingType, |
155 RArray<TUint>& aArray); |
187 RArray<TUint>& aArray); |
156 |
188 |
|
189 #ifdef USE_EAP_EXPANDED_TYPES |
|
190 |
157 // Stores the tunneled EAP type (expanded) to the database. |
191 // Stores the tunneled EAP type (expanded) to the database. |
158 static void SetTunnelingExpandedEapDataL( |
192 static void SetTunnelingExpandedEapDataL( |
159 RDbNamedDatabase& aDatabase, |
193 RDbNamedDatabase& aDatabase, |
160 eap_am_tools_symbian_c * const aTools, |
194 eap_am_tools_symbian_c * const aTools, |
161 RPointerArray<TEapExpandedType> &aEnabledEAPArrary, |
195 RExpandedEapTypePtrArray &aEnabledEAPArrary, |
162 RPointerArray<TEapExpandedType> &aDisabledEAPArrary, |
196 RExpandedEapTypePtrArray &aDisabledEAPArrary, |
163 const TIndexType aIndexType, |
197 const TIndexType aIndexType, |
164 const TInt aIndex, |
198 const TInt aIndex, |
165 const eap_type_value_e aTunnelingType, |
199 const eap_type_value_e aTunnelingType, |
166 const eap_type_value_e aEapType); |
200 const eap_type_value_e aEapType); |
167 |
201 |
168 // Retrieves the tunneled EAP type (expanded) from the database . |
202 // Retrieves the tunneled EAP type (expanded) from the database . |
169 static void GetTunnelingExpandedEapDataL( |
203 static void GetTunnelingExpandedEapDataL( |
170 RDbNamedDatabase& aDatabase, |
204 RDbNamedDatabase& aDatabase, |
171 eap_am_tools_symbian_c * const aTools, |
205 eap_am_tools_symbian_c * const aTools, |
172 RPointerArray<TEapExpandedType> &aEnabledEAPArrary, |
206 RExpandedEapTypePtrArray &aEnabledEAPArrary, |
173 RPointerArray<TEapExpandedType> &aDisabledEAPArrary, |
207 RExpandedEapTypePtrArray &aDisabledEAPArrary, |
174 const TIndexType aIndexType, |
208 const TIndexType aIndexType, |
175 const TInt aIndex, |
209 const TInt aIndex, |
176 const eap_type_value_e aTunnelingType, |
210 const eap_type_value_e aTunnelingType, |
177 const eap_type_value_e aEapType); |
211 const eap_type_value_e aEapType); |
|
212 |
|
213 #else // For normal EAP types. |
|
214 |
|
215 // This sets only the tunneling EAP types. |
|
216 static void SetEapDataL( |
|
217 RDbNamedDatabase& aDatabase, |
|
218 eap_am_tools_symbian_c * const aTools, |
|
219 TEapArray &aEaps, |
|
220 const TIndexType aIndexType, |
|
221 const TInt aIndex, |
|
222 const eap_type_value_e aTunnelingType, |
|
223 const eap_type_value_e aEapType); |
|
224 |
|
225 // This gets only the tunneling EAP types. |
|
226 static void GetEapDataL( |
|
227 RDbNamedDatabase& aDatabase, |
|
228 eap_am_tools_symbian_c * const aTools, |
|
229 TEapArray &aEaps, |
|
230 const TIndexType aIndexType, |
|
231 const TInt aIndex, |
|
232 const eap_type_value_e aTunnelingType, |
|
233 const eap_type_value_e aEapType); |
|
234 |
|
235 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
178 |
236 |
179 static TBool CompareTCertLabels( |
237 static TBool CompareTCertLabels( |
180 const TCertLabel& item1, |
238 const TCertLabel& item1, |
181 const TCertLabel& item2); |
239 const TCertLabel& item2); |
182 |
240 |
183 static TBool CompareSCertEntries(const EapCertificateEntry& item1, const EapCertificateEntry& item2); |
241 static TBool CompareSCertEntries(const SCertEntry& item1, const SCertEntry& item2); |
184 |
242 |
185 static TBool CipherSuiteUseRSAKeys(tls_cipher_suites_e aCipherSuite); |
243 static TBool CipherSuiteUseRSAKeys(tls_cipher_suites_e aCipherSuite); |
186 |
244 |
187 static TBool CipherSuiteUseDSAKeys(tls_cipher_suites_e aCipherSuite); |
245 static TBool CipherSuiteUseDSAKeys(tls_cipher_suites_e aCipherSuite); |
188 |
246 |
205 const eap_type_value_e aEapType, |
263 const eap_type_value_e aEapType, |
206 const TDesC& aDbColumnName, |
264 const TDesC& aDbColumnName, |
207 const eap_variable_data_c * const aDbColumnValue); |
265 const eap_variable_data_c * const aDbColumnValue); |
208 |
266 |
209 private: |
267 private: |
210 |
|
211 static void OpenTlsDatabaseL( |
268 static void OpenTlsDatabaseL( |
212 RDbNamedDatabase& aDatabase, |
269 RDbNamedDatabase& aDatabase, |
213 RFs& aFileServerSession, |
270 RDbs& aSession, |
214 const TIndexType aIndexType, |
271 const TIndexType aIndexType, |
215 const TInt aIndex, |
272 const TInt aIndex, |
216 const eap_type_value_e aTunnelingType); |
273 const eap_type_value_e aTunnelingType); |
217 |
274 |
218 static void OpenPeapDatabaseL( |
275 static void OpenPeapDatabaseL( |
219 RDbNamedDatabase& aDatabase, |
276 RDbNamedDatabase& aDatabase, |
220 RFs& aFileServerSession, |
277 RDbs& aSession, |
221 const TIndexType aIndexType, |
278 const TIndexType aIndexType, |
222 const TInt aIndex, |
279 const TInt aIndex, |
223 const eap_type_value_e aTunnelingType); |
280 const eap_type_value_e aTunnelingType); |
224 |
281 |
225 #if defined(USE_TTLS_EAP_TYPE) |
282 #if defined(USE_TTLS_EAP_TYPE) |
226 |
|
227 static void OpenTtlsDatabaseL( |
283 static void OpenTtlsDatabaseL( |
228 RDbNamedDatabase& aDatabase, |
284 RDbNamedDatabase& aDatabase, |
229 RFs& aFileServerSession, |
285 RDbs& aSession, |
230 const TIndexType aIndexType, |
286 const TIndexType aIndexType, |
231 const TInt aIndex, |
287 const TInt aIndex, |
232 const eap_type_value_e aTunnelingType); |
288 const eap_type_value_e aTunnelingType); |
233 |
|
234 #endif // #if defined(USE_TTLS_EAP_TYPE) |
289 #endif // #if defined(USE_TTLS_EAP_TYPE) |
235 |
290 |
236 #if defined(USE_FAST_EAP_TYPE) |
291 #if defined(USE_FAST_EAP_TYPE) |
237 |
292 |
238 static void OpenFastDatabaseL( |
293 static void OpenFastDatabaseL( |
239 RDbNamedDatabase& aDatabase, |
294 RDbNamedDatabase& aDatabase, |
240 RFs& aFileServerSession, |
295 RDbs& aSession, |
241 const TIndexType aIndexType, |
296 const TIndexType aIndexType, |
242 const TInt aIndex, |
297 const TInt aIndex, |
243 const eap_type_value_e aTunnelingType); |
298 const eap_type_value_e aTunnelingType); |
244 |
299 |
245 #endif // #if defined(USE_FAST_EAP_TYPE) |
300 #endif // #if defined(USE_FAST_EAP_TYPE) |
246 |
301 |
247 static void AddExtraCertColumnsL( |
302 static void AddExtraCertColumnsL( |
248 RDbNamedDatabase& aDatabase, |
303 RDbNamedDatabase& aDatabase, |
249 TDesC& aTableName); |
304 TDesC& aTableName); |
250 |
|
251 static TInt FilterEapMethods( |
|
252 RPointerArray<TEapExpandedType> * const aEAPTypes, |
|
253 RPointerArray<TEapExpandedType> * const aPlugins); |
|
254 |
305 |
255 private: |
306 private: |
256 |
307 |
257 static void AlterTableL( |
308 static void AlterTableL( |
258 RDbNamedDatabase& aDb, |
309 RDbNamedDatabase& aDb, |
259 TAlterTableCmd aCmd, |
310 TAlterTableCmd aCmd, |
260 const TDesC& aTableName, |
311 const TDesC& aTableName, |
261 const TDesC& aColumnName, |
312 const TDesC& aColumnName, |
262 const TDesC& aColumnDef ); |
313 const TDesC& aColumnDef ); |
|
314 |
263 }; |
315 }; |
264 |
316 |
265 #endif // _EAPTLSPEAPUTILS_H_ |
317 #endif // _EAPTLSPEAPUTILS_H_ |
266 |
318 |
267 // End of file |
319 // End of file |