< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 38
Coverable lines: 38
Total lines: 124
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 12
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Net.Security/src/System/Net/Security/SslServerAuthenticationOptions.cs

#LineLine coverage
 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
 4using System.Runtime.Versioning;
 5using System.Collections.Generic;
 6using System.Security.Authentication;
 7using System.Security.Cryptography.X509Certificates;
 8
 9namespace System.Net.Security
 10{
 11    public class SslServerAuthenticationOptions
 12    {
 013        private X509RevocationMode _checkCertificateRevocation = SslAuthenticationOptions.DefaultRevocationMode;
 014        private SslProtocols _enabledSslProtocols = SslProtocols.None;
 015        private EncryptionPolicy _encryptionPolicy = EncryptionPolicy.RequireEncryption;
 16        private bool _allowRenegotiation;
 017        private bool _allowTlsResume = true;
 18
 19        public bool AllowRenegotiation
 20        {
 021            get => _allowRenegotiation;
 022            set => _allowRenegotiation = value;
 23        }
 24
 25        /// <summary>
 26        ///  Gets or sets a value that indicates whether the SslStream should allow TLS resumption.
 27        /// </summary>
 28        public bool AllowTlsResume
 29        {
 030            get => _allowTlsResume;
 031            set => _allowTlsResume = value;
 32        }
 33
 034        public bool ClientCertificateRequired { get; set; }
 35
 036        public List<SslApplicationProtocol>? ApplicationProtocols { get; set; }
 37
 038        public RemoteCertificateValidationCallback? RemoteCertificateValidationCallback { get; set; }
 39
 040        public ServerCertificateSelectionCallback? ServerCertificateSelectionCallback { get; set; }
 41
 042        public X509Certificate? ServerCertificate { get; set; }
 43
 044        public SslStreamCertificateContext? ServerCertificateContext { get; set; }
 45
 46        public SslProtocols EnabledSslProtocols
 47        {
 048            get => _enabledSslProtocols;
 049            set => _enabledSslProtocols = value;
 50        }
 51
 52        public X509RevocationMode CertificateRevocationCheckMode
 53        {
 054            get => _checkCertificateRevocation;
 55            set
 056            {
 057                if (value != X509RevocationMode.NoCheck && value != X509RevocationMode.Offline && value != X509Revocatio
 058                {
 059                    throw new ArgumentException(SR.Format(SR.net_invalid_enum, nameof(X509RevocationMode)), nameof(value
 60                }
 61
 062                _checkCertificateRevocation = value;
 063            }
 64        }
 65
 66        public EncryptionPolicy EncryptionPolicy
 67        {
 068            get => _encryptionPolicy;
 69            set
 070            {
 71#pragma warning disable SYSLIB0040 // NoEncryption and AllowNoEncryption are obsolete
 072                if (value != EncryptionPolicy.RequireEncryption && value != EncryptionPolicy.AllowNoEncryption && value 
 073                {
 074                    throw new ArgumentException(SR.Format(SR.net_invalid_enum, nameof(EncryptionPolicy)), nameof(value))
 75                }
 76#pragma warning restore SYSLIB0040
 77
 078                _encryptionPolicy = value;
 079            }
 80        }
 81
 82        /// <summary>
 83        /// Specifies cipher suites allowed to be used for TLS.
 84        /// When set to null operating system default will be used.
 85        /// Use extreme caution when changing this setting.
 86        /// </summary>
 087        public CipherSuitesPolicy? CipherSuitesPolicy { get; set; }
 88
 89        /// <summary>
 90        /// Gets or sets an optional customized policy for remote certificate
 91        /// validation. If not <see langword="null"/>,
 92        /// <see cref="CertificateRevocationCheckMode"/> and <see cref="SslCertificateTrust"/>
 93        /// are ignored.
 94        /// </summary>
 095        public X509ChainPolicy? CertificateChainPolicy { get; set; }
 96
 097        private bool _allowRsaPssPadding = true;
 98        /// <summary>
 99        /// Gets or sets a value that indicates whether the the rsa_pss_* family of TLS signature algorithms is enabled 
 100        /// </summary>
 101        public bool AllowRsaPssPadding
 102        {
 0103            get => _allowRsaPssPadding;
 104
 105            [SupportedOSPlatform("windows")]
 106            [SupportedOSPlatform("linux")]
 0107            set { _allowRsaPssPadding = value; }
 108        }
 109
 0110        private bool _allowRsaPkcs1Padding = true;
 111        /// <summary>
 112        /// Gets or sets a value that indicates whether the the rsa_pkcs1_* family of TLS signature algorithms is enable
 113        /// </summary>
 114        public bool AllowRsaPkcs1Padding
 115        {
 0116            get => _allowRsaPkcs1Padding;
 117
 118            [SupportedOSPlatform("windows")]
 119            [SupportedOSPlatform("linux")]
 0120            set { _allowRsaPkcs1Padding = value; }
 121        }
 122    }
 123}
 124