< Summary

Information
Class: IceRpc.Transports.Internal.SslAuthenticationOptionsExtensions
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Internal/SslAuthenticationOptionsExtensions.cs
Tag: 1986_28452893481
Line coverage
100%
Covered lines: 40
Uncovered lines: 0
Coverable lines: 40
Total lines: 64
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 2
Fully covered methods: 2
Total methods: 2
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ShallowClone(...)100%11100%
ShallowClone(...)100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Internal/SslAuthenticationOptionsExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Net.Security;
 4
 5namespace IceRpc.Transports.Internal;
 6
 7/// <summary>Provides extension methods for <see cref="SslClientAuthenticationOptions" /> and <see
 8/// cref="SslServerAuthenticationOptions" />.</summary>
 9/// <remarks>The clone methods copy each property by hand and sit on the security-configuration path: a property
 10/// added by a future .NET release is not copied and is silently set to its initial value in the user's
 11/// authentication options. The SslAuthenticationOptionsExtensionsTests reflection tests fail when the .NET
 12/// property set changes; when they do, add the new property here and to the test's property list.</remarks>
 13internal static class SslAuthenticationOptionsExtensions
 14{
 15    /// <summary>Makes a shallow copy of an SSL client authentication options.</summary>
 16    /// <param name="value">The options to copy.</param>
 17    /// <returns>The shallow copy.</returns>
 18    internal static SslClientAuthenticationOptions ShallowClone(this SslClientAuthenticationOptions value) =>
 16519        new()
 16520        {
 16521            AllowRenegotiation = value.AllowRenegotiation,
 16522#pragma warning disable CA1416 // Validated at runtime by SslStream
 16523            AllowRsaPkcs1Padding = value.AllowRsaPkcs1Padding,
 16524            AllowRsaPssPadding = value.AllowRsaPssPadding,
 16525#pragma warning restore CA1416
 16526            AllowTlsResume = value.AllowTlsResume,
 16527            ApplicationProtocols = value.ApplicationProtocols,
 16528            CertificateChainPolicy = value.CertificateChainPolicy,
 16529            CertificateRevocationCheckMode = value.CertificateRevocationCheckMode,
 16530            CipherSuitesPolicy = value.CipherSuitesPolicy,
 16531            ClientCertificateContext = value.ClientCertificateContext,
 16532            ClientCertificates = value.ClientCertificates,
 16533            EnabledSslProtocols = value.EnabledSslProtocols,
 16534            EncryptionPolicy = value.EncryptionPolicy,
 16535            LocalCertificateSelectionCallback = value.LocalCertificateSelectionCallback,
 16536            RemoteCertificateValidationCallback = value.RemoteCertificateValidationCallback,
 16537            TargetHost = value.TargetHost
 16538        };
 39
 40    /// <summary>Makes a shallow copy of an SSL server authentication options.</summary>
 41    /// <param name="value">The options to copy.</param>
 42    /// <returns>The shallow copy.</returns>
 43    internal static SslServerAuthenticationOptions ShallowClone(this SslServerAuthenticationOptions value) =>
 644        new()
 645        {
 646            AllowRenegotiation = value.AllowRenegotiation,
 647#pragma warning disable CA1416 // Validated at runtime by SslStream
 648            AllowRsaPkcs1Padding = value.AllowRsaPkcs1Padding,
 649            AllowRsaPssPadding = value.AllowRsaPssPadding,
 650#pragma warning restore CA1416
 651            AllowTlsResume = value.AllowTlsResume,
 652            ApplicationProtocols = value.ApplicationProtocols,
 653            CertificateChainPolicy = value.CertificateChainPolicy,
 654            CertificateRevocationCheckMode = value.CertificateRevocationCheckMode,
 655            CipherSuitesPolicy = value.CipherSuitesPolicy,
 656            ClientCertificateRequired = value.ClientCertificateRequired,
 657            EnabledSslProtocols = value.EnabledSslProtocols,
 658            EncryptionPolicy = value.EncryptionPolicy,
 659            RemoteCertificateValidationCallback = value.RemoteCertificateValidationCallback,
 660            ServerCertificate = value.ServerCertificate,
 661            ServerCertificateContext = value.ServerCertificateContext,
 662            ServerCertificateSelectionCallback = value.ServerCertificateSelectionCallback
 663        };
 64}