You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2021/11/15 07:06:40 UTC

[ignite] branch gg-34169 updated: Fix SslStreamFactory to allow null certificate

This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch gg-34169
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/gg-34169 by this push:
     new 0f71f03  Fix SslStreamFactory to allow null certificate
0f71f03 is described below

commit 0f71f03cb898a63ac9009b1020410428c3916077
Author: Pavel Tupitsyn <pt...@apache.org>
AuthorDate: Mon Nov 15 10:06:17 2021 +0300

    Fix SslStreamFactory to allow null certificate
---
 .../dotnet/Apache.Ignite.Core/Client/SslStreamFactory.cs         | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Client/SslStreamFactory.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Client/SslStreamFactory.cs
index 27952be..4a2cf39 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Client/SslStreamFactory.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Client/SslStreamFactory.cs
@@ -55,8 +55,13 @@ namespace Apache.Ignite.Core.Client
 
             var sslStream = new SslStream(stream, false, ValidateServerCertificate, null);
 
-            var cert = new X509Certificate2(CertificatePath, CertificatePassword);
-            var certs = new X509CertificateCollection(new X509Certificate[] { cert });
+            var cert = string.IsNullOrEmpty(CertificatePath)
+                ? null
+                : new X509Certificate2(CertificatePath, CertificatePassword);
+
+            var certs = cert == null
+                ? null
+                : new X509CertificateCollection(new X509Certificate[] { cert });
 
             sslStream.AuthenticateAsClient(targetHost, certs, SslProtocols, CheckCertificateRevocation);