Пример #1
0
        private static void UninstallSsl(string sslCertificateFile, string sslCertificatePassword, RavenConfiguration configuration)
        {
            X509Certificate2 certificate = null;

            if (!string.IsNullOrEmpty(sslCertificateFile))
            {
                certificate = !string.IsNullOrEmpty(sslCertificatePassword) ? new X509Certificate2(sslCertificateFile, sslCertificatePassword) : new X509Certificate2(sslCertificateFile);
            }

            NonAdminHttp.UnbindCertificate(configuration.Port, certificate);
        }
Пример #2
0
        private static void InstallSsl(string sslCertificateFile, string sslCertificatePassword, RavenConfiguration configuration)
        {
            if (string.IsNullOrEmpty(sslCertificateFile))
            {
                throw new InvalidOperationException("X509 certificate path cannot be empty.");
            }

            var certificate = !string.IsNullOrEmpty(sslCertificatePassword) ? new X509Certificate2(sslCertificateFile, sslCertificatePassword) : new X509Certificate2(sslCertificateFile);

            NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(configuration.Port, true);
            NonAdminHttp.UnbindCertificate(configuration.Port, certificate);
            NonAdminHttp.BindCertificate(configuration.Port, certificate);
        }