×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    48

    how to write WEP key correctly???

    hi,I've been able to create a WLAN access point,but WEP key is created as 64-bit ascii,my router's configuration as 128-bit ascii.anyone can tell me how to format WEP key correctly.Thanks advance.
    my code as follows:
    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("NewIAP"));
    wlanAp->SetBearerTypeL(EApBearerTypeWLAN);
    wlanAp->WriteTextL(EApWlanNetworkName, _L("NewIAP")); // 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;

    keyData.Copy(_L("12345678"));

    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);
    }


    // 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
    Registered User
    Join Date
    Oct 2008
    Posts
    48

    Re: how to write WEP key correctly???

    Is there nobody who can answer me?Or my question is too easy for you to answer?I've been looking for the solutions for long time,but I can't find any details.I need some advice or help,thans a lot

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    47

    Re: how to write WEP key correctly???

    Hi,
    64-bits or 128-bits is the encryption type of WEP key. There is macro WLAN_SECURITY_MODE defined in wlancdbcols.h.
    Try to set this value in WLAN service table. I have not tried this solution so it will be on trial and error basis solution. Most likely you have to use WriteUintL() with 128 as aValue and then set your keydata.

    Thanks,
    Yogesh

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    48

    Re: how to write WEP key correctly???

    Quote Originally Posted by yddusane View Post
    Hi,
    64-bits or 128-bits is the encryption type of WEP key. There is macro WLAN_SECURITY_MODE defined in wlancdbcols.h.
    Try to set this value in WLAN service table. I have not tried this solution so it will be on trial and error basis solution. Most likely you have to use WriteUintL() with 128 as aValue and then set your keydata.

    Thanks,
    Yogesh

    Thank you very much!I'll try your advice

Similar Threads

  1. capture short key and long key
    By kkrish in forum Symbian
    Replies: 4
    Last Post: 2010-02-09, 04:48
  2. Replies: 8
    Last Post: 2009-01-24, 06:00
  3. WEP key of WLAN IAP?
    By chishti_hameed in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2006-10-23, 21:03
  4. GameCanvas Middle Soft Key Problem
    By nnigel in forum Mobile Java General
    Replies: 5
    Last Post: 2006-06-27, 11:14
  5. wep network key for my 6600
    By matnss in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-03-29, 20:55

Posting Permissions

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