mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-03 20:18:01 +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.
|
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)
|
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
|
// 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
|
// Library: Net
|
||||||
// Package: HTTPServer
|
// Package: HTTPServer
|
||||||
@@ -53,6 +53,7 @@ namespace Net {
|
|||||||
|
|
||||||
class HTTPServerSession;
|
class HTTPServerSession;
|
||||||
class HTTPServerParams;
|
class HTTPServerParams;
|
||||||
|
class StreamSocket;
|
||||||
|
|
||||||
|
|
||||||
class Net_API HTTPServerRequestImpl: public HTTPServerRequest
|
class Net_API HTTPServerRequestImpl: public HTTPServerRequest
|
||||||
@@ -93,11 +94,15 @@ public:
|
|||||||
HTTPServerResponse& response() const;
|
HTTPServerResponse& response() const;
|
||||||
/// Returns a reference to the associated response.
|
/// Returns a reference to the associated response.
|
||||||
|
|
||||||
|
StreamSocket& socket();
|
||||||
|
/// Returns a reference to the underlying socket.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const std::string EXPECT;
|
static const std::string EXPECT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTTPServerResponse& _response;
|
HTTPServerResponse& _response;
|
||||||
|
HTTPServerSession& _session;
|
||||||
std::istream* _pStream;
|
std::istream* _pStream;
|
||||||
Poco::AutoPtr<HTTPServerParams> _pParams;
|
Poco::AutoPtr<HTTPServerParams> _pParams;
|
||||||
SocketAddress _clientAddress;
|
SocketAddress _clientAddress;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// HTTPSession.h
|
// 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
|
// Library: Net
|
||||||
// Package: HTTP
|
// Package: HTTP
|
||||||
@@ -103,6 +103,9 @@ public:
|
|||||||
/// The socket is returned, and a new, uninitialized socket is
|
/// The socket is returned, and a new, uninitialized socket is
|
||||||
/// attached to the session.
|
/// attached to the session.
|
||||||
|
|
||||||
|
StreamSocket& socket();
|
||||||
|
/// Returns a reference to the underlying socket.
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HTTPSession();
|
HTTPSession();
|
||||||
/// Creates a HTTP session using an
|
/// Creates a HTTP session using an
|
||||||
@@ -150,9 +153,6 @@ protected:
|
|||||||
int buffered() const;
|
int buffered() const;
|
||||||
/// Returns the number of bytes in the buffer.
|
/// Returns the number of bytes in the buffer.
|
||||||
|
|
||||||
StreamSocket& socket();
|
|
||||||
/// Returns a reference to the underlying socket.
|
|
||||||
|
|
||||||
void refill();
|
void refill();
|
||||||
/// Refills the internal buffer.
|
/// Refills the internal buffer.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Socket.h
|
// 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
|
// Library: Net
|
||||||
// Package: Sockets
|
// Package: Sockets
|
||||||
@@ -296,6 +296,10 @@ public:
|
|||||||
SocketImpl* impl() const;
|
SocketImpl* impl() const;
|
||||||
/// Returns the SocketImpl for this socket.
|
/// 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();
|
static bool supportsIPv4();
|
||||||
/// Returns true if the system supports IPv4.
|
/// 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()
|
inline bool Socket::supportsIPv4()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SocketImpl.h
|
// 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
|
// Library: Net
|
||||||
// Package: Sockets
|
// Package: Sockets
|
||||||
@@ -338,6 +338,10 @@ public:
|
|||||||
/// This method will only work if the blocking modes of
|
/// This method will only work if the blocking modes of
|
||||||
/// the socket are changed via the setBlocking method!
|
/// 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();
|
int socketError();
|
||||||
/// Returns the value of the SO_ERROR socket option.
|
/// Returns the value of the SO_ERROR socket option.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// HTTPServerRequestImpl.cpp
|
// HTTPServerRequestImpl.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.3/Net/src/HTTPServerRequestImpl.cpp#4 $
|
// $Id: //poco/1.3/Net/src/HTTPServerRequestImpl.cpp#5 $
|
||||||
//
|
//
|
||||||
// Library: Net
|
// Library: Net
|
||||||
// Package: HTTPServer
|
// Package: HTTPServer
|
||||||
@@ -56,6 +56,7 @@ const std::string HTTPServerRequestImpl::EXPECT("Expect");
|
|||||||
|
|
||||||
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams):
|
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams):
|
||||||
_response(response),
|
_response(response),
|
||||||
|
_session(session),
|
||||||
_pStream(0),
|
_pStream(0),
|
||||||
_pParams(pParams, true)
|
_pParams(pParams, true)
|
||||||
{
|
{
|
||||||
@@ -83,6 +84,12 @@ HTTPServerRequestImpl::~HTTPServerRequestImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
StreamSocket& HTTPServerRequestImpl::socket()
|
||||||
|
{
|
||||||
|
return _session.socket();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool HTTPServerRequestImpl::expectContinue() const
|
bool HTTPServerRequestImpl::expectContinue() const
|
||||||
{
|
{
|
||||||
const std::string& expect = get(EXPECT, EMPTY);
|
const std::string& expect = get(EXPECT, EMPTY);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SocketImpl.cpp
|
// SocketImpl.cpp
|
||||||
//
|
//
|
||||||
// $Id: //poco/1.3/Net/src/SocketImpl.cpp#9 $
|
// $Id: //poco/1.3/Net/src/SocketImpl.cpp#10 $
|
||||||
//
|
//
|
||||||
// Library: Net
|
// Library: Net
|
||||||
// Package: Sockets
|
// Package: Sockets
|
||||||
@@ -337,6 +337,12 @@ int SocketImpl::available()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SocketImpl::secure() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
||||||
{
|
{
|
||||||
fd_set fdRead;
|
fd_set fdRead;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SSLManager.h
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLCore
|
// Package: SSLCore
|
||||||
@@ -66,7 +66,7 @@ class NetSSL_API SSLManager
|
|||||||
/// Either initialize via Poco::Util::Application or via the
|
/// Either initialize via Poco::Util::Application or via the
|
||||||
/// initialize methods of the singleton. Note that the latter initialization must happen very early
|
/// initialize methods of the singleton. Note that the latter initialization must happen very early
|
||||||
/// during program startup before somebody calls defaultClientContext()/defaultServerContext()
|
/// 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).
|
/// 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
|
/// 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>
|
/// <verificationMode>relaxed</verificationMode>
|
||||||
/// <verificationDepth>9</verificationDepth>
|
/// <verificationDepth>9</verificationDepth>
|
||||||
/// <loadDefaultCAFile>true</loadDefaultCAFile>
|
/// <loadDefaultCAFile>true</loadDefaultCAFile>
|
||||||
/// <cypherList>ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH</cypherList>
|
/// <cipherList>ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH</cipherList>
|
||||||
/// <privateKeyPassphraseHandler>
|
/// <privateKeyPassphraseHandler>
|
||||||
/// <name>KeyFileHandler</name>
|
/// <name>KeyFileHandler</name>
|
||||||
/// <options>
|
/// <options>
|
||||||
@@ -103,45 +103,48 @@ public:
|
|||||||
typedef Poco::SharedPtr<InvalidCertificateHandler> InvalidCertificateHandlerPtr;
|
typedef Poco::SharedPtr<InvalidCertificateHandler> InvalidCertificateHandlerPtr;
|
||||||
|
|
||||||
Poco::BasicEvent<VerificationErrorArgs> ServerVerificationError;
|
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;
|
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;
|
Poco::BasicEvent<std::string> PrivateKeyPassphraseRequired;
|
||||||
/// Thrown when a encrypted certificate is loaded. Not setting the password
|
/// Fired when a encrypted certificate is loaded. Not setting the password
|
||||||
/// in the event parameter will result in a failure to load the certificate.
|
/// 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,
|
/// for which default delegate it should register. If nothing is configured,
|
||||||
/// a KeyConsoleHandler is used.
|
/// a KeyConsoleHandler is used.
|
||||||
|
|
||||||
static SSLManager& instance();
|
static SSLManager& instance();
|
||||||
/// Returns the instance of the SSLManager singleton.
|
/// 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
|
/// 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.
|
/// 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!
|
/// Note: ALWAYS create the handlers before you create the context!
|
||||||
///
|
///
|
||||||
/// Valid initialization code would be:
|
/// Valid initialization code would be:
|
||||||
/// SharedPtr<PrivateKeyPassphraseHandler> ptrConsole = new KeyConsoleHandler();
|
/// SharedPtr<PrivateKeyPassphraseHandler> pConsoleHandler = new KeyConsoleHandler;
|
||||||
/// SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler();
|
/// SharedPtr<InvalidCertificateHandler> pInvalidCertHandler = new ConsoleCertificateHandler;
|
||||||
/// Context::Ptr ptrContext = new Context("any.pem", "rootcert.pem", Context::Relaxed, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
/// 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.
|
/// 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
|
/// 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.
|
/// 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!
|
/// Note: ALWAYS create the handlers before you create the context!
|
||||||
///
|
///
|
||||||
/// Valid initialization code would be:
|
/// Valid initialization code would be:
|
||||||
/// SharedPtr<PrivateKeyPassphraseHandler> ptrConsole = new KeyConsoleHandler();
|
/// SharedPtr<PrivateKeyPassphraseHandler> pConsoleHandler = new KeyConsoleHandler;
|
||||||
/// SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler();
|
/// SharedPtr<InvalidCertificateHandler> pInvalidCertHandler = new ConsoleCertificateHandler;
|
||||||
/// Context::Ptr ptrContext = new Context("any.pem", "rootcert.pem", Context::Relaxed, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
/// 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.
|
/// 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
|
/// Returns the default context used by the client. The first call to this method initializes the defaultContext
|
||||||
/// from an application configuration.
|
/// 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
|
/// Returns the configured passphrase handler of the server. If none is set, the method will create a default one
|
||||||
/// from an application configuration
|
/// 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.
|
/// 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.
|
/// 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
|
/// Returns the configured passphrase handler of the client. If none is set, the method will create a default one
|
||||||
/// from an application configuration
|
/// from an application configuration
|
||||||
|
|
||||||
@@ -209,7 +212,7 @@ private:
|
|||||||
void initEvents(bool server);
|
void initEvents(bool server);
|
||||||
/// Registers delegates at the events according to the configuration.
|
/// Registers delegates at the events according to the configuration.
|
||||||
|
|
||||||
void initPassPhraseHandler(bool server);
|
void initPassphraseHandler(bool server);
|
||||||
/// Inits the passphrase handler.
|
/// Inits the passphrase handler.
|
||||||
|
|
||||||
void initCertificateHandler(bool server);
|
void initCertificateHandler(bool server);
|
||||||
@@ -223,10 +226,10 @@ private:
|
|||||||
PrivateKeyFactoryMgr _factoryMgr;
|
PrivateKeyFactoryMgr _factoryMgr;
|
||||||
CertificateHandlerFactoryMgr _certHandlerFactoryMgr;
|
CertificateHandlerFactoryMgr _certHandlerFactoryMgr;
|
||||||
Context::Ptr _ptrDefaultServerContext;
|
Context::Ptr _ptrDefaultServerContext;
|
||||||
PrivateKeyPassphraseHandlerPtr _ptrServerPassPhraseHandler;
|
PrivateKeyPassphraseHandlerPtr _ptrServerPassphraseHandler;
|
||||||
InvalidCertificateHandlerPtr _ptrServerCertificateHandler;
|
InvalidCertificateHandlerPtr _ptrServerCertificateHandler;
|
||||||
Context::Ptr _ptrDefaultClientContext;
|
Context::Ptr _ptrDefaultClientContext;
|
||||||
PrivateKeyPassphraseHandlerPtr _ptrClientPassPhraseHandler;
|
PrivateKeyPassphraseHandlerPtr _ptrClientPassphraseHandler;
|
||||||
InvalidCertificateHandlerPtr _ptrClientCertificateHandler;
|
InvalidCertificateHandlerPtr _ptrClientCertificateHandler;
|
||||||
Poco::FastMutex _mutex;
|
Poco::FastMutex _mutex;
|
||||||
|
|
||||||
@@ -239,8 +242,9 @@ private:
|
|||||||
static const int VAL_VER_DEPTH;
|
static const int VAL_VER_DEPTH;
|
||||||
static const std::string CFG_ENABLE_DEFAULT_CA;
|
static const std::string CFG_ENABLE_DEFAULT_CA;
|
||||||
static const bool VAL_ENABLE_DEFAULT_CA;
|
static const bool VAL_ENABLE_DEFAULT_CA;
|
||||||
static const std::string CFG_CYPHER_LIST;
|
static const std::string CFG_CIPHER_LIST;
|
||||||
static const std::string VAL_CYPHER_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 CFG_DELEGATE_HANDLER;
|
||||||
static const std::string VAL_DELEGATE_HANDLER;
|
static const std::string VAL_DELEGATE_HANDLER;
|
||||||
static const std::string CFG_CERTIFICATE_HANDLER;
|
static const std::string CFG_CERTIFICATE_HANDLER;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SecureServerSocketImpl.h
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLSockets
|
// Package: SSLSockets
|
||||||
@@ -133,6 +133,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// Throws a Poco::InvalidAccessException.
|
/// Throws a Poco::InvalidAccessException.
|
||||||
|
|
||||||
|
bool secure() const;
|
||||||
|
/// Returns true iff the socket's connection is secure
|
||||||
|
/// (using SSL or TLS).
|
||||||
|
|
||||||
Context::Ptr context() const;
|
Context::Ptr context() const;
|
||||||
/// Returns the SSL context used by this socket.
|
/// Returns the SSL context used by this socket.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SecureStreamSocketImpl.h
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLSockets
|
// Package: SSLSockets
|
||||||
@@ -139,6 +139,10 @@ public:
|
|||||||
void shutdown();
|
void shutdown();
|
||||||
/// Shuts down the SSL connection.
|
/// 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);
|
void setPeerHostName(const std::string& hostName);
|
||||||
/// Sets the peer host name for certificate validation purposes.
|
/// 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.root.channel.class = ConsoleChannel
|
||||||
logging.loggers.app.name = Application
|
logging.loggers.app.name = Application
|
||||||
@@ -7,14 +20,3 @@ logging.formatters.f1.class = PatternFormatter
|
|||||||
logging.formatters.f1.pattern = [%p] %t
|
logging.formatters.f1.pattern = [%p] %t
|
||||||
logging.channels.c1.class = ConsoleChannel
|
logging.channels.c1.class = ConsoleChannel
|
||||||
logging.channels.c1.formatter = f1
|
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
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLCore
|
// Package: SSLCore
|
||||||
@@ -48,13 +48,13 @@ namespace Net {
|
|||||||
|
|
||||||
PrivateKeyPassphraseHandler::PrivateKeyPassphraseHandler(bool onServerSide): _serverSide(onServerSide)
|
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()
|
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
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLCore
|
// Package: SSLCore
|
||||||
@@ -60,8 +60,9 @@ const std::string SSLManager::CFG_VER_DEPTH("verificationDepth");
|
|||||||
const int SSLManager::VAL_VER_DEPTH(9);
|
const int SSLManager::VAL_VER_DEPTH(9);
|
||||||
const std::string SSLManager::CFG_ENABLE_DEFAULT_CA("loadDefaultCAFile");
|
const std::string SSLManager::CFG_ENABLE_DEFAULT_CA("loadDefaultCAFile");
|
||||||
const bool SSLManager::VAL_ENABLE_DEFAULT_CA(false);
|
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::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::CFG_DELEGATE_HANDLER("privateKeyPassphraseHandler.name");
|
||||||
const std::string SSLManager::VAL_DELEGATE_HANDLER("KeyConsoleHandler");
|
const std::string SSLManager::VAL_DELEGATE_HANDLER("KeyConsoleHandler");
|
||||||
const std::string SSLManager::CFG_CERTIFICATE_HANDLER("invalidCertificateHandler.name");
|
const std::string SSLManager::CFG_CERTIFICATE_HANDLER("invalidCertificateHandler.name");
|
||||||
@@ -79,7 +80,7 @@ SSLManager::SSLManager()
|
|||||||
|
|
||||||
SSLManager::~SSLManager()
|
SSLManager::~SSLManager()
|
||||||
{
|
{
|
||||||
PrivateKeyPassPhrase.clear();
|
PrivateKeyPassphraseRequired.clear();
|
||||||
ClientVerificationError.clear();
|
ClientVerificationError.clear();
|
||||||
ServerVerificationError.clear();
|
ServerVerificationError.clear();
|
||||||
_ptrDefaultServerContext = 0; // ensure all Context objects go away before we uninitialize OpenSSL.
|
_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;
|
_ptrServerCertificateHandler = ptrHandler;
|
||||||
_ptrDefaultServerContext = ptrContext;
|
_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;
|
_ptrClientCertificateHandler = ptrHandler;
|
||||||
_ptrDefaultClientContext = ptrContext;
|
_ptrDefaultClientContext = ptrContext;
|
||||||
}
|
}
|
||||||
@@ -133,25 +134,25 @@ Context::Ptr SSLManager::defaultClientContext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::serverPassPhraseHandler()
|
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::serverPassphraseHandler()
|
||||||
{
|
{
|
||||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
if (!_ptrServerPassPhraseHandler)
|
if (!_ptrServerPassphraseHandler)
|
||||||
initPassPhraseHandler(true);
|
initPassphraseHandler(true);
|
||||||
|
|
||||||
return _ptrServerPassPhraseHandler;
|
return _ptrServerPassphraseHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::clientPassPhraseHandler()
|
SSLManager::PrivateKeyPassphraseHandlerPtr SSLManager::clientPassphraseHandler()
|
||||||
{
|
{
|
||||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
if (!_ptrClientPassPhraseHandler)
|
if (!_ptrClientPassphraseHandler)
|
||||||
initPassPhraseHandler(false);
|
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)
|
int SSLManager::privateKeyPasswdCallback(char* pBuf, int size, int flag, void* userData)
|
||||||
{
|
{
|
||||||
std::string pwd;
|
std::string pwd;
|
||||||
SSLManager::instance().PrivateKeyPassPhrase.notify(&SSLManager::instance(), pwd);
|
SSLManager::instance().PrivateKeyPassphraseRequired.notify(&SSLManager::instance(), pwd);
|
||||||
|
|
||||||
strncpy(pBuf, (char *)(pwd.c_str()), size);
|
strncpy(pBuf, (char *)(pwd.c_str()), size);
|
||||||
pBuf[size - 1] = '\0';
|
pBuf[size - 1] = '\0';
|
||||||
@@ -241,11 +242,12 @@ void SSLManager::initDefaultContext(bool server)
|
|||||||
|
|
||||||
int verDepth = config.getInt(prefix + CFG_VER_DEPTH, VAL_VER_DEPTH);
|
int verDepth = config.getInt(prefix + CFG_VER_DEPTH, VAL_VER_DEPTH);
|
||||||
bool loadDefCA = config.getBool(prefix + CFG_ENABLE_DEFAULT_CA, VAL_ENABLE_DEFAULT_CA);
|
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)
|
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
|
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)
|
if (server)
|
||||||
{
|
{
|
||||||
@@ -257,15 +259,15 @@ void SSLManager::initDefaultContext(bool server)
|
|||||||
|
|
||||||
void SSLManager::initEvents(bool server)
|
void SSLManager::initEvents(bool server)
|
||||||
{
|
{
|
||||||
initPassPhraseHandler(server);
|
initPassphraseHandler(server);
|
||||||
initCertificateHandler(server);
|
initCertificateHandler(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SSLManager::initPassPhraseHandler(bool server)
|
void SSLManager::initPassphraseHandler(bool server)
|
||||||
{
|
{
|
||||||
if (server && _ptrServerPassPhraseHandler) return;
|
if (server && _ptrServerPassphraseHandler) return;
|
||||||
if (!server && _ptrClientPassPhraseHandler) return;
|
if (!server && _ptrClientPassphraseHandler) return;
|
||||||
|
|
||||||
std::string prefix = server ? CFG_SERVER_PREFIX : CFG_CLIENT_PREFIX;
|
std::string prefix = server ? CFG_SERVER_PREFIX : CFG_CLIENT_PREFIX;
|
||||||
Poco::Util::LayeredConfiguration& config = Poco::Util::Application::instance().config();
|
Poco::Util::LayeredConfiguration& config = Poco::Util::Application::instance().config();
|
||||||
@@ -281,11 +283,11 @@ void SSLManager::initPassPhraseHandler(bool server)
|
|||||||
if (pFactory)
|
if (pFactory)
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
_ptrServerPassPhraseHandler = pFactory->create(server);
|
_ptrServerPassphraseHandler = pFactory->create(server);
|
||||||
else
|
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
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLSockets
|
// Package: SSLSockets
|
||||||
@@ -127,4 +127,10 @@ void SecureServerSocketImpl::sendUrgent(unsigned char data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SecureServerSocketImpl::secure() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Net
|
} } // namespace Poco::Net
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// SecureStreamSocketImpl.cpp
|
// 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
|
// Library: NetSSL_OpenSSL
|
||||||
// Package: SSLSockets
|
// Package: SSLSockets
|
||||||
@@ -179,6 +179,12 @@ void SecureStreamSocketImpl::shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SecureStreamSocketImpl::secure() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
X509Certificate SecureStreamSocketImpl::peerCertificate() const
|
X509Certificate SecureStreamSocketImpl::peerCertificate() const
|
||||||
{
|
{
|
||||||
X509* pCert = _impl.peerCertificate();
|
X509* pCert = _impl.peerCertificate();
|
||||||
|
|||||||
Reference in New Issue
Block a user