×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Apr 2009
    Location
    Madrid, Spain
    Posts
    13

    CSecureSocket::StartClientHandShake returns -46

    Hi everybody,

    I'm having some troubles to make a secure connection.
    This is how i prepare secure connection:

    Code:
    iTlsSocket = CSecureSocket::NewL(iSocket,_L("TLS1.0"));
    iTlsSocket->FlushSessionCache();
    iTlsSocket->SetDialogMode(EDialogModeAttended);
    iTlsSocket->SetOpt(KSoSSLDomainName,KSolInetSSL,host);
    iTlsSocket->StartClientHandshake(iStatus);
    SetActive();
    I'm using ActiveObject.

    On emulator it works, but when a i try to connect to a server in a real device, RunL method return error -46 (KErrPermissionDenied).
    When i'm trying to connect to the same server manually via Symbian Web Explorer it ask me about starting the secure connection, and then it connects.

    i was be able to connect to my own local web server via WIFI installing self-signed server certificate on device. It says that cerficate isn't secure but it lets me go ahead.
    However when i try to connect to a real secure server this code fails with error -46.

    am i missing something?
    I'm testing with Nokia C7-00.
    i tested this code a year ago on S60 3rd Edition device and i don't remembee have this problem.
    do i have to make changes to get this work on Symbian^3 devices?

    Any idea?

    Thanks!!

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: CSecureSocket::StartClientHandShake returns -46

    Check the logfile of the emulator (http://www.developer.nokia.com/Commu...i/Epocwind.out) for platform security warnings.
    There is a chance that the SetOpt failed already, generally it is a good idea to always check return codes of methods having one.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Location
    Madrid, Spain
    Posts
    13

    Re: CSecureSocket::StartClientHandShake returns -46

    Hi wizard_hu,
    Thanks for your answer.

    SetOpt returns KErrNone (i'm checking it now).
    And about Epocwind.out ... i don't see any secutity warnings.
    However it's true that i don't know exactly what to look for in this file.
    I've search for "security", "warning", "error", "sec", "err", "war", etc. and i didn't see any that could explain connection problem in device.

    What is getting me crazy is why works with an untrusted server (with security warnings that user must accept) in my LAN, and with a trusted server like "versign.es" StartClientHandshake returns KErrPermissionDenied.
    And why when i start a secure connection (https) with the bult-in phone web explorer it always ask me "Start secure connection?"
    Maybe i'm skipping this step programatically and that's the origin of KErrPermissionDenied.
    However i don´t see where i can enable user interaction but CSecureSocket::SetDialogMode()

    Thanks for your help

  4. #4
    Registered User
    Join Date
    Apr 2009
    Location
    Madrid, Spain
    Posts
    13

    Re: CSecureSocket::StartClientHandShake returns -46

    Ok, i read the link you provided.
    Now i know what to look for :P
    i'll tell you if i found any warning in Epocwind.out
    Thanks

  5. #5
    Registered User
    Join Date
    Apr 2009
    Location
    Madrid, Spain
    Posts
    13

    Re: CSecureSocket::StartClientHandShake returns -46

    No luck
    No Platform Security warnings

  6. #6
    Registered User
    Join Date
    Apr 2009
    Location
    Madrid, Spain
    Posts
    13

    Re: CSecureSocket::StartClientHandShake returns -46

    Solved!

    Searching if this was a C7-00 or Symbian^3 known issue i found this:
    http://www.developer.nokia.com/Commu...-(N8)-devices.
    (Sorry if it's forbidden to place external links on this forum)

    This says you must add "ReadUserData" capability.
    However i never read this was a requisite to use CSecureSocket.
    Maybe it's written somewhere so i wont say its undocumented.

    By the way, adding ReadUserData capability solves the problem
    Last edited by wizard_hu_; 2011-11-18 at 11:48. Reason: Replaced boardreader link with an internal one

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: CSecureSocket::StartClientHandShake returns -46

    platsec is a good keyword when searching for messages in the file.
    Do you have WriteDeviceData and NetworkServices capabilites? WriteDeviceData is required for this SetOpt magic as I remember, and NetworkServices is certainly required for networking.

    EDIT: external links are not forbidden, just boardreader simply steals content and presents it in a less-readable form in addition (at least these are my personal opinions), the discussion actually happened on this site.
    EDIT2: nice finding by the way.
    Last edited by wizard_hu_; 2011-11-18 at 11:52.

Similar Threads

  1. CSecureSocket::StartClientHandshake fails with -7510
    By mtaponen in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2010-10-13, 09:31
  2. CSecureSocket - StartClientHandShake fails
    By chengguangguo in forum Symbian Networking & Messaging (Closed)
    Replies: 21
    Last Post: 2008-11-06, 10:23
  3. CSEcureSocket::StartClientHandshake, trouble in emulator
    By cartman_ume in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2007-05-21, 20:42
  4. Problem with CSecureSocket StartClientHandShake
    By chengguangguo in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-02-20, 05:27
  5. CSecureSocket::StartClientHandshake horribly slow
    By glarock in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2003-11-08, 03:00

Posting Permissions

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