branch | RCL_3 |
changeset 58 | 83ca720e2b9a |
parent 57 | 05bc53fe583b |
57:05bc53fe583b | 58:83ca720e2b9a |
---|---|
31 #include <datamobilitycommsdattypes.h> |
31 #include <datamobilitycommsdattypes.h> |
32 #include <commsdattypesv1_1.h> |
32 #include <commsdattypesv1_1.h> |
33 #include <WlanCdbCols.h> |
33 #include <WlanCdbCols.h> |
34 #include <commsdattypesv1_1.h> |
34 #include <commsdattypesv1_1.h> |
35 #include <wlancontainer.h> |
35 #include <wlancontainer.h> |
36 #include <EapType.h> |
|
36 |
37 |
37 using namespace CMManager; |
38 using namespace CMManager; |
38 |
39 |
39 // CONSTANTS |
40 // CONSTANTS |
40 |
41 |
56 // default port number |
57 // default port number |
57 const TUint32 KDefaultPortNum = 0; |
58 const TUint32 KDefaultPortNum = 0; |
58 |
59 |
59 // ratio between sizes of ascii and unicode characters |
60 // ratio between sizes of ascii and unicode characters |
60 const TUint KAsciiUnicodeRatio = 2; |
61 const TUint KAsciiUnicodeRatio = 2; |
62 |
|
63 // Length of expanded EAP type identifier |
|
64 const TUint KExpandedEAPIdLength = 8; |
|
65 |
|
66 // Plain MSCHAPv2 EAP identifier. Needed because of special handling |
|
67 const TUint8 KMschapv2TypeId[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63}; |
|
61 |
68 |
62 // ================= MEMBER FUNCTIONS ======================= |
69 // ================= MEMBER FUNCTIONS ======================= |
63 |
70 |
64 CEapTypeElement::~CEapTypeElement() |
71 CEapTypeElement::~CEapTypeElement() |
65 { |
72 { |
135 // --------------------------------------------------------- |
142 // --------------------------------------------------------- |
136 // |
143 // |
137 CProcessorWlan::~CProcessorWlan() |
144 CProcessorWlan::~CProcessorWlan() |
138 { |
145 { |
139 delete iEmptyTag; |
146 delete iEmptyTag; |
140 REComSession::FinalClose(); |
|
141 } |
147 } |
142 |
148 |
143 // --------------------------------------------------------- |
149 // --------------------------------------------------------- |
144 // CProcessorWlan::ProcessSpecialFieldsL |
150 // CProcessorWlan::ProcessSpecialFieldsL |
145 // --------------------------------------------------------- |
151 // --------------------------------------------------------- |
371 } |
377 } |
372 break; |
378 break; |
373 //WPA |
379 //WPA |
374 case EWPAPresharedKey: |
380 case EWPAPresharedKey: |
375 case EWPAKeyLength: |
381 case EWPAKeyLength: |
376 case EWPAEapMethod: |
382 case EWPAListOfEAPs: |
377 case EWPAUseOfPresharedKey: |
383 case EWPAUseOfPresharedKey: |
378 { |
384 { |
379 if( iSecurityMode != ESecurityModeWEP && iSecurityMode != ESecurityModeOpen ) |
385 if( iSecurityMode != ESecurityModeWEP && iSecurityMode != ESecurityModeOpen ) |
380 { |
386 { |
381 AddSecurityDataL( aField, aPtrTag, EFalse ); |
387 AddSecurityDataL( aField, aPtrTag, EFalse ); |
593 |
599 |
594 TInt serviceId = iapRecord->iService; |
600 TInt serviceId = iapRecord->iService; |
595 |
601 |
596 CleanupStack::PopAndDestroy( iapRecord ); |
602 CleanupStack::PopAndDestroy( iapRecord ); |
597 |
603 |
598 CEapType* eapType ( NULL ); |
604 TInt err = KErrNone; |
599 TRAPD( leave, |
605 TUint8 expandedEapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
600 eapType = CEapType::NewL( ELan, |
606 |
601 serviceId, |
607 TBuf8<KExpandedEAPIdLength> cue; |
602 eap->iEapSettings->iEAPExpandedType ) ); |
608 |
603 if ( leave == KErrNone ) |
609 // Set-up 64-bit expanded EAP id |
604 { |
610 if ( eap->iEapSettings->iEAPType == KMschapv2TypeId[7] ) |
605 CleanupStack::PushL( eapType ); |
611 { |
606 |
612 // This is plain MSCHAPv2. Set vendor ID correctly |
607 // Inner EAP |
613 expandedEapId[1] = KMschapv2TypeId[1]; |
608 if ( eap->iEncapsulatingEapId != *EapExpandedTypeNone.GetType() ) |
614 expandedEapId[2] = KMschapv2TypeId[2]; |
609 { |
615 expandedEapId[3] = KMschapv2TypeId[3]; |
610 eapType->SetTunnelingType( eap->iEncapsulatingEapId ); |
616 } |
611 } |
617 |
612 |
618 expandedEapId[KExpandedEAPIdLength - 1] = static_cast<TUint8> ( eap->iEapSettings->iEAPType ); |
613 // write EAP setting |
619 cue.Copy( expandedEapId, KExpandedEAPIdLength ); |
614 eapType->SetConfigurationL(*eap->iEapSettings); |
620 |
615 CleanupStack::PopAndDestroy( eapType ); |
621 // Try loading EAP ECOM module |
616 } |
622 CLOG_WRITE_FORMAT( "Try to load EAP module: %d", expandedEapId[7]); |
617 } |
623 CEapType* eapType = 0; |
618 |
624 TRAP( err, eapType = CEapType::NewL( cue, ELan, serviceId ) ); |
625 // The error is caused by probably missing EAP method from the device. Ignore the error |
|
626 // because same scripts can be used for devices with and without certain methods. |
|
627 if( err == KErrNone ) |
|
628 { |
|
629 CleanupStack::PushL( eapType ); |
|
630 |
|
631 // Check if this type is tunneled |
|
632 if ( eap->iEncapsulatingEapId != EAPSettings::EEapNone ) |
|
633 { |
|
634 // It is tunneled. Take the last byte of the expanded id. |
|
635 eapType->SetTunnelingType( eap->iEncapsulatingEapId ); |
|
636 } |
|
637 CLOG_WRITE( "Calling eapType->SetConfiguration" ); |
|
638 eapType->SetConfigurationL( *eap->iEapSettings ); |
|
639 CLOG_WRITE( "eapType->SetConfiguration success!" ); |
|
640 CleanupStack::PopAndDestroy( eapType ); |
|
641 } |
|
642 } |
|
643 |
|
619 session->Close(); |
644 session->Close(); |
620 CleanupStack::PopAndDestroy( session ); |
645 CleanupStack::PopAndDestroy( session ); |
621 CLOG_WRITE( "Finished EAP settings saving" ); |
646 CLOG_WRITE( "Finished EAP settings saving" ); |
647 //iEapSettings.ResetAndDestroy(); |
|
622 |
648 |
623 CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() ); |
649 CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() ); |
624 } |
650 } |
625 |
651 |
626 // --------------------------------------------------------- |
652 // --------------------------------------------------------- |
1178 // --------------------------------------------------------- |
1204 // --------------------------------------------------------- |
1179 // |
1205 // |
1180 void CProcessorWlan::SaveWPAL( TUint32 aIapId ) |
1206 void CProcessorWlan::SaveWPAL( TUint32 aIapId ) |
1181 { |
1207 { |
1182 CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" ); |
1208 CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" ); |
1183 |
|
1184 CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); |
1209 CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); |
1185 CleanupStack::PushL( session ); |
1210 CleanupStack::PushL( session ); |
1186 |
1211 |
1187 // Load IAP record |
1212 // Load IAP record |
1188 CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *> |
1213 CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *> |
1221 CMDBField<TUint>* secModeField = static_cast<CMDBField<TUint>*> |
1246 CMDBField<TUint>* secModeField = static_cast<CMDBField<TUint>*> |
1222 ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) ); |
1247 ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) ); |
1223 secModeField->SetL( iSecurityMode ); |
1248 secModeField->SetL( iSecurityMode ); |
1224 |
1249 |
1225 CLOG_WRITE( "Wrote securityMode" ); |
1250 CLOG_WRITE( "Wrote securityMode" ); |
1226 |
|
1227 // Save EAP list |
1251 // Save EAP list |
1228 SetExpandedEapListL( service ); |
1252 CMDBField<TDesC>* wlanEapsField = static_cast<CMDBField<TDesC>*> |
1229 CLOG_WRITE( "Wrote Expanded EAPList" ); |
1253 ( generic->GetFieldByIdL( KCDTIdWlanEaps ) ); |
1230 |
1254 wlanEapsField->SetL( WPAFieldData( EWPAListOfEAPs )->Des() ); |
1255 |
|
1256 CLOG_WRITE( "Wrote EAPList" ); |
|
1257 |
|
1258 SetExpandedEapListL( generic ); |
|
1259 |
|
1260 CLOG_WRITE( "Wrote expandedEapList" ); |
|
1261 |
|
1231 // Save PreShared Key |
1262 // Save PreShared Key |
1232 TBuf8<KMaxLengthOfKeyData> keyWPA; |
1263 TBuf8<KMaxLengthOfKeyData> keyWPA; |
1233 //convert to 8 bit |
1264 //convert to 8 bit |
1234 keyWPA.Copy( WPAFieldData( EWPAPresharedKey )->Des() ); |
1265 keyWPA.Copy( WPAFieldData( EWPAPresharedKey )->Des() ); |
1235 CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*> |
1266 CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*> |
1263 |
1294 |
1264 // --------------------------------------------------------- |
1295 // --------------------------------------------------------- |
1265 // CProcessorWlan::SetExpandedEapListL |
1296 // CProcessorWlan::SetExpandedEapListL |
1266 // --------------------------------------------------------- |
1297 // --------------------------------------------------------- |
1267 // |
1298 // |
1268 void CProcessorWlan::SetExpandedEapListL( const TUint aServiceId ) |
1299 void CProcessorWlan::SetExpandedEapListL( CMDBGenericRecord* generic ) |
1269 { |
1300 { |
1270 CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" ) |
|
1271 // Gets the text format eap list |
1301 // Gets the text format eap list |
1272 HBufC16* eapList = WPAFieldData( EWPAEapMethod ); |
1302 HBufC16* eapList = WPAFieldData( EWPAListOfEAPs ); |
1273 |
1303 |
1274 if ( eapList != NULL && 0 < eapList->Length() ) |
1304 if ( eapList != NULL && 0 < eapList->Length() ) |
1275 { |
1305 { |
1276 // load general EAP settings If |
1306 |
1277 CEapGeneralSettings* eapGs; |
1307 // Creates the expanded eap lists |
1278 eapGs = CEapGeneralSettings::NewL( ELan, aServiceId ); |
1308 HBufC8* enabledEapList = ExpandedEapListLC( eapList, ETrue ); |
1279 CleanupStack::PushL( eapGs ); |
1309 HBufC8* disabledEapList = ExpandedEapListLC( eapList, EFalse ); |
1280 |
1310 |
1281 // get lists of enabled/disabled EAPs for the IAP |
1311 // Save enabled EAP list |
1282 RArray< TEapExpandedType > enabledEapMethods; |
1312 CMDBField<TDesC8>* wlanEnabledEapsField = static_cast<CMDBField<TDesC8>*> |
1283 RArray< TEapExpandedType > disabledEapMethods; |
1313 ( generic->GetFieldByIdL( KCDTIdWlanEnabledEaps ) ); |
1284 |
1314 wlanEnabledEapsField->SetL( enabledEapList->Des() ); |
1285 enabledEapMethods.Append( GetExpandedEapTypeIdL( *eapList ) ); |
1315 |
1286 |
1316 // Save disabled EAP list |
1287 // disabledEapMethods can be empty, SetEapMethods takes care of it, |
1317 CMDBField<TDesC8>* wlanDisabledEapsField = static_cast<CMDBField<TDesC8>*> |
1288 // only enabledEapMethods is a must with correct contents |
1318 ( generic->GetFieldByIdL( KCDTIdWlanDisabledEaps ) ); |
1289 User::LeaveIfError( eapGs->SetEapMethods( enabledEapMethods, |
1319 wlanDisabledEapsField->SetL( disabledEapList->Des() ); |
1290 disabledEapMethods ) ); |
1320 |
1291 |
1321 CleanupStack::PopAndDestroy( disabledEapList ); |
1292 CleanupStack::PopAndDestroy( eapGs ); |
1322 CleanupStack::PopAndDestroy( enabledEapList ); |
1293 } |
1323 |
1294 } |
1324 } |
1295 |
1325 } |
1296 // --------------------------------------------------------- |
1326 |
1297 // CProcessorWlan::GetExpandedEapTypeId |
1327 // --------------------------------------------------------- |
1298 // --------------------------------------------------------- |
1328 // CProcessorWlan::ExpandedEapListLC |
1299 // |
1329 // --------------------------------------------------------- |
1300 TEapExpandedType CProcessorWlan::GetExpandedEapTypeIdL( TDesC& aField ) |
1330 // |
1301 { |
1331 HBufC8* CProcessorWlan::ExpandedEapListLC( HBufC16* aEapList, TBool aEnabledNeed ) |
1332 { |
|
1333 // The eap list has a well defined form |
|
1334 // so this parser supposes this concrete form like this: |
|
1335 // "+018,-023,+026,-021,-006" |
|
1336 |
|
1337 // Lenght of a 3 digit long signed number |
|
1338 const TInt sliceLength = 4; |
|
1339 |
|
1340 // Max lenght of the resulted list. |
|
1341 // Adding one "," then divide the lenght of a slice+1 |
|
1342 TInt maxLenght = ( ( aEapList->Length()+1 ) / 5 ) * 8; |
|
1343 |
|
1344 HBufC8* expandedEapList = HBufC8::NewLC( maxLenght ); |
|
1345 |
|
1346 TInt pos = 0; |
|
1347 while ( pos + sliceLength <= aEapList->Length() ) |
|
1348 { |
|
1349 // Getting a slice |
|
1350 TPtrC16 slice = aEapList->Mid( pos, sliceLength ); |
|
1351 |
|
1352 // Checks the sign |
|
1353 if( slice[0] == '+' ) |
|
1354 { |
|
1355 if( aEnabledNeed ) |
|
1356 { |
|
1357 AddToList( expandedEapList, slice ); |
|
1358 } |
|
1359 } |
|
1360 else if( slice[0] == '-' ) |
|
1361 { |
|
1362 if( !aEnabledNeed ) |
|
1363 { |
|
1364 AddToList( expandedEapList, slice ); |
|
1365 } |
|
1366 } |
|
1367 else |
|
1368 { |
|
1369 CLOG_WRITE_FORMAT( "! Error : Wrong Eap list format %S", aEapList ); |
|
1370 } |
|
1371 |
|
1372 // Step over one slice and "," e.g. "+023," |
|
1373 pos+=5; |
|
1374 |
|
1375 } |
|
1376 if( pos != aEapList->Length() + 1) |
|
1377 { |
|
1378 CLOG_WRITE_FORMAT( "! Warning : possible wrong Eap list format %S", aEapList ); |
|
1379 } |
|
1380 |
|
1381 return expandedEapList; |
|
1382 } |
|
1383 |
|
1384 // --------------------------------------------------------- |
|
1385 // CProcessorWlan::AddToList |
|
1386 // --------------------------------------------------------- |
|
1387 // |
|
1388 void CProcessorWlan::AddToList( HBufC8* aExpandedEapList, TPtrC16 aSlice ) |
|
1389 { |
|
1390 // Fills the 8 byte form with "0xFE000000000000" |
|
1391 TBuf8<8> expandedForm; |
|
1392 expandedForm.AppendFill( 0xFE, 1 ); |
|
1393 expandedForm.AppendFill( 0x00, 6 ); |
|
1394 |
|
1395 // Leave the "sign" |
|
1396 TPtrC16 number = aSlice.Mid( 1 ); |
|
1302 TUint8 resultByte; |
1397 TUint8 resultByte; |
1303 TLex16 lex( aField.Ptr() ); |
1398 TLex16 lex( number ); |
1304 User::LeaveIfError( lex.Val( resultByte, EDecimal ) ); |
1399 |
1305 |
1400 if( KErrNone == lex.Val( resultByte, EDecimal ) ) |
1306 CLOG_WRITE_FORMAT( "CProcessorWlan::GetExpandedEapTypeIdL: EAP %d", |
1401 { |
1307 (int)resultByte ) |
1402 expandedForm.AppendFill( resultByte, 1 ); |
1308 |
1403 } |
1309 switch ( resultByte ) |
1404 else |
1310 { |
1405 { |
1311 case 0x06: |
1406 expandedForm.AppendFill( 0x00, 1 ); |
1312 { |
1407 CLOG_WRITE( "! Error : Unlexed Eap number. 0 is addded" ); |
1313 return *EapExpandedTypeGtc.GetType(); |
1408 } |
1314 } |
1409 |
1315 case 0x0d: |
1410 aExpandedEapList->Des().Append( expandedForm ); |
1316 { |
1411 } |
1317 return *EapExpandedTypeTls.GetType(); |
1412 |
1318 } |
|
1319 case 0x11: |
|
1320 { |
|
1321 return *EapExpandedTypeLeap.GetType(); |
|
1322 } |
|
1323 case 0x12: |
|
1324 { |
|
1325 return *EapExpandedTypeSim.GetType(); |
|
1326 } |
|
1327 case 0x15: |
|
1328 { |
|
1329 return *EapExpandedTypeTtls.GetType(); |
|
1330 } |
|
1331 case 0x17: |
|
1332 { |
|
1333 return *EapExpandedTypeAka.GetType(); |
|
1334 } |
|
1335 case 0x19: |
|
1336 { |
|
1337 return *EapExpandedTypePeap.GetType(); |
|
1338 } |
|
1339 case 0x1a: |
|
1340 { |
|
1341 return *EapExpandedTypeMsChapv2.GetType(); |
|
1342 } |
|
1343 case 0x2b: |
|
1344 { |
|
1345 return *EapExpandedTypeFast.GetType(); |
|
1346 } |
|
1347 case 0x01: |
|
1348 { |
|
1349 return *EapExpandedTypeProtectedSetup.GetType(); |
|
1350 } |
|
1351 case 0x62: |
|
1352 { |
|
1353 return *EapExpandedTypeTtlsPap.GetType(); |
|
1354 } |
|
1355 case 0x63: |
|
1356 { |
|
1357 return *EapExpandedPlainMsChapv2.GetType(); |
|
1358 } |
|
1359 default: |
|
1360 { |
|
1361 return *EapExpandedTypeNone.GetType(); |
|
1362 } |
|
1363 } |
|
1364 } |
|
1365 |
1413 |
1366 // --------------------------------------------------------- |
1414 // --------------------------------------------------------- |
1367 // CProcessorWlan::WPAIndex |
1415 // CProcessorWlan::WPAIndex |
1368 // --------------------------------------------------------- |
1416 // --------------------------------------------------------- |
1369 // |
1417 // |
1372 __ASSERT_ALWAYS( aFieldId >= EWPAPresharedKey && aFieldId <= EWPAUseOfPresharedKey, |
1420 __ASSERT_ALWAYS( aFieldId >= EWPAPresharedKey && aFieldId <= EWPAUseOfPresharedKey, |
1373 User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); |
1421 User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); |
1374 |
1422 |
1375 return aFieldId - 0x2000 + iDataStart; |
1423 return aFieldId - 0x2000 + iDataStart; |
1376 } |
1424 } |
1425 |
|
1377 |
1426 |
1378 // --------------------------------------------------------- |
1427 // --------------------------------------------------------- |
1379 // CProcessorWlan::WPAFieldData |
1428 // CProcessorWlan::WPAFieldData |
1380 // --------------------------------------------------------- |
1429 // --------------------------------------------------------- |
1381 // |
1430 // |
1531 else |
1580 else |
1532 { |
1581 { |
1533 return EFalse; |
1582 return EFalse; |
1534 } |
1583 } |
1535 } |
1584 } |
1536 |
|
1537 // --------------------------------------------------------- |
1585 // --------------------------------------------------------- |
1538 // CProcessorWlan::GetEapTypeIdFromSettingId |
1586 // CProcessorWlan::GetEapTypeIdFromSettingId |
1539 // --------------------------------------------------------- |
1587 // --------------------------------------------------------- |
1540 // |
1588 // |
1541 TEapExpandedType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField ) |
1589 EAPSettings::TEapType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField ) |
1542 { |
1590 { |
1543 switch ( aField ) |
1591 switch ( aField ) |
1544 { |
1592 { |
1545 case EEapGtcUsername: |
1593 case EEapGtcUsername: |
1546 case EEapGtcSessionValidityTime: |
1594 case EEapGtcSessionValidityTime: |
1547 case EEapGtcEncapsulation: |
1595 case EEapGtcEncapsulation: |
1548 { |
1596 { |
1549 return *EapExpandedTypeGtc.GetType(); |
1597 return EAPSettings::EEapGtc; |
1550 } |
1598 } |
1551 case EEapTlsUsername: |
1599 case EEapTlsUsername: |
1552 case EEapTlsRealm: |
1600 case EEapTlsRealm: |
1553 case EEapTlsVerifyServerRealm: |
1601 case EEapTlsVerifyServerRealm: |
1554 case EEapTlsRequireClientAuth: |
1602 case EEapTlsRequireClientAuth: |
1560 case EEapTlsCaCertSubjectKeyId: |
1608 case EEapTlsCaCertSubjectKeyId: |
1561 case EEapTlsCaCertIssuerName: |
1609 case EEapTlsCaCertIssuerName: |
1562 case EEapTlsCaCertSerialNumber: |
1610 case EEapTlsCaCertSerialNumber: |
1563 case EEapTlsEncapsulation: |
1611 case EEapTlsEncapsulation: |
1564 { |
1612 { |
1565 return *EapExpandedTypeTls.GetType(); |
1613 return EAPSettings::EEapTls; |
1566 } |
1614 } |
1567 case EEapLeapUsername: |
1615 case EEapLeapUsername: |
1568 case EEapLeapPassword: |
1616 case EEapLeapPassword: |
1569 case EEapLeapSessionValidityTime: |
1617 case EEapLeapSessionValidityTime: |
1570 { |
1618 { |
1571 return *EapExpandedTypeLeap.GetType(); |
1619 return EAPSettings::EEapLeap; |
1572 } |
1620 } |
1573 case EEapSimUsername: |
1621 case EEapSimUsername: |
1574 case EEapSimRealm: |
1622 case EEapSimRealm: |
1575 case EEapSimUsePseudonyms: |
1623 case EEapSimUsePseudonyms: |
1576 case EEapSimSessionValidityTime: |
1624 case EEapSimSessionValidityTime: |
1577 case EEapSimEncapsulation: |
1625 case EEapSimEncapsulation: |
1578 { |
1626 { |
1579 return *EapExpandedTypeSim.GetType(); |
1627 return EAPSettings::EEapSim; |
1580 } |
1628 } |
1581 case EEapTtlsUsername: |
1629 case EEapTtlsUsername: |
1582 case EEapTtlsRealm: |
1630 case EEapTtlsRealm: |
1583 case EEapTtlsVerifyServerRealm: |
1631 case EEapTtlsVerifyServerRealm: |
1584 case EEapTtlsRequireClientAuth: |
1632 case EEapTtlsRequireClientAuth: |
1590 case EEapTtlsUserCertSerialNumber: |
1638 case EEapTtlsUserCertSerialNumber: |
1591 case EEapTtlsCaCertSubjectKeyId: |
1639 case EEapTtlsCaCertSubjectKeyId: |
1592 case EEapTtlsCaCertIssuerName: |
1640 case EEapTtlsCaCertIssuerName: |
1593 case EEapTtlsCaCertSerialNumber: |
1641 case EEapTtlsCaCertSerialNumber: |
1594 { |
1642 { |
1595 return *EapExpandedTypeTtls.GetType(); |
1643 return EAPSettings::EEapTtls; |
1596 } |
1644 } |
1597 case EEapAkaUsername: |
1645 case EEapAkaUsername: |
1598 case EEapAkaRealm: |
1646 case EEapAkaRealm: |
1599 case EEapAkaUsePseudonyms: |
1647 case EEapAkaUsePseudonyms: |
1600 case EEapAkaSessionValidityTime: |
1648 case EEapAkaSessionValidityTime: |
1601 case EEapAkaEncapsulation: |
1649 case EEapAkaEncapsulation: |
1602 { |
1650 { |
1603 return *EapExpandedTypeAka.GetType(); |
1651 return EAPSettings::EEapAka; |
1604 } |
1652 } |
1605 case EEapPeapUsername: |
1653 case EEapPeapUsername: |
1606 case EEapPeapRealm: |
1654 case EEapPeapRealm: |
1607 case EEapPeapVerifyServerRealm: |
1655 case EEapPeapVerifyServerRealm: |
1608 case EEapPeapRequireClientAuth: |
1656 case EEapPeapRequireClientAuth: |
1617 case EEapPeapUserCertSerialNumber: |
1665 case EEapPeapUserCertSerialNumber: |
1618 case EEapPeapCaCertSubjectKeyId: |
1666 case EEapPeapCaCertSubjectKeyId: |
1619 case EEapPeapCaCertIssuerName: |
1667 case EEapPeapCaCertIssuerName: |
1620 case EEapPeapCaCertSerialNumber: |
1668 case EEapPeapCaCertSerialNumber: |
1621 { |
1669 { |
1622 return *EapExpandedTypePeap.GetType(); |
1670 return EAPSettings::EEapPeap; |
1623 } |
1671 } |
1624 case EEapMschapv2Username: |
1672 case EEapMschapv2Username: |
1625 case EEapMschapv2Password: |
1673 case EEapMschapv2Password: |
1626 case EEapMschapv2SessionValidityTime: |
1674 case EEapMschapv2SessionValidityTime: |
1627 case EEapMschapv2Encapsulation: |
1675 case EEapMschapv2Encapsulation: |
1628 { |
1676 { |
1629 return *EapExpandedTypeMsChapv2.GetType(); |
1677 return EAPSettings::EEapMschapv2; |
1630 } |
1678 } |
1631 case EEapFastUsername: |
1679 case EEapFastUsername: |
1632 case EEapFastRealm: |
1680 case EEapFastRealm: |
1633 case EEapFastVerifyServerRealm: |
1681 case EEapFastVerifyServerRealm: |
1634 case EEapFastRequireClientAuth: |
1682 case EEapFastRequireClientAuth: |
1645 case EEapFastUserCertSerialNumber: |
1693 case EEapFastUserCertSerialNumber: |
1646 case EEapFastCaCertSubjectKeyId: |
1694 case EEapFastCaCertSubjectKeyId: |
1647 case EEapFastCaCertIssuerName: |
1695 case EEapFastCaCertIssuerName: |
1648 case EEapFastCaCertSerialNumber: |
1696 case EEapFastCaCertSerialNumber: |
1649 { |
1697 { |
1650 return *EapExpandedTypeFast.GetType(); |
1698 return EAPSettings::EEapFast; |
1651 } |
1699 } |
1652 |
1700 |
1653 case EMschapv2Username: |
1701 case EMschapv2Username: |
1654 case EMschapv2Password: |
1702 case EMschapv2Password: |
1655 case EMschapv2SessionValidityTime: |
1703 case EMschapv2SessionValidityTime: |
1656 case EMschapv2Encapsulation: |
1704 case EMschapv2Encapsulation: |
1657 { |
1705 { |
1658 return *EapExpandedPlainMsChapv2.GetType(); |
1706 return EAPSettings::EPlainMschapv2; |
1659 } |
1707 } |
1660 default: |
1708 default: |
1661 { |
1709 { |
1662 return *EapExpandedTypeNone.GetType(); |
1710 return EAPSettings::EEapNone; |
1663 } |
1711 } |
1664 |
1712 |
1665 } |
1713 } |
1666 } |
1714 } |
1667 |
|
1668 // --------------------------------------------------------- |
1715 // --------------------------------------------------------- |
1669 // CProcessorWlan::AddEAPSetting |
1716 // CProcessorWlan::AddEAPSetting |
1670 // --------------------------------------------------------- |
1717 // --------------------------------------------------------- |
1671 // |
1718 // |
1672 void CProcessorWlan::AddEAPSettingL( const TInt aField, HBufC16* aValue ) |
1719 void CProcessorWlan::AddEAPSettingL( const TInt aField, const HBufC16* const aValue ) |
1673 { |
1720 { |
1674 TEapExpandedType eapId = GetEapTypeIdFromSettingId( aField ); |
1721 EAPSettings::TEapType eapId = GetEapTypeIdFromSettingId( aField ); |
1675 if ( eapId == *EapExpandedTypeNone.GetType() ) |
1722 if ( eapId == EAPSettings::EEapNone ) |
1676 { |
1723 { |
1677 CLOG_WRITE( "! Error : Unknown EAP method" ); |
1724 CLOG_WRITE( "! Error : Unknown EAP method" ); |
1678 User::Leave( KErrArgument ); |
1725 User::Leave( KErrArgument ); |
1679 } |
1726 } |
1680 |
1727 |
1681 TInt eapIndex(0); |
1728 TInt eapIndex(0); |
1682 // Search if the EAP instance already exists in the array for this |
1729 // Search if the EAP instance already exists in the array for this |
1683 for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ ) |
1730 for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ ) |
1684 { |
1731 { |
1685 if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPExpandedType == eapId ) |
1732 if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPType == eapId ) |
1686 && ( iEapSettings[eapIndex]->iName != NULL ) |
1733 && ( iEapSettings[eapIndex]->iName != NULL ) |
1687 && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 )) |
1734 && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 )) |
1688 { |
1735 { |
1689 // Found it |
1736 // Found it |
1690 break; |
1737 break; |
1697 CEapTypeElement* newEap = new (ELeave) CEapTypeElement; |
1744 CEapTypeElement* newEap = new (ELeave) CEapTypeElement; |
1698 CleanupStack::PushL( newEap ); |
1745 CleanupStack::PushL( newEap ); |
1699 |
1746 |
1700 newEap->iEapSettings = new (ELeave) EAPSettings; |
1747 newEap->iEapSettings = new (ELeave) EAPSettings; |
1701 |
1748 |
1702 newEap->iEapSettings->iEAPExpandedType = eapId; |
1749 newEap->iEapSettings->iEAPType = eapId; |
1703 |
1750 |
1704 newEap->iName = iName->AllocL(); |
1751 newEap->iName = iName->AllocL(); |
1705 |
1752 |
1706 iEapSettings.AppendL(newEap); |
1753 iEapSettings.AppendL(newEap); |
1707 |
1754 |
1724 case EEapFastUsername: |
1771 case EEapFastUsername: |
1725 case EMschapv2Username: |
1772 case EMschapv2Username: |
1726 { |
1773 { |
1727 iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue; |
1774 iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue; |
1728 iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue ); |
1775 iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue ); |
1729 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsernamePresent = ETrue; |
|
1730 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; |
|
1731 break; |
1776 break; |
1732 } |
1777 } |
1733 |
1778 |
1734 case EEapLeapPassword: |
1779 case EEapLeapPassword: |
1735 case EEapMschapv2Password: |
1780 case EEapMschapv2Password: |
1736 case EMschapv2Password: |
1781 case EMschapv2Password: |
1737 { |
1782 { |
1738 iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue; |
1783 iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue; |
1739 iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue ); |
1784 iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue ); |
1740 iEapSettings[eapIndex]->iEapSettings->iShowPassWordPromptPresent = ETrue; |
|
1741 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; |
|
1742 break; |
1785 break; |
1743 } |
1786 } |
1744 |
1787 |
1745 case EEapTlsRealm: |
1788 case EEapTlsRealm: |
1746 case EEapSimRealm: |
1789 case EEapSimRealm: |
1748 case EEapAkaRealm: |
1791 case EEapAkaRealm: |
1749 case EEapPeapRealm: |
1792 case EEapPeapRealm: |
1750 case EEapFastRealm: |
1793 case EEapFastRealm: |
1751 { |
1794 { |
1752 iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue; |
1795 iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue; |
1753 iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue ); |
1796 iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue ); |
1754 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealmPresent = ETrue; |
|
1755 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealm = EFalse; |
|
1756 break; |
1797 break; |
1757 } |
1798 } |
1758 |
1799 |
1759 case EEapGtcSessionValidityTime: |
1800 case EEapGtcSessionValidityTime: |
1760 case EEapTtlsSessionValidityTime: |
1801 case EEapTtlsSessionValidityTime: |
1770 // Convert the input parameter to integer |
1811 // Convert the input parameter to integer |
1771 TLex lex( *aValue ); |
1812 TLex lex( *aValue ); |
1772 TUint value( 0 ); |
1813 TUint value( 0 ); |
1773 if( lex.Val( value, EDecimal) != KErrNone ) |
1814 if( lex.Val( value, EDecimal) != KErrNone ) |
1774 { |
1815 { |
1775 CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId.GetVendorType() ); |
1816 CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId ); |
1776 User::Leave( KErrArgument ); |
1817 User::Leave( KErrArgument ); |
1777 } |
1818 } |
1778 |
1819 |
1779 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTimePresent = ETrue; |
1820 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTimePresent = ETrue; |
1780 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTime = value; |
1821 iEapSettings[eapIndex]->iEapSettings->iSessionValidityTime = value; |
1790 { |
1831 { |
1791 TLex lex( *aValue ); |
1832 TLex lex( *aValue ); |
1792 TUint eapTypeId( 0 ); |
1833 TUint eapTypeId( 0 ); |
1793 if( lex.Val( eapTypeId, EDecimal) != KErrNone ) |
1834 if( lex.Val( eapTypeId, EDecimal) != KErrNone ) |
1794 { |
1835 { |
1795 CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId.GetVendorType() ); |
1836 CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId ); |
1796 User::Leave( KErrArgument ); |
1837 User::Leave( KErrArgument ); |
1797 } |
1838 } |
1798 iEapSettings[eapIndex]->iEncapsulatingEapId.SetValue( eapId.GetVendorId(), eapTypeId ); |
1839 |
1840 iEapSettings[eapIndex]->iEncapsulatingEapId = static_cast< EAPSettings::TEapType >( eapTypeId ); |
|
1799 break; |
1841 break; |
1800 } |
1842 } |
1801 |
1843 |
1802 case EEapTlsVerifyServerRealm: |
1844 case EEapTlsVerifyServerRealm: |
1803 case EEapTtlsVerifyServerRealm: |
1845 case EEapTtlsVerifyServerRealm: |
1814 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; |
1856 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; |
1815 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = EFalse; |
1857 iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = EFalse; |
1816 } |
1858 } |
1817 else |
1859 else |
1818 { |
1860 { |
1819 CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId.GetVendorType() ); |
1861 CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId ); |
1820 User::Leave( KErrArgument ); |
1862 User::Leave( KErrArgument ); |
1821 } |
1863 } |
1822 |
1864 |
1823 break; |
1865 break; |
1824 } |
1866 } |
1838 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; |
1880 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; |
1839 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = EFalse; |
1881 iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = EFalse; |
1840 } |
1882 } |
1841 else |
1883 else |
1842 { |
1884 { |
1843 CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId.GetVendorType() ); |
1885 CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId ); |
1844 User::Leave( KErrArgument ); |
1886 User::Leave( KErrArgument ); |
1845 } |
1887 } |
1846 |
1888 |
1847 break; |
1889 break; |
1848 } |
1890 } |
1853 case EEapFastCipherSuites: |
1895 case EEapFastCipherSuites: |
1854 { |
1896 { |
1855 TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) ); |
1897 TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) ); |
1856 if( err != KErrNone ) |
1898 if( err != KErrNone ) |
1857 { |
1899 { |
1858 CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId.GetVendorType() ); |
1900 CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId ); |
1859 User::Leave( KErrArgument ); |
1901 User::Leave( KErrArgument ); |
1860 } |
1902 } |
1861 break; |
1903 break; |
1862 } |
1904 } |
1863 |
1905 |
1864 case EEapTlsUserCertSubjectKeyId: |
1906 case EEapTlsUserCertSubjectKeyId: |
1865 case EEapTtlsUserCertSubjectKeyId: |
1907 case EEapTtlsUserCertSubjectKeyId: |
1866 case EEapPeapUserCertSubjectKeyId: |
1908 case EEapPeapUserCertSubjectKeyId: |
1867 case EEapFastUserCertSubjectKeyId: |
1909 case EEapFastUserCertSubjectKeyId: |
1868 { |
1910 { |
1869 TInt certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); |
1911 TInt certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex ); |
1870 |
1912 |
1871 TKeyIdentifier key; |
1913 TBuf<KKeyIdentifierLength> key; |
1872 |
1914 |
1873 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1915 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1874 if( err != KErrNone ) |
1916 if( err != KErrNone ) |
1875 { |
1917 { |
1876 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); |
1918 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId ); |
1877 User::Leave( KErrArgument ); |
1919 User::Leave( KErrArgument ); |
1878 } |
1920 } |
1879 |
1921 |
1880 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1922 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1881 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1923 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key); |
1882 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); |
1924 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue; |
1883 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); |
|
1884 break; |
1925 break; |
1885 } |
1926 } |
1886 |
1927 |
1887 case EEapTlsUserCertIssuerName: |
1928 case EEapTlsUserCertIssuerName: |
1888 case EEapTtlsUserCertIssuerName: |
1929 case EEapTtlsUserCertIssuerName: |
1889 case EEapPeapUserCertIssuerName: |
1930 case EEapPeapUserCertIssuerName: |
1890 case EEapFastUserCertIssuerName: |
1931 case EEapFastUserCertIssuerName: |
1891 { |
1932 { |
1892 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); |
1933 TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex ); |
1893 |
1934 |
1894 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1935 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1895 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1936 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue; |
1896 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); |
1937 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue ); |
1897 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); |
|
1898 break; |
1938 break; |
1899 } |
1939 } |
1900 |
1940 |
1901 case EEapTlsUserCertSerialNumber: |
1941 case EEapTlsUserCertSerialNumber: |
1902 case EEapTtlsUserCertSerialNumber: |
1942 case EEapTtlsUserCertSerialNumber: |
1903 case EEapPeapUserCertSerialNumber: |
1943 case EEapPeapUserCertSerialNumber: |
1904 case EEapFastUserCertSerialNumber: |
1944 case EEapFastUserCertSerialNumber: |
1905 { |
1945 { |
1906 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); |
1946 TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex ); |
1907 |
1947 |
1908 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1948 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1909 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1949 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue; |
1910 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); |
1950 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue ); |
1911 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); |
|
1912 break; |
1951 break; |
1913 } |
1952 } |
1914 |
1953 |
1915 case EEapTlsCaCertSubjectKeyId: |
1954 case EEapTlsCaCertSubjectKeyId: |
1916 case EEapTtlsCaCertSubjectKeyId: |
1955 case EEapTtlsCaCertSubjectKeyId: |
1917 case EEapPeapCaCertSubjectKeyId: |
1956 case EEapPeapCaCertSubjectKeyId: |
1918 case EEapFastCaCertSubjectKeyId: |
1957 case EEapFastCaCertSubjectKeyId: |
1919 { |
1958 { |
1920 TInt certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); |
1959 TInt certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex ); |
1921 |
1960 |
1922 TKeyIdentifier key; |
1961 TBuf<KKeyIdentifierLength> key; |
1923 |
1962 |
1924 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1963 TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); |
1925 if( err != KErrNone ) |
1964 if( err != KErrNone ) |
1926 { |
1965 { |
1927 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); |
1966 CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId ); |
1928 User::Leave( KErrArgument ); |
1967 User::Leave( KErrArgument ); |
1929 } |
1968 } |
1930 |
1969 |
1931 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1970 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1932 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1971 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key); |
1933 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); |
1972 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue; |
1934 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); |
|
1935 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; |
|
1936 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; |
|
1937 break; |
1973 break; |
1938 } |
1974 } |
1939 |
1975 |
1940 case EEapTlsCaCertIssuerName: |
1976 case EEapTlsCaCertIssuerName: |
1941 case EEapTtlsCaCertIssuerName: |
1977 case EEapTtlsCaCertIssuerName: |
1942 case EEapPeapCaCertIssuerName: |
1978 case EEapPeapCaCertIssuerName: |
1943 case EEapFastCaCertIssuerName: |
1979 case EEapFastCaCertIssuerName: |
1944 { |
1980 { |
1945 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); |
1981 TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex ); |
1946 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1982 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1947 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1983 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue; |
1948 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerNamePresent(); |
1984 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue ); |
1949 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); |
|
1950 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; |
|
1951 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; |
|
1952 |
1985 |
1953 break; |
1986 break; |
1954 } |
1987 } |
1955 |
1988 |
1956 case EEapTlsCaCertSerialNumber: |
1989 case EEapTlsCaCertSerialNumber: |
1957 case EEapTtlsCaCertSerialNumber: |
1990 case EEapTtlsCaCertSerialNumber: |
1958 case EEapPeapCaCertSerialNumber: |
1991 case EEapPeapCaCertSerialNumber: |
1959 case EEapFastCaCertSerialNumber: |
1992 case EEapFastCaCertSerialNumber: |
1960 { |
1993 { |
1961 TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); |
1994 TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex ); |
1962 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1995 iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; |
1963 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); |
1996 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue; |
1964 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); |
1997 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue ); |
1965 iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); |
|
1966 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; |
|
1967 iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; |
|
1968 break; |
1998 break; |
1969 } |
1999 } |
1970 |
2000 |
1971 case EEapSimUsePseudonyms: |
2001 case EEapSimUsePseudonyms: |
1972 case EEapAkaUsePseudonyms: |
2002 case EEapAkaUsePseudonyms: |
1981 iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; |
2011 iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; |
1982 iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = EFalse; |
2012 iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = EFalse; |
1983 } |
2013 } |
1984 else |
2014 else |
1985 { |
2015 { |
1986 CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId.GetVendorType() ); |
2016 CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId ); |
1987 User::Leave( KErrArgument ); |
2017 User::Leave( KErrArgument ); |
1988 } |
2018 } |
1989 break; |
2019 break; |
1990 } |
2020 } |
1991 |
2021 |
1992 case EEapTtlsEncapsulatedTypes: |
2022 case EEapTtlsEncapsulatedTypes: |
1993 case EEapPeapEncapsulatedTypes: |
2023 case EEapPeapEncapsulatedTypes: |
1994 case EEapFastEncapsulatedTypes: |
2024 case EEapFastEncapsulatedTypes: |
1995 { |
2025 { |
1996 iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( GetExpandedEapTypeIdL( *aValue ) ); |
2026 // Lenght of a 3 digit long signed number |
1997 iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; |
2027 const TInt sliceLength = 4; |
2028 |
|
2029 TInt pos = 0; |
|
2030 while ( pos + sliceLength <= aValue->Length() ) |
|
2031 { |
|
2032 // Getting a slice |
|
2033 TPtrC16 slice = aValue->Mid( pos, sliceLength ); |
|
2034 |
|
2035 // Checks the sign |
|
2036 if( slice[0] == '+' ) |
|
2037 { |
|
2038 TLex lex( slice.Ptr() + 1 ); |
|
2039 TUint encapsEapId( 0 ); |
|
2040 |
|
2041 if( lex.Val( encapsEapId, EDecimal) != KErrNone ) |
|
2042 { |
|
2043 CLOG_WRITE_FORMAT( "! Error : Invalid EncapsulatedTypes. EapId: %d", eapId ); |
|
2044 User::Leave( KErrArgument ); |
|
2045 } |
|
2046 |
|
2047 iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypes.Append( encapsEapId ); |
|
2048 iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypesPresent = ETrue; |
|
2049 } |
|
2050 |
|
2051 // Step over one slice and "," e.g. "+023," |
|
2052 pos+=5; |
|
2053 } |
|
2054 |
|
1998 break; |
2055 break; |
1999 } |
2056 } |
2000 |
2057 |
2001 case EEapPeapV0Allowed: |
2058 case EEapPeapV0Allowed: |
2002 { |
2059 { |
2010 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2067 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2011 iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = EFalse; |
2068 iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = EFalse; |
2012 } |
2069 } |
2013 else |
2070 else |
2014 { |
2071 { |
2015 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId.GetVendorType() ); |
2072 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId ); |
2016 User::Leave( KErrArgument ); |
2073 User::Leave( KErrArgument ); |
2017 } |
2074 } |
2018 |
2075 |
2019 break; |
2076 break; |
2020 } |
2077 } |
2031 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2088 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2032 iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = EFalse; |
2089 iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = EFalse; |
2033 } |
2090 } |
2034 else |
2091 else |
2035 { |
2092 { |
2036 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId.GetVendorType() ); |
2093 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId ); |
2037 User::Leave( KErrArgument ); |
2094 User::Leave( KErrArgument ); |
2038 } |
2095 } |
2039 |
2096 |
2040 break; |
2097 break; |
2041 } |
2098 } |
2052 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2109 iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; |
2053 iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = EFalse; |
2110 iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = EFalse; |
2054 } |
2111 } |
2055 else |
2112 else |
2056 { |
2113 { |
2057 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId.GetVendorType() ); |
2114 CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId ); |
2058 User::Leave( KErrArgument ); |
2115 User::Leave( KErrArgument ); |
2059 } |
2116 } |
2060 |
2117 |
2061 break; |
2118 break; |
2062 } |
2119 } |
2073 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; |
2130 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; |
2074 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = EFalse; |
2131 iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = EFalse; |
2075 } |
2132 } |
2076 else |
2133 else |
2077 { |
2134 { |
2078 CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); |
2135 CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId ); |
2079 User::Leave( KErrArgument ); |
2136 User::Leave( KErrArgument ); |
2080 } |
2137 } |
2081 |
2138 |
2082 break; |
2139 break; |
2083 } |
2140 } |
2095 iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = EFalse; |
2152 iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = EFalse; |
2096 } |
2153 } |
2097 else |
2154 else |
2098 { |
2155 { |
2099 |
2156 |
2100 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); |
2157 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId ); |
2101 User::Leave( KErrArgument ); |
2158 User::Leave( KErrArgument ); |
2102 } |
2159 } |
2103 |
2160 |
2104 break; |
2161 break; |
2105 } |
2162 } |
2116 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; |
2173 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; |
2117 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = EFalse; |
2174 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = EFalse; |
2118 } |
2175 } |
2119 else |
2176 else |
2120 { |
2177 { |
2121 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId.GetVendorType() ); |
2178 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId ); |
2122 User::Leave( KErrArgument ); |
2179 User::Leave( KErrArgument ); |
2123 } |
2180 } |
2124 |
2181 |
2125 break; |
2182 break; |
2126 } |
2183 } |
2137 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; |
2194 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; |
2138 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = EFalse; |
2195 iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = EFalse; |
2139 } |
2196 } |
2140 else |
2197 else |
2141 { |
2198 { |
2142 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId.GetVendorType() ); |
2199 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId ); |
2143 User::Leave( KErrArgument ); |
2200 User::Leave( KErrArgument ); |
2144 } |
2201 } |
2145 |
2202 |
2146 break; |
2203 break; |
2147 } |
2204 } |
2158 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; |
2215 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; |
2159 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = EFalse; |
2216 iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = EFalse; |
2160 } |
2217 } |
2161 else |
2218 else |
2162 { |
2219 { |
2163 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId.GetVendorType() ); |
2220 CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId ); |
2164 User::Leave( KErrArgument ); |
2221 User::Leave( KErrArgument ); |
2165 } |
2222 } |
2166 |
2223 |
2167 break; |
2224 break; |
2168 } |
2225 } |
2209 |
2266 |
2210 // --------------------------------------------------------- |
2267 // --------------------------------------------------------- |
2211 // CProcessorWlan::FindCertificateEntry |
2268 // CProcessorWlan::FindCertificateEntry |
2212 // --------------------------------------------------------- |
2269 // --------------------------------------------------------- |
2213 // |
2270 // |
2214 TUint CProcessorWlan::FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex ) |
2271 TUint CProcessorWlan::FindCertificateEntryL( const CertificateEntry::TCertType aCertType, const TInt aEapIndex ) |
2215 { |
2272 { |
2216 TUint certIndex( 0 ); |
2273 TUint certIndex( 0 ); |
2217 for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ ) |
2274 for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ ) |
2218 { |
2275 { |
2219 if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex]->GetCertType() == aCertType ) |
2276 if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex].iCertType == aCertType ) |
2220 { |
2277 { |
2221 // Found |
2278 // Found |
2222 break; |
2279 break; |
2223 } |
2280 } |
2224 } |
2281 } |
2225 if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ) |
2282 if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ) |
2226 { |
2283 { |
2227 // Not found. Create |
2284 // Not found. Create |
2228 EapCertificateEntry* entry; |
2285 CertificateEntry entry; |
2229 entry = new (ELeave) EapCertificateEntry; |
2286 |
2230 entry->SetCertType( aCertType ); |
2287 entry.iCertType = aCertType; |
2231 |
2288 |
2232 iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry ); |
2289 iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry ); |
2233 |
2290 |
2234 certIndex = iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() - 1; |
2291 certIndex = iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() - 1; |
2235 } |
2292 } |
2238 |
2295 |
2239 // --------------------------------------------------------- |
2296 // --------------------------------------------------------- |
2240 // CProcessorWlan::ConvertSubjectKeyIdToBinary |
2297 // CProcessorWlan::ConvertSubjectKeyIdToBinary |
2241 // --------------------------------------------------------- |
2298 // --------------------------------------------------------- |
2242 // |
2299 // |
2243 void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey) |
2300 void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TDes& aBinaryKey) |
2244 { |
2301 { |
2245 TInt err( KErrNone ); |
2302 TInt err( KErrNone ); |
2246 |
2303 |
2247 // Define literals to search the subject key for possible 0X/0x beginning |
2304 // Define literals to search the subject key for possible 0X/0x beginning |
2248 _LIT(KHexIdLC, "0x"); |
2305 _LIT(KHexIdLC, "0x"); |