Chapter 17 Creating CORBA C++ Clients


Establishing a secure session

A C++ client can use IIOP tunnelled within SSL (also called IIOPS) to establish a secure session with a Jaguar server.

Note   For more information about security, including issuing certificates, see the chapter on security configuration in the Jaguar CTS System Administration Guide.

To establish a secure session with a Jaguar server, follow these steps:

Step

What It Does

Detailed Explanation

1

Initialize the SSL security service as an ORB.

"Initializing the SSL security service"

2

Initialize the client ORB and create an ORB reference.

"ORB properties for secure sessions"

3

Use the ORB reference to create a Manager instance for the Jaguar server.

"ORB properties for secure sessions"

4

Use the Session instance to create stub component instances. This step is the same regardless of whether the application uses SSL.

"Creating sessions" and "Creating stub instances"

5

Optionally, you can retrieve security information about the session.

"Retrieving session security information"

An example that illustrates all of these steps is provided in the sample/ClientSSL subdirectory of your Jaguar server installation.

Initializing the SSL security service

To initialize the SSL security service, you must retrieve the SSL security service context and set the quality of security services as well as any global properties for that context.

You must decide:

Retrieve the SSL security service context

In this example, you use CORBA::ORB_init to initialize the ORB as an instance, orb1.

CORBA::ORB_var orb1 = 
CORBA::ORB_init(argc,argv, "");

Use resolve_initial_references to obtain the initial context from the SSL security service URL string (SSLServiceProvider ) as an object reference, object, on orb1. You must use SSLServiceProvider as the URL string. You use CtsSecurity::SSLServiceProvider::_narrow to convert object to the sslServProv instance (an instance of the SSLServiceProvider interface).

object = orb1->resolve_initial_references
("SSLServiceProvider");
sslServProv = CtsSecurity::SSLServiceProvider
::_narrow(object);

Set the quality of security services and global properties

To return the available qualities of security services from the availableQop property, call getGlobalProperty on the sslServProv instance. The qualities of security services refer to the security profile characteristic, which specifies the supported CipherSuites.

// query Available quality of services and set 
// whatever we want. 
CtsSecurity::StringSeq_var * availQop =
sslServProv->getGlobalProperty("availableQop");

At this time, you can also set any global properties, such as the callback component with the callbackImpl property. You specify the callback component using the setGlobalProperty method. The setGlobalProperty method takes the name of the global property, callbackImpl, and the name of the callback component. The name of the component is the DLL name (without file extension) followed by a forward slash, and the package and component name separated by forward slashes as shown in this example:

// Set callbacks. sslServProv->setGlobalProperty
    ("callbackImpl", "myDLL/myPackage/myComponent"); 

Enable client authentication

To respond to a server's request for client authentication, you can:

ORB properties for secure sessions

You must set the ORBqop property when initializing the client ORB in order to use one of the available security profile characteristics. The security profile characteristic lists the CipherSuites the client uses when negotiating an SSL connection. The client sends the list of CipherSuites that it uses to the server, and the server selects a CipherSuite from that list. The server must choose the first CipherSuite in the list that it can use.

In this example, the ORBqop property is specified as sybpks_strong (strong 128-bit encryption) and the ORBuserdata property is specified as myUserData . The CORBA::ORB_init method initializes the client ORB (orb2) with these properties.

// Now configure a specific ORB instance, 
// overriding the default Quality of // service. Might want to connect to a server
// only using 128bit encryption. Properties props(argc, argv); props.put("ORBqop", "sybpks_strong"); props.put("ORBuserData", myUserData); orb2 = CORBA::ORB_init(props.argc(),
      props.argv(), "");

You can also set these properties when initializing the client ORB:

Creating a Manager instance

Creating the manager instance for an SSL session is exactly like creating a manager instance for a non-SSL session, except that instead of specifying an IIOP port for the manager session in the string_to_object method, you specify the secure IIOP (specify iiops ) port (the IIOPS default port number for mutual client-server authentication is 9002 ). You must specify a port that supports the at least the level of security specified by the QOP setting.

Retrieving session security information

To retrieve security information about the session, narrow the component object reference, typeObj, to an SSL session, sslSession. Then use the getSessionInfo method to retrieve the session information from the SSL session and create an object reference for the session information. Use individual get methods to retrieve information about each SSL session property.

Note   You cannot use the getName, getPassword, getAuthenticationStatus, getListener, getPeerAddress, getHostName. These methods are inherited from the SessionInfo interface.

// Obtain SSLSession information from 
// typesObj. CtsSecurity::SSLSession_var sslSession =     CtsSecurity::SSLSession::
    _narrow(typesObj); CtsSecurity::SSLSessionInfo_var 
sslSessionInfo = sslSession->getSessionInfo();

// Obtain user data (similar usage in user's 
// SSL callback implementation) String_var currentUserData = 
    sslSessionInfo->getProperty("userData");

// Obtain details about server's certificate. CtsSecurity::X509Certificate_var serverX509=    sslSessionInfo->getPeerCertificate(); cout << "Connected to server: << 
    serverX509->getSubjectDN() << endl"; // get details about my certificate CtsSecurity::X509Certificate_var clientX509= 
    sslSessionInfo->getCertificate(); 

Creating an SSL callback component

An SSL callback component is a component that the client uses to execute callback methods. A callback method is a method that responds to SSL requests from a Jaguar server. An SSL callback component resides on the client machine. To create an SSL callback, you must create a component DLL and deploy it on the client machine in a directory specified by the PATH environment variable. You can create a component DLL in the same manner that you would create any other server-side component--using Jaguar Manager and a C++ IDE.

You must specify the component DLL by using the setGlobalProperty method in the CtsSecurity::SSLServiceProvider interface to set the callbackImpl global property. For information, see "Set the quality of security services and global properties".

Implementing callback methods

Although default implementation of the following callback methods are included with the Jaguar client ORB, you can implement your own logic for these callback methods. To implement the default response for callback methods, code them to return the CORBA::NO_IMPLEMENT exception.

For more information about these callback methods, see the CtsSecurity::SSLCallback interface in the interface repository documentation. The interface repository documentation can be viewed in a Web browser by connecting to your server with this URL:

http://yourhost:yourport/ir/

where yourhost is the Jaguar server's host name and yourport is the HTTP port number.

Example

The sample/ClientSSL subdirectory in your Jaguar server installatation contains an example program that installs an SSL callback to interact with the user.

 


Copyright © 2000 Sybase, Inc. All rights reserved.