private X509CertificateCollection GetClientCertificates(byte[] sslCertificateBytes) { log_?.OnEvent($"{nameof(SSLStreamFactory)} function {nameof(GetClientCertificates)} started"); X509CertificateCollection result = new X509Certificate2Collection(); log_?.OnEvent($"{nameof(X509CertificateCollection)} {nameof(result)} construction successfull"); try { if (sslCertificateBytes != null) { log_?.OnEvent($"{nameof(sslCertificateBytes)} enumerable != null"); result.Add(new X509Certificate2(sslCertificateBytes, socketSettings_.CertificatePassword)); log_?.OnEvent($"result.Add successful"); } else if (!string.IsNullOrEmpty(socketSettings_.CertificatePath)) { log_?.OnEvent($"{nameof(socketSettings_.CertificatePath)} != null"); result = new X509Certificate2Collection(); log_?.OnEvent($"{nameof(X509CertificateCollection)} {nameof(result)} construction successfull"); var clientCert = StreamFactory.LoadCertificate(socketSettings_.CertificatePath, socketSettings_.CertificatePassword, log_); log_?.OnEvent($"{nameof(StreamFactory.LoadCertificate)} function ended"); if (clientCert != null) { result.Add(clientCert); log_?.OnEvent($"result.Add successful"); } } } catch (Exception ex) { log_?.OnEvent($"{nameof(SSLStreamFactory)} function {nameof(GetClientCertificates)} raised exception: {ex.Message}"); throw; } log_?.OnEvent($"{nameof(SSLStreamFactory)} function {nameof(GetClientCertificates)} ended"); return result; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)