summaryrefslogtreecommitdiff
path: root/cpp/demo/Glacier/session/Client.cpp
diff options
context:
space:
mode:
authorAnthony Neal <aneal@zeroc.com>2002-05-02 17:33:27 +0000
committerAnthony Neal <aneal@zeroc.com>2002-05-02 17:33:27 +0000
commitd71349bc8be595183c00bd04b2df17fc35c2351b (patch)
treecc86863a211516e1455a247951fca1f67632c14c /cpp/demo/Glacier/session/Client.cpp
parentAdded Freeze::Evictor::hasObject. (diff)
downloadice-d71349bc8be595183c00bd04b2df17fc35c2351b.tar.bz2
ice-d71349bc8be595183c00bd04b2df17fc35c2351b.tar.xz
ice-d71349bc8be595183c00bd04b2df17fc35c2351b.zip
Added support for IceSSL.
Diffstat (limited to 'cpp/demo/Glacier/session/Client.cpp')
-rw-r--r--cpp/demo/Glacier/session/Client.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/cpp/demo/Glacier/session/Client.cpp b/cpp/demo/Glacier/session/Client.cpp
index feaa2beefa5..163ef3033a1 100644
--- a/cpp/demo/Glacier/session/Client.cpp
+++ b/cpp/demo/Glacier/session/Client.cpp
@@ -11,6 +11,7 @@
#include <Ice/Ice.h>
#include <Glacier/Glacier.h>
#include <Glacier/Router.h>
+#include <IceSSL/Plugin.h>
#include <HelloSession.h>
@@ -83,6 +84,29 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
break;
}
+
+ //
+ // Required in order to activate the trust relationship with
+ // the glacier router.
+ //
+
+ //
+ // Get the SSL plugin.
+ //
+ Ice::PluginManagerPtr pluginManager = communicator->getPluginManager();
+ Ice::PluginPtr plugin = pluginManager->getPlugin("IceSSL");
+ IceSSL::PluginPtr sslPlugin = IceSSL::PluginPtr::dynamicCast(plugin);
+ assert(sslPlugin);
+
+ // Configure the client context of the IceSSL Plugin
+ sslPlugin->configure(IceSSL::Client);
+
+ // Trust only the router certificate, no other certificate.
+ sslPlugin->addTrustedCertificate(IceSSL::Client, routerCert);
+ sslPlugin->setCertificateVerifier(IceSSL::Client, sslPlugin->getSingleCertVerifier(routerCert));
+
+ // Set the public and private keys that the Router will accept.
+ sslPlugin->setRSAKeys(IceSSL::Client, privateKey, publicKey);
communicator->setDefaultRouter(router);