Hi
I was making a TLS connection with S60 3 FP1 - sdk and stumbled onto this:
I keep getting KErrSSLAlertUnexpectedMessage both in emulator & HW.
So the socket connects nicely over Winsock in emulator. Then the StartClienthandshake always comes up with status -7510.
There were some posting on other error codes ans older platform versions but if someone has actually asked this please point me to the answer
Just in case I missed/messed something bad - here is stripped down example code which I can be triggered by constucting the object from UI your facourite event - port & address is hardcoded:
And here is the class definition:Code:CSecureConnector::CSecureConnector() : CActive(CActive::EPriorityStandard) { } CSecureConnector::~CSecureConnector() { } CSecureConnector* CSecureConnector::CSecureConnector::NewL() { CSecureConnector* self = new (ELeave) CSecureConnector(); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(); return self; } void CSecureConnector::ConstructL() { CActiveScheduler::Add(this); CAknInformationNote* note = new ( ELeave ) CAknInformationNote; TNameEntry nameEntry; TInt err; iPrefs.SetDialogPreference( ECommDbDialogPrefPrompt ); err = iSession.Connect(); RDebug::Print(_L("iSession.Connect %d"), err); RHostResolver resolver; if (err == KErrNone) { iConnection.Open( iSession ); iConnection.Start(iPrefs); // err = resolver.Open( iSession, KAfInet, KProtocolInetUdp, iConnection ) ; iErrorText.Format(_L("resolver.Open %d"), err); RDebug::Print(iErrorText); } if (err == KErrNone) { err = resolver.GetByName( _L("myhost.here"), nameEntry ); iErrorText.Format(_L("resolver.GetByName %d"), err); RDebug::Print(iErrorText); } if (err == KErrNone) { TInt32 aAddr = TInetAddr::Cast( nameEntry().iAddr ).Address(); iAddress.SetPort( 447 ); // Put your favourite SSL port here iAddress.SetAddress( aAddr ); RDebug::Print(_L("CXmppConnection::ResolveHostL aAddr = 0x%x"), aAddr); resolver.Close(); err = iSocket.Open( iSession, KAfInet, KSockStream, KProtocolInetTcp, iConnection ); iErrorText.Format(_L("iSocket.Open %d"), err); RDebug::Print(iErrorText); } if (err == KErrNone) { RDebug::Print(_L("iSocket.Connect")); iSocket.Connect( iAddress, iStatus ); RDebug::Print(_L("iSocket.Connect ok")); User::WaitForRequest(iStatus); // I know this is not good practice here I liked to simplify this down. //So please make active object with states as I'm doing with my real implementation iErrorText.Format(_L("iSocket.Connect status %d "), iStatus); RDebug::Print(iErrorText); } if (iStatus == KErrNone) { iSecureSocket = CSecureSocket::NewL(iSocket, _L("TLS1.0") ); RDebug::Print(_L("CSecureSocket::NewL ('TLS1.0') ok")); iSecureSocket->SetOpt(KSoSSLDomainName,KSolInetSSL, _L8("")); iSecureSocket->SetDialogMode(EDialogModeAttended); RDebug::Print(_L("SecureSocket->SetOpt ok")); iSecureSocket->StartClientHandshake(iStatus); SetActive(); } note->ExecuteLD( iErrorText); } void CSecureConnector::RunL() { CAknInformationNote* note = new ( ELeave ) CAknInformationNote; iErrorText.Format(_L("iSecureSocket->StartClientHandshake %d"), iStatus); RDebug::Print(iErrorText); note->ExecuteLD( iErrorText); } void CSecureConnector::DoCancel() { }
<edit - fixed a small typo in the code>Code:class CSecureConnector : public CActive { public: static CSecureConnector* NewL(); void RunL(); ~CSecureConnector(); private: void DoCancel(); void ConstructL(); CSecureConnector(); protected: // data RSocketServ iSession; RSocket iSocket; CSecureSocket* iSecureSocket; RConnection iConnection; TCommDbConnPref iPrefs; TInetAddr iAddress; TBuf<50> iErrorText; };



