| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.Collections.Generic; |
| | | 5 | | using System.Runtime.Versioning; |
| | | 6 | | |
| | | 7 | | namespace System.Net.Security |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Specifies allowed cipher suites. |
| | | 11 | | /// </summary> |
| | | 12 | | [UnsupportedOSPlatform("windows")] |
| | | 13 | | [UnsupportedOSPlatform("android")] |
| | | 14 | | public sealed partial class CipherSuitesPolicy |
| | | 15 | | { |
| | 0 | 16 | | internal CipherSuitesPolicyPal Pal { get; } |
| | | 17 | | |
| | | 18 | | [CLSCompliant(false)] |
| | 0 | 19 | | public CipherSuitesPolicy(IEnumerable<TlsCipherSuite> allowedCipherSuites) |
| | 0 | 20 | | { |
| | 0 | 21 | | ArgumentNullException.ThrowIfNull(allowedCipherSuites); |
| | | 22 | | |
| | 0 | 23 | | Pal = new CipherSuitesPolicyPal(allowedCipherSuites); |
| | 0 | 24 | | } |
| | | 25 | | |
| | | 26 | | [CLSCompliant(false)] |
| | | 27 | | public IEnumerable<TlsCipherSuite> AllowedCipherSuites |
| | | 28 | | { |
| | | 29 | | get |
| | 0 | 30 | | { |
| | | 31 | | // This method is only useful only for diagnostic purposes so perf is not important |
| | | 32 | | // We do not want users to be able to cast result to something they can modify |
| | 0 | 33 | | foreach (TlsCipherSuite cs in Pal.GetCipherSuites()) |
| | 0 | 34 | | { |
| | 0 | 35 | | yield return cs; |
| | 0 | 36 | | } |
| | 0 | 37 | | } |
| | | 38 | | } |
| | | 39 | | } |
| | | 40 | | } |
| | | 41 | | |