กิจกรรม
17 มี.ค. 21 - 21 มี.ค. 10
แอปอัจฉริยะ เข้าร่วมชุด meetup เพื่อสร้างโซลูชัน AI ที่ปรับขนาดได้ตามกรณีการใช้งานจริงกับนักพัฒนาและผู้เชี่ยวชาญร่วมกัน
ลงทะเบียนตอนนี้เบราว์เซอร์นี้ไม่ได้รับการสนับสนุนอีกต่อไป
อัปเกรดเป็น Microsoft Edge เพื่อใช้ประโยชน์จากคุณลักษณะล่าสุด เช่น การอัปเดตความปลอดภัยและการสนับสนุนด้านเทคนิค
Property | Value |
---|---|
Rule ID | CA5397 |
Title | Do not use deprecated SslProtocols values |
Category | Security |
Fix is breaking or non-breaking | Non-breaking |
Enabled by default in .NET 9 | No |
This rule fires when either of the following conditions are met:
Deprecated values are:
Transport Layer Security (TLS) secures communication between computers, most commonly with Hypertext Transfer Protocol Secure (HTTPS). Older protocol versions of TLS are less secure than TLS 1.2 and TLS 1.3 and are more likely to have new vulnerabilities. Avoid older protocol versions to minimize risk. For guidance on identifying and removing deprecated protocol versions, see Solving the TLS 1.0 Problem, 2nd Edition.
Don't use deprecated TLS protocol versions.
You can suppress this warning if:
If you just want to suppress a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.
#pragma warning disable CA5397
// The code that's violating the rule is on this line.
#pragma warning restore CA5397
To disable the rule for a file, folder, or project, set its severity to none
in the configuration file.
[*.{cs,vb}]
dotnet_diagnostic.CA5397.severity = none
For more information, see How to suppress code analysis warnings.
using System;
using System.Security.Authentication;
public class ExampleClass
{
public void ExampleMethod()
{
// CA5397 violation for using Tls11
SslProtocols protocols = SslProtocols.Tls11 | SslProtocols.Tls12;
}
}
Imports System
Imports System.Security.Authentication
Public Class TestClass
Public Sub ExampleMethod()
' CA5397 violation for using Tls11
Dim sslProtocols As SslProtocols = SslProtocols.Tls11 Or SslProtocols.Tls12
End Sub
End Class
using System;
using System.Security.Authentication;
public class ExampleClass
{
public void ExampleMethod()
{
// CA5397 violation
SslProtocols sslProtocols = (SslProtocols) 768; // TLS 1.1
}
}
Imports System
Imports System.Security.Authentication
Public Class TestClass
Public Sub ExampleMethod()
' CA5397 violation
Dim sslProtocols As SslProtocols = CType(768, SslProtocols) ' TLS 1.1
End Sub
End Class
using System;
using System.Security.Authentication;
public class TestClass
{
public void Method()
{
// Let the operating system decide what TLS protocol version to use.
// See https://learn.microsoft.com/dotnet/framework/network-programming/tls
SslProtocols sslProtocols = SslProtocols.None;
}
}
Imports System
Imports System.Security.Authentication
Public Class TestClass
Public Sub ExampleMethod()
' Let the operating system decide what TLS protocol version to use.
' See https://learn.microsoft.com/dotnet/framework/network-programming/tls
Dim sslProtocols As SslProtocols = SslProtocols.None
End Sub
End Class
CA5364: Do not use deprecated security protocols
คำติชม .NET
.NET เป็นโครงการโอเพนซอร์ส เลือกลิงก์เพื่อให้คำติชม:
กิจกรรม
17 มี.ค. 21 - 21 มี.ค. 10
แอปอัจฉริยะ เข้าร่วมชุด meetup เพื่อสร้างโซลูชัน AI ที่ปรับขนาดได้ตามกรณีการใช้งานจริงกับนักพัฒนาและผู้เชี่ยวชาญร่วมกัน
ลงทะเบียนตอนนี้