< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 39
Coverable lines: 39
Total lines: 128
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/SslClientAuthenticationOptions.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.Runtime.InteropServices;
 7using System.Security.Authentication;
 8using System.Security.Cryptography.X509Certificates;
 9
 10namespace System.Net.Security
 11{
 12    public class SslClientAuthenticationOptions
 13    {
 014        private EncryptionPolicy _encryptionPolicy = EncryptionPolicy.RequireEncryption;
 015        private X509RevocationMode _checkCertificateRevocation = SslAuthenticationOptions.DefaultRevocationMode;
 016        private SslProtocols _enabledSslProtocols = SslProtocols.None;
 017        private bool _allowRenegotiation = true;
 018        private bool _allowTlsResume = true;
 19
 20        public bool AllowRenegotiation
 21        {
 022            get => _allowRenegotiation;
 023            set => _allowRenegotiation = value;
 24        }
 25
 26        /// <summary>
 27        ///  Gets or sets a value that indicates whether the SslStream should allow TLS resumption.
 28        /// </summary>
 29        public bool AllowTlsResume
 30        {
 031            get => _allowTlsResume;
 032            set => _allowTlsResume = value;
 33        }
 34
 035        public LocalCertificateSelectionCallback? LocalCertificateSelectionCallback { get; set; }
 36
 037        public RemoteCertificateValidationCallback? RemoteCertificateValidationCallback { get; set; }
 38
 039        public List<SslApplicationProtocol>? ApplicationProtocols { get; set; }
 40
 041        public string? TargetHost { get; set; }
 42
 043        public X509CertificateCollection? ClientCertificates { get; set; }
 44
 45        /// <summary>
 46        /// Gets or sets the client certificate context.
 47        /// </summary>
 048        public SslStreamCertificateContext? ClientCertificateContext { get; set; }
 49
 50        public X509RevocationMode CertificateRevocationCheckMode
 51        {
 052            get => _checkCertificateRevocation;
 53            set
 054            {
 055                if (value != X509RevocationMode.NoCheck && value != X509RevocationMode.Offline && value != X509Revocatio
 056                {
 057                    throw new ArgumentException(SR.Format(SR.net_invalid_enum, nameof(X509RevocationMode)), nameof(value
 58                }
 59
 060                _checkCertificateRevocation = value;
 061            }
 62        }
 63
 64        public EncryptionPolicy EncryptionPolicy
 65        {
 066            get => _encryptionPolicy;
 67            set
 068            {
 69#pragma warning disable SYSLIB0040 // NoEncryption and AllowNoEncryption are obsolete
 070                if (value != EncryptionPolicy.RequireEncryption && value != EncryptionPolicy.AllowNoEncryption && value 
 071                {
 072                    throw new ArgumentException(SR.Format(SR.net_invalid_enum, nameof(EncryptionPolicy)), nameof(value))
 73                }
 74#pragma warning restore SYSLIB0040
 75
 076                _encryptionPolicy = value;
 077            }
 78        }
 79
 80        public SslProtocols EnabledSslProtocols
 81        {
 082            get => _enabledSslProtocols;
 083            set => _enabledSslProtocols = value;
 84        }
 85
 86        /// <summary>
 87        /// Specifies cipher suites allowed to be used for TLS.
 88        /// When set to null operating system default will be used.
 89        /// Use extreme caution when changing this setting.
 90        /// </summary>
 091        public CipherSuitesPolicy? CipherSuitesPolicy { get; set; }
 92
 93        /// <summary>
 94        /// Gets or sets an optional customized policy for remote certificate
 95        /// validation. If not <see langword="null"/>,
 96        /// <see cref="CertificateRevocationCheckMode"/> and <see cref="SslCertificateTrust"/>
 97        /// are ignored.
 98        /// </summary>
 099        public X509ChainPolicy? CertificateChainPolicy { get; set; }
 100
 0101        private bool _allowRsaPssPadding = true;
 102        /// <summary>
 103        /// Gets or sets a value that indicates whether the the rsa_pss_* family of TLS signature algorithms is enabled 
 104        /// </summary>
 105        public bool AllowRsaPssPadding
 106        {
 0107            get => _allowRsaPssPadding;
 108
 109            [SupportedOSPlatform("windows")]
 110            [SupportedOSPlatform("linux")]
 0111            set { _allowRsaPssPadding = value; }
 112        }
 113
 0114        private bool _allowRsaPkcs1Padding = true;
 115        /// <summary>
 116        /// Gets or sets a value that indicates whether the the rsa_pkcs1_* family of TLS signature algorithms is enable
 117        /// </summary>
 118        public bool AllowRsaPkcs1Padding
 119        {
 0120            get => _allowRsaPkcs1Padding;
 121
 122            [SupportedOSPlatform("windows")]
 123            [SupportedOSPlatform("linux")]
 0124            set { _allowRsaPkcs1Padding = value; }
 125        }
 126    }
 127}
 128