diff options
Diffstat (limited to 'cpp/test/Glacier/starter/Client.cpp')
-rw-r--r-- | cpp/test/Glacier/starter/Client.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/cpp/test/Glacier/starter/Client.cpp b/cpp/test/Glacier/starter/Client.cpp index 92b85caa522..73e82038fea 100644 --- a/cpp/test/Glacier/starter/Client.cpp +++ b/cpp/test/Glacier/starter/Client.cpp @@ -88,22 +88,28 @@ CallbackClient::run(int argc, char* argv[]) PropertiesPtr properties = communicator()->getProperties(); - string privateKeyBase64 = IceUtil::Base64::encode(privateKey); - string publicKeyBase64 = IceUtil::Base64::encode(publicKey); - string routerCertString = IceUtil::Base64::encode(routerCert); + string clientConfig = properties->getProperty("Ice.SSL.Client.Config"); + string serverConfig = properties->getProperty("Ice.SSL.Server.Config"); - IceSSL::SystemPtr sslSystem = communicator()->getSslSystem(); - IceSSL::SslExtensionPtr sslExtension = communicator()->getSslExtension(); + if (!clientConfig.empty() && !serverConfig.empty()) + { + string privateKeyBase64 = IceUtil::Base64::encode(privateKey); + string publicKeyBase64 = IceUtil::Base64::encode(publicKey); + string routerCertString = IceUtil::Base64::encode(routerCert); + + IceSSL::SystemPtr sslSystem = communicator()->getSslSystem(); + IceSSL::SslExtensionPtr sslExtension = communicator()->getSslExtension(); - // Configure Server, client is already configured - sslSystem->configure(IceSSL::Server); + // Configure Server, client is already configured + sslSystem->configure(IceSSL::Server); - sslSystem->setCertificateVerifier(IceSSL::ClientServer, sslExtension->getSingleCertVerifier(routerCert)); + sslSystem->setCertificateVerifier(IceSSL::ClientServer, sslExtension->getSingleCertVerifier(routerCert)); - // Set the keys overrides. - sslSystem->setRSAKeysBase64(IceSSL::ClientServer, privateKeyBase64, publicKeyBase64); + // Set the keys overrides. + sslSystem->setRSAKeysBase64(IceSSL::ClientServer, privateKeyBase64, publicKeyBase64); - sslSystem->addTrustedCertificateBase64(IceSSL::ClientServer, routerCertString); + sslSystem->addTrustedCertificateBase64(IceSSL::ClientServer, routerCertString); + } test(router); cout << "ok" << endl; |