mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-03 03:57:49 +00:00
see CHANGELOG
This commit is contained in:
12
CHANGELOG
12
CHANGELOG
@@ -1,5 +1,15 @@
|
||||
This is the changelog file for the POCO C++ Libraries.
|
||||
|
||||
|
||||
Release 1.3.7 (2010-0?-??)
|
||||
==========================
|
||||
|
||||
- SSLManager: documentation fixes, code cleanup
|
||||
- SSLManager: renamed PrivateKeyPassPhrase event to PrivateKeyPassphraseRequired
|
||||
- added HTTPServerRequestImpl::socket() to get access to the underlying socket
|
||||
- added Socket::secure() to find out whether a given socket supports SSL/TLS
|
||||
|
||||
|
||||
Release 1.3.6p2 (2010-01-15)
|
||||
============================
|
||||
|
||||
@@ -1179,4 +1189,4 @@ building the libraries.
|
||||
|
||||
|
||||
--
|
||||
$Id: //poco/1.3/dist/CHANGELOG#79 $
|
||||
$Id: //poco/1.3/dist/CHANGELOG#82 $
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerRequestImpl.h
|
||||
//
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerRequestImpl.h#3 $
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPServerRequestImpl.h#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -53,6 +53,7 @@ namespace Net {
|
||||
|
||||
class HTTPServerSession;
|
||||
class HTTPServerParams;
|
||||
class StreamSocket;
|
||||
|
||||
|
||||
class Net_API HTTPServerRequestImpl: public HTTPServerRequest
|
||||
@@ -93,11 +94,15 @@ public:
|
||||
HTTPServerResponse& response() const;
|
||||
/// Returns a reference to the associated response.
|
||||
|
||||
StreamSocket& socket();
|
||||
/// Returns a reference to the underlying socket.
|
||||
|
||||
protected:
|
||||
static const std::string EXPECT;
|
||||
|
||||
private:
|
||||
HTTPServerResponse& _response;
|
||||
HTTPServerSession& _session;
|
||||
std::istream* _pStream;
|
||||
Poco::AutoPtr<HTTPServerParams> _pParams;
|
||||
SocketAddress _clientAddress;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPSession.h
|
||||
//
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPSession.h#5 $
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/HTTPSession.h#6 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
@@ -103,6 +103,9 @@ public:
|
||||
/// The socket is returned, and a new, uninitialized socket is
|
||||
/// attached to the session.
|
||||
|
||||
StreamSocket& socket();
|
||||
/// Returns a reference to the underlying socket.
|
||||
|
||||
protected:
|
||||
HTTPSession();
|
||||
/// Creates a HTTP session using an
|
||||
@@ -150,9 +153,6 @@ protected:
|
||||
int buffered() const;
|
||||
/// Returns the number of bytes in the buffer.
|
||||
|
||||
StreamSocket& socket();
|
||||
/// Returns a reference to the underlying socket.
|
||||
|
||||
void refill();
|
||||
/// Refills the internal buffer.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// Socket.h
|
||||
//
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/Socket.h#4 $
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/Socket.h#5 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
@@ -296,6 +296,10 @@ public:
|
||||
SocketImpl* impl() const;
|
||||
/// Returns the SocketImpl for this socket.
|
||||
|
||||
bool secure() const;
|
||||
/// Returns true iff the socket's connection is secure
|
||||
/// (using SSL or TLS).
|
||||
|
||||
static bool supportsIPv4();
|
||||
/// Returns true if the system supports IPv4.
|
||||
|
||||
@@ -588,6 +592,12 @@ inline SocketAddress Socket::peerAddress() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Socket::secure() const
|
||||
{
|
||||
return _pImpl->secure();
|
||||
}
|
||||
|
||||
|
||||
inline bool Socket::supportsIPv4()
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketImpl.h
|
||||
//
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketImpl.h#7 $
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/SocketImpl.h#8 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
@@ -338,6 +338,10 @@ public:
|
||||
/// This method will only work if the blocking modes of
|
||||
/// the socket are changed via the setBlocking method!
|
||||
|
||||
virtual bool secure() const;
|
||||
/// Returns true iff the socket's connection is secure
|
||||
/// (using SSL or TLS).
|
||||
|
||||
int socketError();
|
||||
/// Returns the value of the SO_ERROR socket option.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerRequestImpl.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Net/src/HTTPServerRequestImpl.cpp#4 $
|
||||
// $Id: //poco/1.3/Net/src/HTTPServerRequestImpl.cpp#5 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -56,6 +56,7 @@ const std::string HTTPServerRequestImpl::EXPECT("Expect");
|
||||
|
||||
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams):
|
||||
_response(response),
|
||||
_session(session),
|
||||
_pStream(0),
|
||||
_pParams(pParams, true)
|
||||
{
|
||||
@@ -83,6 +84,12 @@ HTTPServerRequestImpl::~HTTPServerRequestImpl()
|
||||
}
|
||||
|
||||
|
||||
StreamSocket& HTTPServerRequestImpl::socket()
|
||||
{
|
||||
return _session.socket();
|
||||
}
|
||||
|
||||
|
||||
bool HTTPServerRequestImpl::expectContinue() const
|
||||
{
|
||||
const std::string& expect = get(EXPECT, EMPTY);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketImpl.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Net/src/SocketImpl.cpp#9 $
|
||||
// $Id: //poco/1.3/Net/src/SocketImpl.cpp#10 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
@@ -337,6 +337,12 @@ int SocketImpl::available()
|
||||
}
|
||||
|
||||
|
||||
bool SocketImpl::secure() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
||||
{
|
||||
fd_set fdRead;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SSLManager.h
|
||||
//
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h#4 $
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SSLManager.h#5 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -66,7 +66,7 @@ class NetSSL_API SSLManager
|
||||
/// Either initialize via Poco::Util::Application or via the
|
||||
/// initialize methods of the singleton. Note that the latter initialization must happen very early
|
||||
/// during program startup before somebody calls defaultClientContext()/defaultServerContext()
|
||||
/// or any of the passPhraseHandler methods (which tries to auto-initialize
|
||||
/// or any of the passphraseHandler methods (which tries to auto-initialize
|
||||
/// the context and passphrase handler based on an Poco::Util::Application configuration).
|
||||
///
|
||||
/// An exemplary documentation which sets either the server or client default context and creates
|
||||
@@ -81,7 +81,7 @@ class NetSSL_API SSLManager
|
||||
/// <verificationMode>relaxed</verificationMode>
|
||||
/// <verificationDepth>9</verificationDepth>
|
||||
/// <loadDefaultCAFile>true</loadDefaultCAFile>
|
||||
/// <cypherList>ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH</cypherList>
|
||||
/// <cipherList>ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH</cipherList>
|
||||
/// <privateKeyPassphraseHandler>
|
||||
/// <name>KeyFileHandler</name>
|
||||
/// <options>
|
||||
@@ -103,45 +103,48 @@ public:
|
||||
typedef Poco::SharedPtr<InvalidCertificateHandler> InvalidCertificateHandlerPtr;
|
||||
|
||||
Poco::BasicEvent<VerificationErrorArgs> ServerVerificationError;
|
||||
/// Thrown whenever a certificate error is detected by the server during a handshake.
|
||||
/// Fired whenever a certificate error is detected by the server during a handshake.
|
||||
|
||||
Poco::BasicEvent<VerificationErrorArgs> ClientVerificationError;
|
||||
/// Thrown whenever a certificate error is detected by the client during a handshake.
|
||||
/// Fired whenever a certificate error is detected by the client during a handshake.
|
||||
|
||||
Poco::BasicEvent<std::string> PrivateKeyPassPhrase;
|
||||
/// Thrown when a encrypted certificate is loaded. Not setting the password
|
||||
Poco::BasicEvent<std::string> PrivateKeyPassphraseRequired;
|
||||
/// Fired when a encrypted certificate is loaded. Not setting the password
|
||||
/// in the event parameter will result in a failure to load the certificate.
|
||||
///
|
||||
/// Per default the SSLManager checks the configuration.xml file (path openSSL.privateKeyPassphraseHandler.name)
|
||||
/// Per default the SSLManager checks the application configuration file
|
||||
/// (path openSSL.privateKeyPassphraseHandler.name)
|
||||
/// for which default delegate it should register. If nothing is configured,
|
||||
/// a KeyConsoleHandler is used.
|
||||
|
||||
static SSLManager& instance();
|
||||
/// Returns the instance of the SSLManager singleton.
|
||||
|
||||
void initializeServer(PrivateKeyPassphraseHandlerPtr ptrPassPhraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext);
|
||||
void initializeServer(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext);
|
||||
/// Initializes the server side of the SSLManager with a default passphrase handler, a default invalid certificate handler and a default context. If this method
|
||||
/// is never called the SSLmanager will try to initialize its members from an application configuration.
|
||||
///
|
||||
/// Note: ALWAYS create the handlers before you create the context!
|
||||
///
|
||||
/// Valid initialization code would be:
|
||||
/// SharedPtr<PrivateKeyPassphraseHandler> ptrConsole = new KeyConsoleHandler();
|
||||
/// SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler();
|
||||
/// Context::Ptr ptrContext = new Context("any.pem", "rootcert.pem", Context::Relaxed, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||
/// SharedPtr<PrivateKeyPassphraseHandler> pConsoleHandler = new KeyConsoleHandler;
|
||||
/// SharedPtr<InvalidCertificateHandler> pInvalidCertHandler = new ConsoleCertificateHandler;
|
||||
/// Context::Ptr pContext = new Context(Context::SERVER_USE, "any.pem", "any.pem", "rootcert.pem", Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||
/// SSLManager::instance().initializeServer(pConsoleHandler, pInvalidCertHandler, pContext);
|
||||
///
|
||||
/// This method can only be called if no defaultContext is set yet.
|
||||
|
||||
void initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassPhraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext);
|
||||
void initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext);
|
||||
/// Initializes the client side of the SSLManager with a default passphrase handler, a default invalid certificate handler and a default context. If this method
|
||||
/// is never called the SSLmanager will try to initialize its members from an application configuration.
|
||||
///
|
||||
/// Note: ALWAYS create the handlers before you create the context!
|
||||
///
|
||||
/// Valid initialization code would be:
|
||||
/// SharedPtr<PrivateKeyPassphraseHandler> ptrConsole = new KeyConsoleHandler();
|
||||
/// SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler();
|
||||
/// Context::Ptr ptrContext = new Context("any.pem", "rootcert.pem", Context::Relaxed, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||
/// SharedPtr<PrivateKeyPassphraseHandler> pConsoleHandler = new KeyConsoleHandler;
|
||||
/// SharedPtr<InvalidCertificateHandler> pInvalidCertHandler = new ConsoleCertificateHandler;
|
||||
/// Context::Ptr pContext = new Context(Context::CLIENT_USE, "", "", "rootcert.pem", Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||
/// SSLManager::instance().initializeClient(pConsoleHandler, pInvalidCertHandler, pContext);
|
||||
///
|
||||
/// This method can only be called if no defaultContext is set yet.
|
||||
|
||||
@@ -153,7 +156,7 @@ public:
|
||||
/// Returns the default context used by the client. The first call to this method initializes the defaultContext
|
||||
/// from an application configuration.
|
||||
|
||||
PrivateKeyPassphraseHandlerPtr serverPassPhraseHandler();
|
||||
PrivateKeyPassphraseHandlerPtr serverPassphraseHandler();
|
||||
/// Returns the configured passphrase handler of the server. If none is set, the method will create a default one
|
||||
/// from an application configuration
|
||||
|
||||
@@ -161,7 +164,7 @@ public:
|
||||
/// Returns an initialized certificate handler (used by the server to verify client cert) which determines how invalid certificates are treated.
|
||||
/// If none is set, it will try to auto-initialize one from an application configuration.
|
||||
|
||||
PrivateKeyPassphraseHandlerPtr clientPassPhraseHandler();
|
||||
PrivateKeyPassphraseHandlerPtr clientPassphraseHandler();
|
||||
/// Returns the configured passphrase handler of the client. If none is set, the method will create a default one
|
||||
/// from an application configuration
|
||||
|
||||
@@ -209,7 +212,7 @@ private:
|
||||
void initEvents(bool server);
|
||||
/// Registers delegates at the events according to the configuration.
|
||||
|
||||
void initPassPhraseHandler(bool server);
|
||||
void initPassphraseHandler(bool server);
|
||||
/// Inits the passphrase handler.
|
||||
|
||||
void initCertificateHandler(bool server);
|
||||
@@ -223,10 +226,10 @@ private:
|
||||
PrivateKeyFactoryMgr _factoryMgr;
|
||||
CertificateHandlerFactoryMgr _certHandlerFactoryMgr;
|
||||
Context::Ptr _ptrDefaultServerContext;
|
||||
PrivateKeyPassphraseHandlerPtr _ptrServerPassPhraseHandler;
|
||||
PrivateKeyPassphraseHandlerPtr _ptrServerPassphraseHandler;
|
||||
InvalidCertificateHandlerPtr _ptrServerCertificateHandler;
|
||||
Context::Ptr _ptrDefaultClientContext;
|
||||
PrivateKeyPassphraseHandlerPtr _ptrClientPassPhraseHandler;
|
||||
PrivateKeyPassphraseHandlerPtr _ptrClientPassphraseHandler;
|
||||
InvalidCertificateHandlerPtr _ptrClientCertificateHandler;
|
||||
Poco::FastMutex _mutex;
|
||||
|
||||
@@ -239,8 +242,9 @@ private:
|
||||
static const int VAL_VER_DEPTH;
|
||||
static const std::string CFG_ENABLE_DEFAULT_CA;
|
||||
static const bool VAL_ENABLE_DEFAULT_CA;
|
||||
static const std::string CFG_CYPHER_LIST;
|
||||
static const std::string VAL_CYPHER_LIST;
|
||||
static const std::string CFG_CIPHER_LIST;
|
||||
static const std::string CFG_CYPHER_LIST; // for backwards compatibility
|
||||
static const std::string VAL_CIPHER_LIST;
|
||||
static const std::string CFG_DELEGATE_HANDLER;
|
||||
static const std::string VAL_DELEGATE_HANDLER;
|
||||
static const std::string CFG_CERTIFICATE_HANDLER;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SecureServerSocketImpl.h
|
||||
//
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SecureServerSocketImpl.h#4 $
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SecureServerSocketImpl.h#5 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLSockets
|
||||
@@ -133,6 +133,10 @@ public:
|
||||
///
|
||||
/// Throws a Poco::InvalidAccessException.
|
||||
|
||||
bool secure() const;
|
||||
/// Returns true iff the socket's connection is secure
|
||||
/// (using SSL or TLS).
|
||||
|
||||
Context::Ptr context() const;
|
||||
/// Returns the SSL context used by this socket.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SecureStreamSocketImpl.h
|
||||
//
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SecureStreamSocketImpl.h#7 $
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SecureStreamSocketImpl.h#8 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLSockets
|
||||
@@ -139,6 +139,10 @@ public:
|
||||
void shutdown();
|
||||
/// Shuts down the SSL connection.
|
||||
|
||||
bool secure() const;
|
||||
/// Returns true iff the socket's connection is secure
|
||||
/// (using SSL or TLS).
|
||||
|
||||
void setPeerHostName(const std::string& hostName);
|
||||
/// Sets the peer host name for certificate validation purposes.
|
||||
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
# This is a sample configuration file for HTTPTimeServer
|
||||
# This is a sample configuration file for HTTPSTimeServer
|
||||
|
||||
HTTPSTimeServer.format = %W, %e %b %y %H:%M:%S %Z
|
||||
HTTPSTimeServer.port = 9980
|
||||
|
||||
openSSL.server.privateKeyFile = ${application.configDir}any.pem
|
||||
openSSL.server.caConfig = ${application.configDir}rootcert.pem
|
||||
openSSL.server.verificationMode = none
|
||||
openSSL.server.verificationDepth = 9
|
||||
openSSL.server.loadDefaultCAFile = false
|
||||
openSSL.server.cipherList = ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
|
||||
openSSL.server.privateKeyPassphraseHandler.name = KeyFileHandler
|
||||
openSSL.server.privateKeyPassphraseHandler.options.password = secret
|
||||
openSSL.server.invalidCertificateHandler = AcceptCertificateHandler
|
||||
|
||||
logging.loggers.root.channel.class = ConsoleChannel
|
||||
logging.loggers.app.name = Application
|
||||
@@ -7,14 +20,3 @@ logging.formatters.f1.class = PatternFormatter
|
||||
logging.formatters.f1.pattern = [%p] %t
|
||||
logging.channels.c1.class = ConsoleChannel
|
||||
logging.channels.c1.formatter = f1
|
||||
HTTPSTimeServer.format = %W, %e %b %y %H:%M:%S %Z
|
||||
HTTPSTimeServer.port = 9980
|
||||
openSSL.server.privateKeyFile = ${application.configDir}any.pem
|
||||
openSSL.server.caConfig = ${application.configDir}rootcert.pem
|
||||
openSSL.server.verificationMode = none
|
||||
openSSL.server.verificationDepth = 9
|
||||
openSSL.server.loadDefaultCAFile = false
|
||||
openSSL.server.cypherList = ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
|
||||
openSSL.server.privateKeyPassphraseHandler.name = KeyFileHandler
|
||||
openSSL.server.privateKeyPassphraseHandler.options.password = secret
|
||||
openSSL.server.invalidCertificateHandler = AcceptCertificateHandler
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// PrivateKeyPassphraseHandler.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/PrivateKeyPassphraseHandler.cpp#2 $
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/PrivateKeyPassphraseHandler.cpp#3 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -48,13 +48,13 @@ namespace Net {
|
||||
|
||||
PrivateKeyPassphraseHandler::PrivateKeyPassphraseHandler(bool onServerSide): _serverSide(onServerSide)
|
||||
{
|
||||
SSLManager::instance().PrivateKeyPassPhrase += Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested);
|
||||
SSLManager::instance().PrivateKeyPassphraseRequired += Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested);
|
||||
}
|
||||
|
||||
|
||||
PrivateKeyPassphraseHandler::~PrivateKeyPassphraseHandler()
|
||||
{
|
||||
SSLManager::instance().PrivateKeyPassPhrase -= Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested);
|
||||
SSLManager::instance().PrivateKeyPassphraseRequired -= Delegate<PrivateKeyPassphraseHandler, std::string>(this, &PrivateKeyPassphraseHandler::onPrivateKeyRequested);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SSLManager.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SSLManager.cpp#7 $
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SSLManager.cpp#8 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -60,8 +60,9 @@ const std::string SSLManager::CFG_VER_DEPTH("verificationDepth");
|
||||
const int SSLManager::VAL_VER_DEPTH(9);
|
||||
const std::string SSLManager::CFG_ENABLE_DEFAULT_CA("loadDefaultCAFile");
|
||||
const bool SSLManager::VAL_ENABLE_DEFAULT_CA(false);
|
||||
const std::string SSLManager::CFG_CIPHER_LIST("cipherList");
|
||||
const std::string SSLManager::CFG_CYPHER_LIST("cypherList");
|
||||
const std::string SSLManager::VAL_CYPHER_LIST("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||
const std::string SSLManager::VAL_CIPHER_LIST("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||
const std::string SSLManager::CFG_DELEGATE_HANDLER("privateKeyPassphraseHandler.name");
|
||||
const std::string SSLManager::VAL_DELEGATE_HANDLER("KeyConsoleHandler");
|
||||
const std::string SSLManager::CFG_CERTIFICATE_HANDLER("invalidCertificateHandler.name");
|
||||
@@ -79,7 +80,7 @@ SSLManager::SSLManager()
|
||||
|
||||
SSLManager::~SSLManager()
|
||||
{
|
||||
PrivateKeyPassPhrase.clear();
|
||||
PrivateKeyPassphraseRequired.clear();
|
||||
ClientVerificationError.clear();
|
||||
ServerVerificationError.clear();
|
||||
_ptrDefaultServerContext = 0; // ensure all Context objects go away before we uninitialize OpenSSL.
|
||||
@@ -95,17 +96,17 @@ SSLManager& SSLManager::instance()
|
||||
}
|
||||
|
||||
|
||||
void SSLManager::initializeServer(PrivateKeyPassphraseHandlerPtr ptrPassPhraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
|
||||
void SSLManager::initializeServer(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
|
||||
{
|
||||
_ptrServerPassPhraseHandler = ptrPassPhraseHandler;
|
||||
_ptrServerPassphraseHandler = ptrPassphraseHandler;
|
||||
_ptrServerCertificateHandler = ptrHandler;
|
||||
_ptrDefaultServerContext = ptrContext;
|
||||
}
|
||||
|
||||
|
||||
void SSLManager::initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassPhraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
|
||||
void SSLManager::initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
|
||||
{
|
||||
_ptrClientPassPhraseHandler = ptrPassPhraseHandler;
|
||||
_ptrClientPassphraseHandler = ptrPassphraseHandler;
|
||||
_ptrClientCertificateHandler = ptrHandler;
|
||||
_ptrDefaultClientContext = ptrContext;
|
||||
}
|
||||
@@ -133,25 +134,25 @@ Context::Ptr SSLManager::defaultClientContext()
|
||||
}
|
||||
|
||||
|
||||
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::serverPassPhraseHandler()
|
||||
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::serverPassphraseHandler()
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
if (!_ptrServerPassPhraseHandler)
|
||||
initPassPhraseHandler(true);
|
||||
if (!_ptrServerPassphraseHandler)
|
||||
initPassphraseHandler(true);
|
||||
|
||||
return _ptrServerPassPhraseHandler;
|
||||
return _ptrServerPassphraseHandler;
|
||||
}
|
||||
|
||||
|
||||
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::clientPassPhraseHandler()
|
||||
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::clientPassphraseHandler()
|
||||
{
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
if (!_ptrClientPassPhraseHandler)
|
||||
initPassPhraseHandler(false);
|
||||
if (!_ptrClientPassphraseHandler)
|
||||
initPassphraseHandler(false);
|
||||
|
||||
return _ptrClientPassPhraseHandler;
|
||||
return _ptrClientPassphraseHandler;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +202,7 @@ int SSLManager::verifyCallback(bool server, int ok, X509_STORE_CTX* pStore)
|
||||
int SSLManager::privateKeyPasswdCallback(char* pBuf, int size, int flag, void* userData)
|
||||
{
|
||||
std::string pwd;
|
||||
SSLManager::instance().PrivateKeyPassPhrase.notify(&SSLManager::instance(), pwd);
|
||||
SSLManager::instance().PrivateKeyPassphraseRequired.notify(&SSLManager::instance(), pwd);
|
||||
|
||||
strncpy(pBuf, (char *)(pwd.c_str()), size);
|
||||
pBuf[size - 1] = '\0';
|
||||
@@ -241,11 +242,12 @@ void SSLManager::initDefaultContext(bool server)
|
||||
|
||||
int verDepth = config.getInt(prefix + CFG_VER_DEPTH, VAL_VER_DEPTH);
|
||||
bool loadDefCA = config.getBool(prefix + CFG_ENABLE_DEFAULT_CA, VAL_ENABLE_DEFAULT_CA);
|
||||
std::string cypherList = config.getString(prefix + CFG_CYPHER_LIST, VAL_CYPHER_LIST);
|
||||
std::string cipherList = config.getString(prefix + CFG_CIPHER_LIST, VAL_CIPHER_LIST);
|
||||
cipherList = config.getString(prefix + CFG_CYPHER_LIST, cipherList); // for backwards compatibility
|
||||
if (server)
|
||||
_ptrDefaultServerContext = new Context(Context::SERVER_USE, privKeyFile, certFile, caLocation, verMode, verDepth, loadDefCA, cypherList);
|
||||
_ptrDefaultServerContext = new Context(Context::SERVER_USE, privKeyFile, certFile, caLocation, verMode, verDepth, loadDefCA, cipherList);
|
||||
else
|
||||
_ptrDefaultClientContext = new Context(Context::CLIENT_USE, privKeyFile, certFile, caLocation, verMode, verDepth, loadDefCA, cypherList);
|
||||
_ptrDefaultClientContext = new Context(Context::CLIENT_USE, privKeyFile, certFile, caLocation, verMode, verDepth, loadDefCA, cipherList);
|
||||
|
||||
if (server)
|
||||
{
|
||||
@@ -257,15 +259,15 @@ void SSLManager::initDefaultContext(bool server)
|
||||
|
||||
void SSLManager::initEvents(bool server)
|
||||
{
|
||||
initPassPhraseHandler(server);
|
||||
initPassphraseHandler(server);
|
||||
initCertificateHandler(server);
|
||||
}
|
||||
|
||||
|
||||
void SSLManager::initPassPhraseHandler(bool server)
|
||||
void SSLManager::initPassphraseHandler(bool server)
|
||||
{
|
||||
if (server && _ptrServerPassPhraseHandler) return;
|
||||
if (!server && _ptrClientPassPhraseHandler) return;
|
||||
if (server && _ptrServerPassphraseHandler) return;
|
||||
if (!server && _ptrClientPassphraseHandler) return;
|
||||
|
||||
std::string prefix = server ? CFG_SERVER_PREFIX : CFG_CLIENT_PREFIX;
|
||||
Poco::Util::LayeredConfiguration& config = Poco::Util::Application::instance().config();
|
||||
@@ -281,11 +283,11 @@ void SSLManager::initPassPhraseHandler(bool server)
|
||||
if (pFactory)
|
||||
{
|
||||
if (server)
|
||||
_ptrServerPassPhraseHandler = pFactory->create(server);
|
||||
_ptrServerPassphraseHandler = pFactory->create(server);
|
||||
else
|
||||
_ptrClientPassPhraseHandler = pFactory->create(server);
|
||||
_ptrClientPassphraseHandler = pFactory->create(server);
|
||||
}
|
||||
else throw Poco::Util::UnknownOptionException(std::string("No PassPhrasehandler known with the name ") + className);
|
||||
else throw Poco::Util::UnknownOptionException(std::string("No passphrase handler known with the name ") + className);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SecureServerSocketImpl.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureServerSocketImpl.cpp#4 $
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureServerSocketImpl.cpp#5 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLSockets
|
||||
@@ -127,4 +127,10 @@ void SecureServerSocketImpl::sendUrgent(unsigned char data)
|
||||
}
|
||||
|
||||
|
||||
bool SecureServerSocketImpl::secure() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SecureStreamSocketImpl.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp#7 $
|
||||
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp#8 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLSockets
|
||||
@@ -179,6 +179,12 @@ void SecureStreamSocketImpl::shutdown()
|
||||
}
|
||||
|
||||
|
||||
bool SecureStreamSocketImpl::secure() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
X509Certificate SecureStreamSocketImpl::peerCertificate() const
|
||||
{
|
||||
X509* pCert = _impl.peerCertificate();
|
||||
|
||||
Reference in New Issue
Block a user