diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-04-24 21:13:00 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-04-24 21:13:00 +0000 |
commit | 5409c1ecef0f226dedc77721c0d2fc8dfe9e85de (patch) | |
tree | 97ba75bc47a143726d6d8382be3a462e51716700 /cpp/src/IceSSL/ContextOpenSSLClient.cpp | |
parent | cleaning up sample impls (diff) | |
download | ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.bz2 ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.xz ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.zip |
merging from plugins branch
Diffstat (limited to 'cpp/src/IceSSL/ContextOpenSSLClient.cpp')
-rw-r--r-- | cpp/src/IceSSL/ContextOpenSSLClient.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/cpp/src/IceSSL/ContextOpenSSLClient.cpp b/cpp/src/IceSSL/ContextOpenSSLClient.cpp new file mode 100644 index 00000000000..dfc204684e7 --- /dev/null +++ b/cpp/src/IceSSL/ContextOpenSSLClient.cpp @@ -0,0 +1,85 @@ +// ********************************************************************** +// +// Copyright (c) 2002 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/TraceLevels.h> +#include <Ice/Logger.h> + +#include <IceSSL/Exception.h> +#include <IceSSL/SslConnectionOpenSSL.h> +#include <IceSSL/ContextOpenSSLClient.h> +#include <IceSSL/SslConnectionOpenSSLClient.h> + +using namespace std; + +using IceSSL::ConnectionPtr; + +void +IceSSL::OpenSSL::ClientContext::configure(const GeneralConfig& generalConfig, + const CertificateAuthority& certificateAuthority, + const BaseCertificates& baseCertificates) +{ + Context::configure(generalConfig, certificateAuthority, baseCertificates); + + loadCertificateAuthority(certificateAuthority); + + if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL) + { + ostringstream s; + + s << endl; + s << "general configuration (client)" << endl; + s << "------------------------------" << endl; + s << generalConfig << endl << endl; + + s << "certificate authority (client)" << endl; + s << "------------------------------" << endl; + s << "file: " << certificateAuthority.getCAFileName() << endl; + s << "path: " << certificateAuthority.getCAPath() << endl; + + s << "base certificates (client)" << endl; + s << "--------------------------" << endl; + s << baseCertificates << endl; + + _logger->trace(_traceLevels->securityCat, s.str()); + } +} + +IceSSL::ConnectionPtr +IceSSL::OpenSSL::ClientContext::createConnection(int socket, const PluginBaseIPtr& plugin) +{ + if (_sslContext == 0) + { + IceSSL::OpenSSL::ContextNotConfiguredException contextEx(__FILE__, __LINE__); + + throw contextEx; + } + + ConnectionPtr connection = new ClientConnection(_traceLevels, + _logger, + _certificateVerifier, + createSSLConnection(socket), + plugin); + + connectionSetup(connection); + + return connection; +} + +IceSSL::OpenSSL::ClientContext::ClientContext(const IceInternal::InstancePtr& instance) : + Context(instance) +{ + _rsaPrivateKeyProperty = "IceSSL.Client.Overrides.RSA.PrivateKey"; + _rsaPublicKeyProperty = "IceSSL.Client.Overrides.RSA.Certificate"; + _dsaPrivateKeyProperty = "IceSSL.Client.Overrides.DSA.PrivateKey"; + _dsaPublicKeyProperty = "IceSSL.Client.Overrides.DSA.Certificate"; + _caCertificateProperty = "IceSSL.Client.Overrides.CACertificate"; + _handshakeTimeoutProperty = "IceSSL.Client.Handshake.ReadTimeout"; + _passphraseRetriesProperty = "IceSSL.Client.Passphrase.Retries"; +} |