add unsupported attributes to System.Net.Security (#80717)
authorTomas Weinfurt <tweinfurt@yahoo.com>
Wed, 18 Jan 2023 17:47:43 +0000 (09:47 -0800)
committerGitHub <noreply@github.com>
Wed, 18 Jan 2023 17:47:43 +0000 (09:47 -0800)
* add unsupported attributes to System.Net.Security

* using

* CA1416

src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs
src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicy.cs
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.cs

index ddec979..074e0a0 100644 (file)
@@ -218,7 +218,7 @@ internal static class MsQuicConfiguration
     private static QUIC_ALLOWED_CIPHER_SUITE_FLAGS CipherSuitePolicyToFlags(CipherSuitesPolicy cipherSuitesPolicy)
     {
         QUIC_ALLOWED_CIPHER_SUITE_FLAGS flags = QUIC_ALLOWED_CIPHER_SUITE_FLAGS.NONE;
-
+#pragma warning disable CA1416  // not supported on all platforms
         foreach (TlsCipherSuite cipher in cipherSuitesPolicy.AllowedCipherSuites)
         {
             switch (cipher)
@@ -237,6 +237,7 @@ internal static class MsQuicConfiguration
                     // ignore
                     break;
             }
+#pragma warning restore
         }
 
         if (flags == QUIC_ALLOWED_CIPHER_SUITE_FLAGS.NONE)
index a8abf29..8b3d6a0 100644 (file)
@@ -2,12 +2,15 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using System.Collections.Generic;
+using System.Runtime.Versioning;
 
 namespace System.Net.Security
 {
     /// <summary>
     /// Specifies allowed cipher suites.
     /// </summary>
+    [UnsupportedOSPlatform("windows")]
+    [UnsupportedOSPlatform("android")]
     public sealed partial class CipherSuitesPolicy
     {
         internal CipherSuitesPolicyPal Pal { get; private set; }
index 395ab23..334795d 100644 (file)
@@ -5,6 +5,7 @@ using System.Diagnostics;
 using System.IO;
 using System.Runtime.CompilerServices;
 using System.Runtime.ExceptionServices;
+using System.Runtime.Versioning;
 using System.Security.Authentication;
 using System.Security.Cryptography.X509Certificates;
 using System.Threading;
@@ -674,6 +675,9 @@ namespace System.Net.Security
 
         public override Task FlushAsync(CancellationToken cancellationToken) => InnerStream.FlushAsync(cancellationToken);
 
+        [SupportedOSPlatform("linux")]
+        [SupportedOSPlatform("windows")]
+        [SupportedOSPlatform("freebsd")]
         public virtual Task NegotiateClientCertificateAsync(CancellationToken cancellationToken = default)
         {
             ThrowIfExceptionalOrNotAuthenticated();