How do I use IceSSL with Ruby, Python or PHP?

Ice for Ruby, Ice for Python, and Ice for PHP are based on Ice for C++. Therefore, configuring IceSSL for these languages works the same way as with Ice for C++. With Ice for Ruby and Ice for Python, configuring IceSSL is straightforward. The configuration files for some of the demos that accompany the distributions include examples of how to do this. For example, if you inspect the config.client file for the Ruby or Python demo/Ice/hello, you will find the following configuration items for IceSSL:

# config.client
# ...
#
# Security Tracing
#
# 0 = no security tracing
# 1 = trace messages
#
#IceSSL.Trace.Security=1

#
# SSL Configuration
#
Ice.Plugin.IceSSL=IceSSL:createIceSSL
IceSSL.DefaultDir=../../../certs
IceSSL.CAs=cacert.pem
IceSSL.CertFile=client.p12
IceSSL.Password=password
IceSSL.Keychain=client.keychain
IceSSL.KeychainPassword=password

The Ice.Plugin.IceSSL property tells the Ice run time to load the IceSSL plug-in, and the properties prefixed by IceSSL configure the plug-in itself.

The procedure for configuring Ice for PHP is the same: configure the IceSSL plug-in as you would for any C++ application, and inform the Ice-for-PHP plug-in to use this configuration. However, because the plug-in is loaded by Apache, it can be a little tricky to get things working. If you are loading the Ice-for-PHP plug-in dynamically, the IceSSL shared library must be accessible to Apache. In addition, you must configure IceSSL. One way to do this is to put the property settings (such as the above) into a configuration file that is accessible to Apache, and then add an ice.config directive to the php.ini file. For example, assuming the configuration file is located in /etc/config-ice.php, and you are adding to the default PHP profile:

# php.ini
# ...
ice.config=/etc/config-ice.php

Another method is to add an ice.options directive to the php.ini file. On the up-side, this avoids external configuration files but, on the down-side, makes the php.ini file more verbose.

See Also