< 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: 2300_35243572715
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) =>
 16819        new()
 16820        {
 16821            AllowRenegotiation = value.AllowRenegotiation,
 16822#pragma warning disable CA1416 // Validated at runtime by SslStream
 16823            AllowRsaPkcs1Padding = value.AllowRsaPkcs1Padding,
 16824            AllowRsaPssPadding = value.AllowRsaPssPadding,
 16825#pragma warning restore CA1416
 16826            AllowTlsResume = value.AllowTlsResume,
 16827            ApplicationProtocols = value.ApplicationProtocols,
 16828            CertificateChainPolicy = value.CertificateChainPolicy,
 16829            CertificateRevocationCheckMode = value.CertificateRevocationCheckMode,
 16830            CipherSuitesPolicy = value.CipherSuitesPolicy,
 16831            ClientCertificateContext = value.ClientCertificateContext,
 16832            ClientCertificates = value.ClientCertificates,
 16833            EnabledSslProtocols = value.EnabledSslProtocols,
 16834            EncryptionPolicy = value.EncryptionPolicy,
 16835            LocalCertificateSelectionCallback = value.LocalCertificateSelectionCallback,
 16836            RemoteCertificateValidationCallback = value.RemoteCertificateValidationCallback,
 16837            TargetHost = value.TargetHost
 16838        };
 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}