mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-26 03:57:13 +02:00
Update POCO library.
This commit is contained in:
@ -32,7 +32,7 @@ class NetSSL_API CertificateHandlerFactory
|
||||
/// A CertificateHandlerFactory is responsible for creating InvalidCertificateHandlers.
|
||||
///
|
||||
/// You don't need to access this class directly. Use the macro
|
||||
/// POCO_REGISTER_CHFACTORY(namespace, InvalidCertificateHandlerName)
|
||||
/// POCO_REGISTER_CHFACTORY(namespace, InvalidCertificateHandlerName)
|
||||
/// instead (see the documentation of InvalidCertificateHandler for an example).
|
||||
{
|
||||
public:
|
||||
@ -50,7 +50,7 @@ public:
|
||||
class NetSSL_API CertificateHandlerFactoryRegistrar
|
||||
/// Registrar class which automatically registers CertificateHandlerFactory at the CertificateHandlerFactoryMgr.
|
||||
/// You don't need to access this class directly. Use the macro
|
||||
/// POCO_REGISTER_CHFACTORY(namespace, InvalidCertificateHandlerName)
|
||||
/// POCO_REGISTER_CHFACTORY(namespace, InvalidCertificateHandlerName)
|
||||
/// instead (see the documentation of InvalidCertificateHandler for an example).
|
||||
{
|
||||
public:
|
||||
|
@ -28,7 +28,7 @@ namespace Net {
|
||||
|
||||
class NetSSL_API ConsoleCertificateHandler: public InvalidCertificateHandler
|
||||
/// A ConsoleCertificateHandler is invoked whenever an error occurs verifying the certificate.
|
||||
///
|
||||
///
|
||||
/// The certificate is printed to stdout and the user is asked via console if he wants to accept it.
|
||||
{
|
||||
public:
|
||||
|
@ -126,6 +126,16 @@ public:
|
||||
PROTO_TLSV1_3 = 0x20
|
||||
};
|
||||
|
||||
enum SecurityLevel
|
||||
{
|
||||
SECURITY_LEVEL_NONE = 0,
|
||||
SECURITY_LEVEL_80_BITS = 1,
|
||||
SECURITY_LEVEL_112_BITS = 2,
|
||||
SECURITY_LEVEL_128_BITS = 3,
|
||||
SECURITY_LEVEL_192_BITS = 4,
|
||||
SECURITY_LEVEL_256_BITS = 5
|
||||
};
|
||||
|
||||
struct NetSSL_API Params
|
||||
{
|
||||
Params();
|
||||
@ -193,6 +203,11 @@ public:
|
||||
/// and other TLSv1.3 ephemeral key negotiation, based
|
||||
/// on the group names defined by OpenSSL. Defaults to
|
||||
/// "X448:X25519:ffdhe4096:ffdhe3072:ffdhe2048:ffdhe6144:ffdhe8192:P-521:P-384:P-256"
|
||||
|
||||
SecurityLevel securityLevel;
|
||||
/// Defines minimal number of security bits allowed.
|
||||
/// Requires OpenSSL >= 1.1 to be effective.
|
||||
|
||||
};
|
||||
|
||||
using InvalidCertificateHandlerPtr = Poco::SharedPtr<InvalidCertificateHandler>;
|
||||
@ -274,6 +289,7 @@ public:
|
||||
void addCertificateAuthority(const Poco::Crypto::X509Certificate& certificate);
|
||||
/// Add one trusted certification authority to be used by the Context.
|
||||
|
||||
//@deprecated
|
||||
void usePrivateKey(const Poco::Crypto::RSAKey& key);
|
||||
/// Sets the private key to be used by the Context.
|
||||
///
|
||||
@ -420,6 +436,9 @@ public:
|
||||
/// Returns the InvalidCertificateHandler set for this Context,
|
||||
/// or a null pointer if none has been set.
|
||||
|
||||
void setSecurityLevel(SecurityLevel level);
|
||||
/// Sets the security level.
|
||||
|
||||
private:
|
||||
void init(const Params& params);
|
||||
/// Initializes the Context with the given parameters.
|
||||
|
@ -64,6 +64,9 @@ public:
|
||||
bool isSecure() const;
|
||||
/// Returns true if the session is FTPS.
|
||||
|
||||
void forceSessionReuse(bool force = true);
|
||||
/// Enable or disable session reusing
|
||||
|
||||
protected:
|
||||
virtual StreamSocket establishDataConnection(const std::string& command, const std::string& arg);
|
||||
/// Create secure data connection
|
||||
@ -80,6 +83,7 @@ private:
|
||||
|
||||
bool _enableFTPS = true;
|
||||
bool _secureDataConnection = false;
|
||||
bool _forceSessionReuse = false;
|
||||
Context::Ptr _pContext;
|
||||
};
|
||||
|
||||
@ -95,6 +99,12 @@ inline bool FTPSClientSession::isSecure() const
|
||||
}
|
||||
|
||||
|
||||
inline void FTPSClientSession::forceSessionReuse(bool force)
|
||||
{
|
||||
_forceSessionReuse = force;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
{
|
||||
HTTPS_PORT = 443
|
||||
};
|
||||
|
||||
|
||||
HTTPSClientSession();
|
||||
/// Creates an unconnected HTTPSClientSession.
|
||||
|
||||
@ -122,25 +122,25 @@ public:
|
||||
~HTTPSClientSession();
|
||||
/// Destroys the HTTPSClientSession and closes
|
||||
/// the underlying socket.
|
||||
|
||||
|
||||
bool secure() const;
|
||||
/// Return true iff the session uses SSL or TLS,
|
||||
/// or false otherwise.
|
||||
|
||||
|
||||
X509Certificate serverCertificate();
|
||||
/// Returns the server's certificate.
|
||||
///
|
||||
/// The certificate is available after the first request has been sent.
|
||||
|
||||
|
||||
Session::Ptr sslSession();
|
||||
/// Returns the SSL Session object for the current
|
||||
/// Returns the SSL Session object for the current
|
||||
/// connection, if session caching has been enabled for
|
||||
/// the HTTPSClientSession's Context. A null pointer is
|
||||
/// the HTTPSClientSession's Context. A null pointer is
|
||||
/// returned otherwise.
|
||||
///
|
||||
/// The Session object can be obtained after the first request has
|
||||
/// been sent.
|
||||
|
||||
|
||||
// HTTPSession
|
||||
void abort();
|
||||
|
||||
@ -153,7 +153,7 @@ protected:
|
||||
private:
|
||||
HTTPSClientSession(const HTTPSClientSession&);
|
||||
HTTPSClientSession& operator = (const HTTPSClientSession&);
|
||||
|
||||
|
||||
Context::Ptr _pContext;
|
||||
Session::Ptr _pSession;
|
||||
};
|
||||
|
@ -49,27 +49,27 @@ public:
|
||||
|
||||
~HTTPSStreamFactory();
|
||||
/// Destroys the HTTPSStreamFactory.
|
||||
|
||||
|
||||
std::istream* open(const Poco::URI& uri);
|
||||
/// Creates and opens a HTTPS stream for the given URI.
|
||||
/// The URI must be a https://... URI.
|
||||
///
|
||||
/// Throws a NetException if anything goes wrong.
|
||||
|
||||
|
||||
static void registerFactory();
|
||||
/// Registers the HTTPSStreamFactory with the
|
||||
/// default URIStreamOpener instance.
|
||||
/// default URIStreamOpener instance.
|
||||
|
||||
static void unregisterFactory();
|
||||
/// Unregisters the HTTPSStreamFactory with the
|
||||
/// default URIStreamOpener instance.
|
||||
|
||||
/// default URIStreamOpener instance.
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
MAX_REDIRECTS = 10
|
||||
};
|
||||
|
||||
|
||||
std::string _proxyHost;
|
||||
Poco::UInt16 _proxyPort;
|
||||
std::string _proxyUsername;
|
||||
|
@ -27,7 +27,7 @@ namespace Net {
|
||||
|
||||
|
||||
class NetSSL_API KeyFileHandler: public PrivateKeyPassphraseHandler
|
||||
/// An implementation of PrivateKeyPassphraseHandler that
|
||||
/// An implementation of PrivateKeyPassphraseHandler that
|
||||
/// reads the key for a certificate from a configuration file
|
||||
/// under the path "openSSL.privateKeyPassphraseHandler.options.password".
|
||||
{
|
||||
|
@ -20,8 +20,8 @@
|
||||
#define NetSSL_NetSSL_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Crypto/Crypto.h"
|
||||
#include "Poco/Net/Net.h"
|
||||
|
||||
|
||||
//
|
||||
@ -71,7 +71,7 @@ void NetSSL_API initializeSSL();
|
||||
/// libraries, by calling Poco::Crypto::OpenSSLInitializer::initialize().
|
||||
///
|
||||
/// Should be called before using any class from the NetSSL library.
|
||||
/// The NetSSL will be initialized automatically, through
|
||||
/// The NetSSL will be initialized automatically, through
|
||||
/// Poco::Crypto::OpenSSLInitializer instances or similar mechanisms
|
||||
/// when creating Context or SSLManager instances.
|
||||
/// However, it is recommended to call initializeSSL()
|
||||
@ -80,10 +80,10 @@ void NetSSL_API initializeSSL();
|
||||
/// Can be called multiple times; however, for every call to
|
||||
/// initializeSSL(), a matching call to uninitializeSSL()
|
||||
/// must be performed.
|
||||
|
||||
|
||||
|
||||
void NetSSL_API uninitializeSSL();
|
||||
/// Uninitializes the NetSSL library by calling
|
||||
/// Uninitializes the NetSSL library by calling
|
||||
/// Poco::Crypto::OpenSSLInitializer::uninitialize() and
|
||||
/// shutting down the SSLManager.
|
||||
|
||||
|
@ -32,7 +32,7 @@ class NetSSL_API PrivateKeyFactory
|
||||
/// A PrivateKeyFactory is responsible for creating PrivateKeyPassphraseHandlers.
|
||||
///
|
||||
/// You don't need to access this class directly. Use the macro
|
||||
/// POCO_REGISTER_KEYFACTORY(namespace, PrivateKeyPassphraseHandlerName)
|
||||
/// POCO_REGISTER_KEYFACTORY(namespace, PrivateKeyPassphraseHandlerName)
|
||||
/// instead (see the documentation of PrivateKeyPassphraseHandler for an example).
|
||||
{
|
||||
public:
|
||||
@ -51,7 +51,7 @@ class NetSSL_API PrivateKeyFactoryRegistrar
|
||||
/// Registrar class which automatically registers PrivateKeyFactories at the PrivateKeyFactoryMgr.
|
||||
///
|
||||
/// You don't need to access this class directly. Use the macro
|
||||
/// POCO_REGISTER_KEYFACTORY(namespace, PrivateKeyPassphraseHandlerName)
|
||||
/// POCO_REGISTER_KEYFACTORY(namespace, PrivateKeyPassphraseHandlerName)
|
||||
/// instead (see the documentation of PrivateKeyPassphraseHandler for an example).
|
||||
|
||||
{
|
||||
|
@ -29,9 +29,9 @@ class NetSSL_API PrivateKeyPassphraseHandler
|
||||
/// A passphrase handler is needed whenever the private key of a certificate is loaded and the certificate is protected
|
||||
/// by a passphrase. The PrivateKeyPassphraseHandler's task is to provide that passphrase.
|
||||
/// One can install one's own PrivateKeyPassphraseHandler by implementing this interface. Note that
|
||||
/// in the implementation file of the subclass the following code must be present (assuming you use the namespace My_API
|
||||
/// in the implementation file of the subclass the following code must be present (assuming you use the namespace My_API
|
||||
/// and the name of your handler class is MyGuiHandler):
|
||||
///
|
||||
///
|
||||
/// #include "Poco/Net/PrivateKeyFactory.h"
|
||||
/// ...
|
||||
/// POCO_REGISTER_KEYFACTORY(My_API, MyGuiHandler)
|
||||
@ -42,7 +42,7 @@ class NetSSL_API PrivateKeyPassphraseHandler
|
||||
///
|
||||
/// or in case one's application extends Poco::Util::Application one can use an XML configuration and put the following entry
|
||||
/// under the path openSSL.privateKeyPassphraseHandler:
|
||||
///
|
||||
///
|
||||
/// <privateKeyPassphraseHandler>
|
||||
/// <name>MyGuiHandler</name>
|
||||
/// <options>
|
||||
|
@ -27,7 +27,7 @@ namespace Net {
|
||||
|
||||
|
||||
class NetSSL_API RejectCertificateHandler: public InvalidCertificateHandler
|
||||
/// A RejectCertificateHandler is invoked whenever an error
|
||||
/// A RejectCertificateHandler is invoked whenever an error
|
||||
/// occurs verifying the certificate. It always rejects
|
||||
/// the certificate.
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
///
|
||||
/// Releases the socket's SocketImpl and
|
||||
/// attaches the SocketImpl from the other socket and
|
||||
/// increments the reference count of the SocketImpl.
|
||||
/// increments the reference count of the SocketImpl.
|
||||
|
||||
StreamSocket acceptConnection(SocketAddress& clientAddr);
|
||||
/// Get the next completed connection from the
|
||||
|
@ -161,6 +161,15 @@ public:
|
||||
/// underlying TCP connection. No orderly SSL shutdown
|
||||
/// is performed.
|
||||
|
||||
void setBlocking(bool flag);
|
||||
/// Sets the socket in blocking mode if flag is true,
|
||||
/// disables blocking mode if flag is false.
|
||||
|
||||
bool getBlocking() const;
|
||||
/// Returns the blocking mode of the socket.
|
||||
/// This method will only work if the blocking modes of
|
||||
/// the socket are changed via the setBlocking method!
|
||||
|
||||
int sendBytes(const void* buffer, int length, int flags = 0);
|
||||
/// Sends the contents of the given buffer through
|
||||
/// the socket. Any specified flags are ignored.
|
||||
@ -281,6 +290,7 @@ private:
|
||||
bool _needHandshake;
|
||||
std::string _peerHostName;
|
||||
Session::Ptr _pSession;
|
||||
bool _bidirectShutdown = true;
|
||||
|
||||
friend class SecureStreamSocketImpl;
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ class NetSSL_API SecureStreamSocket: public StreamSocket
|
||||
///
|
||||
/// A few notes about nonblocking IO:
|
||||
/// sendBytes() and receiveBytes() can return a
|
||||
/// negative value when using a nonblocking socket, which means
|
||||
/// negative value when using a nonblocking socket, which means
|
||||
/// a SSL handshake is currently in progress and more data
|
||||
/// needs to be read or written for the handshake to continue.
|
||||
/// If sendBytes() or receiveBytes() return ERR_SSL_WANT_WRITE,
|
||||
@ -43,7 +43,7 @@ class NetSSL_API SecureStreamSocket: public StreamSocket
|
||||
/// ERR_SSL_WANT_READ is returned, receiveBytes() must be called
|
||||
/// as soon as data is available for reading (indicated by select()).
|
||||
///
|
||||
/// The SSL handshake is delayed until the first sendBytes() or
|
||||
/// The SSL handshake is delayed until the first sendBytes() or
|
||||
/// receiveBytes() operation is performed on the socket. No automatic
|
||||
/// post connection check (checking the peer certificate for a valid
|
||||
/// hostname) is performed when using nonblocking I/O. To manually
|
||||
@ -56,7 +56,7 @@ public:
|
||||
ERR_SSL_WANT_READ = -1,
|
||||
ERR_SSL_WANT_WRITE = -2
|
||||
};
|
||||
|
||||
|
||||
SecureStreamSocket();
|
||||
/// Creates an unconnected secure stream socket
|
||||
/// using the default client SSL context.
|
||||
@ -83,17 +83,17 @@ public:
|
||||
/// agrees to reuse the session).
|
||||
|
||||
explicit SecureStreamSocket(const SocketAddress& address);
|
||||
/// Creates a secure stream socket using the default
|
||||
/// Creates a secure stream socket using the default
|
||||
/// client SSL context and connects it to
|
||||
/// the socket specified by address.
|
||||
|
||||
SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext);
|
||||
/// Creates a secure stream socket using the given
|
||||
/// Creates a secure stream socket using the given
|
||||
/// client SSL context and connects it to
|
||||
/// the socket specified by address.
|
||||
|
||||
SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext, Session::Ptr pSession);
|
||||
/// Creates a secure stream socket using the given
|
||||
/// Creates a secure stream socket using the given
|
||||
/// client SSL context and connects it to
|
||||
/// the socket specified by address.
|
||||
///
|
||||
@ -102,21 +102,21 @@ public:
|
||||
/// agrees to reuse the session).
|
||||
|
||||
SecureStreamSocket(const SocketAddress& address, const std::string& hostName);
|
||||
/// Creates a secure stream socket using the default
|
||||
/// Creates a secure stream socket using the default
|
||||
/// client SSL context and connects it to
|
||||
/// the socket specified by address.
|
||||
///
|
||||
/// The given host name is used for certificate verification.
|
||||
|
||||
SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext);
|
||||
/// Creates a secure stream socket using the given
|
||||
/// Creates a secure stream socket using the given
|
||||
/// client SSL context and connects it to
|
||||
/// the socket specified by address.
|
||||
///
|
||||
/// The given host name is used for certificate verification.
|
||||
|
||||
SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession);
|
||||
/// Creates a secure stream socket using the given
|
||||
/// Creates a secure stream socket using the given
|
||||
/// client SSL context and connects it to
|
||||
/// the socket specified by address.
|
||||
///
|
||||
@ -140,8 +140,8 @@ public:
|
||||
///
|
||||
/// Releases the socket's SocketImpl and
|
||||
/// attaches the SocketImpl from the other socket and
|
||||
/// increments the reference count of the SocketImpl.
|
||||
|
||||
/// increments the reference count of the SocketImpl.
|
||||
|
||||
bool havePeerCertificate() const;
|
||||
/// Returns true iff the peer has presented a
|
||||
/// certificate.
|
||||
@ -151,10 +151,10 @@ public:
|
||||
///
|
||||
/// Throws a SSLException if the peer did not
|
||||
/// present a certificate.
|
||||
|
||||
|
||||
void setPeerHostName(const std::string& hostName);
|
||||
/// Sets the peer's host name used for certificate validation.
|
||||
|
||||
|
||||
const std::string& getPeerHostName() const;
|
||||
/// Returns the peer's host name used for certificate validation.
|
||||
|
||||
@ -198,15 +198,15 @@ public:
|
||||
|
||||
Context::Ptr context() const;
|
||||
/// Returns the SSL context used by this socket.
|
||||
|
||||
|
||||
void setLazyHandshake(bool flag = true);
|
||||
/// Enable lazy SSL handshake. If enabled, the SSL handshake
|
||||
/// will be performed the first time date is sent or
|
||||
/// received over the connection.
|
||||
|
||||
|
||||
bool getLazyHandshake() const;
|
||||
/// Returns true if setLazyHandshake(true) has been called.
|
||||
|
||||
|
||||
void verifyPeerCertificate();
|
||||
/// Performs post-connect (or post-accept) peer certificate validation,
|
||||
/// using the peer host name set with setPeerHostName(), or the peer's
|
||||
@ -221,7 +221,7 @@ public:
|
||||
///
|
||||
/// Should only be used for non-blocking connections, after the
|
||||
/// initial SSL handshake has been performed (see completeHandshake()).
|
||||
|
||||
|
||||
int completeHandshake();
|
||||
/// Completes the SSL handshake.
|
||||
///
|
||||
@ -240,7 +240,7 @@ public:
|
||||
/// is enabled).
|
||||
///
|
||||
/// If no connection is established, returns null.
|
||||
|
||||
|
||||
void useSession(Session::Ptr pSession);
|
||||
/// Sets the SSL session to use for the next
|
||||
/// connection. Setting a previously saved Session
|
||||
@ -250,15 +250,15 @@ public:
|
||||
/// can be given.
|
||||
///
|
||||
/// Must be called before connect() to be effective.
|
||||
|
||||
|
||||
bool sessionWasReused();
|
||||
/// Returns true iff a reused session was negotiated during
|
||||
/// the handshake.
|
||||
|
||||
|
||||
void abort();
|
||||
/// Aborts the SSL connection by closing the underlying
|
||||
/// TCP connection. No orderly SSL shutdown is performed.
|
||||
|
||||
|
||||
protected:
|
||||
SecureStreamSocket(SocketImpl* pImpl);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
/// Throws a Poco::InvalidAccessException.
|
||||
|
||||
void connect(const SocketAddress& address);
|
||||
/// Initializes the socket and establishes a connection to
|
||||
/// Initializes the socket and establishes a connection to
|
||||
/// the TCP server at the given address.
|
||||
///
|
||||
/// Can also be used for UDP sockets. In this case, no
|
||||
@ -53,19 +53,19 @@ public:
|
||||
/// packets are restricted to the specified address.
|
||||
|
||||
void connect(const SocketAddress& address, const Poco::Timespan& timeout);
|
||||
/// Initializes the socket, sets the socket timeout and
|
||||
/// Initializes the socket, sets the socket timeout and
|
||||
/// establishes a connection to the TCP server at the given address.
|
||||
|
||||
void connectNB(const SocketAddress& address);
|
||||
/// Initializes the socket and establishes a connection to
|
||||
/// Initializes the socket and establishes a connection to
|
||||
/// the TCP server at the given address. Prior to opening the
|
||||
/// connection the socket is set to nonblocking mode.
|
||||
|
||||
|
||||
void bind(const SocketAddress& address, bool reuseAddress = false);
|
||||
/// Not supported by a SecureStreamSocket.
|
||||
///
|
||||
/// Throws a Poco::InvalidAccessException.
|
||||
|
||||
|
||||
void listen(int backlog = 64);
|
||||
/// Not supported by a SecureStreamSocket.
|
||||
///
|
||||
@ -73,30 +73,30 @@ public:
|
||||
|
||||
void close();
|
||||
/// Close the socket.
|
||||
|
||||
|
||||
int sendBytes(const void* buffer, int length, int flags = 0);
|
||||
/// Sends the contents of the given buffer through
|
||||
/// the socket. Any specified flags are ignored.
|
||||
///
|
||||
/// Returns the number of bytes sent, which may be
|
||||
/// less than the number of bytes specified.
|
||||
|
||||
|
||||
int receiveBytes(void* buffer, int length, int flags = 0);
|
||||
/// Receives data from the socket and stores it
|
||||
/// in buffer. Up to length bytes are received.
|
||||
///
|
||||
/// Returns the number of bytes received.
|
||||
|
||||
|
||||
int sendTo(const void* buffer, int length, const SocketAddress& address, int flags = 0);
|
||||
/// Not supported by a SecureStreamSocket.
|
||||
///
|
||||
/// Throws a Poco::InvalidAccessException.
|
||||
|
||||
|
||||
int receiveFrom(void* buffer, int length, SocketAddress& address, int flags = 0);
|
||||
/// Not supported by a SecureStreamSocket.
|
||||
///
|
||||
/// Throws a Poco::InvalidAccessException.
|
||||
|
||||
|
||||
void sendUrgent(unsigned char data);
|
||||
/// Not supported by a SecureStreamSocket.
|
||||
///
|
||||
@ -115,27 +115,27 @@ public:
|
||||
///
|
||||
/// Since SSL does not support a half shutdown, this does
|
||||
/// nothing.
|
||||
|
||||
|
||||
void shutdownSend();
|
||||
/// Shuts down the receiving part of the socket connection.
|
||||
///
|
||||
/// Since SSL does not support a half shutdown, this does
|
||||
/// nothing.
|
||||
|
||||
|
||||
void shutdown();
|
||||
/// Shuts down the SSL connection.
|
||||
|
||||
|
||||
void abort();
|
||||
/// Aborts the connection by closing the underlying
|
||||
/// TCP connection. No orderly SSL shutdown is performed.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
const std::string& getPeerHostName() const;
|
||||
/// Returns the peer host name.
|
||||
|
||||
@ -148,7 +148,7 @@ public:
|
||||
///
|
||||
/// Throws a SSLException if the peer did not
|
||||
/// present a certificate.
|
||||
|
||||
|
||||
Context::Ptr context() const;
|
||||
/// Returns the SSL context used by this socket.
|
||||
|
||||
@ -156,7 +156,7 @@ public:
|
||||
/// Enable lazy SSL handshake. If enabled, the SSL handshake
|
||||
/// will be performed the first time date is sent or
|
||||
/// received over the connection.
|
||||
|
||||
|
||||
bool getLazyHandshake() const;
|
||||
/// Returns true if setLazyHandshake(true) has been called.
|
||||
|
||||
@ -173,7 +173,7 @@ public:
|
||||
///
|
||||
/// If the SSL connection was the result of an accept(),
|
||||
/// the server-side handshake is completed, otherwise
|
||||
/// a client-side handshake is performed.
|
||||
/// a client-side handshake is performed.
|
||||
|
||||
Session::Ptr currentSession();
|
||||
/// Returns the SSL session of the current connection,
|
||||
@ -181,7 +181,7 @@ public:
|
||||
/// is enabled).
|
||||
///
|
||||
/// If no connection is established, returns null.
|
||||
|
||||
|
||||
void useSession(Session::Ptr pSession);
|
||||
/// Sets the SSL session to use for the next
|
||||
/// connection. Setting a previously saved Session
|
||||
@ -191,18 +191,18 @@ public:
|
||||
/// can be given.
|
||||
///
|
||||
/// Must be called before connect() to be effective.
|
||||
|
||||
|
||||
bool sessionWasReused();
|
||||
/// Returns true iff a reused session was negotiated during
|
||||
/// the handshake.
|
||||
|
||||
|
||||
protected:
|
||||
void acceptSSL();
|
||||
/// Performs a SSL server-side handshake.
|
||||
|
||||
|
||||
void connectSSL();
|
||||
/// Performs a SSL client-side handshake on an already connected TCP socket.
|
||||
|
||||
|
||||
~SecureStreamSocketImpl();
|
||||
/// Destroys the SecureStreamSocketImpl.
|
||||
|
||||
@ -250,13 +250,13 @@ inline Session::Ptr SecureStreamSocketImpl::currentSession()
|
||||
return _impl.currentSession();
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void SecureStreamSocketImpl::useSession(Session::Ptr pSession)
|
||||
{
|
||||
_impl.useSession(pSession);
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline bool SecureStreamSocketImpl::sessionWasReused()
|
||||
{
|
||||
return _impl.sessionWasReused();
|
||||
|
@ -48,13 +48,13 @@ public:
|
||||
|
||||
explicit X509Certificate(X509* pCert);
|
||||
/// Creates the X509Certificate from an existing
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// the certificate.
|
||||
|
||||
X509Certificate(X509* pCert, bool shared);
|
||||
/// Creates the X509Certificate from an existing
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// the certificate. If shared is true, the
|
||||
/// OpenSSL certificate. Ownership is taken of
|
||||
/// the certificate. If shared is true, the
|
||||
/// certificate's reference count is incremented.
|
||||
|
||||
X509Certificate(const Poco::Crypto::X509Certificate& cert);
|
||||
@ -84,9 +84,9 @@ public:
|
||||
/// For this check to be successful, the certificate must contain
|
||||
/// a domain name that matches the domain name
|
||||
/// of the host.
|
||||
///
|
||||
///
|
||||
/// Returns true if verification succeeded, or false otherwise.
|
||||
|
||||
|
||||
static bool verify(const Poco::Crypto::X509Certificate& cert, const std::string& hostName);
|
||||
/// Verifies the validity of the certificate against the host name.
|
||||
///
|
||||
@ -95,11 +95,11 @@ public:
|
||||
/// of the host.
|
||||
///
|
||||
/// Returns true if verification succeeded, or false otherwise.
|
||||
|
||||
|
||||
protected:
|
||||
static bool containsWildcards(const std::string& commonName);
|
||||
static bool matchWildcard(const std::string& alias, const std::string& hostName);
|
||||
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
|
Reference in New Issue
Block a user