×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Karachi, Pakistan
    Posts
    98

    Creating WLAN IAP with WEP 128 bit

    Hi,

    I have successfully create WLAN IAP with WEP Security having 64 bit key in HEX format. I used WLAN Management API and on checking wlancdbcols.h I am unable to find any column entry to define 128/64 bit key. For 64 bit key we don't need to define any thing but when we are define key larger than 10 characters (HEX Formatted) for 128 bit key, it trimmed to only 1 character.

    How can we define 128 bit WEP key?

    Following is the code take from WLanSampleEx and modified for HEX format;

    void CWLanSampleExAppUi::CreateAccessPointL()
    {
    TInt errorCode;
    TInt error;
    CCommsDatabase* db = CCommsDatabase::NewL();
    CleanupStack::PushL(db);
    TInt err = db->BeginTransaction();

    // Create a wlan AP and fill its mandatory fields.
    CApAccessPointItem* wlanAp = CApAccessPointItem::NewLC();
    CApAccessPointItem* wlanNewItem=CApAccessPointItem::NewLC();


    wlanAp->SetNamesL(_L("mynet"));
    wlanAp->SetBearerTypeL(EApBearerTypeWLAN);
    wlanAp->WriteTextL(EApWlanNetworkName, _L("My Network")); // Give corrct Data as per the router configuration //L!nkSys@MdpNok!a

    //Security mode should be 2 for WEP network
    //1 for Open network
    //4 for E802_1x
    //8 for EWpa
    //16 for EWpa2
    wlanAp->WriteUint(EApWlanSecurityMode,2);

    //Lan network mode should be 1 for infrastructure, 0 for adhoc
    wlanAp->WriteUint(EApWlanNetworkMode,1);


    // Store it into the iDb.
    TBool val =ETrue;
    TUint32 newalanid;

    CApDataHandler* handler = CApDataHandler::NewLC(*db);
    TUint32 apid;
    apid = handler->CreateFromDataL(*wlanAp);
    handler->UpdateAccessPointDataL(*wlanAp,val);
    handler->AccessPointDataL(apid,*wlanNewItem);
    wlanNewItem->ReadUint( EApIapServiceId, newalanid );
    wlanNewItem->ReadTextL( EApWlanNetworkName, ibuff );


    TBuf8<50> keyData;

    //this works fine for ASCII, but for HEX it trimmed down to 1 character
    // keyData.Copy(_L("5F89AE0A3B9D5C1123F81F0A41")); // Give corrct Data as per the router configuration
    keyData.Copy(_L("DFCDFF4E22")); // Give corrct Data as per the router configuration

    CCommsDbTableView* wLanServiceTable = db->OpenViewMatchingUintLC(
    TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), newalanid );
    errorCode = wLanServiceTable->GotoFirstRecord();


    if ( errorCode == KErrNone )
    {
    wLanServiceTable->UpdateRecord();
    }
    else
    {
    TUint32 dummyUid( KUidNone );
    User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) );
    // Save link to LAN service
    wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), apid );
    }


    //changing format from default ASCII to HEX, here 0 is ASCII and 1 is HEX
    wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ), 1);
    wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY2_FORMAT ), 1);
    wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY3_FORMAT ), 1);
    wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY4_FORMAT ), 1);


    // Save first WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY1 ),
    keyData ));
    // Save second WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY2 ),
    keyData ));
    // Save third WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY3 ),
    keyData ));
    // Save fourth WEP key
    TRAP(error,wLanServiceTable->WriteTextL( TPtrC( WLAN_WEP_KEY4 ),
    keyData ));

    wLanServiceTable->PutRecordChanges();
    err = db->CommitTransaction(); // // End a transaction. Call after `InsertRecord()` or `UpdateRecord()`.
    CleanupStack::PopAndDestroy(5);

    }

  2. #2
    Regular Contributor
    Join Date
    Sep 2008
    Location
    Karachi, Pakistan
    Posts
    98

    Smile Re: Creating WLAN IAP with WEP 128 bit

    The code sample posted in last post is working. The issue was that if we have any Enum values for ASCII and HEX like

    enum TWlanType {ASCII, HEX};
    TWlanType type;

    and we use

    type = HEX;

    wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ),( TUint32& ) type);

    The this creates HEX 64 bit format, but if we use following statement:

    wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ), 1);

    it creates HEX 128 bit format.

Similar Threads

  1. 128 bit UUID
    By DanielAspel in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-10-11, 19:47
  2. S60 2'nd ed refuses using 128 bit keys
    By mpo in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-09-01, 09:43
  3. E60 with WLAN and WEP 128 Bit
    By jens070365 in forum Wired and Wireless interfaces (Closed)
    Replies: 3
    Last Post: 2006-09-01, 08:11
  4. 128 bit SSL and the Nokia 9210 Communicator
    By nkn_winston in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2002-09-10, 13:16
  5. 128 bit SSL and the Nokia 9210 Communicator
    By nkn_winston in forum Symbian
    Replies: 0
    Last Post: 2001-11-08, 16:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×