| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | using System.Net.Security; |
| | | 4 | | |
| | | 5 | | namespace IceRpc.Transports.Internal; |
| | | 6 | | |
| | | 7 | | /// <summary>Provides extension methods for <see cref="SslClientAuthenticationOptions" /> and <see |
| | | 8 | | /// cref="SslServerAuthenticationOptions" />.</summary> |
| | | 9 | | internal static class SslAuthenticationOptionsExtensions |
| | | 10 | | { |
| | | 11 | | /// <summary>Makes a shallow copy of an SSL client authentication options.</summary> |
| | | 12 | | /// <param name="value">The options to copy.</param> |
| | | 13 | | /// <returns>The shallow copy.</returns> |
| | | 14 | | internal static SslClientAuthenticationOptions ShallowClone(this SslClientAuthenticationOptions value) => |
| | 164 | 15 | | new() |
| | 164 | 16 | | { |
| | 164 | 17 | | AllowRenegotiation = value.AllowRenegotiation, |
| | 164 | 18 | | #pragma warning disable CA1416 // Validated at runtime by SslStream |
| | 164 | 19 | | AllowRsaPkcs1Padding = value.AllowRsaPkcs1Padding, |
| | 164 | 20 | | AllowRsaPssPadding = value.AllowRsaPssPadding, |
| | 164 | 21 | | #pragma warning restore CA1416 |
| | 164 | 22 | | AllowTlsResume = value.AllowTlsResume, |
| | 164 | 23 | | ApplicationProtocols = value.ApplicationProtocols, |
| | 164 | 24 | | CertificateChainPolicy = value.CertificateChainPolicy, |
| | 164 | 25 | | CertificateRevocationCheckMode = value.CertificateRevocationCheckMode, |
| | 164 | 26 | | CipherSuitesPolicy = value.CipherSuitesPolicy, |
| | 164 | 27 | | ClientCertificateContext = value.ClientCertificateContext, |
| | 164 | 28 | | ClientCertificates = value.ClientCertificates, |
| | 164 | 29 | | EnabledSslProtocols = value.EnabledSslProtocols, |
| | 164 | 30 | | EncryptionPolicy = value.EncryptionPolicy, |
| | 164 | 31 | | LocalCertificateSelectionCallback = value.LocalCertificateSelectionCallback, |
| | 164 | 32 | | RemoteCertificateValidationCallback = value.RemoteCertificateValidationCallback, |
| | 164 | 33 | | TargetHost = value.TargetHost |
| | 164 | 34 | | }; |
| | | 35 | | |
| | | 36 | | /// <summary>Makes a shallow copy of an SSL server authentication options.</summary> |
| | | 37 | | /// <param name="value">The options to copy.</param> |
| | | 38 | | /// <returns>The shallow copy.</returns> |
| | | 39 | | internal static SslServerAuthenticationOptions ShallowClone(this SslServerAuthenticationOptions value) => |
| | 5 | 40 | | new() |
| | 5 | 41 | | { |
| | 5 | 42 | | AllowRenegotiation = value.AllowRenegotiation, |
| | 5 | 43 | | #pragma warning disable CA1416 // Validated at runtime by SslStream |
| | 5 | 44 | | AllowRsaPkcs1Padding = value.AllowRsaPkcs1Padding, |
| | 5 | 45 | | AllowRsaPssPadding = value.AllowRsaPssPadding, |
| | 5 | 46 | | #pragma warning restore CA1416 |
| | 5 | 47 | | AllowTlsResume = value.AllowTlsResume, |
| | 5 | 48 | | ApplicationProtocols = value.ApplicationProtocols, |
| | 5 | 49 | | CertificateChainPolicy = value.CertificateChainPolicy, |
| | 5 | 50 | | CertificateRevocationCheckMode = value.CertificateRevocationCheckMode, |
| | 5 | 51 | | CipherSuitesPolicy = value.CipherSuitesPolicy, |
| | 5 | 52 | | ClientCertificateRequired = value.ClientCertificateRequired, |
| | 5 | 53 | | EnabledSslProtocols = value.EnabledSslProtocols, |
| | 5 | 54 | | EncryptionPolicy = value.EncryptionPolicy, |
| | 5 | 55 | | RemoteCertificateValidationCallback = value.RemoteCertificateValidationCallback, |
| | 5 | 56 | | ServerCertificate = value.ServerCertificate, |
| | 5 | 57 | | ServerCertificateContext = value.ServerCertificateContext, |
| | 5 | 58 | | ServerCertificateSelectionCallback = value.ServerCertificateSelectionCallback |
| | 5 | 59 | | }; |
| | | 60 | | } |