public static bool SupportsAlpn { get { throw null; } }
public static bool SupportsClientAlpn { get { throw null; } }
public static bool SupportsSsl3 { get { throw null; } }
+ public static bool SupportsTls13 { get { throw null; } }
public static bool TargetsNetFx452OrLower { get { throw null; } }
public static int WindowsVersion { get { throw null; } }
public static string GetDistroVersionString() { throw null; }
public static bool SupportsAlpn => (IsWindows && !IsWindows7) ||
((!IsOSX && !IsWindows) &&
(OpenSslVersion.Major >= 1 && (OpenSslVersion.Minor >= 1 || OpenSslVersion.Build >= 2)));
- public static bool SupportsClientAlpn => SupportsAlpn ||
- (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && PlatformDetection.OSXVersion > new Version(10, 12));
+ public static bool SupportsClientAlpn => SupportsAlpn || (IsOSX && PlatformDetection.OSXVersion > new Version(10, 12));
+ // OpenSSL 1.1.1 and above.
+ public static bool SupportsTls13 => !IsWindows && !IsOSX && (OpenSslVersion.CompareTo(new Version(1,1,1)) >= 0);
// Officially, .NET Native only supports processes running in an AppContainer. However, the majority of tests still work fine
// in a normal Win32 process and we often do so as running in an AppContainer imposes a substantial tax in debuggability
using (var sslStream = new SslStream(client.GetStream(), false, AllowAnyServerCertificate, null, EncryptionPolicy.NoEncryption))
{
- await sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocolSupport.DefaultSslProtocols, false);
+ // null encryption is not permitted with Tls13
+ await sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12, false);
_log.WriteLine("Client authenticated to server({0}) with encryption cipher: {1} {2}-bit strength",
serverAllowNoEncryption.RemoteEndPoint, sslStream.CipherAlgorithm, sslStream.CipherStrength);
{
if (SupportsNullEncryption)
{
- await sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocolSupport.DefaultSslProtocols, false);
+ // null encryption is not permitted with Tls13
+ await sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12, false);
_log.WriteLine("Client authenticated to server({0}) with encryption cipher: {1} {2}-bit strength",
serverNoEncryption.RemoteEndPoint, sslStream.CipherAlgorithm, sslStream.CipherStrength);
using (var sslStream = new SslStream(client.GetStream(), false, AllowAnyServerCertificate, null, EncryptionPolicy.NoEncryption))
{
await Assert.ThrowsAsync<IOException>(() =>
- sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocolSupport.DefaultSslProtocols, false));
+ sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12, false));
}
}
}
private const SslProtocols NonTls13Protocols = AllProtocols & (~SslProtocols.Tls13);
- private static bool IsKnownPlatformSupportingTls13 => PlatformDetection.IsUbuntu1810OrHigher;
+ private static bool IsKnownPlatformSupportingTls13 => PlatformDetection.SupportsTls13;
private static bool CipherSuitesPolicySupported => s_cipherSuitePolicySupported.Value;
private static bool Tls13Supported { get; set; } = IsKnownPlatformSupportingTls13 || ProtocolsSupported(SslProtocols.Tls13);
private static bool CipherSuitesPolicyAndTls13Supported => Tls13Supported && CipherSuitesPolicySupported;