Configuring the Server Name Indication : Tutorial

This topic describes how to configure the server name indication.

Context

Servers that support a virtual name-based hosting must know the virtual names of the client that tries to establish a connection. The virtual name-based hosts controls the decision of the server. The decision of server is to return the server certificate or PSK if you use a PSK ciphersuite.

To address this issue, Symbian implements the server name indication extension which is specified in RFC4366.

Note: To maintain maximum compatibility with the existing servers, a server name indication extension is not sent to the server unless the server explicitly requests it. For example the implementer Secure User Plane Location (SUPL) has to use this feature explicitly.

The steps required to establish a connection are shown below:

Steps

  1. Create an array class.

  2. Wrap the array class.

  3. Call Setopt() on CSecureSocket to pass the array of names.

Example

The following example code shows how to find the server names that the client is attempting to establish a connection:


//Create an array class
  CDesC8ArrayFlat *serverNames = new(ELeave) CDesC8ArrayFlat(1);
  CleanupStack::PushL(serverNames);
//Wrap the array class
  serverNames->AppendL(serverName);
//Call Setopt() on CSecureSocket to pass the array of names in
  TPckgC<CDesC8Array *> serverNameIndicationPkg(serverNames);
  User::LeaveIfError(secureSocket->SetOpt(KSoServerNameIndication, KSolInetSSL, serverNameIndicationPkg));
//SecureSocket now owns the serverNames object
  CleanupStack::Pop(serverNames);