Chapter 7 Using SSL in ActiveX Clients


Using the SSLServiceProvider interface

The CtsSecurity.SSLServiceProvider interface provides setGlobalProperty and getGlobalProperty methods to set and retrieve the SSL properties listed in Table 7-1. After initializing an ORB instance, you can instantiate a proxy for the SSLServiceProvider interface with the ORB.resolve_initial_references method, as shown below:

Dim orbRef As JaguarTypeLibrary.ORB
Dim ssp As CtsSecurity.SSLServiceProvider
Dim CORBAObj As Object ' Generic unnarrowed CORBA object

' Initialize the ORB
Set orbRef = New JaguarTypeLibrary.ORB
orbRef.Init ("")

' Get a proxy for the SSLServiceProvider
Set CORBAObj = _
    orbRef.resolve_initial_references("SSLServiceProvider")
Set ssp = CORBAObj.Narrow_("CtsSecurity/SSLServiceProvider")

You can then call the setGlobalProperty method to set properties, as in the example below:

ssp.setGlobalProperty("qop", "sybpks_intl");

Properties set with the SSLServiceProvider interface affect all ORB instances used by the application. However, if an equivalent property has been set when initializing an ORB instance, the ORB property value takes precedence.

You can retrieve property values using the getGlobalProperty method, which returns a JCollection instance. For example, this code retrieves the value of the availableQop property, which specifies the list of valid settings for the qop property:

Dim availQop As JaguarTypeLibrary.JCollection

' Retrieve available QOP settings and populate combo box
Set availQop = ssp.getGlobalProperty("availableQOP")

Dim iter As Integer
  
comboQOP.Text = "<none>"
Call comboQOP.AddItem("<none>", 0)

For iter = 1 To availQop.Count
  Call comboQOP.AddItem( _
    Format(availQop.Item(iter - 1)), iter)
Next iter

When retrieving properties that take a single value, the value is returned in a JCollection with one item.

 


Copyright © 2002 Sybase, Inc. All rights reserved.