NetSSL: add support for disabling certain protocols

This commit is contained in:
Guenter Obiltschnig
2016-01-19 11:36:02 +01:00
parent 3afbd82809
commit 556b4bd32f
4 changed files with 78 additions and 0 deletions

View File

@@ -95,6 +95,15 @@ public:
///
/// Client: Same as VERIFY_RELAXED.
};
enum Protocols
{
PROTO_SSLV2 = 0x01,
PROTO_SSLV3 = 0x02,
PROTO_TLSV1 = 0x04,
PROTO_TLSV1_1 = 0x08,
PROTO_TLSV1_2 = 0x10
};
Context(
Usage usage,
@@ -265,6 +274,14 @@ public:
/// session resumption.
///
/// The feature can be disabled by calling this method.
void disableProtocols(int protocols);
/// Disables the given protocols.
///
/// The protocols to be disabled are specified by OR-ing
/// values from the Protocols enumeration, e.g.:
///
/// context.disableProtocols(PROTO_SSLV2 | PROTO_SSLV3)
private:
void createSSLContext();

View File

@@ -94,6 +94,7 @@ class NetSSL_API SSLManager
/// <requireTLSv1>true|false</requireTLSv1>
/// <requireTLSv1_1>true|false</requireTLSv1_1>
/// <requireTLSv1_2>true|false</requireTLSv1_2>
/// <disableProtocols>sslv2,sslv3,tlsv1,tlsv1_1,tlsv1_2</disableProtocols>
/// </server|client>
/// <fips>false</fips>
/// </openSSL>
@@ -137,6 +138,8 @@ class NetSSL_API SSLManager
/// - requireTLSv1 (boolean): Require a TLSv1 connection.
/// - requireTLSv1_1 (boolean): Require a TLSv1.1 connection.
/// - requireTLSv1_2 (boolean): Require a TLSv1.2 connection.
/// - disableProtocols (string): A comma-separated list of protocols that should be
/// disabled. Valid protocol names are sslv2, sslv3, tlsv1, tlsv1_1, tlsv1_2.
/// - fips: Enable or disable OpenSSL FIPS mode. Only supported if the OpenSSL version
/// that this library is built against supports FIPS mode.
{
@@ -320,6 +323,7 @@ private:
static const std::string CFG_REQUIRE_TLSV1;
static const std::string CFG_REQUIRE_TLSV1_1;
static const std::string CFG_REQUIRE_TLSV1_2;
static const std::string CFG_DISABLE_PROTOCOLS;
#ifdef OPENSSL_FIPS
static const std::string CFG_FIPS_MODE;