Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a8bc39

Browse files
edwardnealbenrr101
authored andcommitted
Fix down-level SSL/TLS version warnings (#3126)
* Added test for downlevel connectivity warning * Correctly test bit flags for legacy SSL protocol warning * Corrected warning disablement/restore.
1 parent 3a6d8f9 commit 2a8bc39

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System.Collections.Generic;
66
using System.IO;
7+
using System.Security.Authentication;
78
using Microsoft.SqlServer.TDS.PreLogin;
89

910
namespace Microsoft.Data.SqlClient.ManualTesting.Tests.DataCommon
@@ -32,11 +33,11 @@ public ConnectionTestParametersData()
3233
// Test cases possible field values for connection parameters:
3334
// These combinations are based on the possible values of Encrypt, TrustServerCertificate, Certificate, HostNameInCertificate
3435
/*
35-
* TDSEncryption | Encrypt | TrustServerCertificate | Certificate | HNIC | TestResults
36-
* ----------------------------------------------------------------------------------------------
37-
* Off | Optional | true | valid | valid name | true
38-
* On | Mandatory | false | mismatched | empty | false
39-
* Required | | x | ChainError? | wrong name? |
36+
* TDSEncryption | Encrypt | TrustServerCertificate | Certificate | HNIC | SSL Protocols | TestResults
37+
* ---------------------------------------------------------------------------------------------------------------
38+
* Off | Optional | true | valid | valid name | TLS 1.2 | true
39+
* On | Mandatory | false | mismatched | empty | TLS 1.0, TLS 1.1 | false
40+
* Required | | x | ChainError? | wrong name? | |
4041
*/
4142
ConnectionTestParametersList = new List<ConnectionTestParameters>
4243
{
@@ -78,6 +79,21 @@ public ConnectionTestParametersData()
7879
new(TDSPreLoginTokenEncryptionType.On, SqlConnectionEncryptOption.Mandatory, true, s_mismatchedcert, _empty, true),
7980
new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, false, s_mismatchedcert, _empty, false),
8081
new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, true, s_mismatchedcert, _empty, true),
82+
83+
// Multiple SSL protocols test
84+
#pragma warning disable CA5397 // Do not use deprecated SslProtocols values
85+
#pragma warning disable CA5398 // Avoid hardcoded SslProtocols values
86+
#if NET
87+
#pragma warning disable SYSLIB0039 // Type or member is obsolete: TLS 1.0 & 1.1 are deprecated
88+
#endif
89+
new(TDSPreLoginTokenEncryptionType.Off, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true),
90+
new(TDSPreLoginTokenEncryptionType.On, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true),
91+
new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true),
92+
#if NET
93+
#pragma warning restore SYSLIB0039 // Type or member is obsolete: TLS 1.0 & 1.1 are deprecated
94+
#endif
95+
#pragma warning restore CA5397 // Do not use deprecated SslProtocols values
96+
#pragma warning restore CA5398 // Avoid hardcoded SslProtocols values
8197
};
8298
}
8399
}

0 commit comments

Comments
 (0)